Skip to content

Add file dialog to exclude patterns#2252

Merged
m3nu merged 13 commits intoborgbase:masterfrom
VandalByte:dev-add-exclude-dialog
Sep 2, 2025
Merged

Add file dialog to exclude patterns#2252
m3nu merged 13 commits intoborgbase:masterfrom
VandalByte:dev-add-exclude-dialog

Conversation

@VandalByte
Copy link
Collaborator

@VandalByte VandalByte commented Jun 24, 2025

Description

This PR intends to add an option to use the file dialog to add the patterns directly into the "Custom" tab of exclusion dialog instead of adding then one click at a time.

Related Issue

Resolves #2144
Fixes #2260 (Unrelated bug fix)

Motivation and Context

This option makes it easy for users to add the patterns by directly selecting files/folders from the file dialog and a pattern to exclude the same will be auto generated and added to the Custom list, which you can edit later on if needed.

How Has This Been Tested?

Hasn't been tested yet, still a WIP.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@VandalByte VandalByte changed the title Do button testing Add file dialog to exclude patterns Jun 24, 2025
@VandalByte
Copy link
Collaborator Author

VandalByte commented Jun 24, 2025

As of right now I have two UI design concepts, it would be great to have some feedback

First one is this, adding two separate buttons, Exclude File to open the file dialog and Exclude Pattern to add one pattern at a time (functions same as the current plus button).

Screenshot 2025-06-24 190429

Second one has a single plus button having a submenu with two choices as mentioned above, a lot cleaner on UI front but adds an extra click (for every pattern you manually add).
Screenshot 2025-06-24 192416

@m3nu
Copy link
Contributor

m3nu commented Jul 4, 2025

First option seems better since we have enough space and it's more explicit.

@VandalByte
Copy link
Collaborator Author

By keeping the + button as it is, this is the current design:

Screenshot 2025-07-11 194747

Now for the button text other options I can think of is

  • Browse Exclusions
  • Browse Exclusion Files
  • Select Files and Folders to Exclude (seems too long)
  • Add Exclusions
  • Choose Exclusion Files
  • Select Exclusion Files

Making that + button into named button as shown in my previous comment left the - button looking out of place and changing the - button to a named button will further increase the overall button width in the dialog. Would love to have some feedback on this.

I'm starting on the implementation since the layout design has already been fixed (only the button label mentioned above can change, if needed).

@m3nu
Copy link
Contributor

m3nu commented Jul 11, 2025

Looks good to me.

@VandalByte
Copy link
Collaborator Author

I have added the last few changes, works fine during testing, both files and folders given are being excluded as expected.

@VandalByte VandalByte marked this pull request as ready for review July 23, 2025 17:57
@m3nu m3nu force-pushed the dev-add-exclude-dialog branch from d4d237e to 45ca9a5 Compare July 23, 2025 19:50
@m3nu
Copy link
Contributor

m3nu commented Jul 23, 2025

(rebased)

@andrewcrook
Copy link

andrewcrook commented Aug 3, 2025

I would test for blank strings as well s.strip() == ‘’ under text_editing_finished() just to be complete #2260

@VandalByte
Copy link
Collaborator Author

Also fixes #2260

@m3nu m3nu requested a review from Copilot August 22, 2025 06:41

This comment was marked as outdated.

@m3nu m3nu requested a review from Copilot August 22, 2025 20:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a file dialog feature to the exclude patterns functionality, allowing users to select files and folders directly through a file dialog rather than manually typing exclusion patterns. The changes introduce a new button in the Custom exclusion tab that opens a file dialog for selecting items to exclude.

  • Added a new "Exclude Files/Folders" button that opens a file dialog for selecting exclusion patterns
  • Implemented pattern generation logic that converts selected file/folder paths into exclusion patterns
  • Fixed a bug in the exclude-if-present pattern editing functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/vorta/views/exclude_dialog.py Added file dialog integration, pattern generation logic, and bug fixes for text editing
src/vorta/assets/UI/exclude_dialog.ui Added the new "Exclude Files/Folders" button to the UI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@m3nu
Copy link
Contributor

m3nu commented Aug 28, 2025

Screenshot 2025-08-28 at 12 33 05

Excluding this pattern and a specific folder isn't the same. When a user selects a specific folder they would expect the exclusion to only apply to this one folder, not all with the same name.

@m3nu
Copy link
Contributor

m3nu commented Aug 29, 2025

Here a minimal reproducible example of the issue:

Given this source folder
~

And this excluded folder line
fm:*/Downloads

which was selected in the UI as ~/Downloads

I have these folders and files:
~/Downloads
~/Desktop/Downloads/important vorta file.png
And only want to exclude ~/Downloads, but never had the intention to exclude ~/Desktop/Downloads and the important file in it.

Unfortunately after testing the feature I can confirm that both folders are excluded, which isn't the user's intention and very unexpected.

Screenshot 2025-08-29 at 06 40 35

@VandalByte
Copy link
Collaborator Author

I have changes the pattern from fm: to pf:

This pattern style is (only) useful to match full paths. This is kind of a pseudo pattern as it can not have any variable or unspecified parts - the full path must be given. pf:root/file.ext matches root/file.ext only. A leading path separator is always removed.

image image

I have tested out the same and now it should work as expected. Also the wildcard path have been replaced with complete path of file/folder selected, as required by the pf: pattern.

@m3nu m3nu merged commit 801f356 into borgbase:master Sep 2, 2025
7 checks passed
@VandalByte VandalByte deleted the dev-add-exclude-dialog branch September 6, 2025 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When I am editing Exclude Items, it crashes add a button to open a file chooser for excluding files/folders

4 participants