mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 16:24:16 +02:00
fix: install / uninstall notification
This commit is contained in:
@@ -93,7 +93,7 @@ class RefreshApps(QThread):
|
|||||||
|
|
||||||
|
|
||||||
class UninstallApp(AsyncAction):
|
class UninstallApp(AsyncAction):
|
||||||
signal_finished = pyqtSignal(bool)
|
signal_finished = pyqtSignal(ApplicationView)
|
||||||
signal_output = pyqtSignal(str)
|
signal_output = pyqtSignal(str)
|
||||||
|
|
||||||
def __init__(self, manager: ApplicationManager, icon_cache: Cache, app: ApplicationView = None):
|
def __init__(self, manager: ApplicationManager, icon_cache: Cache, app: ApplicationView = None):
|
||||||
@@ -112,7 +112,7 @@ class UninstallApp(AsyncAction):
|
|||||||
self.icon_cache.delete(self.app.model.base_data.icon_url)
|
self.icon_cache.delete(self.app.model.base_data.icon_url)
|
||||||
self.manager.clean_cache_for(self.app.model)
|
self.manager.clean_cache_for(self.app.model)
|
||||||
|
|
||||||
self.signal_finished.emit(success)
|
self.signal_finished.emit(self.app if success else None)
|
||||||
self.app = None
|
self.app = None
|
||||||
self.root_password = None
|
self.root_password = None
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ class SearchApps(QThread):
|
|||||||
|
|
||||||
class InstallApp(AsyncAction):
|
class InstallApp(AsyncAction):
|
||||||
|
|
||||||
signal_finished = pyqtSignal(bool)
|
signal_finished = pyqtSignal(ApplicationView)
|
||||||
signal_output = pyqtSignal(str)
|
signal_output = pyqtSignal(str)
|
||||||
|
|
||||||
def __init__(self, manager: ApplicationManager, disk_cache: bool, icon_cache: Cache, locale_keys: dict, app: ApplicationView = None):
|
def __init__(self, manager: ApplicationManager, disk_cache: bool, icon_cache: Cache, locale_keys: dict, app: ApplicationView = None):
|
||||||
@@ -238,8 +238,8 @@ class InstallApp(AsyncAction):
|
|||||||
success = False
|
success = False
|
||||||
self.signal_output.emit(self.locale_keys['internet.required'])
|
self.signal_output.emit(self.locale_keys['internet.required'])
|
||||||
finally:
|
finally:
|
||||||
|
self.signal_finished.emit(self.app if success else None)
|
||||||
self.app = None
|
self.app = None
|
||||||
self.signal_finished.emit(success)
|
|
||||||
|
|
||||||
|
|
||||||
class AnimateProgress(QThread):
|
class AnimateProgress(QThread):
|
||||||
|
|||||||
@@ -303,18 +303,16 @@ class ManageWindow(QWidget):
|
|||||||
self.thread_refresh_app.root_password = pwd
|
self.thread_refresh_app.root_password = pwd
|
||||||
self.thread_refresh_app.start()
|
self.thread_refresh_app.start()
|
||||||
|
|
||||||
def _finish_uninstall(self, success: bool):
|
def _finish_uninstall(self, app: ApplicationView):
|
||||||
self.finish_action()
|
self.finish_action()
|
||||||
|
|
||||||
if success:
|
if app:
|
||||||
if self._can_notify_user():
|
if self._can_notify_user():
|
||||||
app = self.table_apps.get_selected_app()
|
|
||||||
system.notify_user('{} ({}) {}'.format(app.model.base_data.name, app.model.get_type(), self.locale_keys['uninstalled']))
|
system.notify_user('{} ({}) {}'.format(app.model.base_data.name, app.model.get_type(), self.locale_keys['uninstalled']))
|
||||||
|
|
||||||
self.refresh_apps()
|
self.refresh_apps()
|
||||||
else:
|
else:
|
||||||
if self._can_notify_user():
|
if self._can_notify_user():
|
||||||
app = self.table_apps.get_selected_app()
|
|
||||||
system.notify_user('{}: {}'.format(app.model.base_data.name, self.locale_keys['notification.uninstall.failed']))
|
system.notify_user('{}: {}'.format(app.model.base_data.name, self.locale_keys['notification.uninstall.failed']))
|
||||||
|
|
||||||
self.checkbox_console.setChecked(True)
|
self.checkbox_console.setChecked(True)
|
||||||
@@ -637,19 +635,17 @@ class ManageWindow(QWidget):
|
|||||||
self.thread_install.root_password = pwd
|
self.thread_install.root_password = pwd
|
||||||
self.thread_install.start()
|
self.thread_install.start()
|
||||||
|
|
||||||
def _finish_install(self, success: bool):
|
def _finish_install(self, app: ApplicationView):
|
||||||
self.input_search.setText('')
|
self.input_search.setText('')
|
||||||
self.finish_action()
|
self.finish_action()
|
||||||
|
|
||||||
if success:
|
if app:
|
||||||
if self._can_notify_user():
|
if self._can_notify_user():
|
||||||
app = self.table_apps.get_selected_app()
|
|
||||||
system.notify_user('{} ({}) {}'.format(app.model.base_data.name, app.model.get_type(), self.locale_keys['installed']))
|
system.notify_user('{} ({}) {}'.format(app.model.base_data.name, app.model.get_type(), self.locale_keys['installed']))
|
||||||
|
|
||||||
self.refresh_apps()
|
self.refresh_apps()
|
||||||
else:
|
else:
|
||||||
if self._can_notify_user():
|
if self._can_notify_user():
|
||||||
app = self.table_apps.get_selected_app()
|
|
||||||
system.notify_user('{}: {}'.format(app.model.base_data.name, self.locale_keys['notification.install.failed']))
|
system.notify_user('{}: {}'.format(app.model.base_data.name, self.locale_keys['notification.install.failed']))
|
||||||
|
|
||||||
self.checkbox_console.setChecked(True)
|
self.checkbox_console.setChecked(True)
|
||||||
|
|||||||
Reference in New Issue
Block a user