From 42f5a55377c83f53b3b83cf0ba315fe23aed416d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 12 Sep 2024 18:32:45 +0200 Subject: [PATCH] In browser.py, fix sorting. --- browser.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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() -- 2.30.2