[ui][improvement] refreshing custom actions after installing/uninstalling/downgrading/upgrading packages

This commit is contained in:
Vinicius Moreira
2020-06-05 18:57:54 -03:00
parent d3d40c85b6
commit 763d7cf51a
11 changed files with 29 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- UI - UI
- not limiting the name filter size - not limiting the name filter size
- rendering package icons with no full paths declared - rendering package icons with no full paths declared
- refreshing custom actions (**+**) after installing/uninstalling/downgrading/upgrading packages
- minor improvements - minor improvements
- download clients parameters - download clients parameters

View File

@@ -12,7 +12,7 @@ from bauh.api.abstract.disk import DiskCacheLoader
from bauh.api.abstract.handler import ProcessWatcher, TaskManager from bauh.api.abstract.handler import ProcessWatcher, TaskManager
from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \ from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \
CustomSoftwareAction CustomSoftwareAction
from bauh.api.abstract.view import ViewComponent, TabGroupComponent from bauh.api.abstract.view import ViewComponent, TabGroupComponent, MessageType
from bauh.api.exception import NoInternetException from bauh.api.exception import NoInternetException
from bauh.commons import internet from bauh.commons import internet
from bauh.commons.html import bold from bauh.commons.html import bold
@@ -80,11 +80,20 @@ class GenericSoftwareManager(SoftwareManager):
self.working_managers.clear() self.working_managers.clear()
def launch_timeshift(self, root_password: str, watcher: ProcessWatcher): def launch_timeshift(self, root_password: str, watcher: ProcessWatcher):
try: if self._is_timeshift_launcher_available():
Popen(['timeshift-launcher'], stderr=STDOUT) try:
return True Popen(['timeshift-launcher'], stderr=STDOUT)
except: return True
traceback.print_exc() except:
traceback.print_exc()
watcher.show_message(title=self.i18n["error"].capitalize(),
body=self.i18n['action.backups.tool_error'].format(bold('Timeshift')),
type_=MessageType.ERROR)
return False
else:
watcher.show_message(title=self.i18n["error"].capitalize(),
body=self.i18n['action.backups.tool_error'].format(bold('Timeshift')),
type_=MessageType.ERROR)
return False return False
def _sort(self, apps: List[SoftwarePackage], word: str) -> List[SoftwarePackage]: def _sort(self, apps: List[SoftwarePackage], word: str) -> List[SoftwarePackage]:

View File

