Skip to content

Commit

Permalink
style: add more mypy hints
Browse files Browse the repository at this point in the history
  • Loading branch information
actionless committed Jan 27, 2023
1 parent 64554e0 commit 2d1a2ef
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions oomox_plugin.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import os
from typing import TYPE_CHECKING

from gi.repository import Gtk

from oomox_gui.export_common import ExportConfig, FileBasedExportDialog
from oomox_gui.i18n import translate
from oomox_gui.plugin_api import OomoxExportPlugin

PLUGIN_DIR = os.path.dirname(os.path.realpath(__file__))
OOMOXIFY_SCRIPT_PATH = os.path.join(
if TYPE_CHECKING:
from typing import Any, Final

from oomox_gui.theme_file import ThemeT


PLUGIN_DIR: "Final" = os.path.dirname(os.path.realpath(__file__))
OOMOXIFY_SCRIPT_PATH: "Final" = os.path.join(
PLUGIN_DIR, "oomoxify.sh",
)

Expand All @@ -25,7 +32,7 @@ class SpotifyExportDialog(FileBasedExportDialog):
export_config = None
timeout = 120

def do_export(self):
def do_export(self) -> None:
self.export_config[OPTION_FONT_NAME] = self.font_name_entry.get_text()
self.export_config[OPTION_SPOTIFY_PATH] = self.spotify_path_entry.get_text()
self.export_config.save()
Expand All @@ -46,12 +53,12 @@ def do_export(self):
self.command = export_args
super().do_export()

def on_font_radio_toggled(self, button, value):
def on_font_radio_toggled(self, button: Gtk.Button, value: bool) -> None:
if button.get_active():
self.export_config[OPTION_FONT_OPTIONS] = value
self.font_name_entry.set_sensitive(value == VALUE_FONT_CUSTOM)

def _init_radios(self):
def _init_radios(self) -> None:
self.font_radio_default = \
Gtk.RadioButton.new_with_mnemonic_from_widget(
None,
Expand Down Expand Up @@ -92,7 +99,13 @@ def _init_radios(self):
if self.export_config[OPTION_FONT_OPTIONS] == VALUE_FONT_CUSTOM:
self.font_radio_custom.set_active(True)

def __init__(self, transient_for, colorscheme, theme_name):
def __init__(
self,
transient_for: Gtk.Window,
colorscheme: "ThemeT",
theme_name: str,
**_kwargs: "Any",
) -> None:
super().__init__(
transient_for=transient_for,
headline=translate("Spotify Options"),
Expand Down

0 comments on commit 2d1a2ef

Please sign in to comment.