tui-utilities 1.1.2__py3-none-any.whl → 1.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tui-utilities might be problematic. Click here for more details.

tui_utilities/console.py CHANGED
@@ -20,8 +20,7 @@ def _style(
20
20
  top_padding = None,
21
21
  right_padding = None,
22
22
  bottom_padding = None,
23
- left_padding = None,
24
- plain_text = False
23
+ left_padding = None
25
24
  ):
26
25
  def apply_text_styles(object):
27
26
  styleable = Text()
@@ -74,9 +73,6 @@ def _style(
74
73
  )
75
74
  return Padding(paddable, final_padding)
76
75
 
77
- if plain_text:
78
- styled = apply_text_styles(object)
79
- return styled
80
76
  if isinstance(object, (str, list)):
81
77
  styled = apply_text_styles(object)
82
78
  aligned = apply_alignment(styled)
@@ -99,15 +95,14 @@ def print(
99
95
  underline = False,
100
96
  strike = False,
101
97
  reverse = False,
102
- alignment = "left",
103
- padding = 0,
98
+ alignment = None,
99
+ padding = None,
104
100
  top_padding = None,
105
101
  right_padding = None,
106
102
  bottom_padding = None,
107
103
  left_padding = None,
108
104
  separator = " ",
109
105
  end = "\n",
110
- plain_text = False,
111
106
  **kwargs
112
107
  ):
113
108
  renderables = []
@@ -125,8 +120,7 @@ def print(
125
120
  top_padding = top_padding,
126
121
  right_padding = right_padding,
127
122
  bottom_padding = bottom_padding,
128
- left_padding = left_padding,
129
- plain_text = plain_text
123
+ left_padding = left_padding
130
124
  ))
131
125
  _console.print(*renderables, sep = separator, end = end, **kwargs)
132
126
 
@@ -146,8 +140,7 @@ def input(
146
140
  italic = italic,
147
141
  underline = underline,
148
142
  strike = strike,
149
- reverse = reverse,
150
- plain_text = True
143
+ reverse = reverse
151
144
  )).strip()
152
145
 
153
146
  def clear_console(): os.system("cls")
@@ -165,8 +158,7 @@ def wait_for_key(
165
158
  top_padding = None,
166
159
  right_padding = None,
167
160
  bottom_padding = None,
168
- left_padding = None,
169
- plain_text = True
161
+ left_padding = None
170
162
  ):
171
163
  print(
172
164
  f"\n{text}",
@@ -182,7 +174,6 @@ def wait_for_key(
182
174
  right_padding = right_padding,
183
175
  bottom_padding = bottom_padding,
184
176
  left_padding = left_padding,
185
- end = "",
186
- plain_text = plain_text
177
+ end = ""
187
178
  )
188
179
  readchar.readkey()
@@ -2,6 +2,11 @@ from .console import print, input, clear_console
2
2
  import sys
3
3
  import traceback
4
4
 
5
+ def _total_characters(object):
6
+ if isinstance(object, str): return len(object)
7
+ if isinstance(object, list): return sum(len(segment) for segment, _ in object)
8
+ return len(str(object))
9
+
5
10
  def _choose_option(
6
11
  options,
7
12
  message = "Seleccione una opción:",
@@ -62,7 +67,7 @@ def header(
62
67
  first_character = separator_first_character,
63
68
  separator_character = separator_separator_character,
64
69
  last_character = separator_last_character,
65
- length = separator_length if separator_length else len(title) + 2,
70
+ length = separator_length if separator_length else _total_characters(title) + 2,
66
71
  color = separator_color,
67
72
  aligment = separator_aligment,
68
73
  padding = separator_padding,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: Personal-use console utilities library
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  License: MIT
@@ -1,11 +1,11 @@
1
1
  tui_utilities/__init__.py,sha256=zL2dBAmn6OgjnkjP7ABpgTaivse9WhCj_sQl2W3H0Uw,549
2
- tui_utilities/console.py,sha256=3p3VVzWOAjxzvoYK3P05ZlC7f7zdxocPim8vxbN5fjw,6023
2
+ tui_utilities/console.py,sha256=XdDhDFv3ygRbjVTDVIac_sNduV7dANF3kbET2-XWEII,5763
3
3
  tui_utilities/format.py,sha256=6Ou6aeRku1Fb5Nf0tKmCgh8CIsh3sRJZogog-f5_igc,657
4
- tui_utilities/structure.py,sha256=ctICJOkv5aMM6nP34f6snJSDP_fEsnfEpg18wrScUA4,8331
4
+ tui_utilities/structure.py,sha256=DTNCopWHbURvWduDC1pP1JDjBL5B4bNu3NCzvTk8vHs,8544
5
5
  tui_utilities/system.py,sha256=KGkEg11zlH18FiQsuywgW0Ls7aiPlvgJr7tDsQMJCBo,308
6
6
  tui_utilities/validation.py,sha256=DGaVjTiLAsdG3wFIuiYWg9vRZZ5R0OgBB8cxWg-riZ8,6502
7
7
  tui_utilities/_tlds/tlds.txt,sha256=ieHVMCtLqEoh8aiMZIZPepNdOjR3CGlO2QgH5LKCRuI,10916
8
- tui_utilities-1.1.2.dist-info/METADATA,sha256=mwiE_J6RndyBDSs6XcpH4OF60Mfi2mF1qqNncgLKP7M,4727
9
- tui_utilities-1.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
- tui_utilities-1.1.2.dist-info/top_level.txt,sha256=TF1KuV0fMB1rkFRhqaCkqjprAnH-Tpc4Klsxwif5RWI,14
11
- tui_utilities-1.1.2.dist-info/RECORD,,
8
+ tui_utilities-1.1.4.dist-info/METADATA,sha256=Lr5eiPR0ByxPOeBZmaKnViy3pPtO1M1klzkej4XHGu0,4727
9
+ tui_utilities-1.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
+ tui_utilities-1.1.4.dist-info/top_level.txt,sha256=TF1KuV0fMB1rkFRhqaCkqjprAnH-Tpc4Klsxwif5RWI,14
11
+ tui_utilities-1.1.4.dist-info/RECORD,,