From 8dde8e442a224f96f327c5471ffcdbef8b6e5b1b Mon Sep 17 00:00:00 2001 From: heliguy Date: Fri, 24 Nov 2023 01:22:09 -0500 Subject: [PATCH] Sync current work --- src/app_row_widget.py | 5 ++++- src/common.py | 2 +- src/downgrade_window.py | 3 +-- src/properties_window.py | 2 +- src/window.py | 8 ++------ 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app_row_widget.py b/src/app_row_widget.py index e07ad6b..77f5286 100644 --- a/src/app_row_widget.py +++ b/src/app_row_widget.py @@ -22,6 +22,9 @@ class AppRow(Adw.ActionRow): self.set_visible(is_visible) self.set_selectable(False) + def set_masked(self, is_masked): + self.mask_label.set_visible(is_masked) + def __init__(self, parent_window, host_flatpaks, index, **kwargs): super().__init__(**kwargs) self.my_utils = myUtils(parent_window) @@ -112,7 +115,7 @@ class AppRow(Adw.ActionRow): run_item = Gio.MenuItem.new(_("Open"), f"win.run{index}") row_menu_model.append_item(run_item) - parent_window.create_action(("uninstall" + str(index)), lambda *_, index=index: parent_window.uninstallButtonHandler(self, index)) + parent_window.create_action(("uninstall" + str(index)), lambda *_: parent_window.uninstallButtonHandler(self, self.app_name, self.app_ref, self.app_id)) uninstall_item = Gio.MenuItem.new(_("Uninstall"), f"win.uninstall{index}") row_menu_model.append_item(uninstall_item) diff --git a/src/common.py b/src/common.py index 4331959..cdb1749 100644 --- a/src/common.py +++ b/src/common.py @@ -189,7 +189,7 @@ class myUtils: def uninstallFlatpak(self, ref_arr, type_arr, should_trash, progress_bar=None): self.uninstall_success = True - + print(ref_arr) to_uninstall = [] for i in range(len(ref_arr)): to_uninstall.append([ref_arr[i], type_arr[i]]) diff --git a/src/downgrade_window.py b/src/downgrade_window.py index 37f5c3a..dde2526 100644 --- a/src/downgrade_window.py +++ b/src/downgrade_window.py @@ -105,8 +105,7 @@ class DowngradeWindow(Adw.Window): if self.my_utils.maskFlatpak(self.app_id, self.install_type) != 0: self.parent_window.toast_overlay.add_toast(Adw.Toast.new(_("Could not disable updates for {}").format(self.app_name))) - self.parent_window.flatpaks_list_box.remove(self.parent_window.flatpaks_list_box.get_row_at_index(self.index)) - self.parent_window.create_row(self.index) + self.parent_window.refresh_list_of_flatpaks(self, False) self.close() def downgradeThread(self): diff --git a/src/properties_window.py b/src/properties_window.py index b9f42a1..92a285c 100644 --- a/src/properties_window.py +++ b/src/properties_window.py @@ -109,7 +109,7 @@ class PropertiesWindow(Adw.Window): PropertiesWindow(i, self.host_flatpaks, self.parent_window) def trashDataHandler(self): - def onResponse(response, *args): + def onResponse(_none, response, widget): if response == "cancel": return diff --git a/src/window.py b/src/window.py index fc5cf34..dd650a6 100644 --- a/src/window.py +++ b/src/window.py @@ -107,6 +107,7 @@ class WarehouseWindow(Adw.ApplicationWindow): self.uninstallButtonsEnable(True) self.main_stack.set_visible_child(self.main_box) if self.my_utils.uninstall_success: + self.refresh_list_of_flatpaks(self, False) self.toast_overlay.add_toast(Adw.Toast.new(_("Uninstalled successfully"))) else: self.toast_overlay.add_toast(Adw.Toast.new(_("Could not uninstall some apps"))) @@ -199,16 +200,11 @@ class WarehouseWindow(Adw.ApplicationWindow): dialog.set_response_appearance("continue", Adw.ResponseAppearance.DESTRUCTIVE) Gtk.Window.present(dialog) - def uninstallButtonHandler(self, _widget, index): + def uninstallButtonHandler(self, widget, name, ref, id): if self.currently_uninstalling: self.toast_overlay.add_toast(Adw.Toast.new(_("Cannot uninstall while already uninstalling"))) return - name = self.host_flatpaks[index][0] - ref = self.host_flatpaks[index][8] - id = self.host_flatpaks[index][2] - self.flatpak_rows[index][1] = True - def uninstallResponse(_idk, response_id, _widget): if response_id == "cancel": return 1