Add status box to versions page

This commit is contained in:
heliguy
2024-07-09 17:08:37 -04:00
parent d947a44969
commit 36148b30ad
3 changed files with 35 additions and 33 deletions

View File

@@ -8,36 +8,7 @@ template $ChangeVersionPage : Adw.NavigationPage {
Adw.HeaderBar {
}
Adw.ToastOverlay toast_overlay {
ScrolledWindow scrolled_window {
Adw.Clamp {
Box {
margin-start: 12;
margin-end: 12;
margin-top: 12;
margin-bottom: 12;
spacing: 12;
orientation: vertical;
halign: fill;
hexpand: true;
CheckButton root_group_check_button {
visible: false;
active: true;
}
Adw.PreferencesGroup mask_group {
Adw.SwitchRow mask_row {
title: _("Disable Updates");
}
}
Adw.PreferencesGroup versions_group {
title: _("Select a Release");
description: _("This will uninstalls the current release and install the chosen one instead. Note that downgrading can cause issues.");
}
}
}
}
ScrolledWindow scrolled_window {}
}
[bottom]
ActionBar action_bar {
@@ -56,4 +27,33 @@ template $ChangeVersionPage : Adw.NavigationPage {
}
}
}
}
Adw.Clamp versions_clamp {
Box {
margin-start: 12;
margin-end: 12;
margin-top: 12;
margin-bottom: 12;
spacing: 12;
orientation: vertical;
halign: fill;
hexpand: true;
CheckButton root_group_check_button {
visible: false;
active: true;
}
Adw.PreferencesGroup mask_group {
Adw.SwitchRow mask_row {
title: _("Disable Updates");
}
}
Adw.PreferencesGroup versions_group {
title: _("Select a Release");
description: _("This will uninstalls the current release and install the chosen one instead. Note that downgrading can cause issues.");
}
}
}

View File

@@ -1,6 +1,7 @@
from gi.repository import Adw, Gtk,GLib, Gio
from .error_toast import ErrorToast
from .host_info import HostInfo
from .status_box import StatusBox
import subprocess, os
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/change_version_page/change_version_page.ui")
@@ -9,6 +10,7 @@ class ChangeVersionPage(Adw.NavigationPage):
gtc = Gtk.Template.Child
toast_overlay = gtc()
scrolled_window = gtc()
versions_clamp = gtc()
root_group_check_button = gtc()
mask_group = gtc()
mask_row = gtc()
@@ -76,7 +78,7 @@ class ChangeVersionPage(Adw.NavigationPage):
if not self.failure is None:
self.toast_overlay.add_toast(ErrorToast(_("Could not get versions"), self.failure).toast)
else:
print("yay")
self.scrolled_window.set_child(self.versions_clamp)
def loader_test(self, *args):
def thread(*args):
@@ -97,7 +99,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))
# Gio.Task.new(None, None, self.get_commits_callback).run_in_thread(self.get_commits)
self.scrolled_window.set_child(StatusBox(_("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):

View File

@@ -14,7 +14,7 @@ class StatusBox(Gtk.Box):
cancel_button = gtc()
cancel_button_content = gtc()
def __init__(self, title, description, show_loading_bar=True, on_cancel=None, **kwargs):
def __init__(self, title, description, show_loading_bar=False, on_cancel=None, **kwargs):
super().__init__(**kwargs)
self.title.set_label(title)
self.description.set_label(description)