self.widget = widget
title = f'{self.name} ({len(vals_filtered)}/{len(vals_full)}) '
widget.get_first_child().get_first_child().set_text(title)
- vals_listed = [f'<b>{val}</b>' if val in vals_filtered
- else f'<s>{val}</s>'
- for val in sorted(vals_full)]
+ vals_listed = [f'<b>{v}</b>' if v in vals_filtered else f'<s>{v}</s>'
+ for v in vals_full]
widget.get_last_child().set_text(', '.join(vals_listed))
widget.get_last_child().set_use_markup(True)
filter_entry = widget.get_first_child().get_last_child()
self.items_attrs_filtered[attr_name].add(val)
if passes_filters:
entries_filtered += [entry]
+ for d in (self.items_attrs, self.items_attrs_filtered):
+ for k, v in d.items():
+ d[k] = sorted(list(v))
return entries_filtered
def _build_grid(self, entries_filtered):
self.show_dirs = False
sort_attrs = []
for sorter in reversed(self._sort_order):
- values = self.items_attrs_filtered[sorter.name]
- sort_attrs += [(sorter.name, sorted(list(values)))]
+ sort_attrs += [(sorter.name,
+ self.items_attrs_filtered[sorter.name])]
i_row_ref = [0]
i_slot_ref = [0]
self.per_row = len(sort_attrs[-1][1])
if self.per_row_by_first_sorter:
self._col_headers_grid = Gtk.Grid()
self._col_headers_frame.put(self._col_headers_grid, 0, 0)
- attr_name = self._sort_order[0].name
- attr_values = sorted(self.items_attrs_filtered[attr_name])
+ attr_values = self.items_attrs_filtered[self._sort_order[0].name]
for i, val in enumerate(attr_values):
label = Gtk.Label(label=str(val))
label.set_size_request(slot_size, -1)