diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c916e5..dffcd08d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.5] 2020 +### Features +- new custom action (**+**) to open the system backups (snapshots). It is just a shortcut to Timeshift. +

+ +

### Improvements - Arch diff --git a/bauh/view/core/controller.py b/bauh/view/core/controller.py index be908ca8..f89dbdca 100755 --- a/bauh/view/core/controller.py +++ b/bauh/view/core/controller.py @@ -2,6 +2,7 @@ import re import re import time import traceback +from subprocess import Popen, PIPE, STDOUT from threading import Thread from typing import List, Set, Type, Tuple, Dict @@ -15,6 +16,7 @@ from bauh.api.abstract.view import ViewComponent, TabGroupComponent from bauh.api.exception import NoInternetException from bauh.commons import internet from bauh.commons.html import bold +from bauh.commons.system import run_cmd from bauh.view.core.settings import GenericSettingsManager from bauh.view.core.update import check_for_update from bauh.view.util import resource @@ -57,12 +59,30 @@ class GenericSoftwareManager(SoftwareManager): icon_path=resource.get_path('img/logo.svg'), requires_root=False, refresh=False)] + self.dynamic_extra_actions = {CustomSoftwareAction(i18_label_key='action.backups', + i18n_status_key='action.backups.status', + manager_method='launch_timeshift', + manager=self, + icon_path='timeshift', + requires_root=False, + refresh=False): self._is_timeshift_launcher_available} + + def _is_timeshift_launcher_available(self) -> bool: + return bool(run_cmd('which timeshift-launcher', print_error=False)) def reset_cache(self): if self._available_cache is not None: self._available_cache = {} self.working_managers.clear() + def launch_timeshift(self, root_password: str, watcher: ProcessWatcher): + try: + Popen(['timeshift-launcher'], stderr=STDOUT) + return True + except: + traceback.print_exc() + return False + def _sort(self, apps: List[SoftwarePackage], word: str) -> List[SoftwarePackage]: exact_name_matches, contains_name_matches, others = [], [], [] @@ -526,7 +546,12 @@ class GenericSoftwareManager(SoftwareManager): if man_actions: actions.extend(man_actions) + for action, available in self.dynamic_extra_actions.items(): + if available(): + actions.append(action) + actions.extend(self.extra_actions) + return actions def _fill_sizes(self, man: SoftwareManager, pkgs: List[SoftwarePackage]): diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index fa19e78a..f6248ed5 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -1252,7 +1252,19 @@ class ManageWindow(QWidget): def _map_custom_action(self, action: CustomSoftwareAction) -> QAction: custom_action = QAction(self.i18n[action.i18_label_key]) - custom_action.setIcon(QIcon(action.icon_path)) + + if action.icon_path: + try: + if action.icon_path.startswith('/'): + icon = QIcon(action.icon_path) + else: + icon = QIcon.fromTheme(action.icon_path) + + custom_action.setIcon(icon) + + except: + pass + custom_action.triggered.connect(lambda: self.execute_custom_action(None, action)) return custom_action diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index 36616464..1b61a70a 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -51,6 +51,8 @@ action.backup.invalid_mode=Invalid backup mode action.backup.msg=Do you want to generate a system copy before proceeding ? action.backup.substatus.create=Generating a new system backup action.backup.substatus.delete=Removing old system backups +action.backups=Backups +action.backups.status=Opening backups tool action.cancelled=l’usuari ha cancel·lat l’operació action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim.error=There was a problem while optimizing the disk diff --git a/bauh/view/resources/locale/de b/bauh/view/resources/locale/de index 0c296604..ada44efb 100644 --- a/bauh/view/resources/locale/de +++ b/bauh/view/resources/locale/de @@ -51,6 +51,8 @@ action.backup.invalid_mode=Invalid backup mode action.backup.msg=Do you want to generate a system copy before proceeding ? action.backup.substatus.create=Generating a new system backup action.backup.substatus.delete=Removing old system backups +action.backups=Backups +action.backups.status=Opening backups tool action.cancelled=Aktion vom Nutzer abgebrochen action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim.error=There was a problem while optimizing the disk diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index aadb6c83..cb471a1e 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -51,6 +51,8 @@ action.backup.invalid_mode=Invalid backup mode action.backup.msg=Do you want to generate a system copy before proceeding ? action.backup.substatus.create=Generating a new system backup action.backup.substatus.delete=Removing old system backups +action.backups=Backups +action.backups.status=Opening backups tool action.cancelled=operation cancelled by the user action.disk_trim.error=There was a problem while optimizing the disk action.disk_trim=Optimizing disc ( TRIM ) diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index 3ce963ca..c5e4eb5e 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -51,6 +51,8 @@ action.backup.invalid_mode=Modo de copia de seguridad inválido action.backup.msg=¿Desea generar una copia de seguridad del sistema antes de continuar? action.backup.substatus.create=Generando una nueva copia de seguridad action.backup.substatus.delete=Eliminando copias de seguridad antiguas +action.backups=Copias de seguridad +action.backups.status=Abriendo herramienta de copias de seguridad action.cancelled=operación cancelada por el usuario action.disk_trim=Optimizando el disco ( TRIM ) action.disk_trim.error=Hubo un problema al optimizar el disco diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index 410da3e6..b700cc30 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -51,6 +51,8 @@ action.backup.invalid_mode=Invalid backup mode action.backup.msg=Do you want to generate a system copy before proceeding ? action.backup.substatus.create=Generating a new system backup action.backup.substatus.delete=Removing old system backups +action.backups=Backups +action.backups.status=Opening backups tool action.cancelled=operazione annullata dall'utente action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim.error=There was a problem while optimizing the disk diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index ac3a7c22..ee9c24a2 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -51,6 +51,8 @@ action.backup.invalid_mode=Modo de cópia de segurança inválido action.backup.msg=Você deseja gerar uma cópia de segurança do sistema antes de proceder ? action.backup.substatus.create=Gerando uma nova cópia de segurança action.backup.substatus.delete=Removendo cópias de segurança antigas +action.backups=Cópias de segurança +action.backups.status=Abrindo ferramenta de cópias de segurança action.cancelled=operação cancelada pelo usuário action.disk_trim.error=Ocorreu um problema ao otimizar o disco action.disk_trim=Otimizando disco ( TRIM ) diff --git a/bauh/view/resources/locale/ru b/bauh/view/resources/locale/ru index 12fb1584..d7206f4e 100644 --- a/bauh/view/resources/locale/ru +++ b/bauh/view/resources/locale/ru @@ -51,6 +51,8 @@ action.backup.invalid_mode=Invalid backup mode action.backup.msg=Do you want to generate a system copy before proceeding ? action.backup.substatus.create=Generating a new system backup action.backup.substatus.delete=Removing old system backups +action.backups=Backups +action.backups.status=Opening backups tool action.cancelled=Операция отменена пользователем action.disk_trim=Optimizing disc ( TRIM ) action.disk_trim.error=There was a problem while optimizing the disk diff --git a/bauh/view/resources/locale/tr b/bauh/view/resources/locale/tr index d75fc553..27523355 100644 --- a/bauh/view/resources/locale/tr +++ b/bauh/view/resources/locale/tr @@ -51,6 +51,8 @@ action.backup.invalid_mode=Geçersiz yedekleme modu action.backup.msg=Devam etmeden önce bir sistem kopyası oluşturmak istiyor musunuz? action.backup.substatus.create=Yeni bir sistem yedeklemesi oluştur action.backup.substatus.delete=Eski sistem yedeklemelerini kaldır +action.backups=Backups +action.backups.status=Opening backups tool action.cancelled=işlem kullanıcı tarafından iptal edildi action.disk_trim.error=Diski optimize ederken bir sorun oluştu action.disk_trim=Diski optimize etme ( TRIM ) diff --git a/pictures/releases/0.9.5/backup_action.png b/pictures/releases/0.9.5/backup_action.png new file mode 100644 index 00000000..7d54436e Binary files /dev/null and b/pictures/releases/0.9.5/backup_action.png differ