diff --git a/bauh/core/controller.py b/bauh/core/controller.py index b96e869d..bd94425f 100755 --- a/bauh/core/controller.py +++ b/bauh/core/controller.py @@ -134,11 +134,11 @@ class GenericApplicationManager(ApplicationManager): if man: return man.clean_cache_for(app) - def update(self, app: Application, root_password: str) -> SystemProcess: + def update(self, app: Application, root_password: str, handler: ProcessHandler) -> bool: man = self._get_manager_for(app) if man: - return man.update(app, root_password) + return man.update(app, root_password, handler) def uninstall(self, app: Application, root_password: str, handler: ProcessHandler) -> bool: man = self._get_manager_for(app) diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index 3b711b6e..b0891fb5 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -53,7 +53,7 @@ class AsyncAction(QThread, ProcessHandler): return proc.subproc.returncode is None or proc.subproc.returncode == 0 -class UpdateSelectedApps(AsyncAction): +class UpdateSelectedApps(AsyncAction, ProcessHandler): signal_finished = pyqtSignal(bool, int) signal_status = pyqtSignal(str) @@ -71,8 +71,7 @@ class UpdateSelectedApps(AsyncAction): for app in self.apps_to_update: self.signal_status.emit(app.model.base_data.name) - process = self.manager.update(app.model, self.root_password) - success = self.notify_subproc_outputs(process, self.signal_output) + success = self.manager.update(app.model, self.root_password, self) if not success: break @@ -82,6 +81,13 @@ class UpdateSelectedApps(AsyncAction): self.signal_finished.emit(success, len(self.apps_to_update)) self.apps_to_update = None + def handle(self, proc: SystemProcess) -> bool: + return self.notify_subproc_outputs(proc, self.signal_output) + + def notify(self, msg: str): + if msg: + self.signal_output.emit(msg) + class RefreshApps(QThread): diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 3c18096b..ff4a26aa 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -618,7 +618,7 @@ class ManageWindow(QWidget): def downgrade_app(self, app: ApplicationView): pwd = None - requires_root = self.manager.requires_root('downgrade', self.table_apps.get_selected_app().model) + requires_root = self.manager.requires_root('downgrade', app.model) if not is_root() and requires_root: pwd, ok = ask_root_password(self.locale_keys)