From: Christian Heller Date: Sun, 25 Aug 2024 23:42:53 +0000 (+0200) Subject: Add toggler for folder view. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/task?a=commitdiff_plain;h=2f06d2a63baf0e8cddddab6aeabf69573fc55082;p=stable_plom Add toggler for folder view. --- diff --git a/browser.py b/browser.py index 97def1d..a3e0979 100755 --- a/browser.py +++ b/browser.py @@ -61,6 +61,9 @@ class Window(Gtk.ApplicationWindow): box_buttons.append(btn) box_buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) + btn = Gtk.Button(label='folder') + btn.connect('clicked', self.toggle_folder_view) + box_buttons.append(btn) btn = Gtk.Button(label='reload') btn.connect('clicked', lambda _: self.reload_dir()) box_buttons.append(btn) @@ -90,8 +93,8 @@ class Window(Gtk.ApplicationWindow): popover_menu = Gtk.Popover() popover_menu.props.child = vbox self.sorter = Gtk.MenuButton(label='SORT', popover=popover_menu) - dir_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) - dir_box.append(self.sorter) + self.dir_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + self.dir_box.append(self.sorter) self.img_dir_absolute = abspath(IMG_DIR) self.dir = Gio.File.new_for_path(self.img_dir_absolute) @@ -104,10 +107,11 @@ class Window(Gtk.ApplicationWindow): self.selector = Gtk.ListView(model=self.selection, factory=factory) scrolled = Gtk.ScrolledWindow(child=self.selector, vexpand=True, propagate_natural_width=True) - dir_box.append(scrolled) + self.dir_box.append(scrolled) + self.dir_box.hide() box_outer = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) - box_outer.append(dir_box) + box_outer.append(self.dir_box) box_outer.append(self.viewer) self.props.child = box_outer @@ -115,6 +119,9 @@ class Window(Gtk.ApplicationWindow): self.sort_order = ['last_mod_time'] self.reload_dir() + def toggle_folder_view(self, _): + self.dir_box.props.visible = not self.dir_box.props.visible + def on_sort_select(self, button): self.update_sort_order(button.props.label) self.sort()