diff --git a/CHANGELOG.md b/CHANGELOG.md index de76c188..72c69645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ 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.2] 2020 +### Improvements +- Backup + - new **type** field on settings to specify the Timeshift backup mode: **RSYNC** or **BTRFS** ### UI - icons, buttons and colors changes diff --git a/README.md b/README.md index 4afc8c0b..17b1a853 100644 --- a/README.md +++ b/README.md @@ -288,7 +288,7 @@ backup: uninstall: null # defines if the backup should be performed before uninstalling a package. Allowed values: null (a dialog will be displayed asking if a snapshot should be generated), true: generates the backup without asking. false: disables the backup for this operation upgrade: null # defines if the backup should be performed before upgrading a package. Allowed values: null (a dialog will be displayed asking if a snapshot should be generated), true: generates the backup without asking. false: disables the backup for this operation downgrade: null # defines if the backup should be performed before downgrading a package. Allowed values: null (a dialog will be displayed asking if a snapshot should be generated), true: generates the backup without asking. false: disables the backup for this operation - + type: rsync # defines the Timeshift backup mode -> 'rsync' (default) or 'btrfs' ``` #### Tray icons Priority: diff --git a/bauh/view/core/config.py b/bauh/view/core/config.py index 60db6443..f6695624 100644 --- a/bauh/view/core/config.py +++ b/bauh/view/core/config.py @@ -57,7 +57,8 @@ def read_config(update_file: bool = False) -> dict: 'uninstall': None, 'downgrade': None, 'upgrade': None, - 'mode': 'incremental' + 'mode': 'incremental', + 'type': 'rsync' } } diff --git a/bauh/view/core/settings.py b/bauh/view/core/settings.py index c15fda9f..7d34c5a8 100644 --- a/bauh/view/core/settings.py +++ b/bauh/view/core/settings.py @@ -302,6 +302,7 @@ class GenericSettingsManager: core_config['backup']['enabled'] = bkp_form.get_component('enabled').get_selected() core_config['backup']['mode'] = bkp_form.get_component('mode').get_selected() + core_config['backup']['type'] = bkp_form.get_component('type').get_selected() core_config['backup']['install'] = bkp_form.get_component('install').get_selected() core_config['backup']['uninstall'] = bkp_form.get_component('uninstall').get_selected() core_config['backup']['upgrade'] = bkp_form.get_component('upgrade').get_selected() @@ -447,8 +448,14 @@ class GenericSettingsManager: ], max_width=default_width, id_='mode') + type_ = self._gen_select(label=self.i18n['type'].capitalize(), + tip=None, + value=core_config['backup']['type'], + opts=[('rsync', 'rsync', None), ('btrfs', 'btrfs', None)], + max_width=default_width, + id_='type') - sub_comps = [FormComponent([enabled_opt, mode, install_mode, uninstall_mode, upgrade_mode, downgrade_mode], spaces=False)] + sub_comps = [FormComponent([enabled_opt, mode, type_, install_mode, uninstall_mode, upgrade_mode, downgrade_mode], spaces=False)] return TabComponent(self.i18n['core.config.tab.backup'].capitalize(), PanelComponent(sub_comps), None, 'core.bkp') def _gen_select(self, label: str, tip: str, id_: str, opts: List[tuple], value: object, max_width: int, type_: SelectViewType = SelectViewType.RADIO): diff --git a/bauh/view/core/timeshift.py b/bauh/view/core/timeshift.py index d7138db1..2cb21648 100644 --- a/bauh/view/core/timeshift.py +++ b/bauh/view/core/timeshift.py @@ -9,5 +9,5 @@ def delete_all_snapshots(root_password: str) -> SimpleProcess: return SimpleProcess(['timeshift', '--delete-all', '--scripted'], root_password=root_password) -def create_snapshot(root_password: str) -> SimpleProcess: - return SimpleProcess(['timeshift', '--create', '--scripted'], root_password=root_password) +def create_snapshot(root_password: str, mode: str) -> SimpleProcess: + return SimpleProcess(['timeshift', '--create', '--scripted', '--{}'.format(mode)], root_password=root_password) diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index d87c7e29..b31c0713 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -144,7 +144,7 @@ class AsyncAction(QThread, ProcessWatcher): return False self.change_substatus('[{}] {}'.format(i18n['core.config.tab.backup'].lower(), i18n['action.backup.substatus.create'])) - created, _ = handler.handle_simple(timeshift.create_snapshot(root_pwd)) + created, _ = handler.handle_simple(timeshift.create_snapshot(root_pwd, app_config['backup']['type'])) if not created and not self.request_confirmation(title=i18n['core.config.tab.backup'], body='{}. {}'.format(i18n['action.backup.error.create'],