elif isinstance(b, DirItem):
return +1
# apply self.sort_order within DirItems and FileItems (separately)
- result = 0
for key in self.sort_order:
a_cmp = None
b_cmp = None
if hasattr(b, key):
b_cmp = getattr(b, key)
if a_cmp is None and b_cmp is not None:
- result = -1
+ return -1
elif a_cmp is not None and b_cmp is None:
- result = +1
+ return +1
elif a_cmp > b_cmp:
- result = +1
+ return +1
elif a_cmp < b_cmp:
- result = -1
- return result
+ return -1
+ return 0
def init_gallery_slot(file_item):
slot = Gtk.Box()
self.gallery.set_max_children_per_line(self.per_row)
vp = self.gallery.get_parent().get_parent()
# because sometimes vp.[size] updates too late for our measurements
- vp_height = self.force_height if self.force_height else vp.get_width()
+ vp_height = self.force_height if self.force_height else vp.get_height()
vp_width = self.force_width if self.force_width else vp.get_width()
vp_scroll = vp.get_vadjustment()
vp_top = vp_scroll.get_value()
vp_bottom = vp_top + vp_height
margin = 6
- max_slot_width = vp_width / self.per_row - margin
+ max_slot_width = (vp_width // self.per_row) - margin
prefered_slot_height = vp_height - margin
slot_size = min(prefered_slot_height, max_slot_width)
for i in range(self.gallery_store_filtered.get_n_items()):