From a5558ec97814cb9af514c6b6fdd22a0b0a5943a7 Mon Sep 17 00:00:00 2001 From: heliguy Date: Sun, 7 Jul 2024 15:37:32 -0400 Subject: [PATCH] Sync current work --- data/icons/error-small-symbolic.svg | 2 ++ data/icons/padlock2-symbolic.svg | 2 ++ data/icons/pin-small-symbolic.svg | 2 ++ src/host_info.py | 32 ++++++++++++------------- src/packages_page/packages_page.blp | 12 +++++++++- src/packages_page/packages_page.py | 10 +++++++- src/properties_page/properties_page.blp | 2 +- src/properties_page/properties_page.py | 6 ++--- src/warehouse.gresource.xml | 3 +++ src/widgets/app_row.blp | 22 +++++++++++++++++ src/widgets/app_row.py | 8 +++---- 11 files changed, 75 insertions(+), 26 deletions(-) create mode 100644 data/icons/error-small-symbolic.svg create mode 100644 data/icons/padlock2-symbolic.svg create mode 100644 data/icons/pin-small-symbolic.svg diff --git a/data/icons/error-small-symbolic.svg b/data/icons/error-small-symbolic.svg new file mode 100644 index 0000000..6a01fc3 --- /dev/null +++ b/data/icons/error-small-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/padlock2-symbolic.svg b/data/icons/padlock2-symbolic.svg new file mode 100644 index 0000000..d385daa --- /dev/null +++ b/data/icons/padlock2-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/pin-small-symbolic.svg b/data/icons/pin-small-symbolic.svg new file mode 100644 index 0000000..d29ea96 --- /dev/null +++ b/data/icons/pin-small-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/src/host_info.py b/src/host_info.py index f03a6b6..5e93ea4 100644 --- a/src/host_info.py +++ b/src/host_info.py @@ -140,22 +140,22 @@ class HostInfo: # Remotes def remote_info(installation): - cmd = ['flatpak-spawn', '--host', - 'flatpak', 'remotes'] - if installation == "user" or installation == "system": - cmd.append(f"--{installation}") - else: - cmd.append(f"--installation={installation}") - output = subprocess.run( - cmd, text=True, - capture_output=True, - ).stdout - lines = output.strip().split("\n") - for i in lines: - if i != "": - this.remotes.append(Remote(i.strip(), installation)) - if installation == "user" or installation == "system": - this.installations.append(installation) + # cmd = ['flatpak-spawn', '--host', + # 'flatpak', 'remotes'] + # if installation == "user" or installation == "system": + # cmd.append(f"--{installation}") + # else: + # cmd.append(f"--installation={installation}") + # output = subprocess.run( + # cmd, text=True, + # capture_output=True, + # ).stdout + # lines = output.strip().split("\n") + # for i in lines: + # if i != "": + # this.remotes.append(Remote(i.strip(), installation)) + # if installation == "user" or installation == "system": + # this.installations.append(installation) # Masks cmd = ['flatpak-spawn', '--host', diff --git a/src/packages_page/packages_page.blp b/src/packages_page/packages_page.blp index fcc9cb7..87a7ad7 100644 --- a/src/packages_page/packages_page.blp +++ b/src/packages_page/packages_page.blp @@ -58,7 +58,7 @@ template $PackagesPage : Adw.BreakpointBin { hexpand: true; } } - ScrolledWindow { + ScrolledWindow scrolled_window { ListBox packages_list_box { styles ["navigation-sidebar"] } @@ -103,4 +103,14 @@ template $PackagesPage : Adw.BreakpointBin { ; } } +} + +Adw.StatusPage refresh_status { + title: "Refreshing"; + description: "Refreshing the page lol haha"; + child: + Spinner spinner { + spinning: true; + } + ; } \ No newline at end of file diff --git a/src/packages_page/packages_page.py b/src/packages_page/packages_page.py index 4dcf9e8..b0eb4aa 100644 --- a/src/packages_page/packages_page.py +++ b/src/packages_page/packages_page.py @@ -1,4 +1,4 @@ -from gi.repository import Adw, Gtk#, GLib, Gio, Pango +from gi.repository import Adw, Gtk, GLib#, Gio, Pango from .host_info import HostInfo from .app_row import AppRow from .error_toast import ErrorToast @@ -9,12 +9,14 @@ class PackagesPage(Adw.BreakpointBin): __gtype_name__ = 'PackagesPage' gtc = Gtk.Template.Child packages_toast_overlay = gtc() + scrolled_window = gtc() sidebar_button = gtc() refresh_button = gtc() search_bar = gtc() search_entry = gtc() packages_split = gtc() packages_list_box = gtc() + refresh_status = gtc() # Referred to in the main window # It is used to determine if a new page should be made or not @@ -33,6 +35,9 @@ class PackagesPage(Adw.BreakpointBin): first_row = self.packages_list_box.get_row_at_index(0) self.packages_list_box.select_row(first_row) self.properties_page.set_properties(first_row.package) + self.scrolled_window.set_vadjustment(Gtk.Adjustment.new(0,0,0,0,0,0)) # Scroll list to top + if self.packages_toast_overlay.get_child() != self.packages_split: + self.packages_toast_overlay.set_child(self.packages_split) def row_select_handler(self, list_box, row): self.properties_page.set_properties(row.package) @@ -64,7 +69,10 @@ class PackagesPage(Adw.BreakpointBin): main_window.main_split.connect("notify::show-sidebar", lambda sidebar, *_: self.sidebar_button.set_visible(sidebar.get_collapsed() or not sidebar.get_show_sidebar())) main_window.main_split.connect("notify::collapsed", lambda sidebar, *_: self.sidebar_button.set_visible(sidebar.get_collapsed() or not sidebar.get_show_sidebar())) self.sidebar_button.connect("clicked", lambda *_: main_window.main_split.set_show_sidebar(True)) + + self.refresh_button.connect("clicked", lambda *_: self.packages_toast_overlay.set_child(self.refresh_status)) self.refresh_button.connect("clicked", lambda *_: HostInfo.get_flatpaks(callback=self.generate_list)) + self.search_entry.connect("search-changed", lambda *_: self.packages_list_box.invalidate_filter()) self.search_bar.set_key_capture_widget(main_window) self.packages_list_box.connect("row-activated", self.row_select_handler) diff --git a/src/properties_page/properties_page.blp b/src/properties_page/properties_page.blp index 4012179..fca788c 100644 --- a/src/properties_page/properties_page.blp +++ b/src/properties_page/properties_page.blp @@ -135,7 +135,7 @@ template $PropertiesPage : Adw.NavigationPage { styles ["property"] [suffix] Label mask_label { - label: _("Updates disabled"); + label: _("Updates Disabled"); styles["warning"] } Adw.SwitchRow mask_row { diff --git a/src/properties_page/properties_page.py b/src/properties_page/properties_page.py index 4e22a44..decde9b 100644 --- a/src/properties_page/properties_page.py +++ b/src/properties_page/properties_page.py @@ -1,4 +1,4 @@ -from gi.repository import Adw, Gtk#, GLib, Gio, Pango +from gi.repository import Adw, Gtk,GLib#, Gio, Pango from .error_toast import ErrorToast import subprocess, os @@ -59,9 +59,9 @@ class PropertiesPage(Adw.NavigationPage): self.description.set_label(pkg_description) if package.icon_path: - self.app_icon.set_from_file(package.icon_path) + GLib.idle_add(lambda *_: self.app_icon.set_from_file(package.icon_path)) else: - self.app_icon.set_from_icon_name("application-x-executable-symbolic") + GLib.idle_add(lambda *_: self.app_icon.set_from_icon_name("application-x-executable-symbolic")) self.pin_row.set_visible(package.is_runtime) self.open_app_button.set_visible(package.is_runtime) diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml index 25e0e68..76bd9cf 100644 --- a/src/warehouse.gresource.xml +++ b/src/warehouse.gresource.xml @@ -40,5 +40,8 @@ ../data/icons/arrow-pointing-at-line-down-symbolic.svg ../data/icons/loupe-large-symbolic.svg ../data/icons/folder-open-symbolic.svg + ../data/icons/padlock2-symbolic.svg + ../data/icons/pin-small-symbolic.svg + ../data/icons/error-small-symbolic.svg diff --git a/src/widgets/app_row.blp b/src/widgets/app_row.blp index 0f9df88..5b21f44 100644 --- a/src/widgets/app_row.blp +++ b/src/widgets/app_row.blp @@ -9,6 +9,28 @@ template $AppRow : Adw.ActionRow { icon-name: "application-x-executable-symbolic"; } [suffix] + Image eol_package_label { + icon-name: "error-small-symbolic"; + tooltip-text: _("This package is End Of Life, and will not recieve any security updates"); + styles["error"] + } + [suffix] + Image eol_runtime_label { + icon-name: "error-small-symbolic"; + tooltip-text: _("This app's runtime is End Of Life, and will not recieve any security updates"); + styles["error"] + } + [suffix] + Image pinned_status_icon { + icon-name: "pin-small-symbolic"; + tooltip-text: _("This runtime will never be automatically removed"); + } + [suffix] + Image masked_status_icon { + icon-name: "software-update-urgent-symbolic"; + tooltip-text: _("Updates are disabled for this package"); + } + [suffix] CheckButton check_button { styles["selection-mode"] visible: false; diff --git a/src/widgets/app_row.py b/src/widgets/app_row.py index 5456b9e..d6a27c0 100644 --- a/src/widgets/app_row.py +++ b/src/widgets/app_row.py @@ -15,10 +15,10 @@ class AppRow(Adw.ActionRow): self.package = package # Apply - self.set_title(package.info["name"]) - self.set_subtitle(package.info["id"]) + GLib.idle_add(lambda *_: self.set_title(package.info["name"])) + GLib.idle_add(lambda *_: self.set_subtitle(package.info["id"])) if package.icon_path: - self.image.set_from_file(package.icon_path) - self.image.add_css_class("icon-dropshadow") + GLib.idle_add(lambda *_: self.image.add_css_class("icon-dropshadow")) + GLib.idle_add(lambda *_: self.image.set_from_file(package.icon_path)) # Connections \ No newline at end of file