mirror of
https://github.com/borgbase/vorta
synced 2025-03-08 21:05:56 +00:00
Disable compact button for older borg versions. By @diivi (#1727)
This commit is contained in:
parent
c56c6700ca
commit
f76195e47d
4 changed files with 19 additions and 4 deletions
|
@ -175,6 +175,7 @@ class VortaApp(QtSingleApplication):
|
||||||
borg_compat.set_version(result['data']['version'], result['data']['path'])
|
borg_compat.set_version(result['data']['version'], result['data']['path'])
|
||||||
self.main_window.miscTab.set_borg_details(borg_compat.version, borg_compat.path)
|
self.main_window.miscTab.set_borg_details(borg_compat.version, borg_compat.path)
|
||||||
self.main_window.repoTab.toggle_available_compression()
|
self.main_window.repoTab.toggle_available_compression()
|
||||||
|
self.main_window.archiveTab.toggle_compact_button_visibility()
|
||||||
self.scheduler.reload_all_timers() # Start timer after Borg version is set.
|
self.scheduler.reload_all_timers() # Start timer after Borg version is set.
|
||||||
else:
|
else:
|
||||||
self._alert_missing_borg()
|
self._alert_missing_borg()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from vorta import config
|
from vorta import config
|
||||||
from vorta.i18n import trans_late, translate
|
from vorta.i18n import translate
|
||||||
from vorta.utils import borg_compat
|
from vorta.utils import borg_compat
|
||||||
|
|
||||||
from .borg_job import BorgJob
|
from .borg_job import BorgJob
|
||||||
|
@ -44,9 +44,7 @@ class BorgCompactJob(BorgJob):
|
||||||
ret['ok'] = False # Set back to false, so we can do our own checks here.
|
ret['ok'] = False # Set back to false, so we can do our own checks here.
|
||||||
|
|
||||||
if not borg_compat.check('COMPACT_SUBCOMMAND'):
|
if not borg_compat.check('COMPACT_SUBCOMMAND'):
|
||||||
ret['ok'] = False
|
raise Exception('The compact action needs Borg >= 1.2.0')
|
||||||
ret['message'] = trans_late('messages', 'This feature needs Borg 1.2.0 or higher.')
|
|
||||||
return ret
|
|
||||||
|
|
||||||
cmd = ['borg', '--info', '--log-json', 'compact', '--progress']
|
cmd = ['borg', '--info', '--log-json', 'compact', '--progress']
|
||||||
if borg_compat.check('V2'):
|
if borg_compat.check('V2'):
|
||||||
|
|
|
@ -35,6 +35,7 @@ from vorta.borg.umount import BorgUmountJob
|
||||||
from vorta.i18n import translate
|
from vorta.i18n import translate
|
||||||
from vorta.store.models import ArchiveModel, BackupProfileMixin
|
from vorta.store.models import ArchiveModel, BackupProfileMixin
|
||||||
from vorta.utils import (
|
from vorta.utils import (
|
||||||
|
borg_compat,
|
||||||
choose_file_dialog,
|
choose_file_dialog,
|
||||||
find_best_unit_for_sizes,
|
find_best_unit_for_sizes,
|
||||||
format_archive_name,
|
format_archive_name,
|
||||||
|
@ -83,6 +84,7 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
|
||||||
self.tooltip_dict: Dict[QWidget, str] = {}
|
self.tooltip_dict: Dict[QWidget, str] = {}
|
||||||
self.tooltip_dict[self.bDiff] = self.bDiff.toolTip()
|
self.tooltip_dict[self.bDiff] = self.bDiff.toolTip()
|
||||||
self.tooltip_dict[self.bDelete] = self.bDelete.toolTip()
|
self.tooltip_dict[self.bDelete] = self.bDelete.toolTip()
|
||||||
|
self.tooltip_dict[self.compactButton] = self.compactButton.toolTip()
|
||||||
|
|
||||||
header = self.archiveTable.horizontalHeader()
|
header = self.archiveTable.horizontalHeader()
|
||||||
header.setVisible(True)
|
header.setVisible(True)
|
||||||
|
@ -981,3 +983,16 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
|
||||||
self.populate_from_profile()
|
self.populate_from_profile()
|
||||||
else:
|
else:
|
||||||
self._toggle_all_buttons(True)
|
self._toggle_all_buttons(True)
|
||||||
|
|
||||||
|
def toggle_compact_button_visibility(self):
|
||||||
|
"""
|
||||||
|
Enable or disable the compact button depending on the Borg version.
|
||||||
|
This function runs once on startup, and everytime the profile is changed.
|
||||||
|
"""
|
||||||
|
if borg_compat.check("COMPACT_SUBCOMMAND"):
|
||||||
|
self.compactButton.setEnabled(True)
|
||||||
|
self.compactButton.setToolTip(self.tooltip_dict[self.compactButton])
|
||||||
|
else:
|
||||||
|
self.compactButton.setEnabled(False)
|
||||||
|
tooltip = self.tooltip_dict[self.compactButton]
|
||||||
|
self.compactButton.setToolTip(tooltip + " " + self.tr("(This feature needs Borg 1.2.0 or higher)"))
|
||||||
|
|
|
@ -167,6 +167,7 @@ class MainWindow(MainWindowBase, MainWindowUI):
|
||||||
SettingsModel.update({SettingsModel.str_value: self.current_profile.id}).where(
|
SettingsModel.update({SettingsModel.str_value: self.current_profile.id}).where(
|
||||||
SettingsModel.key == 'previous_profile_id'
|
SettingsModel.key == 'previous_profile_id'
|
||||||
).execute()
|
).execute()
|
||||||
|
self.archiveTab.toggle_compact_button_visibility()
|
||||||
|
|
||||||
def profile_rename_action(self):
|
def profile_rename_action(self):
|
||||||
window = EditProfileWindow(rename_existing_id=self.profileSelector.currentData())
|
window = EditProfileWindow(rename_existing_id=self.profileSelector.currentData())
|
||||||
|
|
Loading…
Add table
Reference in a new issue