self.viewer.append(self.metadata)
self.viewer.append(self.label_nothing_to_show)
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ radio1 = Gtk.CheckButton(label='last_mod_time')
+ radio1.connect('toggled', self.on_sort_select)
+ vbox.append(radio1)
+ for name in GEN_PARAMS:
+ radio = Gtk.CheckButton(label=name.lower(), group=radio1)
+ radio.connect('toggled', self.on_sort_select)
+ vbox.append(radio)
+ 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)
-
- btn_sort_date = Gtk.Button(label='by age')
- btn_sort_date.connect('clicked', lambda _: self.sort('last_mod_time'))
- dir_box.append(btn_sort_date)
- btn_sort_seed = Gtk.Button(label='by seed')
- btn_sort_seed.connect('clicked', lambda _: self.sort('seed'))
- dir_box.append(btn_sort_seed)
+ dir_box.append(self.sorter)
img_dir_absolute = abspath(IMG_DIR)
self.dir = Gio.File.new_for_path(img_dir_absolute)
with open(CACHE_PATH, 'w', encoding='utf8') as f:
json_dump(cache, f)
+ def on_sort_select(self, button):
+ self.sort(button.props.label)
+ self.sorter.props.label = f'SORT: {button.props.label}'
+
def sort(self, attr_name):
self.list_store.remove_all()
for file_item in sorted(self.unsorted,