lookatme.utils module¶
- lookatme.utils.can_style_item(item)[source]¶
Return true/false if
style_textcan work with the given item
- lookatme.utils.dict_deep_update(to_update, new_vals)[source]¶
Deeply update the to_update dict with the new_vals
- lookatme.utils.flatten_text(text, new_spec=None)[source]¶
Return a flattend list of tuples that can be used as the first argument to a new urwid.Text().
- Parameters:
text (urwid.Text) – The text to flatten
new_spec (urwid.AttrSpec) – A new spec to merge with existing styles
- Returns:
list of tuples
- lookatme.utils.pile_or_listbox_add(container, widgets)[source]¶
Add the widget/widgets to the container
- lookatme.utils.resolve_bag_of_text_markup_or_widgets(items)[source]¶
Resolve the list of items into either contiguous urwid.Text() instances, or pre-existing urwid.Widget objects
- lookatme.utils.row_text(rendered_row)[source]¶
Return all text joined together from the rendered row
- lookatme.utils.spec_from_style(styles)[source]¶
Create an urwid.AttrSpec from a {fg:””, bg:””} style dict. If styles is a string, it will be used as the foreground
- lookatme.utils.styled_text(text, new_styles, old_styles=None, supplement_style=False)[source]¶
Return a styled text tuple that can be used within urwid.Text.
Note
If an urwid.Text instance is passed in as the
textparameter, alignment values will be lost and must be explicitly re-added by the caller.