Skip to content

Commit

Permalink
Fix bug causing activated navigation sidebar row to not match visible…
Browse files Browse the repository at this point in the history
… page on startup
  • Loading branch information
heliguy4599 committed Nov 8, 2024
1 parent 2fd24f3 commit 5185764
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/main_window/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/main_window/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ 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
while row := self.navigation_row_listbox.get_row_at_index(idx):
idx += 1
if row.get_child() is nav_row:
row.activate()
nav_row.grab_focus()
break

def show_saved_page(self):
Expand Down

0 comments on commit 5185764

Please sign in to comment.