Make loading status full page

This commit is contained in:
Heliguy
2024-09-06 14:54:06 -04:00
parent 764d9e22f6
commit ea4c7a15c7
4 changed files with 100 additions and 101 deletions

View File

@@ -2,15 +2,6 @@ using Gtk 4.0;
using Adw 1;
template $DataSubpage : Stack {
// Adw.StatusPage loading_data {
// title: _("Loading Data");
// description: _("This should only take a moment");
// child:
// Spinner {
// spinning: true;
// }
// ;
// }
Box content_box {
orientation: vertical;
Box label_box {

View File

@@ -68,6 +68,7 @@ class DataSubpage(Gtk.Stack):
if self.sort_mode == "size":
self.flow_box.invalidate_sort()
self.set_visible_child(self.content_box)
GLib.idle_add(lambda *_: self.parent_page.status_stack.set_visible_child(self.parent_page.main_view))
def trash_handler(self, trashed_box):
self.flow_box.remove(trashed_box)
@@ -164,6 +165,7 @@ class DataSubpage(Gtk.Stack):
self.set_visible_child(self.no_data)
elif self.sort_mode != "size":
self.set_visible_child(self.content_box)
self.parent_page.status_stack.set_visible_child(self.parent_page.main_view)
def filter_func(self, box):
search_text = self.parent_page.search_entry.get_text().lower()
@@ -205,7 +207,6 @@ class DataSubpage(Gtk.Stack):
# Extra Object Creation
self.main_window = main_window
self.parent_page = parent_page
self.loading_data = LoadingStatus(_("Loading User Data"), _("This should only take a moment"))
# self.is_active = is_active
self.sort_mode = ""
self.sort_ascend = False
@@ -221,7 +222,6 @@ class DataSubpage(Gtk.Stack):
self.settings = Gio.Settings.new("io.github.flattool.Warehouse.data_page")
# Apply
self.add_child(self.loading_data)
self.flow_box.set_sort_func(self.sort_func)
self.flow_box.set_filter_func(self.filter_func)

View File

@@ -18,94 +18,103 @@ template $UserDataPage : Adw.BreakpointBin {
Adw.NavigationPage {
title: _("User Data");
Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {
title-widget:
Adw.ViewSwitcher {
stack: stack;
policy: wide;
}
;
[start]
$SidebarButton {}
[start]
ToggleButton search_button {
icon-name: "system-search-symbolic";
tooltip-text: _("Search User Data");
}
[start]
Button open_button {
icon-name: "folder-open-symbolic";
tooltip-text: _("Open User Data Folder");
}
[end]
MenuButton sort_button {
popover: sort_pop;
icon-name: "vertical-arrows-long-symbolic";
tooltip-text: _("Sort User Data");
}
[end]
ToggleButton select_button {
icon-name: "selection-mode-symbolic";
tooltip-text: _("Select User Data");
Stack status_stack {
Adw.ToolbarView loading_view {
[top]
Adw.HeaderBar {
[start]
$SidebarButton {}
}
}
[top]
Adw.Clamp {
SearchBar search_bar {
search-mode-enabled: bind search_button.active bidirectional;
SearchEntry search_entry {
editable: false;
Adw.ToolbarView main_view {
[top]
Adw.HeaderBar header_bar {
title-widget:
Adw.ViewSwitcher {
stack: stack;
policy: wide;
}
;
[start]
$SidebarButton {}
[start]
ToggleButton search_button {
icon-name: "system-search-symbolic";
tooltip-text: _("Search User Data");
}
[start]
Button open_button {
icon-name: "folder-open-symbolic";
tooltip-text: _("Open User Data Folder");
}
[end]
MenuButton sort_button {
popover: sort_pop;
icon-name: "vertical-arrows-long-symbolic";
tooltip-text: _("Sort User Data");
}
[end]
ToggleButton select_button {
icon-name: "selection-mode-symbolic";
tooltip-text: _("Select User Data");
}
}
[top]
Adw.Clamp {
SearchBar search_bar {
search-mode-enabled: bind search_button.active bidirectional;
SearchEntry search_entry {
editable: false;
hexpand: true;
placeholder-text: _("Search User Data");
}
}
}
[bottom]
Revealer revealer {
reveal-child: bind select_button.active;
transition-type: slide_up;
[center]
Box bottom_bar {
styles ["toolbar"]
hexpand: true;
placeholder-text: _("Search User Data");
}
}
}
[bottom]
Revealer 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;
homogeneous: true;
Button select_all_button {
styles ["raised"]
Adw.ButtonContent {
icon-name: "selection-mode-symbolic";
label: _("Select All");
can-shrink: true;
}
}
}
Button copy_button {
sensitive: false;
styles ["raised"]
Adw.ButtonContent {
icon-name: "edit-copy-symbolic";
label: _("Copy");
can-shrink: true;
Button copy_button {
sensitive: false;
styles ["raised"]
Adw.ButtonContent {
icon-name: "edit-copy-symbolic";
label: _("Copy");
can-shrink: true;
}
}
}
Button trash_button {
sensitive: false;
styles ["raised"]
Adw.ButtonContent {
icon-name: "user-trash-symbolic";
label: _("Move to Trash");
can-shrink: true;
Button trash_button {
sensitive: false;
styles ["raised"]
Adw.ButtonContent {
icon-name: "user-trash-symbolic";
label: _("Move to Trash");
can-shrink: true;
}
}
}
}
}
[bottom]
Adw.ViewSwitcherBar switcher_bar {
stack: stack;
visible: false;
}
Adw.ToastOverlay toast_overlay {
Adw.ViewStack stack {
[bottom]
Adw.ViewSwitcherBar switcher_bar {
stack: stack;
visible: false;
}
Adw.ToastOverlay toast_overlay {
Adw.ViewStack stack {
}
}
}
}

View File

@@ -4,15 +4,18 @@ from .data_box import DataBox
from .data_subpage import DataSubpage
from .host_info import HostInfo
from .sidebar_button import SidebarButton
from .loading_status import LoadingStatus
import os, subprocess
import time
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/user_data_page/user_data_page.ui")
class UserDataPage(Adw.BreakpointBin):
__gtype_name__ = 'UserDataPage'
gtc = Gtk.Template.Child
bpt = gtc()
status_stack = gtc()
loading_view = gtc()
main_view = gtc()
header_bar = gtc()
switcher_bar = gtc()
search_button = gtc()
@@ -59,23 +62,18 @@ class UserDataPage(Adw.BreakpointBin):
self.leftover_data.append(folder)
def start_loading(self, *args):
self.header_bar.set_sensitive(False)
self.status_stack.set_visible_child(self.loading_view)
self.search_button.set_active(False)
self.search_entry.set_editable(False)
self.select_button.set_active(False)
self.adp.set_visible_child(self.adp.loading_data)
self.adp.size_label.set_label("Loading Size")
self.adp.size_label.set_label(_("Loading Size"))
self.adp.spinner.set_visible(True)
self.ldp.set_visible_child(self.ldp.loading_data)
self.ldp.size_label.set_label("Loading Size")
self.ldp.size_label.set_label(_("Loading Size"))
self.ldp.spinner.set_visible(True)
def end_loading(self, *args):
def callback(*args):
self.adp.generate_list(self.data_flatpaks, self.active_data)
self.ldp.generate_list([], self.leftover_data)
self.header_bar.set_sensitive(True)
self.search_entry.set_editable(True)
Gio.Task.new(None, None, callback).run_in_thread(self.sort_data)
@@ -247,5 +245,6 @@ class UserDataPage(Adw.BreakpointBin):
self.bpt.connect("unapply", self.breakpoint_handler, False)
# Apply again
self.loading_view.set_content(LoadingStatus(_("Loading User Data"), _("This should only take a moment")))
self.search_bar.set_key_capture_widget(main_window)
self.load_sort_settings()