panel.widgets.file_selector module#

Defines a FileSelector widget which allows selecting files and directories on the server.

class panel.widgets.file_selector.BaseFileNavigator(directory: AnyStr | PathLike | None = None, **params)[source]#

Bases: BaseFileSelector, CompositeWidget

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.widgets.base.Widget: height, margin, width, disabled

panel.widgets.file_selector.BaseFileSelector: directory, file_pattern, only_files, refresh_period, root_directory, value

class panel.widgets.file_selector.BaseFileSelector(directory: AnyStr | os.PathLike | None = None, fs: AbstractFileSystem | None = None, **params)[source]#

Bases: Parameterized

Attributes:
fs

Parameter Definitions


directory = String(default='/Users/runner/work/panel/panel/doc', label='Directory')

The directory to explore.

file_pattern = String(default='*', label='File pattern')

A glob-like pattern to filter the files.

only_files = Boolean(default=False, label='Only files')

Whether to only allow selecting files.

refresh_period = Integer(allow_None=True, inclusive_bounds=(True, True), label='Refresh period')

If set to non-None value indicates how frequently to refresh the directory contents in milliseconds.

root_directory = String(allow_None=True, label='Root directory')

If set, overrides directory parameter as the root directory beyond which users cannot navigate.

value = List(bounds=(0, None), default=[], label='Value')

List of selected files.

class panel.widgets.file_selector.FileSelector(directory: AnyStr | os.PathLike | None = None, fs: AbstractFileSystem | None = None, **params)[source]#

Bases: BaseFileNavigator

The FileSelector widget allows browsing the filesystem on the server and selecting one or more files in a directory.

Reference: https://panel.holoviz.org/reference/widgets/FileSelector.html

Example:

>>> FileSelector(directory='~', file_pattern='*.png')

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.widgets.base.Widget: height, margin, width, disabled

panel.widgets.file_selector.BaseFileSelector: directory, file_pattern, only_files, refresh_period, root_directory, value

show_hidden = Boolean(default=False, label='Show hidden')

Whether to show hidden files and directories (starting with a period).

size = Integer(default=10, inclusive_bounds=(True, True), label='Size')

The number of options shown at once (note this is the only way to control the height of this widget)