88# =============================================================================
99# Authors: Patrick Lehmann
1010#
11- # Python module: A set of helpers to implement a text user interface (TUI) in a terminal.
11+ # Python package: A set of helpers to implement a text user interface (TUI) in a terminal.
1212#
1313# Description:
1414# ------------------------------------
3333# SPDX-License-Identifier: Apache-2.0
3434# ============================================================================
3535#
36- from enum import Enum , unique
37-
38- from pyMetaClasses import Singleton
36+ from enum import Enum , unique
37+ import os
38+ import sys
39+ from platform import system as platform_system
3940
41+ from pydecor import export
42+ from pyMetaClasses import Singleton
4043
41- __api__ = [
42- 'Terminal' ,
43- 'Severity' ,
44- 'Line' ,
45- 'ILineTerminal' ,
46- 'LineTerminal' ,
47- ]
48- __all__ = __api__
4944
50- from platform import system as platform_system
45+ # __all__ = __api__
5146
5247
48+ @export
5349class Terminal :
5450 FATAL_EXIT_CODE = 255
5551
@@ -335,6 +331,7 @@ def ioctl_GWINSZ(fd):
335331 return (int (cr [1 ]), int (cr [0 ]))
336332
337333
334+ @export
338335@unique
339336class Severity (Enum ):
340337 """Logging message severity levels."""
@@ -361,6 +358,7 @@ def __gt__(self, other): return self.value > other.value
361358 def __ge__ (self , other ): return self .value >= other .value
362359
363360
361+ @export
364362class Line :
365363 """Represents a single line message with a severity and indentation level."""
366364
@@ -409,6 +407,7 @@ def __str__(self):
409407 return self ._LOG_MESSAGE_FORMAT__ [self ._severity ].format (message = self ._message )
410408
411409
410+ @export
412411class ILineTerminal :
413412 """A mixin class (interface) to provide class-local terminal writing methods."""
414413
@@ -502,6 +501,7 @@ def WriteDryRun(self, *args, condition=True, **kwargs):
502501 return False
503502
504503
504+ @export
505505class LineTerminal (Terminal , ILineTerminal , metaclass = Singleton ):
506506 def __init__ (self , verbose = False , debug = False , quiet = False , writeToStdOut = True ):
507507 """Initializer of a line based terminal interface."""
0 commit comments