euporie.core.widgets.file_browser

Define a file browser widget.

Functions

add_setting(name, default, help_, description)

Register a new config item.

get_app()

Get the current active (running) Application.

is_dir(path)

Check if a path is a directory.

to_filter(bool_or_filter)

Accept both booleans and Filters as input and turn it into a Filter.

Classes

Border(body, border, style, str] =, show_borders)

Draw a border around any container.

Buffer([completer, auto_suggest, history, ...])

The core data structure that holds the text and cursor position of the current input line and implements all text manipulations on top of it.

Button(text, on_click, None] | None = None, ...)

A clickable button widget.

ConditionalContainer(content, filter)

Wrapper around any other container that can change the visibility.

Event(sender[, handler])

Simple event to which event handlers can be attached. For instance::.

FastDictCache(get_value[, size])

Fast, lightweight cache which keeps at most size items.

FileBrowser([path, on_select, on_open, ...])

A file browser.

FileBrowserControl([path, on_chdir, ...])

A control for browsing a filesystem.

FocusedStyle(body[, style_focus, style_hover])

Apply a style to child containers when focused or hovered.

HSplit(children[, window_too_small, align, ...])

Several layouts, one stacked above/under the other. ::.

KeyBindings()

A container for a set of key bindings.

KeyBindingsBase()

Interface for a KeyBindings.

KeyPressEvent(key_processor_ref, arg, ...)

Key press event, delivered to key bindings.

MarginContainer(margin, target)

A container which renders a stand-alone margin.

MouseButton(value[, names, module, ...])

MouseEvent(position, event_type, button, ...)

Mouse event, sent to UIControl.mouse_handler.

MouseEventType(value[, names, module, ...])

PathCompleter([only_directories, get_paths, ...])

Complete for Path variables.

Point(x, y)

ScrollbarMargin([display_arrows, ...])

Margin displaying a scrollbar.

Text([text, style, height, min_height, ...])

A text input widget.

UIContent(get_line, StyleAndTextTuples] = >, ...)

Content generated by a user control.

UIControl()

Base class for all user interface controls.

UPath(*args, **kwargs)

VSplit(children[, window_too_small, align, ...])

Several layouts, one stacked left/right of the other. ::.

Window([content, width, height, z_index, ...])

Container that holds a control.

WritePosition(xpos, ypos, width, height)

class euporie.core.widgets.file_browser.FileBrowser(path: Path | None = None, on_select: Callable[[Path], None] | None = None, on_open: Callable[[Path], None] | None = None, on_chdir: Callable[[Path], None] | None = None, width: AnyDimension = None, height: AnyDimension = None, style: str = '', show_address_bar: FilterOrBool = True)

Bases: object

A file browser.

completer = <prompt_toolkit.completion.filesystem.PathCompleter object>
class euporie.core.widgets.file_browser.FileBrowserControl(path: Path | None = None, on_chdir: Callable[[FileBrowserControl], None] | None = None, on_select: Callable[[FileBrowserControl], None] | None = None, on_open: Callable[[FileBrowserControl], None] | None = None, window: Window | None = None)

Bases: prompt_toolkit.layout.controls.UIControl

A control for browsing a filesystem.

property contents: list[tuple[bool, Path]]

Return the contents of the current folder.

create_content(width: int, height: int) prompt_toolkit.layout.controls.UIContent

Generate the content for this user control.

property dir: Path

Return the current folder path.

get_invalidate_events() Iterable[Event[object]]

Return a list of Event objects. This can be a generator. (The application collects all these events, in order to bind redraw handlers to these events.)

get_key_bindings() prompt_toolkit.key_binding.key_bindings.KeyBindingsBase | None

Key bindings specific to this user control.

hover(row: int | None) NotImplementedOrNone

Hover a file in the browser.

is_focusable() bool

Determine that the file_browser is focusable.

static load_path(path: Path) list[tuple[bool, Path]]

Return the contents of a folder.

mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

move_cursor_down() None

Request to move the cursor down.

move_cursor_up() None

Request to move the cursor up.

open_path() None

Open the selected file.

property path: Path

Return the current selected path.

preferred_height(width: int, max_available_height: int, wrap_lines: bool, get_line_prefix: GetLinePrefixCallable | None) int | None
preferred_width(max_available_width: int) int | None
reset() None
select(row: int | None, open_file: bool = False) NotImplementedOrNone

Select a file in the browser.

euporie.core.widgets.file_browser.is_dir(path: str | Path) bool | None

Check if a path is a directory.