Utility

These are classes and functions that are generally useful, but aren’t panels, managers, or messages.

class thurible.util.Box(kind: str = 'light', custom: str | None = None)[source]

Create a new thurible.util.Box object. These objects track the characters used to draw a frame in a terminal. It has fifteen properties that return the character used for that part of the box:

  • top: The top

  • bot: The bottom

  • side: The sides

  • mhor: Interior horizontal lines

  • mver: Interior vertical lines

  • ltop: The top-left corner

  • mtop: Top mid-join

  • rtop: The top-right corner

  • lside: Left side mid-join

  • mid: Interior join

  • rside: Right side mid-join

  • lbot: Bottom-left corner

  • mbot: Bottom mid-join

  • rbot: Bottom-right corner

Parameters:
  • kind – (Optional). Sets the set of characters used by the thurible.util.Box object. It defaults to light. Available options include double, heavy, heavy_double_dash, heavy_out_light_in, heavy_quadruple_dash, light, light_double_dash, light_quadruple_dash, light_out_heavy_in, light_triple_dash.

  • custom – (Optional). Provides a custom set of characters for the thurible.util.Box object to use.

Returns:

None.

Return type:

NoneType

thurible.get_queues() tuple[Queue, Queue][source]

Create two queue.Queue objects for use in communicating with a thurible.queued_manager() manager. This is just here for convenience, allowing you to use thurible.queued_manager() without having to import queue. It doesn’t store the queues.

Returns:

A tuple objects, containing two queue.Queue objects.

Return type:

tuple

thurible.get_terminal() Terminal[source]

Retrieve an instance of blessed.Terminal for use by thurible objects. Every time this is called, it will return the same instance, avoiding time wasting due to unnecessary Terminal object initiation.

thurible.man.to_term(text: str, width: int | None = None) str[source]

Convert man-style macros into terminal ready text.

Parameters:
  • text – A str with man troff macros.

  • width – (Optional.) The width of the terminal as a int. Defaults to None.

Returns:

The troff macros turned into a string ready to display in the terminal as a str.

Return type:

str

Usage:

To convert troff macros to terminal ready text:

>>> from thurible import man
>>> macro = '.RS 4\n.P\nThis paragraph is indented.'
>>> man.to_term(macro)
'        This paragraph is indented.\n\n'