# lookatme.utils module

lookatme.utils.can_style_item(item)

  Return true/false if `style_text` can work with the given item

lookatme.utils.dict_deep_update(to_update, new_vals)

  Deeply update the to_update dict with the new_vals

lookatme.utils.flatten_text(text, new_spec=None)

  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)

lookatme.utils.int_to_roman(integer)

lookatme.utils.listbox_add(listbox, widgets)

lookatme.utils.overwrite_spec(orig_spec, new_spec)

lookatme.utils.pile_add(pile, widgets)

lookatme.utils.pile_or_listbox_add(container, widgets)

  Add the widget/widgets to the container

lookatme.utils.prefix_text(text: str, prefix: str, split: str = '\n') → str

lookatme.utils.resolve_bag_of_text_markup_or_widgets(items)

  Resolve the list of items into either contiguous urwid.Text() instances, or pre-existing urwid.Widget objects

lookatme.utils.row_text(rendered_row)

  Return all text joined together from the rendered row

lookatme.utils.spec_from_style(styles)

  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)

  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.