From 71aba825fa49900ef0f94d1eb771b51a6f6cee7c Mon Sep 17 00:00:00 2001 From: heliguy4599 Date: Sun, 13 Oct 2024 13:44:42 -0400 Subject: [PATCH] Update proper pages when package user data is trashed --- src/host_info.py | 2 -- src/properties_page/properties_page.py | 5 +++++ src/user_data_page/data_box.py | 4 ++++ src/user_data_page/user_data_page.py | 6 +++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/host_info.py b/src/host_info.py index e5c11a4..ad5f493 100644 --- a/src/host_info.py +++ b/src/host_info.py @@ -44,8 +44,6 @@ class Flatpak: def trash_data(self, callback=None): try: subprocess.run(['gio', 'trash', self.data_path], capture_output=True, text=True, check=True) - snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page - snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True) except subprocess.CalledProcessError as cpe: raise cpe except Exception as e: diff --git a/src/properties_page/properties_page.py b/src/properties_page/properties_page.py index ee8d076..c6d8ae7 100644 --- a/src/properties_page/properties_page.py +++ b/src/properties_page/properties_page.py @@ -168,6 +168,11 @@ class PropertiesPage(Adw.NavigationPage): self.package.trash_data() self.set_properties(self.package, refresh=True) self.toast_overlay.add_toast(Adw.Toast.new("Trashed User Data")) + snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page + snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True) + user_data_page = HostInfo.main_window.pages[HostInfo.main_window.user_data_row] + user_data_page.start_loading() + user_data_page.end_loading() except subprocess.CalledProcessError as cpe: self.toast_overlay.add_toast(ErrorToast(_("Could not trash data"), cpe.stderr).toast) except Exception as e: diff --git a/src/user_data_page/data_box.py b/src/user_data_page/data_box.py index a87ccd2..5ac8ac6 100644 --- a/src/user_data_page/data_box.py +++ b/src/user_data_page/data_box.py @@ -79,6 +79,10 @@ class DataBox(Gtk.ListBox): def thread(*args): try: subprocess.run(['gio', 'trash', self.data_path], check=True, text=True, capture_output=True) + properties_page = HostInfo.main_window.pages[HostInfo.main_window.packages_row].properties_page + properties_page.set_properties(properties_page.package, True) + snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page + snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True) except subprocess.CalledProcessError as cpe: self.failed_trash = cpe.stderr except Exception as e: diff --git a/src/user_data_page/user_data_page.py b/src/user_data_page/user_data_page.py index a97361e..1007ad2 100644 --- a/src/user_data_page/user_data_page.py +++ b/src/user_data_page/user_data_page.py @@ -163,6 +163,10 @@ class UserDataPage(Adw.BreakpointBin): cmd = ['gio', 'trash'] + path try: subprocess.run(cmd, check=True, capture_output=True, text=True) + properties_page = HostInfo.main_window.pages[HostInfo.main_window.packages_row].properties_page + properties_page.set_properties(properties_page.package, True) + snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page + snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True) except subprocess.CalledProcessError as cpe: error[0] = cpe.stderr except Exception as e: @@ -190,7 +194,7 @@ class UserDataPage(Adw.BreakpointBin): return self.select_button.set_active(False) - child.set_visible_child(child.loading_data) + self.status_stack.set_visible_child(self.loading_view) Gio.Task.new(None, None, callback).run_in_thread(lambda *_: thread(to_trash)) if len(child.selected_boxes) < 1 or self.is_trash_dialog_open: