self.props.child = box_outer
self.item = None
+ self.sort_order = []
self.reload_dir()
def on_sort_select(self, button):
- self.sort(button.props.label)
+ self.update_sort_order(button.props.label)
+ self.sort()
self.sorter.props.label = f'SORT: {button.props.label}'
- def sort(self, attr_name):
+ def update_sort_order(self, attr_name):
+ if attr_name in self.sort_order:
+ self.sort_order.remove(attr_name)
+ self.sort_order += [attr_name]
+
+ def sort(self):
self.list_store.remove_all()
- self.unsorted.sort(key=lambda i: getattr(i, attr_name))
+ for key in self.sort_order:
+ self.unsorted.sort(key=lambda i: getattr(i, key))
for file_item in self.unsorted:
self.list_store.append(file_item)
if self.item:
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('name')
+ self.sort()
with open(CACHE_PATH, 'w', encoding='utf8') as f:
json_dump(cache, f)