From: Christian Heller Date: Tue, 10 Sep 2024 03:56:42 +0000 (+0200) Subject: To browser.py navbar, add index and totals counter. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=19797578663028e3f481bb2a5d76177746c6b48c;p=stable_plom To browser.py navbar, add index and totals counter. --- diff --git a/browser.py b/browser.py index 8c258a3..9290f52 100755 --- a/browser.py +++ b/browser.py @@ -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):