Sync current work

This commit is contained in:
heliguy
2024-07-07 15:37:32 -04:00
parent ad7a7473b0
commit a5558ec978
11 changed files with 75 additions and 26 deletions

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 8.03125 2.984375 c -2.761719 0 -5 2.238281 -5 5 s 2.238281 5 5 5 s 5 -2.238281 5 -5 s -2.238281 -5 -5 -5 z m -3.03125 4.003906 h 6 c 0.554688 0 1 0.445313 1 1 c 0 0.554688 -0.445312 1 -1 1 h -6 c -0.554688 0 -1 -0.445312 -1 -1 c 0 -0.554687 0.445312 -1 1 -1 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 427 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 8 1 c -2.199219 0 -4 1.800781 -4 4 v 2 c -1.109375 0 -2 0.890625 -2 2 v 5 c 0 0.554688 0.445312 1 1 1 h 10 c 0.554688 0 1 -0.445312 1 -1 v -5 c 0 -1.109375 -0.890625 -2 -2 -2 v -2 c 0 -2.199219 -1.800781 -4 -4 -4 z m 0 2 c 1.125 0 2 0.875 2 2 v 2 h -4 v -2 c 0 -1.125 0.875 -2 2 -2 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 451 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 9 10 h -2 v 2 l 1 1 l 1 -1 z m 0 0"/><path d="m 10.707031 3.292969 c -0.1875 -0.1875 -0.441406 -0.292969 -0.707031 -0.292969 h -4 c -0.554688 0 -1 0.449219 -1 1 s 0.445312 1 1 1 h 4 c 0.550781 0 1 -0.449219 1 -1 c 0 -0.265625 -0.105469 -0.519531 -0.292969 -0.707031 z m 0 0"/><path d="m 4 8.988281 c 0 -2.207031 1.792969 -4 4 -4 s 4 1.792969 4 4 z m 0 0"/><path d="m 6 2.972656 l 0.222656 4.773438 h 3.585938 l 0.191406 -4.738282 z m 0 0"/></g></svg>

After

Width:  |  Height:  |  Size: 606 B

View File

@@ -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',

View File

@@ -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;
}
;
}

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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)

View File

@@ -40,5 +40,8 @@
<file preprocess="xml-stripblanks" alias="arrow-pointing-at-line-down-symbolic.svg">../data/icons/arrow-pointing-at-line-down-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="loupe-large-symbolic.svg">../data/icons/loupe-large-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="folder-open-symbolic.svg">../data/icons/folder-open-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="padlock2-symbolic.svg">../data/icons/padlock2-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="pin-small-symbolic.svg">../data/icons/pin-small-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="error-small-symbolic.svg">../data/icons/error-small-symbolic.svg</file>
</gresource>
</gresources>

View File

@@ -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;

View File

@@ -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