self.item = item
self.item.slot = self
if on_click_file:
- self.connect('clicked', on_click_file)
+ self.connect('clicked', lambda _: on_click_file())
def mark(self, css_class, do_add=True):
"""Add or remove css_class from self."""
def build_grid(entries_filtered):
i_row_ref, i_slot_ref = [0], [0]
- def item_clicker(idx):
- def f(_):
- self._set_selection(idx)
- self._on_hit_item()
- return f
-
def build_rows_by_attrs(remaining, items_of_parent, ancestors):
if not items_of_parent:
return
item.with_others = True
row[idx_val_in_attr_values] = item
for i_col, item in enumerate(row):
- if item:
- slot = GallerySlot(item, self._slots_geometry)
- else:
- slot = GallerySlot(GalleryItem('', ''), # dummy
- self._slots_geometry)
+ slot = GallerySlot( # build empty dummy if necessary
+ item if item else GalleryItem('', ''),
+ self._slots_geometry)
self.slots += [slot]
i_slot_ref[0] += 1
self._grid.attach(slot, i_col + len(ancestors),
i_col = 0
i_row += 1
slot = GallerySlot(item, self._slots_geometry,
- item_clicker(i))
+ self._on_hit_item)
self._grid.attach(slot, i_col, i_row, 1, 1)
self.slots += [slot]
i_col += 1
break
i_vlabels += 1
max_slot_width = (vp_width - side_offset) // self._per_row
- slot_size = min(vp_height, max_slot_width)
- self._slots_geometry.set_size(slot_size)
+ self._slots_geometry.set_size(min(vp_height, max_slot_width))
if self._by_1st:
i_widgets = 0
while True: