Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtedde committed Sep 25, 2023
2 parents 73460e7 + 43140be commit 46e56a1
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
102 changes: 51 additions & 51 deletions src/vorta/assets/UI/archivetab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
7 changes: 5 additions & 2 deletions src/vorta/store/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ def get_misc_settings() -> List[Dict[str, str]]:
'value': True,
'type': 'checkbox',
'group': startup,
'label': trans_late('settings', 'Open main window on startup'),
'tooltip': trans_late('settings', 'Open main window when the application is launched'),
'label': trans_late('settings', 'Show main window of Vorta on launch'),
'tooltip': trans_late(
'settings',
'Make Vorta appear on screen instead of minimizing to system tray',
),
},
{
'key': 'get_srcpath_datasize',
Expand Down
60 changes: 20 additions & 40 deletions src/vorta/views/archive_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'))
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -825,6 +802,9 @@ def extract_archive_result(self, result):
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()
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/test_archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit 46e56a1

Please sign in to comment.