Skip to content

Commit

Permalink
refactor(export_common, main): pass plugin instance when initializing…
Browse files Browse the repository at this point in the history
… export dialog
  • Loading branch information
actionless committed Jul 22, 2024
1 parent 8c403cc commit abd2164
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion oomox_gui/export_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from collections.abc import Callable
from typing import Any

from .plugin_api import OomoxPlugin
from .theme_file import ThemeT


Expand Down Expand Up @@ -165,7 +166,8 @@ class ExportDialog(ExportWrapper): # type: ignore[type-arg]

colorscheme: "ThemeT"
theme_name: str
command: str
plugin: "OomoxPlugin"
command: str # deprecated from plugin API 1.1
timeout = 300
done: bool = False

Expand Down Expand Up @@ -213,6 +215,7 @@ def __init__( # pylint: disable=too-many-arguments
transient_for: Gtk.Window,
colorscheme: "ThemeT",
theme_name: str,
plugin: "OomoxPlugin",
headline: str | None = None,
width: int = 150,
height: int = 80,
Expand All @@ -226,6 +229,7 @@ def __init__( # pylint: disable=too-many-arguments
# @TODO: make sure it doesn't break things:
self.colorscheme = colorscheme
self.callback = callback
self.plugin = plugin
# from .terminal import generate_terminal_colors_for_oomox
# self.colorscheme = generate_terminal_colors_for_oomox(colorscheme)

Expand Down
3 changes: 3 additions & 0 deletions oomox_gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def _on_export_theme(self, _action: Gio.SimpleAction, _param: "Any" = None) -> N
transient_for=self,
theme_name=self.colorscheme_name,
colorscheme=self.colorscheme,
plugin=self.plugin_theme,
)

def _on_export_icontheme(self, _action: Gio.SimpleAction, _param: "Any" = None) -> None:
Expand All @@ -510,6 +511,7 @@ def _on_export_icontheme(self, _action: Gio.SimpleAction, _param: "Any" = None)
transient_for=self,
theme_name=self.colorscheme_name,
colorscheme=self.colorscheme,
plugin=self.plugin_icons,
)

def _on_export_plugin(self, action: Gio.SimpleAction, _param: "Any" = None) -> None:
Expand All @@ -520,6 +522,7 @@ def _on_export_plugin(self, action: Gio.SimpleAction, _param: "Any" = None) -> N
transient_for=self,
theme_name=self.colorscheme_name,
colorscheme=self.colorscheme,
plugin=plugin,
)

def _before_quit(self) -> None:
Expand Down
1 change: 1 addition & 0 deletions oomox_gui/multi_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ def add_export_target(
transient_for=self,
theme_name=self.colorscheme_name,
colorscheme=self.colorscheme,
plugin=plugin,
base_class=Gtk.Box, # type: ignore[arg-type]
override_config=default_config,
preview_theme=False,
Expand Down

0 comments on commit abd2164

Please sign in to comment.