-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: fix missing images in docs, update docs deps (#656)
* fix docs * bump napari
- Loading branch information
1 parent
fe29b35
commit 49b3d66
Showing
6 changed files
with
100 additions
and
47 deletions.
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,20 @@ | ||
"""# Directory dialog widget | ||
A dialog to select a directory. | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
from magicgui import magicgui | ||
|
||
|
||
# Select a directory, instead of file(s) | ||
@magicgui(directory={"mode": "d", "label": "Choose a directory"}) | ||
def directorypicker(directory=Path("~")): | ||
"""Take a directory name and do something with it.""" | ||
print("The directory name is:", directory) | ||
return directory | ||
|
||
|
||
directorypicker.directory.changed.connect(print) | ||
directorypicker.show(run=True) |
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 |
---|---|---|
@@ -1,44 +1,20 @@ | ||
"""# File dialog widget | ||
A file dialog widget example. | ||
A dialog to select a file. | ||
""" | ||
|
||
from pathlib import Path | ||
from typing import Sequence | ||
|
||
from magicgui import magicgui, use_app | ||
from magicgui import magicgui | ||
|
||
|
||
@magicgui(filename={"mode": "r"}) | ||
def filepicker(filename=Path("~")): | ||
def filepicker(filename=Path("~")) -> Path: | ||
"""Take a filename and do something with it.""" | ||
print("The filename is:", filename) | ||
return filename | ||
|
||
|
||
# Sequence of paths | ||
# We change the label using "label" for added clarity | ||
# the filter argument restricts file types | ||
@magicgui(filenames={"label": "Choose Tiff files:", "filter": "*.tif"}) | ||
def filespicker(filenames: Sequence[Path]): | ||
"""Take a filename and do something with it.""" | ||
print("The filenames are:", filenames) | ||
return filenames | ||
|
||
|
||
# Select a directory, instead of file(s) | ||
@magicgui(directory={"mode": "d", "label": "Choose a directory"}) | ||
def directorypicker(directory=Path("~")): | ||
"""Take a directory name and do something with it.""" | ||
print("The directory name is:", directory) | ||
return directory | ||
|
||
|
||
filepicker.show() | ||
filespicker.show() | ||
directorypicker.show() | ||
filepicker.filename.changed.connect(print) | ||
filespicker.filenames.changed.connect(print) | ||
directorypicker.directory.changed.connect(print) | ||
|
||
use_app().run() | ||
filepicker.show(run=True) |
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,23 @@ | ||
"""# File dialog widget | ||
A dialog to select multiple files. | ||
""" | ||
|
||
from pathlib import Path | ||
from typing import Sequence | ||
|
||
from magicgui import magicgui | ||
|
||
|
||
# Sequence of paths | ||
# We change the label using "label" for added clarity | ||
# the filter argument restricts file types | ||
@magicgui(filenames={"label": "Choose Tiff files:", "filter": "*.tif"}) | ||
def filespicker(filenames: Sequence[Path]) -> Sequence[Path]: | ||
"""Take a filename and do something with it.""" | ||
print("The filenames are:", filenames) | ||
return filenames | ||
|
||
|
||
filespicker.filenames.changed.connect(print) | ||
filespicker.show(run=True) |
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
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