lookatme.render.context module¶
-
class
lookatme.render.context.
ContainerInfo
(container: 'urwid.Widget', meta: 'Dict[str, Any]', source_token: 'Optional[Dict]')[source]¶ Bases:
object
-
class
lookatme.render.context.
Context
(loop: Optional[urwid.main_loop.MainLoop])[source]¶ Bases:
object
-
clean_state_validate
()[source]¶ Validate that all stacks are empty, that everything unwound correctly
-
clone
() → lookatme.render.context.Context[source]¶ Create a new limited clone of the current context.
The only data that is actually cloned is the source and spec stacks.
-
container
¶ Return the current container
-
container_pop
() → lookatme.render.context.ContainerInfo[source]¶ Pop the last element off the stack. Returns the popped widget
-
container_push
(new_item: urwid.widget.Widget, is_new_block: bool, custom_add: Optional[urwid.widget.Widget] = None)[source]¶ Push to the stack and propagate metadata
-
get_inline_markup
()[source]¶ Return the current inline markup, ignoring any widgets that may have made it in
-
get_inline_widgets
()[source]¶ Return the results of any inline rendering that has occurred in Widget form. The conversion here is necessary since inline rendering functions often produce urwid Text Markup instead of widgets, which need to be converted to ClickableText.
-
inline_markup_consumed
¶ Return and clear the inline markup
-
inline_push
(inline_result: Union[urwid.widget.Widget, str, Tuple[Optional[urwid.display_common.AttrSpec], str]])[source]¶ Push a new inline render result onto the stack. Either a widget, or text markup
-
inline_widgets_consumed
¶ Return and clear the inline widgets
-
is_literal
¶
-
meta
¶ Return metadata associated with the current container, or None if the current container is None.
-
source
¶ Return the current markdown source
-
source_get_token_lines
(token: Dict[KT, VT], extra: int = 5, with_lines: bool = True, with_marker: bool = True) → List[str][source]¶
-
spec_general
¶ Return the current fully resolved current AttrSpec
-
spec_text
¶
-
spec_text_with
(other_spec: Union[None, urwid.display_common.AttrSpec]) → urwid.display_common.AttrSpec[source]¶
-
tag
¶
-
tag_push
(new_tag: str, token: Dict[KT, VT], spec=None, text_only_spec=False)[source]¶ Push a new tag name onto the stack
-
tag_token
¶
-
tokens
¶ Return the current token iterator
-
unwind_bookmark
¶
-
unwind_tokens
¶ Generate a list of unwind (close) tokens from the token iterators in the stack
-
unwind_tokens_consumed
¶ Generate a list of unwind (close) tokens from the token iterators in the stack
-
use_container
(new_container: urwid.widget.Widget, is_new_block: bool, custom_add: Optional[urwid.widget.Widget] = None)[source]¶ Ensure that the container is pushed/popped correctly
-
use_container_tmp
(new_container: urwid.widget.Widget)[source]¶ Swap out the entire container stack for a new one with the new container as the only item, while keeping spec and tag stacks
-
use_tokens
(tokens, inline: bool = False)[source]¶ Create a context manager for pushing/popping tokens via a with block
-