home · contact · privacy
To browser.py navbar, add index and totals counter.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 10 Sep 2024 03:56:42 +0000 (05:56 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 10 Sep 2024 03:56:42 +0000 (05:56 +0200)
browser.py

index 8c258a3e6c68bce232b43fad873a3cfeb0663f34..9290f52f0e028c3323b99018dbf3ffd4cd1570da 100755 (executable)
@@ -109,6 +109,7 @@ class MainWindow(Gtk.Window):
     prev_key: list
     filter_inputs = dict
     button_activate_sort: Gtk.Button
+    counter: Gtk.Label
 
     def __init__(self, app, **kwargs):
         super().__init__(**kwargs)
@@ -120,6 +121,8 @@ class MainWindow(Gtk.Window):
                 btn.connect('clicked', on_click)
                 parent_box.append(btn)
             navbar = Gtk.Box(orientation=OR_H)
+            self.counter = Gtk.Label()
+            navbar.append(self.counter)
             add_button('sidebar', lambda _: self.toggle_side_box(), navbar)
             add_button('reload', lambda _: self.load_directory(), navbar)
             navbar.append(Gtk.Label(label=' per row: '))
@@ -355,6 +358,8 @@ class MainWindow(Gtk.Window):
         if to_select:
             self.block_once_hit_file_selection = True
             to_select.activate()
+        else:
+            self.counter.set_text(f' (nothing) ')
         self.update_gallery_view()
 
     def update_gallery_view(self, refocus=False):
@@ -455,6 +460,9 @@ class MainWindow(Gtk.Window):
 
         sync_fbox_selection_to_gallery_selection()
         update_metadata_on_file()
+        idx = self.gallery_selection.props.selected + 1
+        total = self.gallery_selection.get_n_items()
+        self.counter.set_text(f' {idx} of {total} ')
 
     def update_sort_order_box(self, sort_order_source, cur_selection=0):
         """Rebuild self.sort_store from self.sort_order."""
@@ -517,7 +525,6 @@ class MainWindow(Gtk.Window):
                         if more_than is None or more_than <= value:
                             more_than = value
             if to_compare in numbers_or:
-                print("return TRUE")
                 return True
             if len(numbers_or) > 0 and (less_than == less_or_equal ==
                                         more_or_equal == more_than):