Skip to content

Commit

Permalink
feat(plugins: theme: oomox): allow to configure export theme path (re:
Browse files Browse the repository at this point in the history
  • Loading branch information
actionless committed Feb 13, 2020
1 parent 3ef65b4 commit 64a285c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions plugins/theme_oomox/oomox_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

OPTION_GTK3_CURRENT_VERSION_ONLY = 'OPTION_GTK3_CURRENT_VERSION_ONLY'
OPTION_EXPORT_CINNAMON_THEME = 'OPTION_EXPORT_CINNAMON_THEME'

OPTION_DEFAULT_PATH = 'default_path'

PLUGIN_DIR = os.path.dirname(os.path.realpath(__file__))
GTK_THEME_DIR = os.path.join(PLUGIN_DIR, "gtk-theme/")
Expand All @@ -20,11 +20,15 @@ class OomoxThemeExportDialog(CommonGtkThemeExportDialog):
config_name = 'gtk_theme_oomox'

def do_export(self):
export_path = self.option_widgets[OPTION_DEFAULT_PATH].get_text()
new_destination_dir, theme_name = export_path.rsplit('/', 1)

self.command = [
"bash",
os.path.join(GTK_THEME_DIR, "change_color.sh"),
"--hidpi", str(self.export_config[OPTION_GTK2_HIDPI]),
"--output", self.theme_name,
"--target-dir", new_destination_dir,
"--output", theme_name,
self.temp_theme_path,
]
make_opts = []
Expand All @@ -43,7 +47,11 @@ def do_export(self):
]
super().do_export()

self.export_config[OPTION_DEFAULT_PATH] = new_destination_dir
self.export_config.save()

def __init__(self, transient_for, colorscheme, theme_name, **kwargs):
default_themes_path = os.path.join(os.environ['HOME'], '.themes')
super().__init__(
transient_for=transient_for,
colorscheme=colorscheme,
Expand All @@ -58,9 +66,19 @@ def __init__(self, transient_for, colorscheme, theme_name, **kwargs):
'default': False,
'display_name': _("Generate theme for _Cinnamon"),
},
OPTION_DEFAULT_PATH: {
'default': default_themes_path,
'display_name': _("Export _path: "),
},
},
**kwargs
)
self.option_widgets[OPTION_DEFAULT_PATH].set_text(
os.path.join(
self.export_config[OPTION_DEFAULT_PATH],
self.theme_name,
)
)


class Plugin(OomoxThemePlugin):
Expand Down

0 comments on commit 64a285c

Please sign in to comment.