Skip to content

Commit

Permalink
fix(multi_export_cli: handle the themes which doesn't have terminal p…
Browse files Browse the repository at this point in the history
…alette defined explicitly
  • Loading branch information
actionless committed Sep 24, 2024
1 parent b1222e0 commit 97ca80b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions oomox_gui/multi_export_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from oomox_gui.i18n import translate
from oomox_gui.main import OomoxGtkApplication
from oomox_gui.multi_export import CONFIG_FILE_PREFIX, MultiExportDialog
from oomox_gui.terminal import generate_terminal_colors_for_oomox
from oomox_gui.theme_file_parser import read_colorscheme_from_path

if TYPE_CHECKING:
Expand Down Expand Up @@ -88,25 +89,32 @@ def do_multi_export(args: argparse.Namespace) -> None:
sys.exit(1)
print(f":: Found Themix theme '{themix_theme_name}' at {themix_theme_path}")

def callback(theme: "ThemeT") -> None:
app = OomoxGtkApplication(show_window=False)
app = OomoxGtkApplication(show_window=False)

def export_callback(_me: MultiExportDialog) -> None:
app.quit()
def callback1(theme: "ThemeT") -> None:
generate_terminal_colors_for_oomox(
colorscheme=theme,
app=app,
result_callback=callback2,
)

def callback2(theme: "ThemeT") -> None:
multi_export = MultiExportDialog(
transient_for=app.window, # type: ignore[arg-type]
colorscheme=theme,
theme_name=themix_theme_name,
export_layout=export_layout_name if not export_layout_path.startswith("/") else None,
export_layout_path=export_layout_path if export_layout_path.startswith("/") else None,
readonly=True,
export_callback=export_callback,
export_callback=callback3,
)
Gdk.threads_add_idle(GLib.PRIORITY_LOW, multi_export.export_all)
app.run([])

read_colorscheme_from_path(themix_theme_path, callback=callback)
def callback3(_me: MultiExportDialog) -> None:
app.quit()

read_colorscheme_from_path(themix_theme_path, callback=callback1)
print(":: DONE 👌😸")


Expand Down

0 comments on commit 97ca80b

Please sign in to comment.