From 51857648fcf6c0e18be1420ec7a47a6a6502f112 Mon Sep 17 00:00:00 2001 From: heliguy Date: Thu, 7 Nov 2024 20:36:34 -0500 Subject: [PATCH] Fix bug causing activated navigation sidebar row to not match visible page on startup --- src/main_window/window.blp | 10 +++++----- src/main_window/window.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main_window/window.blp b/src/main_window/window.blp index 8e2bbf94..e59de240 100644 --- a/src/main_window/window.blp +++ b/src/main_window/window.blp @@ -7,10 +7,10 @@ template $WarehouseWindow: Adw.ApplicationWindow { default-width: 921; default-height: 450; Adw.Breakpoint main_breakpoint { - condition ("min-width: 865") + condition ("max-width: 865") setters { - main_split.collapsed: false; - main_split.max-sidebar-width: 999999999; + main_split.collapsed: true; + main_split.min-sidebar-width: 0.2; } } content: @@ -28,9 +28,9 @@ template $WarehouseWindow: Adw.ApplicationWindow { } } Adw.OverlaySplitView main_split { - collapsed: true; + collapsed: false; show-sidebar: true; - sidebar-width-fraction: 0.2; + sidebar-width-fraction: 999999999; min-sidebar-width: 250; sidebar: Adw.NavigationPage { diff --git a/src/main_window/window.py b/src/main_window/window.py index cbf9f296..59a70c13 100644 --- a/src/main_window/window.py +++ b/src/main_window/window.py @@ -89,12 +89,13 @@ def remove_refresh_lockout(self, reason): self.refresh_button.set_sensitive(True) def navigation_handler(self, _, row): + if self.main_split.get_collapsed(): + self.main_split.set_show_sidebar(False) + row = row.get_child() page = self.pages[row] self.stack.set_visible_child(page) self.settings.set_string("page-shown", page.page_name) - if self.main_split.get_collapsed(): - self.main_split.set_show_sidebar(False) def activate_row(self, nav_row): idx = 0 @@ -102,7 +103,6 @@ def activate_row(self, nav_row): idx += 1 if row.get_child() is nav_row: row.activate() - nav_row.grab_focus() break def show_saved_page(self):