From 4506a0cfda3560e619cdcedcc24015e7931796a1 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 10 Jun 2026 08:27:24 +0900 Subject: [PATCH] chore: revert IconButton alignment changes --- dzgui/managers/offline.py | 3 ++- dzgui/views/components/buttons.py | 12 ++++-------- dzgui/views/pages/offline.py | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/dzgui/managers/offline.py b/dzgui/managers/offline.py index 13abf3b..5090d23 100644 --- a/dzgui/managers/offline.py +++ b/dzgui/managers/offline.py @@ -29,12 +29,13 @@ class OfflineManager: self.custom_mods: list[str] | None # TODO: strings - @call_on_thread("parsing") + #@call_on_thread("parsing") def parse_custom_mods(self, folder: str) -> "FastInsertListStore": mods = get_custom_mods(Path(folder)) store = ModelFactory().make_mod_store() store.extend(mods) # TODO: manipulate tree columns to only show name and size + # TODO: return store from cleanup function return store def setup( diff --git a/dzgui/views/components/buttons.py b/dzgui/views/components/buttons.py index 899ff59..affcc5b 100644 --- a/dzgui/views/components/buttons.py +++ b/dzgui/views/components/buttons.py @@ -48,10 +48,8 @@ class LargeIcon(Gtk.Image): class IconButton(Gtk.Button): - def __init__( - self, icon: str, margin: int = 0, halign: Gtk.Align = Gtk.Align.START - ) -> None: - super().__init__(halign=halign) + def __init__(self, icon: str, margin: int = 0) -> None: + super().__init__() self.icon = Icon(icon, l_margin=margin) self.set_image(self.icon) self.set_image_position(Gtk.PositionType.RIGHT) @@ -59,10 +57,8 @@ class IconButton(Gtk.Button): class IconTextButton(IconButton): - def __init__( - self, icon: str, label: str, halign: Gtk.Align = Gtk.Align.START - ) -> None: - super().__init__(icon, margin=5, halign=halign) + def __init__(self, icon: str, label: str) -> None: + super().__init__(icon, margin=5) self.set_label(label) diff --git a/dzgui/views/pages/offline.py b/dzgui/views/pages/offline.py index 843c2a8..e3b433c 100644 --- a/dzgui/views/pages/offline.py +++ b/dzgui/views/pages/offline.py @@ -12,7 +12,7 @@ from dzgui.const.constants import ( ) from dzgui.const.enum import NotebookPage, Preferences from dzgui.managers.offline import OfflineManager -from dzgui.strings import offline +from dzgui.strings import generic, offline from dzgui.views.components.buttons import IconTextButton from dzgui.views.components.frame import HeadingFrame from dzgui.views.components.scrollable import NoOverlayScrolledWindow @@ -64,7 +64,9 @@ class FolderHBox(HBox): # TODO: alternate class for left-aligned icons self.button = IconTextButton(FOLDER, btn_label) + self.button.set_halign(Gtk.Align.START) self.button.set_image_position(Gtk.PositionType.LEFT) + self.label = Gtk.Label() self.extend([self.button, self.label]) @@ -119,8 +121,7 @@ class ModFrame(HeadingFrame): def _on_selection_changed(self, sel: Gtk.TreeSelection) -> None: model, rows = sel.get_selected_rows() if len(rows) == 0: - # TODO recycle (util.format) - status = "Ctrl-click to select multiple; Shift-click to select a range." + status = generic.selectable_tree else: status = f"Mods selected: {len(rows)}" self.status.set_label(status) @@ -148,6 +149,16 @@ class CustomModFrame(ModFrame): folder = self.controller.set_custom_folder() if folder is not None: self.custom_hbox.set_label(str(folder)) + # TODO: + # self.controller.get_custom_mods() + from dzgui.managers.offline import OfflineManager + + om = OfflineManager(self.controller) + store = om.parse_custom_mods(folder) + + # FIXME: button should appear before tree vbox + self.tree.set_model(store) + self.tree_vbox.show() def get_mods(self) -> list[str]: rows = self.tree.get_selection().get_selected_rows()