tui-utilities 1.1.4__py3-none-any.whl → 1.1.6__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,7 +20,8 @@ def _style(
20
20
  top_padding = None,
21
21
  right_padding = None,
22
22
  bottom_padding = None,
23
- left_padding = None
23
+ left_padding = None,
24
+ plain_text = False
24
25
  ):
25
26
  def apply_text_styles(object):
26
27
  styleable = Text()
@@ -73,15 +74,21 @@ def _style(
73
74
  )
74
75
  return Padding(paddable, final_padding)
75
76
 
77
+ needs_layout = (
78
+ alignment is not None or
79
+ padding is not None or
80
+ top_padding is not None or
81
+ right_padding is not None or
82
+ bottom_padding is not None or
83
+ left_padding is not None
84
+ )
76
85
  if isinstance(object, (str, list)):
77
86
  styled = apply_text_styles(object)
78
- aligned = apply_alignment(styled)
79
- padded = apply_padding(aligned)
80
- return padded
87
+ if not needs_layout: return styled
88
+ return apply_padding(apply_alignment(styled))
81
89
  if isinstance(object, RenderableType):
82
- aligned = apply_alignment(object)
83
- padded = apply_padding(aligned)
84
- return padded
90
+ if not needs_layout: return object
91
+ return apply_padding(apply_alignment(object))
85
92
  styled = apply_text_styles(str(object))
86
93
  aligned = apply_alignment(styled)
87
94
  padded = apply_padding(aligned)
@@ -103,6 +110,7 @@ def print(
103
110
  left_padding = None,
104
111
  separator = " ",
105
112
  end = "\n",
113
+ plain_text = False,
106
114
  **kwargs
107
115
  ):
108
116
  renderables = []
@@ -120,7 +128,8 @@ def print(
120
128
  top_padding = top_padding,
121
129
  right_padding = right_padding,
122
130
  bottom_padding = bottom_padding,
123
- left_padding = left_padding
131
+ left_padding = left_padding,
132
+ plain_text = plain_text
124
133
  ))
125
134
  _console.print(*renderables, sep = separator, end = end, **kwargs)
126
135
 
@@ -140,7 +149,8 @@ def input(
140
149
  italic = italic,
141
150
  underline = underline,
142
151
  strike = strike,
143
- reverse = reverse
152
+ reverse = reverse,
153
+ plain_text = True
144
154
  )).strip()
145
155
 
146
156
  def clear_console(): os.system("cls")
@@ -158,7 +168,8 @@ def wait_for_key(
158
168
  top_padding = None,
159
169
  right_padding = None,
160
170
  bottom_padding = None,
161
- left_padding = None
171
+ left_padding = None,
172
+ plain_text = True
162
173
  ):
163
174
  print(
164
175
  f"\n{text}",
@@ -174,6 +185,7 @@ def wait_for_key(
174
185
  right_padding = right_padding,
175
186
  bottom_padding = bottom_padding,
176
187
  left_padding = left_padding,
177
- end = ""
188
+ end = "",
189
+ plain_text = plain_text
178
190
  )
179
191
  readchar.readkey()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.1.4
3
+ Version: 1.1.6
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=XdDhDFv3ygRbjVTDVIac_sNduV7dANF3kbET2-XWEII,5763
2
+ tui_utilities/console.py,sha256=Vnt5bJIjqdwc3It2aw8xLX5rU_v8-n8-pxu94XvFJcA,6163
3
3
  tui_utilities/format.py,sha256=6Ou6aeRku1Fb5Nf0tKmCgh8CIsh3sRJZogog-f5_igc,657
4
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.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,,
8
+ tui_utilities-1.1.6.dist-info/METADATA,sha256=6cp6yBbGBTuSK1vbr1iUcUwBVz0rSx7mxHKolnTDkZ4,4727
9
+ tui_utilities-1.1.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
+ tui_utilities-1.1.6.dist-info/top_level.txt,sha256=TF1KuV0fMB1rkFRhqaCkqjprAnH-Tpc4Klsxwif5RWI,14
11
+ tui_utilities-1.1.6.dist-info/RECORD,,