From d721011c90c190ff0e0d0be87f650cae917eab39 Mon Sep 17 00:00:00 2001 From: Shivansh Singh <89853707+shivansh02@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:21:42 +0530 Subject: [PATCH 1/4] VSC and Android exclusion patterns. By @shivansh02 (#1967) --- src/vorta/assets/exclusion_presets/dev.json | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/vorta/assets/exclusion_presets/dev.json b/src/vorta/assets/exclusion_presets/dev.json index 947cb237d..bf53fb5bb 100644 --- a/src/vorta/assets/exclusion_presets/dev.json +++ b/src/vorta/assets/exclusion_presets/dev.json @@ -5,7 +5,8 @@ "patterns": [ "fm:*/node_modules", - "fm:*/.npm" + "fm:*/.npm", + "fm:*/npm-global" ], "tags": ["type:dev", "lang:javascript", "os:linux", "os:darwin"], "author": "Divi" @@ -33,5 +34,27 @@ ], "tags": ["type:dev", "lang:rust", "os:linux", "os:darwin"], "author": "Divi" + }, + { + "name": "Visual Studio Code cache and config files", + "slug": "vscode-cache", + "patterns": [ + "fm:*/.config/Code", + "fm:*/.vscode/extensions/*" + ], + "tags": ["type:editor", "editor:vscode", "os:linux"], + "author": "shivansh02" + }, + { + "name": "Android Studio Artefacts", + "slug": "android-studio", + "patterns": [ + "fm:*/.android", + "fm:*/.gradle", + "fm:*/Android/Sdk", + "fm:*/.AndroidStudio" + ], + "tags": ["type:dev", "editor:android-studio", "os:linux"], + "author": "shivansh02" } ] From bde55188e46309d8c84dfce6e7b8669c070f728c Mon Sep 17 00:00:00 2001 From: Adwait Date: Mon, 1 Apr 2024 20:07:58 +0530 Subject: [PATCH 2/4] Disabled "Collapse" button in "Flat" view (#1855) Our `DiffResultDialog` and `ExtractDialog` show a context menu for items of the list/tree view. The collapse action in this menu only makes sense for the tree mode of the view. This commit therefore enables the option only for this view mode. * src/vorta/views/extract_dialog.py * src/vorta/views/diff_result.py * tests/unit/test_diff.py : Add tests for the new behaviour. * tests/unit/test_extract.py --- src/vorta/views/diff_result.py | 3 +++ src/vorta/views/extract_dialog.py | 2 ++ tests/unit/test_diff.py | 19 +++++++++++++++++++ tests/unit/test_extract.py | 24 ++++++++++++++++++++++-- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/vorta/views/diff_result.py b/src/vorta/views/diff_result.py index da74ff727..6ed8841a0 100644 --- a/src/vorta/views/diff_result.py +++ b/src/vorta/views/diff_result.py @@ -190,10 +190,13 @@ def change_display_mode(self, selection: int): """ if selection == 0: mode = FileTreeModel.DisplayMode.TREE + self.bCollapseAll.setEnabled(True) elif selection == 1: mode = FileTreeModel.DisplayMode.SIMPLIFIED_TREE + self.bCollapseAll.setEnabled(True) elif selection == 2: mode = FileTreeModel.DisplayMode.FLAT + self.bCollapseAll.setEnabled(False) else: raise Exception("Unknown item in comboBoxDisplayMode with index {}".format(selection)) diff --git a/src/vorta/views/extract_dialog.py b/src/vorta/views/extract_dialog.py index d7781370b..8c3874048 100644 --- a/src/vorta/views/extract_dialog.py +++ b/src/vorta/views/extract_dialog.py @@ -185,8 +185,10 @@ def change_display_mode(self, selection: int): """ if selection == 0: mode = FileTreeModel.DisplayMode.TREE + self.bCollapseAll.setEnabled(True) elif selection == 1: mode = FileTreeModel.DisplayMode.SIMPLIFIED_TREE + self.bCollapseAll.setEnabled(True) else: raise Exception("Unknown item in comboBoxDisplayMode with index {}".format(selection)) diff --git a/tests/unit/test_diff.py b/tests/unit/test_diff.py index cc001f02b..e7ef9fd9b 100644 --- a/tests/unit/test_diff.py +++ b/tests/unit/test_diff.py @@ -6,14 +6,17 @@ import vorta.views.archive_tab from PyQt6.QtCore import QDateTime, QItemSelectionModel, Qt from PyQt6.QtWidgets import QMenu +from vorta.store.models import ArchiveModel from vorta.views.diff_result import ( ChangeType, DiffData, + DiffResultDialog, DiffTree, FileType, parse_diff_json, parse_diff_lines, ) +from vorta.views.partials.treemodel import FileTreeModel def setup_diff_result_window(qtbot, mocker, tab, borg_json_output, json_mock_file="diff_archives"): @@ -457,3 +460,19 @@ def test_archive_diff_json_parser(line, expected): assert item.path == PurePath(expected[0]).parts assert item.data == DiffData(*expected[1:]) + + +@pytest.mark.parametrize( + "selection, expected_mode, expected_bCollapseAllEnabled", + [ + (0, FileTreeModel.DisplayMode.TREE, True), + (1, FileTreeModel.DisplayMode.SIMPLIFIED_TREE, True), + (2, FileTreeModel.DisplayMode.FLAT, False), + ], +) +def test_change_display_mode(selection: int, expected_mode, expected_bCollapseAllEnabled): + dialog = DiffResultDialog(ArchiveModel(), ArchiveModel(), DiffTree()) + dialog.change_display_mode(selection) + + assert dialog.model.mode == expected_mode + assert dialog.bCollapseAll.isEnabled() == expected_bCollapseAllEnabled diff --git a/tests/unit/test_extract.py b/tests/unit/test_extract.py index f4fa2fdf2..e68da0d28 100644 --- a/tests/unit/test_extract.py +++ b/tests/unit/test_extract.py @@ -1,7 +1,15 @@ +import pytest import vorta.borg from PyQt6.QtCore import QModelIndex, Qt -from vorta.views.extract_dialog import ExtractTree, FileData, FileType, parse_json_lines -from vorta.views.partials.treemodel import FileSystemItem +from vorta.store.models import ArchiveModel +from vorta.views.extract_dialog import ( + ExtractDialog, + ExtractTree, + FileData, + FileType, + parse_json_lines, +) +from vorta.views.partials.treemodel import FileSystemItem, FileTreeModel def prepare_borg(mocker, borg_json_output): @@ -177,3 +185,15 @@ def test_selection(): select(model, iab) assert a.data.checkstate == Qt.CheckState(1) + + +@pytest.mark.parametrize( + "selection, expected_mode, expected_bCollapseAllEnabled", + [(0, FileTreeModel.DisplayMode.TREE, True), (1, FileTreeModel.DisplayMode.SIMPLIFIED_TREE, True)], +) +def test_change_display_mode(selection: int, expected_mode, expected_bCollapseAllEnabled): + dialog = ExtractDialog(ArchiveModel(), ExtractTree()) + dialog.change_display_mode(selection) + + assert dialog.model.mode == expected_mode + assert dialog.bCollapseAll.isEnabled() == expected_bCollapseAllEnabled From 9b8dbcecfbab7e7492e05f5e0ae22a2631335718 Mon Sep 17 00:00:00 2001 From: Parnassius Date: Mon, 1 Apr 2024 21:00:53 +0200 Subject: [PATCH 3/4] Sort profiles in the Backup Now tray menu (#1899) The profile list in the main window is already sorted by name (alphabetically, case-sensitive). However the profile list in the *Backup Now* action found in the tray menu wasn't. This commit constructs the sql query to return the profiles in order. * src/vorta/tray_menu.py --- src/vorta/tray_menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vorta/tray_menu.py b/src/vorta/tray_menu.py index e5a154d6d..b9d5ac742 100644 --- a/src/vorta/tray_menu.py +++ b/src/vorta/tray_menu.py @@ -59,7 +59,7 @@ def build_menu(self): cancel_action.triggered.connect(self.app.backup_cancelled_event.emit) else: status.setText(self.tr('Next Task: %s') % next_task_time) - profiles = BackupProfileModel.select() + profiles = BackupProfileModel.select().order_by(BackupProfileModel.name) if profiles.count() > 1: profile_menu = menu.addMenu(self.tr('Backup Now')) for profile in profiles: From 58137f004d72e60d6fb091036d8b2dddfdb421de Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 7 Apr 2024 03:05:31 +0530 Subject: [PATCH 4/4] Add new exclusion presets (#1970) --- src/vorta/assets/exclusion_presets/dev.json | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/vorta/assets/exclusion_presets/dev.json b/src/vorta/assets/exclusion_presets/dev.json index bf53fb5bb..91fe69690 100644 --- a/src/vorta/assets/exclusion_presets/dev.json +++ b/src/vorta/assets/exclusion_presets/dev.json @@ -56,5 +56,44 @@ ], "tags": ["type:dev", "editor:android-studio", "os:linux"], "author": "shivansh02" + }, + { + "name": "Jetbrains IDEs cache, config, path and logs", + "slug": "jetbrains", + "patterns": [ + "fm:*/.config/JetBrains", + "fm:*/.cache/JetBrains", + "fm:*/.local/share/JetBrains" + ], + "tags": ["type:dev", "editor:jetbrains", "os:linux"], + "author": "SAMAD101" + }, + { + "name": "AWS artefacts", + "slug": "aws-artefacts", + "patterns": [ + "fm:*/.aws" + ], + "tags": ["type:dev", "cloud:aws", "os:linux", "os:darwin"], + "author": "SAMAD101" + }, + { + "name": "Spotify cache and config files", + "slug": "spotify", + "patterns": [ + "fm:*/.cache/spotify", + "fm:*/.config/spotify" + ], + "tags": ["type:media", "media:spotify", "os:linux"], + "author": "SAMAD101" + }, + { + "name": "Docker artefacts", + "slug": "docker-artefacts", + "patterns": [ + "fm:*/.docker" + ], + "tags": ["type:dev", "cloud:docker", "os:linux", "os:darwin"], + "author": "SAMAD101" } ]