@@ -653,6 +653,7 @@ class ManageWindow(QWidget):
self.recent_uninstall = True self.recent_uninstall = True
self.refresh_packages(pkg_types={pkgv.model.__class__} if only_pkg_type else None) self.refresh_packages(pkg_types={pkgv.model.__class__} if only_pkg_type else None)
self.update_custom_actions()
notify_tray() notify_tray()
else: else:
@@ -672,7 +673,7 @@ class ManageWindow(QWidget):
util.notify_user('{} {}'.format(res['app'], self.i18n['downgraded'])) util.notify_user('{} {}'.format(res['app'], self.i18n['downgraded']))
self.refresh_packages(pkg_types={res['app'].model.__class__} if len(self.pkgs) > 1 else None) self.refresh_packages(pkg_types={res['app'].model.__class__} if len(self.pkgs) > 1 else None)
self.update_custom_actions()
notify_tray() notify_tray()
else: else:
if self._can_notify_user(): if self._can_notify_user():
@@ -964,6 +965,8 @@ class ManageWindow(QWidget):
self.ref_bt_upgrade.setVisible(True) self.ref_bt_upgrade.setVisible(True)
self.checkbox_console.setChecked(True) self.checkbox_console.setChecked(True)
self.update_custom_actions()
def _update_action_output(self, output: str): def _update_action_output(self, output: str):
self.textarea_output.appendPlainText(output) self.textarea_output.appendPlainText(output)
@@ -1195,6 +1198,7 @@ class ManageWindow(QWidget):
self._finish_refresh_apps({'installed': [res['pkg'].model], 'total': 1, 'types': None}) self._finish_refresh_apps({'installed': [res['pkg'].model], 'total': 1, 'types': None})
self.ref_bt_installed.setVisible(False) self.ref_bt_installed.setVisible(False)
self.ref_checkbox_only_apps.setVisible(False) self.ref_checkbox_only_apps.setVisible(False)
self.update_custom_actions()
else: else:
if self._can_notify_user(): if self._can_notify_user():
util.notify_user('{}: {}'.format(res['pkg'].model.name, self.i18n['notification.install.failed'])) util.notify_user('{}: {}'.format(res['pkg'].model.name, self.i18n['notification.install.failed']))

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Generating a new system backup
action.backup.substatus.delete=Removing old system backups action.backup.substatus.delete=Removing old system backups
action.backups=Backups action.backups=Backups
action.backups.status=Opening backups tool action.backups.status=Opening backups tool
action.backups.tool_error=It was not possible to open the backups tool ({}).
action.cancelled=lusuari ha cancel·lat loperació action.cancelled=lusuari ha cancel·lat loperació
action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim=Optimizing disc ( TRIM )
action.disk_trim.error=There was a problem while optimizing the disk action.disk_trim.error=There was a problem while optimizing the disk

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Generating a new system backup
action.backup.substatus.delete=Removing old system backups action.backup.substatus.delete=Removing old system backups
action.backups=Backups action.backups=Backups
action.backups.status=Opening backups tool action.backups.status=Opening backups tool
action.backups.tool_error=It was not possible to open the backups tool ({}).
action.cancelled=Aktion vom Nutzer abgebrochen action.cancelled=Aktion vom Nutzer abgebrochen
action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim=Optimizing disc ( TRIM )
action.disk_trim.error=There was a problem while optimizing the disk action.disk_trim.error=There was a problem while optimizing the disk

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Generating a new system backup
action.backup.substatus.delete=Removing old system backups action.backup.substatus.delete=Removing old system backups
action.backups=Backups action.backups=Backups
action.backups.status=Opening backups tool action.backups.status=Opening backups tool
action.backups.tool_error=It was not possible to open the backups tool ({}).
action.cancelled=operation cancelled by the user action.cancelled=operation cancelled by the user
action.disk_trim.error=There was a problem while optimizing the disk action.disk_trim.error=There was a problem while optimizing the disk
action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim=Optimizing disc ( TRIM )

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Generando una nueva copia de seguridad
action.backup.substatus.delete=Eliminando copias de seguridad antiguas action.backup.substatus.delete=Eliminando copias de seguridad antiguas
action.backups=Copias de seguridad action.backups=Copias de seguridad
action.backups.status=Abriendo herramienta de copias de seguridad action.backups.status=Abriendo herramienta de copias de seguridad
action.backups.tool_error=No fue posible abrir la herramienta de copias de seguridad ({}).
action.cancelled=operación cancelada por el usuario action.cancelled=operación cancelada por el usuario
action.disk_trim=Optimizando el disco ( TRIM ) action.disk_trim=Optimizando el disco ( TRIM )
action.disk_trim.error=Hubo un problema al optimizar el disco action.disk_trim.error=Hubo un problema al optimizar el disco

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Generating a new system backup
action.backup.substatus.delete=Removing old system backups action.backup.substatus.delete=Removing old system backups
action.backups=Backups action.backups=Backups
action.backups.status=Opening backups tool action.backups.status=Opening backups tool
action.backups.tool_error=It was not possible to open the backups tool ({}).
action.cancelled=operazione annullata dall'utente action.cancelled=operazione annullata dall'utente
action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim=Optimizing disc ( TRIM )
action.disk_trim.error=There was a problem while optimizing the disk action.disk_trim.error=There was a problem while optimizing the disk

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Gerando uma nova cópia de segurança
action.backup.substatus.delete=Removendo cópias de segurança antigas action.backup.substatus.delete=Removendo cópias de segurança antigas
action.backups=Cópias de segurança action.backups=Cópias de segurança
action.backups.status=Abrindo ferramenta de cópias de segurança action.backups.status=Abrindo ferramenta de cópias de segurança
action.backups.tool_error=Não foi possível abrir a ferramenta para backups ({}).
action.cancelled=operação cancelada pelo usuário action.cancelled=operação cancelada pelo usuário
action.disk_trim.error=Ocorreu um problema ao otimizar o disco action.disk_trim.error=Ocorreu um problema ao otimizar o disco
action.disk_trim=Otimizando disco ( TRIM ) action.disk_trim=Otimizando disco ( TRIM )

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Generating a new system backup
action.backup.substatus.delete=Removing old system backups action.backup.substatus.delete=Removing old system backups
action.backups=Backups action.backups=Backups
action.backups.status=Opening backups tool action.backups.status=Opening backups tool
action.backups.tool_error=It was not possible to open the backups tool ({}).
action.cancelled=Операция отменена пользователем action.cancelled=Операция отменена пользователем
action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim=Optimizing disc ( TRIM )
action.disk_trim.error=There was a problem while optimizing the disk action.disk_trim.error=There was a problem while optimizing the disk

View File

@@ -53,6 +53,7 @@ action.backup.substatus.create=Yeni bir sistem yedeklemesi oluştur
action.backup.substatus.delete=Eski sistem yedeklemelerini kaldır action.backup.substatus.delete=Eski sistem yedeklemelerini kaldır
action.backups=Backups action.backups=Backups
action.backups.status=Opening backups tool action.backups.status=Opening backups tool
action.backups.timeshift_not_installed=It was not possible to open the backups tool ({}).
action.cancelled=işlem kullanıcı tarafından iptal edildi action.cancelled=işlem kullanıcı tarafından iptal edildi
action.disk_trim.error=Diski optimize ederken bir sorun oluştu action.disk_trim.error=Diski optimize ederken bir sorun oluştu
action.disk_trim=Diski optimize etme ( TRIM ) action.disk_trim=Diski optimize etme ( TRIM )