tui-utilities 1.0.33__tar.gz → 1.1.1__tar.gz
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-1.0.33 → tui_utilities-1.1.1}/PKG-INFO +17 -3
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/README.md +16 -2
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/pyproject.toml +1 -1
- tui_utilities-1.1.1/tui_utilities/__init__.py +14 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities/console.py +1 -1
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities/structure.py +83 -9
- tui_utilities-1.1.1/tui_utilities/system.py +9 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities.egg-info/PKG-INFO +17 -3
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities.egg-info/SOURCES.txt +1 -0
- tui_utilities-1.0.33/tui_utilities/__init__.py +0 -21
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/setup.cfg +0 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities/_tlds/tlds.txt +0 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities/format.py +0 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities/validation.py +0 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities.egg-info/dependency_links.txt +0 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities.egg-info/requires.txt +0 -0
- {tui_utilities-1.0.33 → tui_utilities-1.1.1}/tui_utilities.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tui_utilities
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Personal-use console utilities library
|
|
5
5
|
Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -58,7 +58,7 @@ Styled terminal interaction built on rich:
|
|
|
58
58
|
|
|
59
59
|
- input(): styled input function built on rich, supporting text styles and automatically trimming whitespaces.
|
|
60
60
|
|
|
61
|
-
- clear_console(): clears the terminal screen
|
|
61
|
+
- clear_console(): clears the terminal screen.
|
|
62
62
|
|
|
63
63
|
- wait_for_key(): pauses execution until the user presses a key.
|
|
64
64
|
|
|
@@ -68,11 +68,13 @@ Styled terminal interaction built on rich:
|
|
|
68
68
|
|
|
69
69
|
Tools for building structures in console applications:
|
|
70
70
|
|
|
71
|
+
- header(): prints a styled header, consisting of a title and a separator.
|
|
72
|
+
|
|
71
73
|
- menu(): creates interactive selection menus with automatic numbering and special options like "Go back" and "Exit".
|
|
72
74
|
|
|
73
75
|
- confirm_exit(): confirmation dialog that exits the program safely.
|
|
74
76
|
|
|
75
|
-
- separator(): prints a
|
|
77
|
+
- separator(): prints a fully-personalized visual separator line.
|
|
76
78
|
|
|
77
79
|
- error_message(): displays formatted error information including:
|
|
78
80
|
|
|
@@ -118,6 +120,18 @@ Utilities for applying consistent formatting:
|
|
|
118
120
|
|
|
119
121
|
/----------------------------------------------------------------------------------------------------/
|
|
120
122
|
|
|
123
|
+
### System Utilities (system)
|
|
124
|
+
|
|
125
|
+
Helpers for interacting with the operating system console environment:
|
|
126
|
+
|
|
127
|
+
- set_window_title(): sets the console window title.
|
|
128
|
+
|
|
129
|
+
- maximize_window(): maximizes the console window.
|
|
130
|
+
|
|
131
|
+
- set_locale(): configures the process locale for number, date, and cultural formatting.
|
|
132
|
+
|
|
133
|
+
/----------------------------------------------------------------------------------------------------/
|
|
134
|
+
|
|
121
135
|
## Installation
|
|
122
136
|
|
|
123
137
|
pip install tui_utilities
|
|
@@ -42,7 +42,7 @@ Styled terminal interaction built on rich:
|
|
|
42
42
|
|
|
43
43
|
- input(): styled input function built on rich, supporting text styles and automatically trimming whitespaces.
|
|
44
44
|
|
|
45
|
-
- clear_console(): clears the terminal screen
|
|
45
|
+
- clear_console(): clears the terminal screen.
|
|
46
46
|
|
|
47
47
|
- wait_for_key(): pauses execution until the user presses a key.
|
|
48
48
|
|
|
@@ -52,11 +52,13 @@ Styled terminal interaction built on rich:
|
|
|
52
52
|
|
|
53
53
|
Tools for building structures in console applications:
|
|
54
54
|
|
|
55
|
+
- header(): prints a styled header, consisting of a title and a separator.
|
|
56
|
+
|
|
55
57
|
- menu(): creates interactive selection menus with automatic numbering and special options like "Go back" and "Exit".
|
|
56
58
|
|
|
57
59
|
- confirm_exit(): confirmation dialog that exits the program safely.
|
|
58
60
|
|
|
59
|
-
- separator(): prints a
|
|
61
|
+
- separator(): prints a fully-personalized visual separator line.
|
|
60
62
|
|
|
61
63
|
- error_message(): displays formatted error information including:
|
|
62
64
|
|
|
@@ -102,6 +104,18 @@ Utilities for applying consistent formatting:
|
|
|
102
104
|
|
|
103
105
|
/----------------------------------------------------------------------------------------------------/
|
|
104
106
|
|
|
107
|
+
### System Utilities (system)
|
|
108
|
+
|
|
109
|
+
Helpers for interacting with the operating system console environment:
|
|
110
|
+
|
|
111
|
+
- set_window_title(): sets the console window title.
|
|
112
|
+
|
|
113
|
+
- maximize_window(): maximizes the console window.
|
|
114
|
+
|
|
115
|
+
- set_locale(): configures the process locale for number, date, and cultural formatting.
|
|
116
|
+
|
|
117
|
+
/----------------------------------------------------------------------------------------------------/
|
|
118
|
+
|
|
105
119
|
## Installation
|
|
106
120
|
|
|
107
121
|
pip install tui_utilities
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from .console import *
|
|
2
|
+
from .structure import *
|
|
3
|
+
from .validation import *
|
|
4
|
+
from .format import *
|
|
5
|
+
from .system import *
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"print", "input", "clear_console", "wait_for_key",
|
|
9
|
+
"header", "menu", "confirm_exit", "separator", "error_message",
|
|
10
|
+
"check_if_empty", "validate_string", "validate_integer", "validate_double",
|
|
11
|
+
"validate_date", "validate_id", "validate_cellphone_number", "validate_email",
|
|
12
|
+
"decimal_format", "id_format", "cellphone_number_format",
|
|
13
|
+
"set_window_title", "maximize_window", "set_locale"
|
|
14
|
+
]
|
|
@@ -16,8 +16,7 @@ def _choose_option(
|
|
|
16
16
|
selection = input(f"\n{selection_text}", bold = True).upper()
|
|
17
17
|
return selection
|
|
18
18
|
|
|
19
|
-
def
|
|
20
|
-
options,
|
|
19
|
+
def header(
|
|
21
20
|
title,
|
|
22
21
|
title_color = "#ffffff",
|
|
23
22
|
title_bold = True,
|
|
@@ -31,17 +30,17 @@ def menu(
|
|
|
31
30
|
title_right_padding = None,
|
|
32
31
|
title_bottom_padding = None,
|
|
33
32
|
title_left_padding = None,
|
|
34
|
-
|
|
33
|
+
separator_first_character = "\\",
|
|
34
|
+
separator_separator_character = "-",
|
|
35
|
+
separator_last_character = "/",
|
|
36
|
+
separator_length = None,
|
|
35
37
|
separator_color = "#ffffff",
|
|
36
38
|
separator_aligment = "center",
|
|
37
39
|
separator_padding = 0,
|
|
38
40
|
separator_top_padding = None,
|
|
39
41
|
separator_right_padding = None,
|
|
40
42
|
separator_bottom_padding = 2,
|
|
41
|
-
separator_left_padding = None
|
|
42
|
-
message = "Seleccione una opción:",
|
|
43
|
-
selection_text = "Su elección: ",
|
|
44
|
-
error = "La opción ingresada no es válida, intente nuevamente"
|
|
43
|
+
separator_left_padding = None
|
|
45
44
|
):
|
|
46
45
|
clear_console()
|
|
47
46
|
print(
|
|
@@ -60,7 +59,10 @@ def menu(
|
|
|
60
59
|
left_padding = title_left_padding
|
|
61
60
|
)
|
|
62
61
|
separator(
|
|
63
|
-
|
|
62
|
+
first_character = separator_first_character,
|
|
63
|
+
separator_character = separator_separator_character,
|
|
64
|
+
last_character = separator_last_character,
|
|
65
|
+
length = separator_length if separator_length else len(title) + 2,
|
|
64
66
|
color = separator_color,
|
|
65
67
|
aligment = separator_aligment,
|
|
66
68
|
padding = separator_padding,
|
|
@@ -69,6 +71,63 @@ def menu(
|
|
|
69
71
|
bottom_padding = separator_bottom_padding,
|
|
70
72
|
left_padding = separator_left_padding
|
|
71
73
|
)
|
|
74
|
+
|
|
75
|
+
def menu(
|
|
76
|
+
options,
|
|
77
|
+
title,
|
|
78
|
+
title_color = "#ffffff",
|
|
79
|
+
title_bold = True,
|
|
80
|
+
title_italic = True,
|
|
81
|
+
title_underline = False,
|
|
82
|
+
title_strike = False,
|
|
83
|
+
title_reverse = False,
|
|
84
|
+
title_alignment = "center",
|
|
85
|
+
title_padding = 0,
|
|
86
|
+
title_top_padding = None,
|
|
87
|
+
title_right_padding = None,
|
|
88
|
+
title_bottom_padding = None,
|
|
89
|
+
title_left_padding = None,
|
|
90
|
+
separator_first_character = "\\",
|
|
91
|
+
separator_separator_character = "-",
|
|
92
|
+
separator_last_character = "/",
|
|
93
|
+
separator_length = None,
|
|
94
|
+
separator_color = "#ffffff",
|
|
95
|
+
separator_aligment = "center",
|
|
96
|
+
separator_padding = 0,
|
|
97
|
+
separator_top_padding = None,
|
|
98
|
+
separator_right_padding = None,
|
|
99
|
+
separator_bottom_padding = 2,
|
|
100
|
+
separator_left_padding = None,
|
|
101
|
+
message = "Seleccione una opción:",
|
|
102
|
+
selection_text = "Su elección: ",
|
|
103
|
+
error = "La opción ingresada no es válida, intente nuevamente"
|
|
104
|
+
):
|
|
105
|
+
header(
|
|
106
|
+
title = title,
|
|
107
|
+
title_color = title_color,
|
|
108
|
+
title_bold = title_bold,
|
|
109
|
+
title_italic = title_italic,
|
|
110
|
+
title_underline = title_underline,
|
|
111
|
+
title_strike = title_strike,
|
|
112
|
+
title_reverse = title_reverse,
|
|
113
|
+
title_alignment = title_alignment,
|
|
114
|
+
title_padding = title_padding,
|
|
115
|
+
title_top_padding = title_top_padding,
|
|
116
|
+
title_right_padding = title_right_padding,
|
|
117
|
+
title_bottom_padding = title_bottom_padding,
|
|
118
|
+
title_left_padding = title_left_padding,
|
|
119
|
+
separator_first_character = separator_first_character,
|
|
120
|
+
separator_separator_character = separator_separator_character,
|
|
121
|
+
separator_last_character = separator_last_character,
|
|
122
|
+
separator_length = separator_length,
|
|
123
|
+
separator_color = separator_color,
|
|
124
|
+
separator_aligment = separator_aligment,
|
|
125
|
+
separator_padding = separator_padding,
|
|
126
|
+
separator_top_padding = separator_top_padding,
|
|
127
|
+
separator_right_padding = separator_right_padding,
|
|
128
|
+
separator_bottom_padding = separator_bottom_padding,
|
|
129
|
+
separator_left_padding = separator_left_padding
|
|
130
|
+
)
|
|
72
131
|
options_dictionary = {}
|
|
73
132
|
key = 1
|
|
74
133
|
for option in options:
|
|
@@ -94,6 +153,9 @@ def confirm_exit(
|
|
|
94
153
|
if selection == "1": sys.exit()
|
|
95
154
|
|
|
96
155
|
def separator(
|
|
156
|
+
first_character = "/",
|
|
157
|
+
separator_character = "-",
|
|
158
|
+
last_character = "/",
|
|
97
159
|
length = 100,
|
|
98
160
|
color = "#ffffff",
|
|
99
161
|
aligment = "left",
|
|
@@ -103,7 +165,7 @@ def separator(
|
|
|
103
165
|
bottom_padding = None,
|
|
104
166
|
left_padding = None
|
|
105
167
|
):
|
|
106
|
-
print(
|
|
168
|
+
print(first_character + f"{separator_character * length - 2}" + last_character,
|
|
107
169
|
color = color,
|
|
108
170
|
bold = True,
|
|
109
171
|
alignment = aligment,
|
|
@@ -117,6 +179,9 @@ def separator(
|
|
|
117
179
|
def error_message(
|
|
118
180
|
message,
|
|
119
181
|
error,
|
|
182
|
+
separator_first_character = "/",
|
|
183
|
+
separator_separator_character = "-",
|
|
184
|
+
separator_last_character = "/",
|
|
120
185
|
separator_length = 100,
|
|
121
186
|
separator_color = "#ffffff",
|
|
122
187
|
separator_aligment = "left",
|
|
@@ -128,6 +193,9 @@ def error_message(
|
|
|
128
193
|
):
|
|
129
194
|
print(f"{message}\n", color = "#ff0000", bold = True)
|
|
130
195
|
separator(
|
|
196
|
+
first_character = separator_first_character,
|
|
197
|
+
separator_character = separator_separator_character,
|
|
198
|
+
last_character = separator_last_character,
|
|
131
199
|
length = separator_length,
|
|
132
200
|
color = separator_color,
|
|
133
201
|
aligment = separator_aligment,
|
|
@@ -139,6 +207,9 @@ def error_message(
|
|
|
139
207
|
)
|
|
140
208
|
print(f"Error: {error}", bold = True)
|
|
141
209
|
separator(
|
|
210
|
+
first_character = separator_first_character,
|
|
211
|
+
separator_character = separator_separator_character,
|
|
212
|
+
last_character = separator_last_character,
|
|
142
213
|
length = separator_length,
|
|
143
214
|
color = separator_color,
|
|
144
215
|
aligment = separator_aligment,
|
|
@@ -151,6 +222,9 @@ def error_message(
|
|
|
151
222
|
print("Detalles:\n", bold = True)
|
|
152
223
|
print(traceback.format_exc(), color = "#00bfff")
|
|
153
224
|
separator(
|
|
225
|
+
first_character = separator_first_character,
|
|
226
|
+
separator_character = separator_separator_character,
|
|
227
|
+
last_character = separator_last_character,
|
|
154
228
|
length = separator_length,
|
|
155
229
|
color = separator_color,
|
|
156
230
|
aligment = separator_aligment,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import ctypes
|
|
3
|
+
import locale
|
|
4
|
+
|
|
5
|
+
def set_window_title(title): os.system(f"title {title}")
|
|
6
|
+
|
|
7
|
+
def maximize_window(): ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 3)
|
|
8
|
+
|
|
9
|
+
def set_locale(locale_identifier = "es_AR.UTF-8"): locale.setlocale(locale.LC_ALL, locale_identifier)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tui_utilities
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Personal-use console utilities library
|
|
5
5
|
Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -58,7 +58,7 @@ Styled terminal interaction built on rich:
|
|
|
58
58
|
|
|
59
59
|
- input(): styled input function built on rich, supporting text styles and automatically trimming whitespaces.
|
|
60
60
|
|
|
61
|
-
- clear_console(): clears the terminal screen
|
|
61
|
+
- clear_console(): clears the terminal screen.
|
|
62
62
|
|
|
63
63
|
- wait_for_key(): pauses execution until the user presses a key.
|
|
64
64
|
|
|
@@ -68,11 +68,13 @@ Styled terminal interaction built on rich:
|
|
|
68
68
|
|
|
69
69
|
Tools for building structures in console applications:
|
|
70
70
|
|
|
71
|
+
- header(): prints a styled header, consisting of a title and a separator.
|
|
72
|
+
|
|
71
73
|
- menu(): creates interactive selection menus with automatic numbering and special options like "Go back" and "Exit".
|
|
72
74
|
|
|
73
75
|
- confirm_exit(): confirmation dialog that exits the program safely.
|
|
74
76
|
|
|
75
|
-
- separator(): prints a
|
|
77
|
+
- separator(): prints a fully-personalized visual separator line.
|
|
76
78
|
|
|
77
79
|
- error_message(): displays formatted error information including:
|
|
78
80
|
|
|
@@ -118,6 +120,18 @@ Utilities for applying consistent formatting:
|
|
|
118
120
|
|
|
119
121
|
/----------------------------------------------------------------------------------------------------/
|
|
120
122
|
|
|
123
|
+
### System Utilities (system)
|
|
124
|
+
|
|
125
|
+
Helpers for interacting with the operating system console environment:
|
|
126
|
+
|
|
127
|
+
- set_window_title(): sets the console window title.
|
|
128
|
+
|
|
129
|
+
- maximize_window(): maximizes the console window.
|
|
130
|
+
|
|
131
|
+
- set_locale(): configures the process locale for number, date, and cultural formatting.
|
|
132
|
+
|
|
133
|
+
/----------------------------------------------------------------------------------------------------/
|
|
134
|
+
|
|
121
135
|
## Installation
|
|
122
136
|
|
|
123
137
|
pip install tui_utilities
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from .console import print, input, clear_console, wait_for_key
|
|
2
|
-
from .structure import menu, confirm_exit, separator, error_message
|
|
3
|
-
from .validation import (
|
|
4
|
-
check_if_empty,
|
|
5
|
-
validate_string,
|
|
6
|
-
validate_integer,
|
|
7
|
-
validate_double,
|
|
8
|
-
validate_date,
|
|
9
|
-
validate_id,
|
|
10
|
-
validate_cellphone_number,
|
|
11
|
-
validate_email,
|
|
12
|
-
)
|
|
13
|
-
from .format import decimal_format, id_format, cellphone_number_format
|
|
14
|
-
|
|
15
|
-
__all__ = [
|
|
16
|
-
"print", "input", "clear_console", "wait_for_key",
|
|
17
|
-
"menu", "confirm_exit", "separator", "error_message",
|
|
18
|
-
"check_if_empty", "validate_string", "validate_integer", "validate_double",
|
|
19
|
-
"validate_date", "validate_id", "validate_cellphone_number", "validate_email",
|
|
20
|
-
"decimal_format", "id_format", "cellphone_number_format",
|
|
21
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|