tui-utilities 1.0.6__py3-none-any.whl → 1.0.8__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.
- tui_utilities/structure.py +110 -6
- {tui_utilities-1.0.6.dist-info → tui_utilities-1.0.8.dist-info}/METADATA +1 -1
- {tui_utilities-1.0.6.dist-info → tui_utilities-1.0.8.dist-info}/RECORD +5 -5
- {tui_utilities-1.0.6.dist-info → tui_utilities-1.0.8.dist-info}/WHEEL +0 -0
- {tui_utilities-1.0.6.dist-info → tui_utilities-1.0.8.dist-info}/top_level.txt +0 -0
tui_utilities/structure.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .console import print, input
|
|
1
|
+
from .console import print, input, clear_console
|
|
2
2
|
import sys
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
@@ -18,10 +18,57 @@ def _choose_option(
|
|
|
18
18
|
|
|
19
19
|
def menu(
|
|
20
20
|
options_list,
|
|
21
|
+
title,
|
|
22
|
+
title_color = "#ffffff",
|
|
23
|
+
title_bold = True,
|
|
24
|
+
title_italic = False,
|
|
25
|
+
title_underline = False,
|
|
26
|
+
title_strike = False,
|
|
27
|
+
title_reverse = False,
|
|
28
|
+
title_alignment = "center",
|
|
29
|
+
title_padding = 0,
|
|
30
|
+
title_top_padding = None,
|
|
31
|
+
title_right_padding = None,
|
|
32
|
+
title_bottom_padding = None,
|
|
33
|
+
title_left_padding = None,
|
|
34
|
+
separator_length = 100,
|
|
35
|
+
separator_color = "#ffffff",
|
|
36
|
+
separator_aligment = "left",
|
|
37
|
+
separator_padding = 0,
|
|
38
|
+
separator_top_padding = None,
|
|
39
|
+
separator_right_padding = None,
|
|
40
|
+
separator_bottom_padding = None,
|
|
41
|
+
separator_left_padding = None,
|
|
21
42
|
message = "Seleccione una opción:",
|
|
22
43
|
selection_text = "Su elección: ",
|
|
23
44
|
error = "La opción ingresada no es válida, intente nuevamente"
|
|
24
45
|
):
|
|
46
|
+
clear_console()
|
|
47
|
+
print(
|
|
48
|
+
object = title,
|
|
49
|
+
color = title_color,
|
|
50
|
+
bold = title_bold,
|
|
51
|
+
italic = title_italic,
|
|
52
|
+
underline = title_underline,
|
|
53
|
+
strike = title_strike,
|
|
54
|
+
reverse = title_reverse,
|
|
55
|
+
alignment = title_alignment,
|
|
56
|
+
padding = title_padding,
|
|
57
|
+
top_padding = title_top_padding,
|
|
58
|
+
right_padding = title_right_padding,
|
|
59
|
+
bottom_padding = title_bottom_padding,
|
|
60
|
+
left_padding = title_left_padding
|
|
61
|
+
)
|
|
62
|
+
separator(
|
|
63
|
+
length = separator_length,
|
|
64
|
+
color = separator_color,
|
|
65
|
+
aligment = separator_aligment,
|
|
66
|
+
padding = separator_padding,
|
|
67
|
+
top_padding = separator_top_padding,
|
|
68
|
+
right_padding = separator_right_padding,
|
|
69
|
+
bottom_padding = separator_bottom_padding,
|
|
70
|
+
left_padding = separator_left_padding
|
|
71
|
+
)
|
|
25
72
|
options = {}
|
|
26
73
|
key = 1
|
|
27
74
|
for option in options_list:
|
|
@@ -46,13 +93,70 @@ def confirm_exit(
|
|
|
46
93
|
selection = _choose_option(options, f"\n{message}", selection_text, error)
|
|
47
94
|
if selection == "1": sys.exit()
|
|
48
95
|
|
|
49
|
-
def separator(
|
|
96
|
+
def separator(
|
|
97
|
+
length = 100,
|
|
98
|
+
color = "#ffffff",
|
|
99
|
+
aligment = "left",
|
|
100
|
+
padding = 0,
|
|
101
|
+
top_padding = None,
|
|
102
|
+
right_padding = None,
|
|
103
|
+
bottom_padding = None,
|
|
104
|
+
left_padding = None
|
|
105
|
+
):
|
|
106
|
+
print(object = "/" + "-" * length + "/",
|
|
107
|
+
color = color,
|
|
108
|
+
bold = True,
|
|
109
|
+
alignment = aligment,
|
|
110
|
+
padding = padding,
|
|
111
|
+
top_padding = top_padding,
|
|
112
|
+
right_padding = right_padding,
|
|
113
|
+
bottom_padding = bottom_padding,
|
|
114
|
+
left_padding = left_padding
|
|
115
|
+
)
|
|
50
116
|
|
|
51
|
-
def error_message(
|
|
117
|
+
def error_message(
|
|
118
|
+
message,
|
|
119
|
+
error,
|
|
120
|
+
separator_length = 100,
|
|
121
|
+
separator_color = "#ffffff",
|
|
122
|
+
separator_aligment = "left",
|
|
123
|
+
separator_padding = 0,
|
|
124
|
+
separator_top_padding = None,
|
|
125
|
+
separator_right_padding = None,
|
|
126
|
+
separator_bottom_padding = None,
|
|
127
|
+
separator_left_padding = None
|
|
128
|
+
):
|
|
52
129
|
print(f"{message}\n", color = "#ff0000", bold = True)
|
|
53
|
-
separator(
|
|
130
|
+
separator(
|
|
131
|
+
length = separator_length,
|
|
132
|
+
color = separator_color,
|
|
133
|
+
aligment = separator_aligment,
|
|
134
|
+
padding = separator_padding,
|
|
135
|
+
top_padding = separator_top_padding,
|
|
136
|
+
right_padding = separator_right_padding,
|
|
137
|
+
bottom_padding = separator_bottom_padding,
|
|
138
|
+
left_padding = separator_left_padding
|
|
139
|
+
)
|
|
54
140
|
print(f"Error: {error}", bold = True)
|
|
55
|
-
separator(
|
|
141
|
+
separator(
|
|
142
|
+
length = separator_length,
|
|
143
|
+
color = separator_color,
|
|
144
|
+
aligment = separator_aligment,
|
|
145
|
+
padding = separator_padding,
|
|
146
|
+
top_padding = separator_top_padding,
|
|
147
|
+
right_padding = separator_right_padding,
|
|
148
|
+
bottom_padding = separator_bottom_padding,
|
|
149
|
+
left_padding = separator_left_padding
|
|
150
|
+
)
|
|
56
151
|
print("Detalles:\n", bold = True)
|
|
57
152
|
print(traceback.format_exc(), color = "#00bfff")
|
|
58
|
-
separator(
|
|
153
|
+
separator(
|
|
154
|
+
length = separator_length,
|
|
155
|
+
color = separator_color,
|
|
156
|
+
aligment = separator_aligment,
|
|
157
|
+
padding = separator_padding,
|
|
158
|
+
top_padding = separator_top_padding,
|
|
159
|
+
right_padding = separator_right_padding,
|
|
160
|
+
bottom_padding = separator_bottom_padding,
|
|
161
|
+
left_padding = separator_left_padding
|
|
162
|
+
)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
tui_utilities/__init__.py,sha256=8WIoKhRFLM4Bcdd7W3grDoBgfSR0HFWxTsP4ON6Il-E,775
|
|
2
2
|
tui_utilities/console.py,sha256=eOj-5nq8WqMwP7eamIDjbOpnPQU4e6XLAz0VxTaHU6g,5447
|
|
3
3
|
tui_utilities/format.py,sha256=6Ou6aeRku1Fb5Nf0tKmCgh8CIsh3sRJZogog-f5_igc,657
|
|
4
|
-
tui_utilities/structure.py,sha256=
|
|
4
|
+
tui_utilities/structure.py,sha256=V7RQme52EPetk7Y2iQXzrJ8Uxmq0xjjkrJvl8aj9pHM,5264
|
|
5
5
|
tui_utilities/validation.py,sha256=Vz-gdOj2ZlWl5j2Hf8RMymxqdJvGTD8Duq4feFcsAlM,6637
|
|
6
6
|
tui_utilities/_tlds/tlds.txt,sha256=ieHVMCtLqEoh8aiMZIZPepNdOjR3CGlO2QgH5LKCRuI,10916
|
|
7
|
-
tui_utilities-1.0.
|
|
8
|
-
tui_utilities-1.0.
|
|
9
|
-
tui_utilities-1.0.
|
|
10
|
-
tui_utilities-1.0.
|
|
7
|
+
tui_utilities-1.0.8.dist-info/METADATA,sha256=0Ny2y8C00cGL9pzh4FjkZdAC7D2lGlK7elCocRA62Tw,4249
|
|
8
|
+
tui_utilities-1.0.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
9
|
+
tui_utilities-1.0.8.dist-info/top_level.txt,sha256=TF1KuV0fMB1rkFRhqaCkqjprAnH-Tpc4Klsxwif5RWI,14
|
|
10
|
+
tui_utilities-1.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|