lookatme.utils module

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.get_fg_bg_styles(style)[source]
lookatme.utils.overwrite_spec(orig_spec, new_spec)[source]
lookatme.utils.pile_add(pile, widgets)[source]
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 text parameter, alignment values will be lost and must be explicitly re-added by the caller.

lookatme.utils.translate_color(raw_text)[source]