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)
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)
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
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()