b.ui : package documentation

Part of bzrlib

Abstraction for interacting with the user.

Applications can choose different types of UI, and they deal with displaying messages or progress to the user, and with gathering different types of input.

Several levels are supported, and you can also register new factories such as for a GUI.

bzrlib.ui.UIFactory
Semi-abstract base class
bzrlib.ui.SilentUIFactory
Produces no output and cannot take any input; useful for programs using bzrlib in batch mode or for programs such as loggerhead.
bzrlib.ui.CannedInputUIFactory
For use in testing; the input values to be returned are provided at construction.
bzrlib.ui.text.TextUIFactory
Standard text command-line interface, with stdin, stdout, stderr. May make more or less advanced use of them, eg in drawing progress bars, depending on the detected capabilities of the terminal. GUIs may choose to subclass this so that unimplemented methods fall back to working through the terminal.
Module text Text UI, write output to the console.

From the __init__.py module:

Class CannedInputUIFactory A silent UI that return canned input.
Class ConfirmationUserInterfacePolicy Wrapper for a UIFactory that allows or denies all confirmed actions.
Class NoninteractiveUIFactory Base class for UIs with no user.
Class NullOutputStream Acts like a file, but discard all output.
Class NullProgressView Soak up and ignore progress information.
Class SilentUIFactory A UI Factory which never prints anything.
Class UIFactory UI abstraction.
Function bool_from_string Returns a boolean if the string can be interpreted as such.
Function make_ui_for_terminal Construct and return a suitable UIFactory for a text mode program.
def bool_from_string(s, accepted_values=None):
Returns a boolean if the string can be interpreted as such.

Interpret case insensitive strings as booleans. The default values includes: 'yes', 'no, 'y', 'n', 'true', 'false', '0', '1', 'on', 'off'. Alternative values can be provided with the 'accepted_values' parameter.

ParameterssA string that should be interpreted as a boolean. It should be of type string or unicode.
accepted_valuesAn optional dict with accepted strings as keys and True/False as values. The strings will be tested against a lowered version of 's'.
ReturnsTrue or False for accepted strings, None otherwise.
def make_ui_for_terminal(stdin, stdout, stderr):
Construct and return a suitable UIFactory for a text mode program.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.