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)
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:
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)
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))