euporie.core.widgets.page
Contain containers which display children at full height vertially stacked.
Functions
|
Cast a value to a type. |
|
Get the current active (running) Application. |
|
Run a function in an thread, but make sure it uses the same contextvars. |
|
Make sure that the given object is a |
|
Turn the given object into a Dimension object. |
|
Walk through layout, starting at this container. |
Classes
|
A write position which also hold bounding box information. |
|
Represent a single character in a |
|
A class which holds information about a |
Base class for user interface layout. |
|
|
A tuple of four integers with directions. |
|
Specified dimension (width/height) of a user control or window. |
|
Mouse event, sent to UIControl.mouse_handler. |
|
|
Two dimensional raster of callbacks for mouse events. |
|
|
|
|
|
|
A container which displays all it's children in a vertical list. |
|
Two dimensional buffer of |
|
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.widgets.page.BoundedWritePosition(xpos: int, ypos: int, width: int, height: int, bbox: euporie.core.data_structures.DiInt)
Bases:
prompt_toolkit.layout.screen.WritePosition
A write position which also hold bounding box information.
- class euporie.core.widgets.page.ChildRenderInfo(parent: ScrollingContainer, child: AnyContainer)
Bases:
object
A class which holds information about a
ScrollingContainer
child.- blit(screen: prompt_toolkit.layout.screen.Screen, mouse_handlers: prompt_toolkit.layout.mouse_handlers.MouseHandlers, left: int, top: int, cols: slice, rows: slice) None
Copy the rendered child from the local screen to the main screen.
All locations are adjusted, allowing the pre-rendered child to be placed at any location on the main screen.
- Parameters
screen – The main screen to copy the pre-rendered screen data to
mouse_handlers – The mouse handler collection to copy the pre-rendered handelers to
left – The left-most column in which to start placing the data
top – The upper row in which to start placing the data
cols – The columns to copy
rows – The rows to copy
- class euporie.core.widgets.page.PrintingContainer(children: Callable | Sequence[AnyContainer], width: AnyDimension = None, key_bindings: KeyBindingsBase | None = None)
Bases:
prompt_toolkit.layout.containers.Container
A container which displays all it’s children in a vertical list.
- property children: Sequence[AnyContainer]
Return the container’s children.
- get_children() list[prompt_toolkit.layout.containers.Container]
Return a list of all child containers.
- get_key_bindings() KeyBindingsBase | None
Return the container’s key bindings.
- 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.
- preferred_height(width: int, max_available_height: int) prompt_toolkit.layout.dimension.Dimension
Return the preferred height, equal to the sum of the child heights.
- preferred_width(max_available_width: int) prompt_toolkit.layout.dimension.Dimension
Calculate and returns the desired width for this container.
- reset() None
Reet the state of this container and all the children.
Does nothing as this container is used for dumping output.
- write_to_screen(screen: prompt_toolkit.layout.screen.Screen, mouse_handlers: prompt_toolkit.layout.mouse_handlers.MouseHandlers, write_position: prompt_toolkit.layout.screen.WritePosition, parent_style: str, erase_bg: bool, z_index: int | None) None
Render the container to a Screen instance.
All children are rendered vertically in sequence.
- 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.
- class euporie.core.widgets.page.ScrollingContainer(children: Callable[[], Sequence[AnyContainer]] | Sequence[AnyContainer], height: AnyDimension = None, width: AnyDimension = None, style: str | Callable[[], str] = '')
Bases:
prompt_toolkit.layout.containers.Container
A scrollable container which renders only the currently visible children.
- property children: Sequence[AnyContainer]
Return the current children of this container instance.
- get_child(index: int | None = None) AnyContainer
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_child_render_info(index: int | None = None) euporie.core.widgets.page.ChildRenderInfo
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[prompt_toolkit.layout.containers.Container]
Return the list of currently visible children to include in the layout.
- get_key_bindings() prompt_toolkit.key_binding.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) prompt_toolkit.layout.dimension.Dimension
Return the preferred height only if one is provided.
- preferred_width(max_available_width: int) prompt_toolkit.layout.dimension.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) None
Scroll a child into view.
- Parameters
index – The child index to scroll into view
- 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: prompt_toolkit.layout.screen.Screen, mouse_handlers: prompt_toolkit.layout.mouse_handlers.MouseHandlers, write_position: prompt_toolkit.layout.screen.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.