glxviewer package
Module contents
-
class glxviewer.Viewer(*args, **kw)[source]
Bases: object
The class viewer
-
property allowed_colors
Allowed colors:
ORANGE, RED, RED2, YELLOW, YELLOW2, WHITE, WHITE2, CYAN, GREEN, GREEN2
Note that Upper, Lower, Tittle case are allowed
- Returns:
A list of allowed colors
- Return type:
list
-
static flush_a_new_line()[source]
-
property formatted_date
-
instance = <glxviewer.viewer.Viewer object>
-
property status_symbol
Property it stores a symbol of one letter. like ! > < / - | generally for show you application fo something.
its thing exist that because I use it for show if that an input or output message.
Actually the symbol use CYAN color, and have 1 space character on the final template. Certainly something it can
be improved. Will see in future need’s …
- Returns:
status_symbol character
- Return type:
str
-
property status_text
Property it stores text of the status text like “DEBUG” “LOAD”
Later the Viewer will add bracket’s around it text, and set the color during display post-processing.
see: status_text_color property
- Returns:
status_text property value
- Return type:
str
-
property status_text_color
Property it stores one allowed color value, it values will be used to display status_text color.
see: status_text property for more details
- Returns:
the status_text_color property value
- Return type:
str
-
property text_column_1
Property it stores text_column_1 value. Its value is use by template for display the column 1
- Returns:
The text_column_1 value
- Return type:
str
-
property text_column_2
Property it stores text_column_2 value. Its value is use by template for display the column 2
- Returns:
The text_column_2 value
- Return type:
str
-
property text_column_3
Property it stores text_column_3 value. Its value is use by template for display the column 3
- Returns:
The text_column_3 value
- Return type:
str
-
property with_date
Property use for show date
- Returns:
with date property value
- Return type:
str
-
write(with_date=None, status_text=None, status_text_color=None, status_symbol=' ', column_1=None, column_2=None, column_3=None, prompt=None)[source]
Flush a line a bit like you want
- Parameters:
with_date (bool) – show date if True
status_text (str) – The text to display ton the status part
status_text_color (str) – allowed : BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE
status_symbol (str or None) – A symbol like >, in general that a one char string
column_1 (str or None) – The thing to print in column 1
column_2 (str or None) – The thing to print in column 2
column_3 (str or None) – The thing to print in column 3
prompt (None, -1, +1) – Add a new line if True
-
glxviewer.bracket_text(text=None, symbol_inner='[', symbol_outer=']')[source]
Surround a text with an inner and outer char.
Not you should center you text with center_text()before call it function
- Parameters:
symbol_inner (str) – the symbol to use for as inner, generally that ‘[’, ‘<’, ‘(’
symbol_outer (str) – the symbol to use for as outer, generally that ‘]’, ‘>’, ‘)’
text (str) – the text it will be sur surround by the inner and outer chars
- Returns:
the text surrounded by inner and outer
- Return type:
str
-
glxviewer.center_text(text=None, max_width=None)[source]
Return a centred text from max_width, if max_width is None it will use the terminal width size.
example:
center_text(text=”DLA”, max_width=5) return “ DLA “
- Parameters:
-
- Returns:
the centred text
- Return type:
str
-
glxviewer.resize_text(text=None, max_width=0, separator='~')[source]
Resize the text , and return a new text
example: return ‘123~789’ for ‘123456789’ where max_width = 7 or 8
- Parameters:
text (str) – the original text to resize
max_width (int) – the size of the text
separator (str) – a separator an in middle of the resize text
- Returns:
a resize text
- Return type:
str
|