mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[feature] new custom action to open the system backup tool
This commit is contained in:
@@ -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.
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/vinifmor/bauh/staging/pictures/releases/0.9.5/backup_action.png">
|
||||
</p>
|
||||
|
||||
### Improvements
|
||||
- Arch
|
||||
|
||||
@@ -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]):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
|
||||
BIN
pictures/releases/0.9.5/backup_action.png
Normal file
BIN
pictures/releases/0.9.5/backup_action.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Reference in New Issue
Block a user