euporie.core.layout.scroll
Contains containers which display children at full height vertically stacked.
Functions
|
Cast a value to a type. |
|
Get the current active (running) Application. |
|
Turn the given object into a Dimension object. |
Classes
|
A write position which also hold bounding box information. |
|
A container which renders its content once and caches the output. |
Base class for user interface layout. |
|
|
Specified dimension (width/height) of a user control or window. |
|
Fast, lightweight cache which keeps at most size items. |
|
Mouse event, sent to UIControl.mouse_handler. |
|
|
|
|
|
Scroll offsets for the |
|
A scrollable container which renders only the currently visible children. |
|
Content generated by a user control. |
|
Container that holds a control. |
|
Render information for the last render time of this control. |
- class euporie.core.layout.scroll.ScrollingContainer(children: Callable[[], Sequence[AnyContainer]] | Sequence[AnyContainer], height: AnyDimension = None, width: AnyDimension = None, style: str | Callable[[], str] = '', scroll_offsets: ScrollOffsets | None = None)
Bases:
Container
A scrollable container which renders only the currently visible children.
- get_child(index: int | None = None) CachedContainer
Return a rendered instance of the child at the given index.
If no index is given, the currently selected child is returned.
- Parameters:
index – The index of the child to return.
- Returns:
A rendered instance of the child.
- get_children() list[Container]
Return the list of currently visible children to include in the layout.
- get_key_bindings() KeyBindingsBase | None
Returns a
KeyBindings
object. These bindings become active when any user control in this container has the focus, except if any containers between this container and the focused user control is modal.
- is_modal() bool
When this container is modal, key bindings from parent containers are not taken into account if a user control in this container is focused.
- mouse_scroll_handler(mouse_event: MouseEvent) NotImplementedOrNone
Mouse handler to scroll the pane.
- pre_render_children(width: int, height: int) None
Render all unrendered children in a background thread.
- preferred_height(width: int, max_available_height: int) Dimension
Return the preferred height only if one is provided.
- preferred_width(max_available_width: int) Dimension
Do not provide a preferred width - grow to fill the available space.
- render_info: WindowRenderInfo | None
- scroll(n: int) NotImplementedOrNone
Scroll up or down a number of rows.
- Parameters:
n – The number of rows to scroll, negative for up, positive for down
- Returns:
NotImplemented
is scrolling is not allowed, otherwiseNone
- scroll_to(index: int, anchor: Literal['top', 'bottom'] | None = None) None
Scroll a child into view.
- Parameters:
index – The child index to scroll into view
anchor – Whether to scroll to the top or bottom the given child index
- select(index: int, extend: bool = False, position: int | None = None, scroll: bool = True) None
Select a child or adds it to the selection.
- Parameters:
index – The index of the cell to select
extend – If true, the selection will be extended to include the cell
position – An optional cursor position index to apply to the cell input
scroll – Whether to scroll the page
- write_to_screen(screen: PtkScreen, mouse_handlers: MouseHandlers, write_position: WritePosition, parent_style: str, erase_bg: bool, z_index: int | None) None
Write the actual content to the screen.
Children are rendered only if they are visible and have changed, and the output is cached to a separate screen object stored in a :py:
ChildRenderInfo
. The cached rendering of the children which are actually visible are then copied to the screen. This results in faster rendering of the scrolling container, and makes scrolling more performant.- Parameters:
screen – The
Screen
class to which the output has to be written.mouse_handlers –
prompt_toolkit.layout.mouse_handlers.MouseHandlers
.write_position – A
prompt_toolkit.layout.screen.WritePosition
object defining where this container should be drawn.erase_bg – If true, the background will be erased prior to drawing.
parent_style – Style string to pass to the
Window
object. This will be applied to all content of the windows.VSplit
andprompt_toolkit.layout.containers.HSplit
can use it to pass their style down to the windows that they contain.z_index – Used for propagating z_index from parent to child.