mirror of
https://github.com/borgbase/vorta
synced 2024-12-22 15:57:34 +00:00
Disable Archive tab buttons during backup. By @sunny775 (#1587)
* Disable archive action buttons when running backup. * Disable archive action buttons only individually. * Fix enabling. * fixup! Fix enabling. --------- Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com> Co-authored-by: Manu <3916435+m3nu@users.noreply.github.com>
This commit is contained in:
parent
3ebb078409
commit
d0245977d2
1 changed files with 17 additions and 8 deletions
|
@ -231,8 +231,10 @@ def _toggle_all_buttons(self, enabled=True):
|
||||||
self.bList,
|
self.bList,
|
||||||
self.bPrune,
|
self.bPrune,
|
||||||
self.bDiff,
|
self.bDiff,
|
||||||
self.fArchiveActions,
|
|
||||||
self.bMountRepo,
|
self.bMountRepo,
|
||||||
|
self.bDelete,
|
||||||
|
self.compactButton,
|
||||||
|
self.fArchiveActions,
|
||||||
]:
|
]:
|
||||||
button.setEnabled(enabled)
|
button.setEnabled(enabled)
|
||||||
button.repaint()
|
button.repaint()
|
||||||
|
@ -322,17 +324,22 @@ def on_selection_change(self, selected=None, deselected=None):
|
||||||
# Toggle archive actions frame
|
# Toggle archive actions frame
|
||||||
layout: QLayout = self.fArchiveActions.layout()
|
layout: QLayout = self.fArchiveActions.layout()
|
||||||
|
|
||||||
|
# task in progress -> disable all
|
||||||
|
reason = ""
|
||||||
|
if not self.repoactions_enabled:
|
||||||
|
reason = self.tr("(borg already running)")
|
||||||
|
|
||||||
# toggle delete button
|
# toggle delete button
|
||||||
if len(indexes) > 0:
|
if self.repoactions_enabled and len(indexes) > 0:
|
||||||
self.bDelete.setEnabled(True)
|
self.bDelete.setEnabled(True)
|
||||||
self.bDelete.setToolTip(self.tooltip_dict.get(self.bDelete, ""))
|
self.bDelete.setToolTip(self.tooltip_dict.get(self.bDelete, ""))
|
||||||
else:
|
else:
|
||||||
self.bDelete.setEnabled(False)
|
self.bDelete.setEnabled(False)
|
||||||
tooltip = self.tooltip_dict[self.bDelete]
|
tooltip = self.tooltip_dict[self.bDelete]
|
||||||
self.bDelete.setToolTip(tooltip + " " + self.tr("(Select minimum one archive)"))
|
self.bDelete.setToolTip(tooltip + " " + reason or self.tr("(Select minimum one archive)"))
|
||||||
|
|
||||||
# Toggle diff button
|
# Toggle diff button
|
||||||
if len(indexes) == 2:
|
if self.repoactions_enabled and len(indexes) == 2:
|
||||||
# Enable diff button
|
# Enable diff button
|
||||||
self.bDiff.setEnabled(True)
|
self.bDiff.setEnabled(True)
|
||||||
self.bDiff.setToolTip(self.tooltip_dict.get(self.bDiff, ""))
|
self.bDiff.setToolTip(self.tooltip_dict.get(self.bDiff, ""))
|
||||||
|
@ -341,9 +348,9 @@ def on_selection_change(self, selected=None, deselected=None):
|
||||||
self.bDiff.setEnabled(False)
|
self.bDiff.setEnabled(False)
|
||||||
|
|
||||||
tooltip = self.tooltip_dict[self.bDiff]
|
tooltip = self.tooltip_dict[self.bDiff]
|
||||||
self.bDiff.setToolTip(tooltip + " " + self.tr("(Select two archives)"))
|
self.bDiff.setToolTip(tooltip + " " + reason or self.tr("(Select two archives)"))
|
||||||
|
|
||||||
if len(indexes) == 1:
|
if self.repoactions_enabled and len(indexes) == 1:
|
||||||
# Enable archive actions
|
# Enable archive actions
|
||||||
self.fArchiveActions.setEnabled(True)
|
self.fArchiveActions.setEnabled(True)
|
||||||
|
|
||||||
|
@ -354,6 +361,8 @@ def on_selection_change(self, selected=None, deselected=None):
|
||||||
# refresh bMountArchive for the selected archive
|
# refresh bMountArchive for the selected archive
|
||||||
self.bmountarchive_refresh()
|
self.bmountarchive_refresh()
|
||||||
else:
|
else:
|
||||||
|
reason = reason or self.tr("(Select exactly one archive)")
|
||||||
|
|
||||||
# too few or too many selected.
|
# too few or too many selected.
|
||||||
self.fArchiveActions.setEnabled(False)
|
self.fArchiveActions.setEnabled(False)
|
||||||
|
|
||||||
|
@ -362,12 +371,12 @@ def on_selection_change(self, selected=None, deselected=None):
|
||||||
tooltip = widget.toolTip()
|
tooltip = widget.toolTip()
|
||||||
|
|
||||||
tooltip = self.tooltip_dict.setdefault(widget, tooltip)
|
tooltip = self.tooltip_dict.setdefault(widget, tooltip)
|
||||||
widget.setToolTip(tooltip + " " + self.tr("(Select exactly one archive)"))
|
widget.setToolTip(tooltip + " " + reason)
|
||||||
|
|
||||||
# special treatment for dynamic mount/unmount button.
|
# special treatment for dynamic mount/unmount button.
|
||||||
self.bmountarchive_refresh()
|
self.bmountarchive_refresh()
|
||||||
tooltip = self.bMountArchive.toolTip()
|
tooltip = self.bMountArchive.toolTip()
|
||||||
self.bMountArchive.setToolTip(tooltip + " " + self.tr("(Select exactly one archive)"))
|
self.bMountArchive.setToolTip(tooltip + " " + reason)
|
||||||
|
|
||||||
def archive_copy(self, index=None):
|
def archive_copy(self, index=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue