diff --git a/src/vorta/assets/UI/archivetab.ui b/src/vorta/assets/UI/archivetab.ui
index 6c206033f..9c81d49f2 100644
--- a/src/vorta/assets/UI/archivetab.ui
+++ b/src/vorta/assets/UI/archivetab.ui
@@ -219,6 +219,25 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Compare two archives
+
+
+ Diff
+
+
+ Qt::ToolButtonTextBesideIcon
+
+
+
-
@@ -276,60 +295,41 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Delete selected archive(s)
+
+
+ Delete
+
+
+ Qt::ToolButtonTextBesideIcon
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Compare two archives
-
-
- Diff
-
-
- Qt::ToolButtonTextBesideIcon
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Delete selected archive(s)
-
-
- Delete
-
-
- Qt::ToolButtonTextBesideIcon
-
-
-
diff --git a/src/vorta/views/archive_tab.py b/src/vorta/views/archive_tab.py
index a6690be28..cb4d41843 100644
--- a/src/vorta/views/archive_tab.py
+++ b/src/vorta/views/archive_tab.py
@@ -5,7 +5,7 @@
from PyQt6 import QtCore, uic
from PyQt6.QtCore import QItemSelectionModel, QMimeData, QPoint, Qt, pyqtSlot
-from PyQt6.QtGui import QAction, QDesktopServices, QKeySequence, QShortcut
+from PyQt6.QtGui import QDesktopServices, QKeySequence, QShortcut
from PyQt6.QtWidgets import (
QAbstractItemView,
QApplication,
@@ -154,7 +154,7 @@ def __init__(self, parent=None, app=None):
self.app.paletteChanged.connect(lambda p: self.set_icons())
def set_icons(self):
- "Used when changing between light- and dark mode"
+ """Used when changing between light- and dark mode"""
self.bCheck.setIcon(get_colored_icon('check-circle'))
self.bDiff.setIcon(get_colored_icon('stream-solid'))
self.bPrune.setIcon(get_colored_icon('cut'))
@@ -183,46 +183,22 @@ def archiveitem_contextmenu(self, pos: QPoint):
return # popup only for selected items
menu = QMenu(self.archiveTable)
- menu.addAction(
- get_colored_icon('copy'),
- self.tr("Copy"),
- lambda: self.archive_copy(index=index),
- )
+ menu.addAction(get_colored_icon('copy'), self.tr("Copy"), lambda: self.archive_copy(index=index))
menu.addSeparator()
# archive actions
- archive_actions = []
- archive_actions.append(
- menu.addAction(
- self.bRefreshArchive.icon(),
- self.bRefreshArchive.text(),
- self.refresh_archive_info,
- )
- )
- archive_actions.append(
- menu.addAction(
- self.bMountArchive.icon(),
- self.bMountArchive.text(),
- self.bmountarchive_clicked,
- )
- )
- archive_actions.append(menu.addAction(self.bExtract.icon(), self.bExtract.text(), self.extract_action))
- archive_actions.append(menu.addAction(self.bRename.icon(), self.bRename.text(), self.cell_double_clicked))
- # deletion possible with one but also multiple archives
- menu.addAction(self.bDelete.icon(), self.bDelete.text(), self.delete_action)
-
- if not (self.repoactions_enabled and len(selected_rows) <= 1):
- for action in archive_actions:
- action.setEnabled(False)
-
- # diff action
- menu.addSeparator()
- diff_action = QAction(self.bDiff.icon(), self.bDiff.text(), menu)
- diff_action.triggered.connect(self.diff_action)
- menu.addAction(diff_action)
-
- selected_rows = self.archiveTable.selectionModel().selectedRows(index.column())
- diff_action.setEnabled(self.repoactions_enabled and len(selected_rows) == 2)
+ button_connection_pairs = [
+ (self.bRefreshArchive, self.refresh_archive_info),
+ (self.bDiff, self.diff_action),
+ (self.bMountArchive, self.bmountarchive_clicked),
+ (self.bExtract, self.extract_action),
+ (self.bRename, self.cell_double_clicked),
+ (self.bDelete, self.delete_action),
+ ]
+
+ for button, connection in button_connection_pairs:
+ action = menu.addAction(button.icon(), button.text(), connection)
+ action.setEnabled(button.isEnabled())
menu.popup(self.archiveTable.viewport().mapToGlobal(pos))
@@ -406,7 +382,8 @@ def on_selection_change(self, selected=None, deselected=None):
for index in range(layout.count()):
widget = layout.itemAt(index).widget()
- widget.setToolTip(self.tooltip_dict.get(widget, ""))
+ if widget is not None:
+ widget.setToolTip(self.tooltip_dict.get(widget, ""))
# refresh bMountArchive for the selected archive
self.bmountarchive_refresh()