Skip to content

Commit

Permalink
feat(plugins: theme: materia): allow to configure export theme path (…
Browse files Browse the repository at this point in the history
…re: #284)
  • Loading branch information
actionless committed Feb 13, 2020
1 parent 64a285c commit f95a4cd
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion plugins/theme_materia/oomox_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from oomox_gui.export_common import CommonGtkThemeExportDialog, OPTION_GTK2_HIDPI
from oomox_gui.color import convert_theme_color_to_gdk, mix_theme_colors

OPTION_DEFAULT_PATH = 'default_path'

PLUGIN_DIR = os.path.dirname(os.path.realpath(__file__))
THEME_DIR = os.path.join(PLUGIN_DIR, "materia-theme/")
Expand All @@ -16,14 +17,40 @@ class MateriaThemeExportDialog(CommonGtkThemeExportDialog):
timeout = 1000

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(THEME_DIR, "change_color.sh"),
"--hidpi", str(self.export_config[OPTION_GTK2_HIDPI]),
"--output", self.theme_name,
"--target", new_destination_dir,
"--output", theme_name,
self.temp_theme_path,
]
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,
theme_name=theme_name,
add_options={
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,
)
)


def _monkeypatch_update_preview_colors(preview_object):
Expand Down

0 comments on commit f95a4cd

Please sign in to comment.