FileDialog#
- class ignis.widgets.Widget.FileDialog(*args: Any, **kwargs: Any)#
Bases:
Gtk.FileDialog
Danger
This is not a regular widget. It doesn't support common widget properties and cannot be added as a child to a container.
A window that allows the user to select a file.
Widget.FileDialog( initial_path=os.path.expanduser("~/.config"), on_file_set=lambda self, file: print(file.get_path()), select_folder=False, filters=[ Widget.FileFilter( mime_types=["image/jpeg", "image/png"], default=True, name="Images JPEG/PNG", ) ] )
- file_set(*args)#
Signal
Emitted when a file or directory is selected.
- Parameters:
file (
Gio.File
) -- The instance ofGio.File
for this file or directory.
- property file: gi.repository.Gio.File | None#
not argument, read-only
The selected
Gio.File
.Hint
Use the
get_path
method on theGio.File
to get the path.
- property filters: list[FileFilter]#
optional, read-write
A list of file filters.
- property initial_path: str#
optional, read-write
The path to the folder or file that will be selected by default.
- property select_folder: bool#
optional, read-write
Whether the dialog should allow selecting folders instead of files.
- add_filter(filter: FileFilter) None #
Add a filter.
- Parameters:
filter (
FileFilter
) -- The instance of filter to add.- Return type: