From: Christian Heller Date: Sat, 26 Oct 2024 13:25:06 +0000 (+0200) Subject: Browser: In by_1st view, label *all* active non-1st sorters to the left. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/todo?a=commitdiff_plain;h=b7c4aa1d1911f11d6d2e286ee8f7c8760c49a5ae;p=stable_plom Browser: In by_1st view, label *all* active non-1st sorters to the left. --- diff --git a/browser.py b/browser.py index 8db39e3..939dc1a 100755 --- a/browser.py +++ b/browser.py @@ -792,13 +792,15 @@ class Gallery: def build_rows_by_attrs(remaining_attrs, items_of_parent_attr_value, - parent_attr_value=None): + parent_attrs_values): if not items_of_parent_attr_value: return attr_name, attr_values = remaining_attrs[0] if 1 == len(remaining_attrs): - self._grid.attach(VerticalLabel(str(parent_attr_value)), - 0, i_row_ref[0], 1, 1) + v_offset = len(parent_attrs_values) + for i, val in enumerate(parent_attrs_values): + self._grid.attach(VerticalLabel(str(val)), + i, i_row_ref[0], 1, 1) row = [None] * len(attr_values) for item in items_of_parent_attr_value: val = getattr(item, attr_name) @@ -814,7 +816,8 @@ class Gallery: slot = GallerySlot(GalleryItem('', '')) # dummy self.slots += [slot] i_slot_ref[0] += 1 - self._grid.attach(slot, i_col+1, i_row_ref[0], 1, 1) + self._grid.attach(slot, i_col + v_offset, + i_row_ref[0], 1, 1) i_row_ref[0] += 1 return for attr_value in attr_values: @@ -823,7 +826,7 @@ class Gallery: if attr_value == getattr(x, attr_name)] build_rows_by_attrs(remaining_attrs[1:], items_of_attr_value, - attr_value) + parent_attrs_values + [attr_value]) if self._grid: self._fixed_frame.remove(self._grid) @@ -838,7 +841,7 @@ class Gallery: if len(vals) > 1: sort_attrs += [(sorter.name, vals)] self._per_row = len(sort_attrs[-1][1]) - build_rows_by_attrs(sort_attrs, entries_filtered) + build_rows_by_attrs(sort_attrs, entries_filtered, []) else: dir_entries_filtered_sorted = sorted( entries_filtered, key=cmp_to_key(self._sort_cmp))