mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Batch install and uninstall now gives more feedback
This commit is contained in:
@@ -86,9 +86,10 @@ template $OrphansWindow: Adw.Window {
|
||||
]
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("This could take a while");
|
||||
|
||||
Label installing_status {
|
||||
label: _("");
|
||||
justify: center;
|
||||
|
||||
styles [
|
||||
"description",
|
||||
"body"
|
||||
|
||||
@@ -136,8 +136,9 @@ template $WarehouseWindow: Adw.ApplicationWindow {
|
||||
styles ["title-1", "title"]
|
||||
}
|
||||
|
||||
Label {
|
||||
label: _("This could take a while");
|
||||
Label uninstalling_status {
|
||||
label: _("");
|
||||
justify: center;
|
||||
styles ["description", "body"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ class myUtils:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def uninstall_flatpak(self, ref_arr, type_arr, should_trash, progress_bar=None):
|
||||
def uninstall_flatpak(self, ref_arr, type_arr, should_trash, progress_bar=None, status_label=None):
|
||||
self.uninstall_success = True
|
||||
print(ref_arr)
|
||||
to_uninstall = []
|
||||
@@ -275,6 +275,9 @@ class myUtils:
|
||||
apps[i][0],
|
||||
]
|
||||
try:
|
||||
print(apps)
|
||||
if status_label:
|
||||
GLib.idle_add(status_label.set_label, _("Working on {}\n{} out of {}").format(apps[i][0], i + 1, len(apps)))
|
||||
subprocess.run(
|
||||
command, capture_output=False, check=True, env=self.new_env
|
||||
)
|
||||
@@ -328,7 +331,7 @@ class myUtils:
|
||||
GLib.idle_add(progress_bar.set_visible, False)
|
||||
GLib.idle_add(progress_bar.set_fraction, 0.0)
|
||||
|
||||
def install_flatpak(self, app_arr, remote, user_or_system, progress_bar=None):
|
||||
def install_flatpak(self, app_arr, remote, user_or_system, progress_bar=None, status_label=None):
|
||||
self.install_success = True
|
||||
fails = []
|
||||
|
||||
@@ -340,6 +343,8 @@ class myUtils:
|
||||
command.append("-y")
|
||||
command.append(app_arr[i])
|
||||
try:
|
||||
if status_label:
|
||||
GLib.idle_add(status_label.set_label, _("Working on {}\n{} out of {}").format(app_arr[i], i + 1, len(app_arr)))
|
||||
subprocess.run(
|
||||
command, capture_output=False, check=True, env=self.new_env
|
||||
)
|
||||
|
||||
@@ -25,6 +25,7 @@ class OrphansWindow(Adw.Window):
|
||||
oepn_folder_button = Gtk.Template.Child()
|
||||
installing = Gtk.Template.Child()
|
||||
main_box = Gtk.Template.Child()
|
||||
installing_status = Gtk.Template.Child()
|
||||
|
||||
window_title = _("Manage Leftover Data")
|
||||
host_home = str(pathlib.Path.home())
|
||||
@@ -88,8 +89,8 @@ class OrphansWindow(Adw.Window):
|
||||
self.keep_checking = True
|
||||
task = Gio.Task.new(None, None, self.install_callback)
|
||||
task.run_in_thread(
|
||||
lambda _task, _obj, _data, _cancellable, id_list=self.selected_dirs, remote=self.selected_remote, app_type=self.selected_remote_type, progress_bar=self.progress_bar: self.my_utils.install_flatpak(
|
||||
id_list, remote, app_type, progress_bar
|
||||
lambda _task, _obj, _data, _cancellable, id_list=self.selected_dirs, remote=self.selected_remote, app_type=self.selected_remote_type, progress_bar=self.progress_bar, status_label=self.installing_status: self.my_utils.install_flatpak(
|
||||
id_list, remote, app_type, progress_bar, status_label
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class WarehouseWindow(Adw.ApplicationWindow):
|
||||
loading_flatpaks = Gtk.Template.Child()
|
||||
no_matches = Gtk.Template.Child()
|
||||
reset_filters_button = Gtk.Template.Child()
|
||||
uninstalling_status = Gtk.Template.Child()
|
||||
|
||||
main_progress_bar = Gtk.ProgressBar(visible=False, can_target=False)
|
||||
main_progress_bar.add_css_class("osd")
|
||||
@@ -115,7 +116,7 @@ class WarehouseWindow(Adw.ApplicationWindow):
|
||||
|
||||
def uninstall_flatpak_thread(self, ref_arr, id_arr, type_arr, should_trash):
|
||||
self.my_utils.uninstall_flatpak(
|
||||
ref_arr, type_arr, should_trash, self.main_progress_bar
|
||||
ref_arr, type_arr, should_trash, self.main_progress_bar, self.uninstalling_status
|
||||
)
|
||||
|
||||
def uninstall_flatpak(self, should_trash):
|
||||
|
||||
Reference in New Issue
Block a user