Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiselect directories #1938

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rajb957
Copy link

@rajb957 rajb957 commented Feb 14, 2024

Multiselection of folders while selecting folders

Description

In the source, multiple folders cant be selected, due to some limitations in QFileDialog. This pull request solves and allows multiselection of folder everywhere where folders need to be selected
Fixes #1869

Motivation and Context

It would be more convenient if one can select multiple directories in one go, not having to open add folder dialog window multiple time, saving previous time and clicks.

How Has This Been Tested?

By running them locally in my system. No actual tests edited so far.

Screenshots (if appropriate):

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.

@rajb957
Copy link
Author

rajb957 commented Feb 15, 2024

The solution implemented is adapted and iterated upon from a method discussed on Stack Overflow for enabling QFileDialog to select and return multiple folders. For further details, see the discussion here.

@sayem314
Copy link
Member

Thank you for your PR but this seems like a duplicate of #1871

Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

Thank you for the work! How does this compare to #1871?

Comment on lines -645 to +646
dialog.open(receive)
if dialog.exec():
receive()
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this change needed for?

@@ -172,6 +172,16 @@ def choose_file_dialog(parent, title, want_folder=True):
dialog.setParent(parent, QtCore.Qt.WindowType.Sheet)
if want_folder:
dialog.setOption(QFileDialog.Option.ShowDirsOnly)
dialog.setFileMode(QFileDialog.FileMode.Directory)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is duplicate.

@m3nu m3nu assigned m3nu and unassigned m3nu Apr 6, 2024
@m3nu
Copy link
Contributor

m3nu commented Apr 8, 2024

This isn't optimal either: Now we have 2 different dialogs. Native one and the one from Qt.

Would be best to have only one dialog for files and folders, including multiple ones.

@m3nu m3nu marked this pull request as draft October 18, 2024 09:45
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.

Multiple selection does not work for directories.
4 participants