diff --git a/src/main.py b/src/main.py index 5f8e5f8..11f3dcf 100644 --- a/src/main.py +++ b/src/main.py @@ -46,7 +46,13 @@ class WarehouseApplication(Adw.Application): self.create_action("quit", lambda *_: self.quit(), ["q"]) self.create_action("refresh", self.on_refresh_shortcut, ["r", "F5"]) self.create_action("open-menu", lambda *_: self.props.active_window.main_menu.popup(), ["F10"]) - + + self.create_action("show-packages-page", lambda *_: self.props.active_window.switch_page_shortcut_handler("p"), ["p"]) + self.create_action("show-remotes-page", lambda *_: self.props.active_window.switch_page_shortcut_handler("m"), ["m"]) + self.create_action("show-user-data-page", lambda *_: self.props.active_window.switch_page_shortcut_handler("d"), ["d"]) + self.create_action("show-snapshots-page", lambda *_: self.props.active_window.switch_page_shortcut_handler("s"), ["s"]) + self.create_action("show-install-page", lambda *_: self.props.active_window.switch_page_shortcut_handler("i"), ["i"]) + self.is_dialog_open = False gtk_version = ( diff --git a/src/main_window/window.py b/src/main_window/window.py index e8fff49..f211d56 100644 --- a/src/main_window/window.py +++ b/src/main_window/window.py @@ -117,11 +117,6 @@ class WarehouseWindow(Adw.ApplicationWindow): nav_row.grab_focus() break - def save_sidebar_state(self, *args): - state = self.main_split.get_show_sidebar() - self.settings.set_boolean("sidebar-shown", state) - print(self.settings.get_boolean("sidebar-shown")) - def show_saved_page(self): page_to_show = self.settings.get_string("page-shown") page_found = False @@ -194,6 +189,9 @@ class WarehouseWindow(Adw.ApplicationWindow): def on_drop_leave(self, *args): self.file_drop_stack.set_visible_child(self.main_split) + def switch_page_shortcut_handler(self, letter): + self.activate_row(self.shortcut_to_pages[letter]) + def __init__(self, **kwargs): super().__init__(**kwargs) @@ -208,6 +206,13 @@ class WarehouseWindow(Adw.ApplicationWindow): self.snapshots_row: SnapshotPage(main_window=self), self.install_row: InstallPage(main_window=self), } + self.shortcut_to_pages = { + "p": self.packages_row, + "m": self.remotes_row, + "d": self.user_data_row, + "s": self.snapshots_row, + "i": self.install_row, + } self.navigation_row_listbox.connect("row-activated", self.navigation_handler) self.show_saved_page() self.refresh_lockouts = []