From 764d9e22f66759338d60e1e896a33c29194e13d6 Mon Sep 17 00:00:00 2001 From: Heliguy Date: Wed, 4 Sep 2024 23:29:01 -0400 Subject: [PATCH] Make Remote Page's loading view full-page --- src/remotes_page/remotes_page.blp | 254 +++++++++++++++--------------- src/remotes_page/remotes_page.py | 15 +- 2 files changed, 133 insertions(+), 136 deletions(-) diff --git a/src/remotes_page/remotes_page.blp b/src/remotes_page/remotes_page.blp index dbe50ff..c423124 100644 --- a/src/remotes_page/remotes_page.blp +++ b/src/remotes_page/remotes_page.blp @@ -3,149 +3,149 @@ using Adw 1; template $RemotesPage : Adw.NavigationPage { title: _("Manage Remotes"); - Adw.ToolbarView { - [top] - Adw.HeaderBar header_bar { - [start] - $SidebarButton {} - [start] - ToggleButton search_button { - icon-name: "loupe-large-symbolic"; - tooltip-text: _("Search Packages"); - } - } - [top] - Adw.Clamp { - SearchBar search_bar { - search-mode-enabled: bind search_button.active bidirectional; - key-capture-widget: template; - SearchEntry search_entry { - hexpand: true; - placeholder-text: _("Search Remotes"); + Adw.ToastOverlay toast_overlay { + Stack status_stack { + Adw.ToolbarView loading_view { + [top] + Adw.HeaderBar { + [start] + $SidebarButton {} } } - } - Adw.ToastOverlay toast_overlay { - Stack stack { - // Adw.StatusPage loading_remotes { - // title: _("Loading Remotes"); - // description: _("This should only take a moment"); - // child: - // Spinner { - // spinning: true; - // } - // ; - // } - Adw.StatusPage no_results { - title: _("No Results Found"); - description: _("Try a different search"); - icon-name: "system-search-symbolic"; + Adw.ToolbarView main_view { + [top] + Adw.HeaderBar header_bar { + [start] + $SidebarButton {} + [start] + ToggleButton search_button { + icon-name: "loupe-large-symbolic"; + tooltip-text: _("Search Packages"); + } } - Adw.PreferencesPage content_page { - Adw.PreferencesGroup current_remotes_group { - title: _("Current Remotes"); - description: _("Remotes available on your system"); - header-suffix: - ToggleButton show_disabled_button { - valign: center; - styles ["flat"] - Adw.ButtonContent show_disabled_button_content { - icon-name: "eye-not-looking-symbolic"; - label: _("Show Disabled"); - } - } - ; - Adw.ActionRow none_visible { - styles ["warning"] - [child] - Box { - spacing: 3; - orientation: vertical; - Box { - halign: center; - Image { - valign: center; - margin-top: 7; - margin-end: 6; + [top] + Adw.Clamp { + SearchBar search_bar { + search-mode-enabled: bind search_button.active bidirectional; + key-capture-widget: template; + SearchEntry search_entry { + hexpand: true; + placeholder-text: _("Search Remotes"); + } + } + } + Stack stack { + Adw.PreferencesPage content_page { + Adw.PreferencesGroup current_remotes_group { + title: _("Current Remotes"); + description: _("Remotes available on your system"); + header-suffix: + ToggleButton show_disabled_button { + valign: center; + styles ["flat"] + Adw.ButtonContent show_disabled_button_content { icon-name: "eye-not-looking-symbolic"; - } - Label { - margin-top: 7; - label: _("No Enabled Remotes"); - wrap: true; - styles ["heading"] + label: _("Show Disabled"); } } - Label { - label: _("You only have disabled remotes on this system"); - margin-start: 16; - margin-end: 16; - margin-bottom: 8; - justify: center; - halign: center; - wrap: true; - } - } - } - Adw.ActionRow no_remotes { - styles ["error"] - [child] - Box { - spacing: 3; - orientation: vertical; + ; + Adw.ActionRow none_visible { + styles ["warning"] + [child] Box { - halign: center; - Image { - valign: center; - margin-top: 7; - margin-end: 6; - icon-name: "error-symbolic"; + spacing: 3; + orientation: vertical; + Box { + halign: center; + Image { + valign: center; + margin-top: 7; + margin-end: 6; + icon-name: "eye-not-looking-symbolic"; + } + Label { + margin-top: 7; + label: _("No Enabled Remotes"); + wrap: true; + styles ["heading"] + } } Label { - margin-top: 7; - label: _("No Remotes Found"); + label: _("You only have disabled remotes on this system"); + margin-start: 16; + margin-end: 16; + margin-bottom: 8; + justify: center; + halign: center; wrap: true; - styles ["heading"] } } - Label { - label: _("Warehouse cannot see the current remotes or your system has no remotes added"); - margin-start: 16; - margin-end: 16; - margin-bottom: 8; - justify: center; - halign: center; - wrap: true; + } + Adw.ActionRow no_remotes { + styles ["error"] + [child] + Box { + spacing: 3; + orientation: vertical; + Box { + halign: center; + Image { + valign: center; + margin-top: 7; + margin-end: 6; + icon-name: "error-symbolic"; + } + Label { + margin-top: 7; + label: _("No Remotes Found"); + wrap: true; + styles ["heading"] + } + } + Label { + label: _("Warehouse cannot see the current remotes or your system has no remotes added"); + margin-start: 16; + margin-end: 16; + margin-bottom: 8; + justify: center; + halign: center; + wrap: true; + } + } + } + } + Adw.PreferencesGroup new_remotes_group { + visible: bind search_button.active inverted; + title: _("Add Popular Remotes"); + description: _("Add new remotes to get more software"); + } + Adw.PreferencesGroup other_remotes { + visible: bind search_button.active inverted; + title: _("Add Other Remotes"); + Adw.ActionRow file_remote_row { + activatable: true; + title: _("Add a Repo File"); + subtitle: _("Open a downloaded repo file to add"); + [suffix] + Image { + icon-name: "plus-large-symbolic"; + } + } + Adw.ActionRow custom_remote_row { + activatable: true; + title: _("Add a Custom Remote"); + subtitle: _("Manually enter new remote details"); + [suffix] + Image { + icon-name: "plus-large-symbolic"; } } } } - Adw.PreferencesGroup new_remotes_group { - visible: bind search_button.active inverted; - title: _("Add Popular Remotes"); - description: _("Add new remotes to get more software"); - } - Adw.PreferencesGroup other_remotes { - visible: bind search_button.active inverted; - title: _("Add Other Remotes"); - Adw.ActionRow file_remote_row { - activatable: true; - title: _("Add a Repo File"); - subtitle: _("Open a downloaded repo file to add"); - [suffix] - Image { - icon-name: "plus-large-symbolic"; - } - } - Adw.ActionRow custom_remote_row { - activatable: true; - title: _("Add a Custom Remote"); - subtitle: _("Manually enter new remote details"); - [suffix] - Image { - icon-name: "plus-large-symbolic"; - } - } + Adw.StatusPage no_results { + title: _("No Results Found"); + description: _("Try a different search"); + icon-name: "system-search-symbolic"; } } } diff --git a/src/remotes_page/remotes_page.py b/src/remotes_page/remotes_page.py index 9701511..2f752fc 100644 --- a/src/remotes_page/remotes_page.py +++ b/src/remotes_page/remotes_page.py @@ -84,8 +84,10 @@ class RemotesPage(Adw.NavigationPage): file_remote_row = gtc() custom_remote_row = gtc() none_visible = gtc() + status_stack = gtc() + loading_view = gtc() + main_view = gtc() - # Statuses no_results = gtc() no_remotes = gtc() content_page = gtc() @@ -98,9 +100,7 @@ class RemotesPage(Adw.NavigationPage): def start_loading(self): self.search_button.set_active(False) - self.search_button.set_sensitive(False) - self.search_entry.set_editable(False) - self.stack.set_visible_child(self.loading_remotes) + self.status_stack.set_visible_child(self.loading_view) self.total_disabled = 0 for row in self.current_remote_rows: self.current_remotes_group.remove(row) @@ -134,9 +134,7 @@ class RemotesPage(Adw.NavigationPage): else: self.no_remotes.set_visible(False) - GLib.idle_add(lambda *_: self.stack.set_visible_child(self.content_page)) - self.search_button.set_sensitive(True) - self.search_entry.set_editable(True) + GLib.idle_add(lambda *_: self.status_stack.set_visible_child(self.main_view)) def none_visible_handler(self): any_visible = False @@ -268,7 +266,6 @@ class RemotesPage(Adw.NavigationPage): # Extra Object Creation self.__class__.instance = self self.main_window = main_window - self.loading_remotes = LoadingStatus(_("Loading Remotes"), _("This should only take a moment")) self.search_bar.set_key_capture_widget(main_window) self.current_remote_rows = [] self.filter_setting = Gio.Settings.new("io.github.flattool.Warehouse.filter") @@ -281,7 +278,7 @@ class RemotesPage(Adw.NavigationPage): self.show_disabled_button.connect("toggled", self.show_disabled_handler) # Appply - self.stack.add_child(self.loading_remotes) + self.loading_view.set_content(LoadingStatus(_("Loading Remotes"), _("This should only take a moment"))) for item in self.new_remotes: row = NewRemoteRow(item) row.connect("activated", lambda *_, remote_info=item: AddRemoteDialog(main_window, self, remote_info).present(main_window))