Use full page loading status

This commit is contained in:
Heliguy
2024-09-28 22:58:15 -04:00
parent 9916c0a216
commit fa4983def4
2 changed files with 123 additions and 126 deletions

View File

@@ -16,136 +16,130 @@ template $PackagesPage : Adw.BreakpointBin {
}
}
Adw.NavigationSplitView packages_split {
sidebar-width-fraction: 0.5;
max-sidebar-width: 999999999;
sidebar:
Adw.NavigationPage packages_navpage {
title: _("Packages");
Adw.ToastOverlay packages_toast_overlay {
Adw.ToolbarView packages_tbv {
[top]
Adw.HeaderBar {
[start]
$SidebarButton {}
[start]
ToggleButton search_button {
icon-name: "loupe-large-symbolic";
tooltip-text: _("Search Packages");
}
[end]
ToggleButton filter_button {
icon-name: "funnel-symbolic";
tooltip-text: _("Filter Packages");
}
[end]
ToggleButton select_button {
icon-name: "selection-mode-symbolic";
tooltip-text: _("Select Packages");
}
}
[top]
SearchBar search_bar {
search-mode-enabled: bind search_button.active bidirectional;
SearchEntry search_entry {
hexpand: true;
placeholder-text: _("Search Packages");
}
}
Stack status_stack {
// Adw.StatusPage loading_packages {
// title: _("Loading Packages");
// description: _("This should only take a moment");
// child:
// Spinner {
// spinning: true;
// }
// ;
// }
ScrolledWindow scrolled_window {
ListBox packages_list_box {
styles ["navigation-sidebar"]
}
}
// Adw.StatusPage uninstalling {
// title: _("Uninstalling Packages");
// description: _("This should only take a moment");
// child:
// Spinner {
// spinning: true;
// }
// ;
// }
Adw.StatusPage no_filter_results {
title: _("No Packages Match Filters");
description: _("No installed package matches all of the currently applied filters");
icon-name: "funnel-symbolic";
Button reset_filters_button {
label: _("Reset Filters");
halign: center;
visible: false;
styles ["pill"]
}
}
Adw.StatusPage no_packages {
title: _("No Packages Found");
description: _("Warehouse cannot see the list of installed packages or your system has no packages installed");
icon-name: "error-symbolic";
}
Adw.StatusPage no_results {
title: _("No Results Found");
description: _("Try a different search");
icon-name: "system-search-symbolic";
}
}
[bottom]
Revealer {
reveal-child: bind select_button.active;
transition-type: slide_up;
[center]
Box bottom_bar {
styles ["toolbar"]
hexpand: true;
homogeneous: true;
Button select_all_button {
styles ["raised"]
Adw.ButtonContent {
Adw.NavigationPage {
title: _("Packages");
Stack stack {
Adw.ToolbarView loading_view {
[top]
Adw.HeaderBar {
[start]
$SidebarButton {}
}
}
Adw.NavigationSplitView packages_split {
sidebar-width-fraction: 0.5;
max-sidebar-width: 999999999;
sidebar:
Adw.NavigationPage packages_navpage {
title: _("Packages");
Adw.ToastOverlay packages_toast_overlay {
Adw.ToolbarView packages_tbv {
[top]
Adw.HeaderBar {
[start]
$SidebarButton {}
[start]
ToggleButton search_button {
icon-name: "loupe-large-symbolic";
tooltip-text: _("Search Packages");
}
[end]
ToggleButton filter_button {
icon-name: "funnel-symbolic";
tooltip-text: _("Filter Packages");
}
[end]
ToggleButton select_button {
icon-name: "selection-mode-symbolic";
label: _("Select All");
can-shrink: true;
tooltip-text: _("Select Packages");
}
}
MenuButton copy_button {
styles ["raised"]
Adw.ButtonContent {
icon-name: "edit-copy-symbolic";
label: _("Copy");
can-shrink: true;
[top]
SearchBar search_bar {
search-mode-enabled: bind search_button.active bidirectional;
SearchEntry search_entry {
hexpand: true;
placeholder-text: _("Search Packages");
}
popover: copy_pop;
}
Button uninstall_button {
styles ["raised"]
Adw.ButtonContent {
icon-name: "user-trash-symbolic";
label: _("Uninstall");
can-shrink: true;
Stack status_stack {
ScrolledWindow scrolled_window {
ListBox packages_list_box {
styles ["navigation-sidebar"]
}
}
Adw.StatusPage no_filter_results {
title: _("No Packages Match Filters");
description: _("No installed package matches all of the currently applied filters");
icon-name: "funnel-symbolic";
Button reset_filters_button {
label: _("Reset Filters");
halign: center;
visible: false;
styles ["pill"]
}
}
Adw.StatusPage no_packages {
title: _("No Packages Found");
description: _("Warehouse cannot see the list of installed packages or your system has no packages installed");
icon-name: "error-symbolic";
}
Adw.StatusPage no_results {
title: _("No Results Found");
description: _("Try a different search");
icon-name: "system-search-symbolic";
}
}
[bottom]
Revealer {
reveal-child: bind select_button.active;
transition-type: slide_up;
[center]
Box bottom_bar {
styles ["toolbar"]
hexpand: true;
homogeneous: true;
Button select_all_button {
styles ["raised"]
Adw.ButtonContent {
icon-name: "selection-mode-symbolic";
label: _("Select All");
can-shrink: true;
}
}
MenuButton copy_button {
styles ["raised"]
Adw.ButtonContent {
icon-name: "edit-copy-symbolic";
label: _("Copy");
can-shrink: true;
}
popover: copy_pop;
}
Button uninstall_button {
styles ["raised"]
Adw.ButtonContent {
icon-name: "user-trash-symbolic";
label: _("Uninstall");
can-shrink: true;
}
}
}
}
}
}
}
}
;
content:
Adw.NavigationPage {
title: "Content Stack";
Stack content_stack {
transition-type: slide_left_right;
}
}
;
}
;
content:
Adw.NavigationPage {
title: "Content Stack";
Stack content_stack {
transition-type: slide_left_right;
}
}
;
}
}
}

View File

@@ -15,10 +15,10 @@ class PackagesPage(Adw.BreakpointBin):
gtc = Gtk.Template.Child
packages_bpt = gtc()
packages_toast_overlay = gtc()
stack = gtc()
status_stack = gtc()
scrolled_window = gtc()
# uninstalling = gtc()
# loading_packages = gtc()
loading_view = gtc()
no_filter_results = gtc()
reset_filters_button = gtc()
no_packages = gtc()
@@ -60,7 +60,7 @@ class PackagesPage(Adw.BreakpointBin):
else:
self.select_button.set_sensitive(False)
if to_set is self.loading_packages or to_set is self.uninstalling:
if to_set is self.uninstalling:
self.properties_page.stack.set_visible_child(self.properties_page.loading_tbv)
self.filter_button.set_sensitive(False)
self.filters_page.set_sensitive(False)
@@ -84,8 +84,12 @@ class PackagesPage(Adw.BreakpointBin):
if to_set is self.no_results:
self.filters_page.set_sensitive(False)
self.status_stack.set_visible_child(to_set)
if to_set is self.loading_packages:
self.stack.set_visible_child(self.loading_view)
else:
self.stack.set_visible_child(self.packages_split)
self.status_stack.set_visible_child(to_set)
def apply_filters(self):
i = 0
@@ -324,8 +328,7 @@ class PackagesPage(Adw.BreakpointBin):
self.current_row_for_properties = None
# Apply
# self.set_status("loading_packages")
self.status_stack.add_child(self.loading_packages)
self.loading_view.set_content(self.loading_packages)
self.status_stack.add_child(self.uninstalling)
self.packages_list_box.set_filter_func(self.filter_func)
self.packages_list_box.set_sort_func(self.sort_func)