uninstall refactoring

This commit is contained in:
Vinicius Moreira
2019-08-13 18:41:36 -03:00
parent cb1ac69e77
commit 83c9e3c186
2 changed files with 11 additions and 5 deletions

View File

@@ -140,11 +140,11 @@ class GenericApplicationManager(ApplicationManager):
if man:
return man.update(app, root_password)
def uninstall(self, app: Application, root_password: str) -> SystemProcess:
def uninstall(self, app: Application, root_password: str, handler: ProcessHandler) -> bool:
man = self._get_manager_for(app)
if man:
return man.uninstall(app, root_password)
return man.uninstall(app, root_password, handler)
def install(self, app: Application, root_password: str, handler: ProcessHandler) -> bool:
man = self._get_manager_for(app)

View File

@@ -95,7 +95,7 @@ class RefreshApps(QThread):
self.signal.emit(self.manager.read_installed())
class UninstallApp(AsyncAction):
class UninstallApp(AsyncAction, ProcessHandler):
signal_finished = pyqtSignal(object)
signal_output = pyqtSignal(str)
@@ -108,8 +108,7 @@ class UninstallApp(AsyncAction):
def run(self):
if self.app:
process = self.manager.uninstall(self.app.model, self.root_password)
success = self.notify_subproc_outputs(process, self.signal_output)
success = self.manager.uninstall(self.app.model, self.root_password, self)
if success:
self.icon_cache.delete(self.app.model.base_data.icon_url)
@@ -119,6 +118,13 @@ class UninstallApp(AsyncAction):
self.app = None
self.root_password = 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 DowngradeApp(AsyncAction):
signal_finished = pyqtSignal(bool)