mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Make the loading pages look good
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from gi.repository import Adw, Gtk,GLib, Gio
|
||||
from .error_toast import ErrorToast
|
||||
from .host_info import HostInfo
|
||||
from .loading_status import LoadingStatus
|
||||
import subprocess, os
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/change_version_page/change_version_page.ui")
|
||||
@@ -103,7 +104,7 @@ class ChangeVersionPage(Adw.NavigationPage):
|
||||
self.set_title(_("{} Versions").format(pkg_name))
|
||||
self.mask_row.set_subtitle(_("Ensure that {} will never be updated to a newer version").format(pkg_name))
|
||||
|
||||
self.scrolled_window.set_child(Adw.StatusPage(title=_("Fetching Releases"), description=_("This could take a while")))
|
||||
self.scrolled_window.set_child(LoadingStatus(_("Fetching Releases"), _("This could take a while")))
|
||||
Gio.Task.new(None, None, self.get_commits_callback).run_in_thread(self.get_commits)
|
||||
|
||||
# for i in range(10):
|
||||
@@ -117,4 +118,4 @@ class ChangeVersionPage(Adw.NavigationPage):
|
||||
|
||||
# Connections
|
||||
self.root_group_check_button.connect("toggled", lambda *_: self.action_bar.set_revealed(True))
|
||||
self.apply_button.connect("clicked", self.loader_test)
|
||||
self.apply_button.connect("clicked", self.loader_test)
|
||||
|
||||
@@ -9,9 +9,9 @@ template $PropertiesPage : Adw.NavigationPage {
|
||||
Adw.HeaderBar {
|
||||
show-title: false;
|
||||
}
|
||||
Adw.StatusPage {
|
||||
title: _("Loading Properties");
|
||||
}
|
||||
// Adw.StatusPage {
|
||||
// title: _("Loading Properties");
|
||||
// }
|
||||
}
|
||||
Adw.ToolbarView error_tbv {
|
||||
[top]
|
||||
@@ -348,4 +348,4 @@ template $PropertiesPage : Adw.NavigationPage {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ from .error_toast import ErrorToast
|
||||
from .host_info import HostInfo
|
||||
from .change_version_page import ChangeVersionPage
|
||||
from .uninstall_dialog import UninstallDialog
|
||||
from .loading_status import LoadingStatus
|
||||
import subprocess, os
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/properties_page/properties_page.ui")
|
||||
@@ -279,7 +280,7 @@ class PropertiesPage(Adw.NavigationPage):
|
||||
"subject": self.subject_row,
|
||||
"date": self.date_row,
|
||||
}
|
||||
|
||||
self.loading_tbv.set_content(LoadingStatus(_("Loading Properties"), _("This should only take a moment")))
|
||||
self.packages_page = packages_page
|
||||
self.__class__.main_window = main_window
|
||||
|
||||
@@ -297,4 +298,4 @@ class PropertiesPage(Adw.NavigationPage):
|
||||
row = self.info_rows[key]
|
||||
if type(row) != Adw.ActionRow:
|
||||
continue
|
||||
row.connect("activated", self.copy_handler)
|
||||
row.connect("activated", self.copy_handler)
|
||||
|
||||
@@ -41,16 +41,16 @@ template $AddRemoteDialog : Adw.Dialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
Adw.StatusPage loading_page {
|
||||
title: _("Adding Remote");
|
||||
description: _("This should only take a moment");
|
||||
child:
|
||||
Spinner {
|
||||
spinning: true;
|
||||
}
|
||||
;
|
||||
}
|
||||
// Adw.StatusPage loading_page {
|
||||
// title: _("Adding Remote");
|
||||
// description: _("This should only take a moment");
|
||||
// child:
|
||||
// Spinner {
|
||||
// spinning: true;
|
||||
// }
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from gi.repository import Adw, Gtk, GLib, Gio
|
||||
from .host_info import HostInfo
|
||||
from .error_toast import ErrorToast
|
||||
from .loading_status import LoadingStatus
|
||||
import subprocess, re
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/remotes_page/add_remote_dialog.ui")
|
||||
@@ -17,7 +18,6 @@ class AddRemoteDialog(Adw.Dialog):
|
||||
name_row = gtc()
|
||||
url_row = gtc()
|
||||
installation_row = gtc()
|
||||
loading_page = gtc()
|
||||
|
||||
def on_apply(self, *args):
|
||||
self.stack.set_visible_child(self.loading_page)
|
||||
@@ -82,6 +82,7 @@ class AddRemoteDialog(Adw.Dialog):
|
||||
self.string_list = Gtk.StringList(strings=HostInfo.installations)
|
||||
self.main_window = main_window
|
||||
self.parent_page = parent_page
|
||||
self.loading_page = LoadingStatus(_("Adding Remote"), _("This should only take a moment"))
|
||||
|
||||
self.rexes = {
|
||||
self.title_row: "^(?=.*[A-Za-z0-9])[A-Za-z0-9._-]+( +[A-Za-z0-9._-]+)*$", #"^(?=.*[A-Za-z0-9])[A-Za-z0-9._-]+( [A-Za-z0-9._-]+)*$",
|
||||
@@ -93,6 +94,7 @@ class AddRemoteDialog(Adw.Dialog):
|
||||
self.url_passes = False
|
||||
|
||||
# Apply
|
||||
self.stack.add_child(self.loading_page)
|
||||
self.installation_row.set_model(self.string_list)
|
||||
if remote_info:
|
||||
self.title_row.set_text(remote_info["title"])
|
||||
@@ -112,4 +114,4 @@ class AddRemoteDialog(Adw.Dialog):
|
||||
self.apply_button.connect("clicked", self.on_apply)
|
||||
self.title_row.connect("changed", self.check_entries)
|
||||
self.name_row.connect("changed", self.check_entries)
|
||||
self.url_row.connect("changed", self.check_entries)
|
||||
self.url_row.connect("changed", self.check_entries)
|
||||
|
||||
@@ -27,15 +27,15 @@ template $RemotesPage : Adw.NavigationPage {
|
||||
}
|
||||
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 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");
|
||||
@@ -151,4 +151,4 @@ template $RemotesPage : Adw.NavigationPage {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ from .host_info import HostInfo
|
||||
from .error_toast import ErrorToast
|
||||
from .remote_row import RemoteRow
|
||||
from .add_remote_dialog import AddRemoteDialog
|
||||
from .loading_status import LoadingStatus
|
||||
import subprocess
|
||||
|
||||
class NewRemoteRow(Adw.ActionRow):
|
||||
@@ -85,7 +86,6 @@ class RemotesPage(Adw.NavigationPage):
|
||||
none_visible = gtc()
|
||||
|
||||
# Statuses
|
||||
loading_remotes = gtc()
|
||||
no_results = gtc()
|
||||
no_remotes = gtc()
|
||||
content_page = gtc()
|
||||
@@ -97,6 +97,10 @@ class RemotesPage(Adw.NavigationPage):
|
||||
page_name = "remotes"
|
||||
|
||||
def start_loading(self):
|
||||
self.search_button.set_active(False)
|
||||
self.search_button.set_sensitive(False)
|
||||
self.search_entry.set_text("")
|
||||
self.search_entry.set_editable(False)
|
||||
self.stack.set_visible_child(self.loading_remotes)
|
||||
self.total_disabled = 0
|
||||
for row in self.current_remote_rows:
|
||||
@@ -104,15 +108,6 @@ class RemotesPage(Adw.NavigationPage):
|
||||
|
||||
self.current_remote_rows.clear()
|
||||
|
||||
def none_visible_handler(self):
|
||||
any_visible = False
|
||||
for row in self.current_remote_rows:
|
||||
if row.get_visible():
|
||||
any_visible = True
|
||||
break
|
||||
|
||||
self.none_visible.set_visible(not any_visible)
|
||||
|
||||
def end_loading(self):
|
||||
show_disabled = self.show_disabled_button.get_active()
|
||||
self.show_disabled_button.set_visible(False)
|
||||
@@ -144,6 +139,15 @@ class RemotesPage(Adw.NavigationPage):
|
||||
self.search_button.set_sensitive(True)
|
||||
self.search_entry.set_editable(True)
|
||||
|
||||
def none_visible_handler(self):
|
||||
any_visible = False
|
||||
for row in self.current_remote_rows:
|
||||
if row.get_visible():
|
||||
any_visible = True
|
||||
break
|
||||
|
||||
self.none_visible.set_visible(not any_visible)
|
||||
|
||||
def filter_remote(self, row):
|
||||
self.filter_setting.set_boolean("show-apps", True)
|
||||
self.filter_setting.set_boolean("show-runtimes", True)
|
||||
@@ -260,6 +264,7 @@ 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")
|
||||
@@ -272,6 +277,7 @@ class RemotesPage(Adw.NavigationPage):
|
||||
self.show_disabled_button.connect("toggled", self.show_disabled_handler)
|
||||
|
||||
# Appply
|
||||
self.stack.add_child(self.loading_remotes)
|
||||
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))
|
||||
|
||||
@@ -53,15 +53,15 @@ template $SnapshotPage : Adw.BreakpointBin {
|
||||
}
|
||||
}
|
||||
Stack stack {
|
||||
Adw.StatusPage loading_snapshots {
|
||||
title: _("Loading Snapshot");
|
||||
description: _("This should only take a moment");
|
||||
child:
|
||||
Spinner {
|
||||
spinning: true;
|
||||
}
|
||||
;
|
||||
}
|
||||
// Adw.StatusPage loading_snapshots {
|
||||
// title: _("Loading Snapshot");
|
||||
// description: _("This should only take a moment");
|
||||
// child:
|
||||
// Spinner {
|
||||
// spinning: true;
|
||||
// }
|
||||
// ;
|
||||
// }
|
||||
Adw.StatusPage no_snapshots {
|
||||
title: _("No Snapshots Found");
|
||||
description: _("Warehouse cannot see the list of snapshots or you don't have any snapshots");
|
||||
@@ -136,4 +136,4 @@ template $SnapshotPage : Adw.BreakpointBin {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ from .error_toast import ErrorToast
|
||||
from .app_row import AppRow
|
||||
from .snapshots_list_page import SnapshotsListPage
|
||||
from .sidebar_button import SidebarButton
|
||||
from .loading_status import LoadingStatus
|
||||
import os, subprocess
|
||||
|
||||
class LeftoverSnapshotRow(Adw.ActionRow):
|
||||
@@ -37,7 +38,6 @@ class SnapshotPage(Adw.BreakpointBin):
|
||||
leftover_listbox = gtc()
|
||||
split_view = gtc()
|
||||
stack = gtc()
|
||||
loading_snapshots = gtc()
|
||||
no_snapshots = gtc()
|
||||
no_results = gtc()
|
||||
scrolled_window = gtc()
|
||||
@@ -165,6 +165,7 @@ class SnapshotPage(Adw.BreakpointBin):
|
||||
# Extra Object Creation
|
||||
self.__class__.instance = self
|
||||
self.main_window = main_window
|
||||
self.loading_snapshots = LoadingStatus(_("Loading Snapshots"), _("This should only take a moment"))
|
||||
self.active_snapshot_paks = []
|
||||
# self.active_rows = []
|
||||
self.leftover_snapshots = []
|
||||
@@ -176,4 +177,5 @@ class SnapshotPage(Adw.BreakpointBin):
|
||||
self.leftover_listbox.connect("row-activated", self.leftover_select_handler)
|
||||
|
||||
# Apply
|
||||
self.split_view.set_content(self.list_page)##
|
||||
self.stack.add_child(self.loading_snapshots)
|
||||
self.split_view.set_content(self.list_page)##
|
||||
|
||||
@@ -2,15 +2,15 @@ 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;
|
||||
}
|
||||
;
|
||||
}
|
||||
// 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 {
|
||||
|
||||
@@ -3,6 +3,7 @@ from .host_info import HostInfo
|
||||
from .error_toast import ErrorToast
|
||||
from .data_box import DataBox
|
||||
from .host_info import HostInfo
|
||||
from .loading_status import LoadingStatus
|
||||
import subprocess
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/user_data_page/data_subpage.ui")
|
||||
@@ -21,7 +22,6 @@ class DataSubpage(Gtk.Stack):
|
||||
flow_box = gtc()
|
||||
|
||||
# Statuses
|
||||
loading_data = gtc()
|
||||
content_box = gtc()
|
||||
no_data = gtc()
|
||||
no_results = gtc()
|
||||
@@ -203,6 +203,7 @@ 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
|
||||
@@ -217,6 +218,7 @@ 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)
|
||||
|
||||
@@ -231,4 +233,4 @@ class DataSubpage(Gtk.Stack):
|
||||
|
||||
# Connections
|
||||
parent_page.search_entry.connect("search-changed", self.on_invalidate)
|
||||
self.flow_box.connect("child-activated", self.box_interact_handler)
|
||||
self.flow_box.connect("child-activated", self.box_interact_handler)
|
||||
|
||||
Reference in New Issue
Block a user