mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
update refactoring
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user