euporie.notebook.widgets.side_bar

Define a side-bar.

Functions

get_app()

Get the current active (running) Application.

to_formatted_text(value[, style, auto_convert])

Convert the given value (which can be formatted text) into a list of text fragments.

Classes

Condition(func)

Turn any callable into a Filter.

ConditionalContainer(content, filter[, ...])

Wrapper around any other container that can change the visibility.

Dimension([min, max, weight, preferred])

Specified dimension (width/height) of a user control or window.

DynamicContainer(get_container)

Container class that dynamically returns any Container.

Event(sender[, handler])

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

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.

Line([char, width, height, collapse, style])

Draw a horizontal or vertical line.

MouseButton(*values)

MouseEventType(*values)

SideBar(titles, icons, panels[, width, ...])

A side-bar for the notebook application.

SideBarButtons(options, labels, index, ...)

Vertical toggle-buttons with additional styling for the side-bar.

SidebarResizeHandleControl(sidebar)

A draggable vertical bar to resize the sidebar.

ToggleButton(text, on_click, ...)

A toggleable button widget.

ToggleButtons(options, labels, index, ...)

A widget where an option is selected using mutually exclusive toggle-buttons.

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

Content generated by a user control.

UIControl()

Base class for all user interface controls.

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

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

Window(*args, **kwargs)

Container that holds a control.

WritePosition(xpos, ypos, width, height)

partial(func, /, *args, **keywords)

Create a new function with partial application of the given arguments and keywords.

class euporie.notebook.widgets.side_bar.SideBar(titles: Sequence[str], icons: Sequence[str], panels: Sequence[AnyContainer], width: int = 25, index: int | None = -1, on_resize: Callable[[SideBar], None] | None = None, on_change: Callable[[SideBar], None] | None = None)

Bases: object

A side-bar for the notebook application.

property index: int | None

Get the current panel index.

Returns:

The current panel index, or None if no panel is active.

toggle_pane() None

Toggle the visibility of the side-bar.

property width: int

Get the current width of the sidebar.

Returns:

The current width in characters.

class euporie.notebook.widgets.side_bar.SideBarButtons(options: list[Any], labels: Sequence[AnyFormattedText] | None = None, index: int | None = None, indices: list[int] | None = None, n_values: int | None = None, multiple: FilterOrBool = False, max_count: int | None = None, on_change: Callable[[SelectableWidget], None] | None = None, style: str | Callable[[], str] = 'class:input', border: GridStyle | None =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , disabled: FilterOrBool = False, vertical: FilterOrBool = False)

Bases: ToggleButtons

Vertical toggle-buttons with additional styling for the side-bar.

get_button_style(index: int) Callable[[], str]

Return the current button style.

hover_rel(rel: int) None

Hover an index relative to the current hovered index.

property index: int | None

Return the first selected index.

property indices: list[int]

Return a list of the selected indices.

key_bindings() KeyBindingsBase

Return key-bindings for the drop-down widget.

load_container() AnyContainer

Load the widget’s container.

property mask: list[bool]

Get mask of selected options.

mouse_handler(i: int, mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

select_rel(rel: int) None

Select an index relative to the current index.

property style: str

Return the widget’s style.

toggle_item(index: int) None

Toggle the selection status of the option at a given index.

update_buttons(widget: SelectableWidget | None = None) None

Set the toggle buttons’ selection state when the selected index changes.

property value: Any

Return the selected value.

property values: list[Any]

Return a list of the selected values.

class euporie.notebook.widgets.side_bar.SidebarResizeHandleControl(sidebar: SideBar)

Bases: UIControl

A draggable vertical bar to resize the sidebar.

create_content(width: int, height: int | None) UIContent

Create the content for the resize handle.

Parameters:
  • width – The width of the control.

  • height – The height of the control.

Returns:

The UI content to display.

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() KeyBindingsBase | None

The key bindings that are specific for this user control.

Return a KeyBindings object if some key bindings are specified, or None otherwise.

is_focusable() bool

Tell whether this user control is focusable.

mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events for resizing the sidebar.

Parameters:

mouse_event – The mouse event to handle.

Returns:

None if the event was handled, NotImplemented otherwise.

move_cursor_down() None

Request to move the cursor down. This happens when scrolling down and the cursor is completely at the top.

move_cursor_up() None

Request to move the cursor up.

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