Skip to content

Commit 92da124

Browse files
committed
Add static typing for utils.EncodingMenu
1 parent 94aa293 commit 92da124

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diffuse/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, parent: Gtk.Widget, message_type: Gtk.MessageType, s: str) ->
5555

5656
# widget to help pick an encoding
5757
class EncodingMenu(Gtk.Box):
58-
def __init__(self, prefs, autodetect=False):
58+
def __init__(self, prefs: Preferences, autodetect: bool = False) -> None:
5959
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
6060
self.combobox = combobox = Gtk.ComboBoxText.new()
6161
self.encodings = prefs.getEncodings()[:]
@@ -67,12 +67,12 @@ def __init__(self, prefs, autodetect=False):
6767
self.pack_start(combobox, False, False, 0)
6868
combobox.show()
6969

70-
def set_text(self, encoding):
70+
def set_text(self, encoding: Optional[str]) -> None:
7171
encoding = norm_encoding(encoding)
7272
if encoding in self.encodings:
7373
self.combobox.set_active(self.encodings.index(encoding))
7474

75-
def get_text(self):
75+
def get_text(self) -> Optional[str]:
7676
i = self.combobox.get_active()
7777
return self.encodings[i] if i >= 0 else None
7878

0 commit comments

Comments
 (0)