-
Notifications
You must be signed in to change notification settings - Fork 47
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
Filedialog widget for magicgui #23
Merged
tlambert03
merged 41 commits into
pyapp-kit:master
from
GenevieveBuckley:filedialog-widget
Jul 3, 2020
Merged
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
52578ca
Add mapping between pathllib.Path and QFileDialog
GenevieveBuckley 2ae87ae
Partial step towards implementation
GenevieveBuckley 96502d5
Working filedialog, but opened immediately
GenevieveBuckley b3eb790
update lineedit filedialog
tlambert03 7c54a35
update docstring
tlambert03 a6d4b1b
update example
tlambert03 cdc6608
Merge branch 'master' into filedialog-widget
GenevieveBuckley 23dff3d
Merge pull request #1 from tlambert03/tjl-filedialog
GenevieveBuckley 7f7473f
Rename to MagicFileDialog for clarity
GenevieveBuckley 9e59bec
Add basic MagicFileDialog test
GenevieveBuckley 2ace939
Test MagicFileDialog mode set with improperly capitalized Enum
GenevieveBuckley f076201
Fix FileDialogMode enum test
GenevieveBuckley 13d6f5c
Add test for MagicFileDialog popup file chooser
GenevieveBuckley 868c05a
Merge branch 'master' into filedialog-widget
GenevieveBuckley 71f4558
Skip test_magicfiledialog_open_chooser on Mac because filedialog won'…
GenevieveBuckley d1f69a4
Test unsupported type for MagicFileDialog set_path
GenevieveBuckley 10dc21e
Add 'r' and 'w' aliases to FileDialogMode enumeration
GenevieveBuckley 771ac6e
Use read mode 'r' in file dialog example code
GenevieveBuckley 86831a8
Parametrize magicfiledialog popup chooser test
GenevieveBuckley 4ae4831
test_get_set_change with MagicFileDialog widget too
GenevieveBuckley 740fd9b
Test MagicFileDialog creation with kwargs 'mode' and 'filter'
GenevieveBuckley bfd8478
Improve test coverage in test_magicfiledialog_opens_chooser by settin…
GenevieveBuckley 0d6ddfd
Test MagicFileDialog get/set multiple paths
GenevieveBuckley a366db5
Change MagicFileDialog default 'r' mode to getExistingFileNames (mult…
GenevieveBuckley ddeafd0
Unneeded else clause in type2widget
GenevieveBuckley 680c574
Improve code coverage of MagicFileDialog popup chooser test
GenevieveBuckley 520854d
Test get/set multiple filepaths in MagicFileDialog properly
GenevieveBuckley 0d7587c
Test MagicFileDialog multiple filepaths set with iterable
GenevieveBuckley e48e6fa
Ooops, turns out this else clause is very important
GenevieveBuckley 9037abb
Add test that would have prevented my silly error
GenevieveBuckley 0e489de
Fix space issue if multiple files selected in MagicFileDialog
GenevieveBuckley 1f70acf
Add test docstrings for linter compliance
GenevieveBuckley e25bc01
Update magicgui/_tests/test_ qt.py
GenevieveBuckley 5e715c4
Test invalid string when seting mode of MagicFileDialog
GenevieveBuckley 77dc265
Black formatting for test_qt.py
GenevieveBuckley 77b2a04
Fix linter error
GenevieveBuckley de3d9af
Merge branch 'master' into filedialog-widget
GenevieveBuckley df09f1f
Add clarification to prevent future misunderstandings of MagicFileDia…
GenevieveBuckley 78aa56a
Update magicgui/_tests/test_ qt.py
GenevieveBuckley 0ed63e0
Update magicgui/_qt.py
tlambert03 5ec9874
Fix test so MagicFileDialog 'r' mode opens a single existing file
GenevieveBuckley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""FileDialog with magicgui.""" | ||
from pathlib import Path | ||
from magicgui import event_loop, magicgui | ||
|
||
|
||
# may also add Qt-style filter to filename options: | ||
# e.g. {"filter": "Images (*.tif *.tiff)"} | ||
@magicgui(filename={"mode": "r"}) | ||
def filepicker(filename=Path("~")): | ||
"""Take a filename and do something with it.""" | ||
print("The filename is:", filename) | ||
return filename | ||
|
||
|
||
with event_loop(): | ||
gui = filepicker.Gui(show=True) | ||
gui.filename_changed.connect(print) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this an alias for a single file. and in a followup (or here if you want to) we can do something like this:
and then in
type2widget
returnfunctools.partial(MagicFileDialog, mode='EXISTING_FILES')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, sorry. I committed this and it broke the test. can you fix that? Then I think this is good to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok