lookatme.tui module¶
This module defines the text user interface (TUI) for lookatme
-
class
lookatme.tui.
SlideRenderer
(loop)[source]¶ Bases:
threading.Thread
-
daemon
= True¶
-
do_render
(to_render, slide_num)[source]¶ Perform the actual rendering of a slide. This is done by:
- parsing the slide into tokens (should have occurred already)
- iterating through each parsed markdown token
- calling the appropriately-named render function for the
token["type"]
inlookatme.render.markdown_block
Each render function must have the signature:
def render_XXX(token, body, stack, loop): pass
The arguments to the render function are described below:
token
- the lexed markdown token - a dictionarybody
- the currenturwid.Pile()
that return values will be added to (same asstack[-1]
)stack
- The stack ofurwid.Pile()
used during rendering. E.g., when rendering nested lists, each nested list will push a newurwid.Pile()
to the stack, each wrapped with its own additional indentation.loop
- theurwid.MainLoop
instance being used by lookatme. This won’t usually be used, but is available if needed.
Main render functions (those defined in markdown_block.py) may have three types of return values:
None
- nothing is added tostack[-1]
. Perhaps the render function only needed to add additional indentation by pushing a newurwid.Pile()
to the stack.list(urwid.Widget)
- A list of widgets to render. These will automatically be added to the Pile atstack[-1]
urwid.Widget
- A single widget to render. Will be added tostack[-1]
automatically.
-
-
lookatme.tui.
create_tui
(pres, start_slide=0)[source]¶ Run the provided presentation
Parameters: start_slide (int) – 0-based slide index