From: Christian Heller Date: Thu, 12 Sep 2024 16:32:45 +0000 (+0200) Subject: In browser.py, fix sorting. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/coming?a=commitdiff_plain;h=42f5a55377c83f53b3b83cf0ba315fe23aed416d;p=stable_plom In browser.py, fix sorting. --- diff --git a/browser.py b/browser.py index 1798fec..792fc4b 100755 --- a/browser.py +++ b/browser.py @@ -238,7 +238,7 @@ class MainWindow(Gtk.Window): self.gallery_store_filtered) self.include_dirs = False self.recurse_dirs = False - self.per_row = 3 + self.per_row = 5 def init_key_control(): key_ctl = Gtk.EventControllerKey( @@ -334,6 +334,7 @@ class MainWindow(Gtk.Window): if isinstance(b, DirItem) and not isinstance(a, DirItem): return +1 # apply self.sort_order within DirItems and FileItems (separately) + ret = 0 for key in self.sort_order: a_cmp = None b_cmp = None @@ -344,14 +345,14 @@ class MainWindow(Gtk.Window): if a_cmp is None and b_cmp is None: continue if a_cmp is None: - return -1 - if b_cmp is None: - return +1 - if a_cmp > b_cmp: - return +1 - if a_cmp < b_cmp: - return -1 - return 0 + ret = -1 + elif b_cmp is None: + ret = +1 + elif a_cmp > b_cmp: + ret = +1 + elif a_cmp < b_cmp: + ret = -1 + return ret def init_gallery_slot(file_item): slot = Gtk.Box()