mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Begin changing to proper loading pages
This commit is contained in:
36
src/gtk/loading_status.blp
Normal file
36
src/gtk/loading_status.blp
Normal file
@@ -0,0 +1,36 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $LoadingStatus : ScrolledWindow {
|
||||
Box {
|
||||
orientation: vertical;
|
||||
valign: center;
|
||||
halign: fill;
|
||||
spacing: 12;
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-top: 12;
|
||||
margin-bottom: 12;
|
||||
Spinner {
|
||||
height-request: 30;
|
||||
spinning: true;
|
||||
}
|
||||
Label title_label {
|
||||
label: "No Title Set";
|
||||
wrap: true;
|
||||
justify: center;
|
||||
styles ["title-1"]
|
||||
}
|
||||
Label description_label {
|
||||
label: "No Description Set";
|
||||
wrap: true;
|
||||
justify: center;
|
||||
styles ["description", "body"]
|
||||
}
|
||||
Button button {
|
||||
label: "No Label Set";
|
||||
styles ["pill"]
|
||||
halign: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
src/gtk/loading_status.py
Normal file
21
src/gtk/loading_status.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from gi.repository import Adw, Gtk, GLib, Gio
|
||||
from .host_info import HostInfo
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/gtk/loading_status.ui")
|
||||
class LoadingStatus(Gtk.ScrolledWindow):
|
||||
__gtype_name__ = 'LoadingStatus'
|
||||
gtc = Gtk.Template.Child
|
||||
|
||||
title_label = gtc()
|
||||
description_label = gtc()
|
||||
button = gtc()
|
||||
|
||||
def __init__(self, title, description, on_cancel=None, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.title_label.set_label(GLib.markup_escape_text(title))
|
||||
self.description_label.set_label(GLib.markup_escape_text(description))
|
||||
if on_cancel is None:
|
||||
self.button.set_visible(False)
|
||||
else:
|
||||
self.button.connect("clicked", on_cancel)
|
||||
@@ -6,6 +6,7 @@ blueprints = custom_target('blueprints',
|
||||
input: files(
|
||||
'packages_page/app_row.blp',
|
||||
'gtk/help-overlay.blp',
|
||||
'gtk/loading_status.blp',
|
||||
'main_window/window.blp',
|
||||
'packages_page/packages_page.blp',
|
||||
'packages_page/filters_page.blp',
|
||||
@@ -70,6 +71,7 @@ warehouse_sources = [
|
||||
'host_info.py',
|
||||
'gtk/error_toast.py',
|
||||
'gtk/sidebar_button.py',
|
||||
'gtk/loading_status.py',
|
||||
'main_window/window.py',
|
||||
'packages_page/app_row.py',
|
||||
'packages_page/uninstall_dialog.py',
|
||||
|
||||
@@ -53,29 +53,29 @@ template $PackagesPage : Adw.BreakpointBin {
|
||||
}
|
||||
}
|
||||
Stack status_stack {
|
||||
Adw.StatusPage loading_packages {
|
||||
title: _("Loading Packages");
|
||||
description: _("This should only take a moment");
|
||||
child:
|
||||
Spinner {
|
||||
spinning: true;
|
||||
}
|
||||
;
|
||||
}
|
||||
// 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 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");
|
||||
@@ -165,4 +165,4 @@ Popover copy_pop {
|
||||
halign: start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ from .properties_page import PropertiesPage
|
||||
from .filters_page import FiltersPage
|
||||
from .sidebar_button import SidebarButton
|
||||
from .uninstall_dialog import UninstallDialog
|
||||
from .loading_status import LoadingStatus
|
||||
import subprocess, os
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/packages_page/packages_page.ui")
|
||||
@@ -16,8 +17,8 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
packages_toast_overlay = gtc()
|
||||
status_stack = gtc()
|
||||
scrolled_window = gtc()
|
||||
uninstalling = gtc()
|
||||
loading_packages = gtc()
|
||||
# uninstalling = gtc()
|
||||
# loading_packages = gtc()
|
||||
no_filter_results = gtc()
|
||||
reset_filters_button = gtc()
|
||||
no_packages = gtc()
|
||||
@@ -303,6 +304,8 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
|
||||
# Extra Object Creation
|
||||
self.main_window = main_window
|
||||
self.loading_packages = LoadingStatus(_("Loading Packages"), _("This should only take a moment"))
|
||||
self.uninstalling = LoadingStatus(_("Uninstalling Packages"), _("This should only take a moment"))
|
||||
self.properties_page = PropertiesPage(main_window, self)
|
||||
self.filters_page = FiltersPage(main_window, self)
|
||||
self.filter_settings = Gio.Settings.new("io.github.flattool.Warehouse.filter")
|
||||
@@ -313,6 +316,8 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
|
||||
# Apply
|
||||
# self.set_status("loading_packages")
|
||||
self.status_stack.add_child(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)
|
||||
self.content_stack.add_child(self.properties_page)
|
||||
@@ -332,4 +337,4 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
self.select_all_button.connect("clicked", self.select_all_handler)
|
||||
|
||||
self.copy_menu.connect("row-activated", self.selection_copy)
|
||||
self.uninstall_button.connect("clicked", self.selection_uninstall)
|
||||
self.uninstall_button.connect("clicked", self.selection_uninstall)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<gresource prefix="/io/github/flattool/Warehouse">
|
||||
<file>../data/style.css</file>
|
||||
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
|
||||
<file preprocess="xml-stripblanks">gtk/loading_status.ui</file>
|
||||
<file preprocess="xml-stripblanks">packages_page/app_row.ui</file>
|
||||
<file preprocess="xml-stripblanks">main_window/window.ui</file>
|
||||
<file preprocess="xml-stripblanks">packages_page/packages_page.ui</file>
|
||||
|
||||
Reference in New Issue
Block a user