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)
+ def add_sorter(attr_name, group):
+ radio = Gtk.CheckButton(label=attr_name, group=group)
radio.connect('toggled', self.on_sort_select)
vbox.append(radio)
+ return radio
+
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ radio1 = add_sorter('last_mod_time', None)
+ for name in ['name'] + list(GEN_PARAMS):
+ add_sorter(name.lower(), group=radio1)
popover_menu = Gtk.Popover()
popover_menu.props.child = vbox
self.sorter = Gtk.MenuButton(label='SORT', popover=popover_menu)
for item in [item for item in self.unsorted if '' == item.model]:
item.set_metadata(et, cache)
self.max_index = len(self.unsorted) - 1
- self.sort('last_mod_time')
+ self.sort('name')
with open(CACHE_PATH, 'w', encoding='utf8') as f:
json_dump(cache, f)