Merge branch 'borgbase:master' into issue1799

This commit is contained in:
Sam 2023-09-20 17:02:46 +05:30 committed by GitHub
commit 92cc9aeae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 92 deletions

View File

@ -28,7 +28,7 @@ Learn more on [Vorta's website](https://vorta.borgbase.com).
## Installation
Vorta should work on all platforms that support Qt and Borg. This includes macOS, Ubuntu, Debian, Fedora, Arch Linux and many others. Windows is currently not supported by Borg, but this may change in the future.
See our website for [download links and and install instructions](https://vorta.borgbase.com/install).
See our website for [download links and install instructions](https://vorta.borgbase.com/install).
## Connect and Contribute
- To discuss everything around using, improving, packaging and translating Vorta, join the [discussion on Github](https://github.com/borgbase/vorta/discussions).

View File

@ -219,6 +219,25 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="bDiff">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Compare two archives</string>
</property>
<property name="text">
<string>Diff</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="bMountArchive">
<property name="sizePolicy">
@ -276,60 +295,41 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="bDelete">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Delete selected archive(s)</string>
</property>
<property name="text">
<string>Delete</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="bDiff">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Compare two archives</string>
</property>
<property name="text">
<string>Diff</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="bDelete">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Delete selected archive(s)</string>
</property>
<property name="text">
<string>Delete</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -5,7 +5,7 @@ from typing import Dict, Optional
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 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
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 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
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)
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),
]
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)
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 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
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()
@ -825,6 +802,9 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
self._toggle_all_buttons(True)
def cell_double_clicked(self, row=None, column=None):
if not self.bRename.isEnabled():
return
if not row or not column:
row = self.archiveTable.currentRow()
column = self.archiveTable.currentColumn()

View File

@ -179,7 +179,10 @@ def test_refresh_archive_info(qapp, qtbot, mocker, borg_json_output, archive_env
qtbot.waitUntil(lambda: tab.mountErrors.text() == 'Refreshed archives.', **pytest._wait_defaults)
def test_archive_rename(qapp, qtbot, mocker, borg_json_output, archive_env):
def test_inline_archive_rename(qapp, qtbot, mocker, borg_json_output, archive_env):
"""
Tests the functionality of in-line renaming an archive by double-clicking its name.
"""
main, tab = archive_env
tab.archiveTable.selectRow(0)
@ -190,9 +193,12 @@ def test_archive_rename(qapp, qtbot, mocker, borg_json_output, archive_env):
pos = tab.archiveTable.visualRect(tab.archiveTable.model().index(0, 4)).center()
qtbot.mouseClick(tab.archiveTable.viewport(), QtCore.Qt.MouseButton.LeftButton, pos=pos)
assert tab.bRename.isEnabled()
qtbot.mouseDClick(tab.archiveTable.viewport(), QtCore.Qt.MouseButton.LeftButton, pos=pos)
tab.archiveTable.viewport().focusWidget().setText("")
qtbot.keyClicks(tab.archiveTable.viewport().focusWidget(), new_archive_name)
qtbot.keyClick(tab.archiveTable.viewport().focusWidget(), QtCore.Qt.Key.Key_Return)
# Successful rename case
qtbot.waitUntil(lambda: tab.archiveTable.model().index(0, 4).data() == new_archive_name, **pytest._wait_defaults)
assert tab.archiveTable.model().index(0, 4).data() == new_archive_name