ui module (UI class)

Author:Chris Warrick <chris@chriswarrick.com>
Copyright:© 2011-2017, Chris Warrick.
License:BSD (see /LICENSE or Appendix B.)
Date:2017-07-13
Version:4.2.14

New in version 3.0.0.

The User Interface.

Copyright:© 2011-2017, Chris Warrick.
License:BSD (see /LICENSE).
pkgbuilder.ui.get_termwidth(default=None)[source]

Get the width of this terminal.

New in version 3.3.0.

Changed in version 4.2.9.

pkgbuilder.ui.hanging_indent(text, intro, termwidth=None, change_spaces=True, introwidth=None)[source]

Produce text with a hanging indent.

New in version 3.3.0.

Changed in version 4.0.0.

pkgbuilder.ui.mlist(items, sep=' ', change_spaces=True, termwidth=None, indentwidth=17)[source]

Output a list of strings, complete with a hanging indent.

New in version 3.3.0.

Changed in version 4.0.0.

class pkgbuilder.ui.Progress(total=1)[source]

A static progress indicator with numbers.

Usage:

pm = Progress(total=2)
pm.msg('Doing step 1...')
step1()
pm.msg('Doing step 2...')
step2()
msg(msg, single=False)[source]

Print a progress message.

class pkgbuilder.ui.Throbber(msg, finalthrob='*', printback=True)[source]

A nice animated throbber.

Usage:

with Throbber('Doing important stuff...'):
    dostuff()
throbber_alive

Check the status of a throbber.

class pkgbuilder.ui.ProgressThrobber(msg, total=1)[source]

An animated progress throbber.

Similar to Progress, but the / is animated.

Usage:

with ProgressThrobber('Working...', total=2) as pt:
    dostuff()
    pt.bump('Cleaning up...')
    cleanup()
bump(msg)[source]

Change the displayed message.