gui-utilities 1.0.0__py3-none-any.whl → 1.1.0__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 gui-utilities might be problematic. Click here for more details.
- gui_utilities/gui_utilities.py +107 -19
- {gui_utilities-1.0.0.dist-info → gui_utilities-1.1.0.dist-info}/METADATA +1 -1
- {gui_utilities-1.0.0.dist-info → gui_utilities-1.1.0.dist-info}/RECORD +6 -6
- {gui_utilities-1.0.0.dist-info → gui_utilities-1.1.0.dist-info}/WHEEL +0 -0
- {gui_utilities-1.0.0.dist-info → gui_utilities-1.1.0.dist-info}/licenses/LICENSE +0 -0
- {gui_utilities-1.0.0.dist-info → gui_utilities-1.1.0.dist-info}/top_level.txt +0 -0
gui_utilities/gui_utilities.py
CHANGED
|
@@ -18,8 +18,96 @@ def create_window(title, background_color = "#1e1e1e"):
|
|
|
18
18
|
window.setLayout(main_layout)
|
|
19
19
|
return window
|
|
20
20
|
|
|
21
|
+
def create_form(
|
|
22
|
+
ui_instance,
|
|
23
|
+
buttons,
|
|
24
|
+
title,
|
|
25
|
+
title_font_family = "Segoe UI",
|
|
26
|
+
title_font_size = 36,
|
|
27
|
+
title_font_color = "#ffffff",
|
|
28
|
+
title_background_color = "#1e1e1e",
|
|
29
|
+
title_padding = 15,
|
|
30
|
+
title_border_width = 0,
|
|
31
|
+
title_border_color = "#ffffff",
|
|
32
|
+
title_border_radius = 0
|
|
33
|
+
):
|
|
34
|
+
main_layout = QVBoxLayout()
|
|
35
|
+
main_layout.setContentsMargins(25, 25, 25, 25)
|
|
36
|
+
main_layout.addLayout(create_title(
|
|
37
|
+
text = title,
|
|
38
|
+
font_family = title_font_family,
|
|
39
|
+
font_size = title_font_size,
|
|
40
|
+
font_color = title_font_color,
|
|
41
|
+
background_color = title_background_color,
|
|
42
|
+
padding = title_padding,
|
|
43
|
+
border_width = title_border_width,
|
|
44
|
+
border_color = title_border_color,
|
|
45
|
+
border_radius = title_border_radius
|
|
46
|
+
))
|
|
47
|
+
body_layout = QHBoxLayout()
|
|
48
|
+
main_layout.addLayout(body_layout)
|
|
49
|
+
body_layout.setSpacing(25)
|
|
50
|
+
menu_layout = QVBoxLayout()
|
|
51
|
+
body_layout.addLayout(menu_layout)
|
|
52
|
+
menu_layout.setSpacing(10)
|
|
53
|
+
normal_buttons = []
|
|
54
|
+
special_buttons = []
|
|
55
|
+
for button_properties in buttons:
|
|
56
|
+
if button_properties.get("text") in ["Atrás", "Salir"]: special_buttons.append(button_properties)
|
|
57
|
+
else: normal_buttons.append(button_properties)
|
|
58
|
+
for button_properties in normal_buttons:
|
|
59
|
+
button_properties_copy = button_properties.copy()
|
|
60
|
+
callback = button_properties_copy.pop("callback", None)
|
|
61
|
+
button = create_button(**button_properties_copy)
|
|
62
|
+
if callback: button.clicked.connect(callback)
|
|
63
|
+
menu_layout.addWidget(button)
|
|
64
|
+
menu_layout.addStretch()
|
|
65
|
+
for button_properties in special_buttons:
|
|
66
|
+
button_properties_copy = button_properties.copy()
|
|
67
|
+
callback = button_properties_copy.pop("callback", None)
|
|
68
|
+
button_properties_copy.setdefault("font_size", 16)
|
|
69
|
+
button = create_button(**button_properties_copy)
|
|
70
|
+
if callback: button.clicked.connect(callback)
|
|
71
|
+
menu_layout.addWidget(button)
|
|
72
|
+
ui_instance.form_widget = QWidget()
|
|
73
|
+
ui_instance.form_widget.setLayout(QVBoxLayout())
|
|
74
|
+
body_layout.addWidget(ui_instance.form_widget)
|
|
75
|
+
ui_instance.form_widget.setStyleSheet("background-color: #333333;")
|
|
76
|
+
body_layout.setStretch(0, 1)
|
|
77
|
+
body_layout.setStretch(1, 4)
|
|
78
|
+
return main_layout
|
|
79
|
+
|
|
80
|
+
def create_title(
|
|
81
|
+
text,
|
|
82
|
+
font_family = "Segoe UI",
|
|
83
|
+
font_size = 36,
|
|
84
|
+
font_color = "#ffffff",
|
|
85
|
+
background_color = "#1e1e1e",
|
|
86
|
+
padding = 15,
|
|
87
|
+
border_width = 0,
|
|
88
|
+
border_color = "#ffffff",
|
|
89
|
+
border_radius = 0
|
|
90
|
+
):
|
|
91
|
+
title_layout = QHBoxLayout()
|
|
92
|
+
title_layout.setContentsMargins(0, 0, 0, 25)
|
|
93
|
+
title_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
94
|
+
title_label = create_label(
|
|
95
|
+
text = text,
|
|
96
|
+
font_family = font_family,
|
|
97
|
+
font_size = font_size,
|
|
98
|
+
font_color = font_color,
|
|
99
|
+
font_weight = "bold",
|
|
100
|
+
background_color = background_color,
|
|
101
|
+
padding = padding,
|
|
102
|
+
border_width = border_width,
|
|
103
|
+
border_color = border_color,
|
|
104
|
+
border_radius = border_radius
|
|
105
|
+
)
|
|
106
|
+
title_layout.addWidget(title_label)
|
|
107
|
+
return title_layout
|
|
108
|
+
|
|
21
109
|
def create_label(
|
|
22
|
-
|
|
110
|
+
text,
|
|
23
111
|
font_family = "Segoe UI",
|
|
24
112
|
font_size = 14,
|
|
25
113
|
font_color = "#ffffff",
|
|
@@ -30,7 +118,7 @@ def create_label(
|
|
|
30
118
|
border_color = "#ffffff",
|
|
31
119
|
border_radius = 0
|
|
32
120
|
):
|
|
33
|
-
label = QLabel(
|
|
121
|
+
label = QLabel(text)
|
|
34
122
|
style = f"""
|
|
35
123
|
font-family: {font_family};
|
|
36
124
|
font-size: {font_size}px;
|
|
@@ -45,7 +133,7 @@ def create_label(
|
|
|
45
133
|
return label
|
|
46
134
|
|
|
47
135
|
def create_button(
|
|
48
|
-
|
|
136
|
+
text,
|
|
49
137
|
font_family = "Segoe UI",
|
|
50
138
|
font_size = 14,
|
|
51
139
|
font_color = "#ffffff",
|
|
@@ -66,7 +154,7 @@ def create_button(
|
|
|
66
154
|
disabled_border_width = 2,
|
|
67
155
|
disabled_border_color = "#4a4a4a"
|
|
68
156
|
):
|
|
69
|
-
button = QPushButton(
|
|
157
|
+
button = QPushButton(text)
|
|
70
158
|
style_sheet = f"""
|
|
71
159
|
QPushButton {{
|
|
72
160
|
font-family: {font_family};
|
|
@@ -266,7 +354,7 @@ def create_combo_box(
|
|
|
266
354
|
return combo_box
|
|
267
355
|
|
|
268
356
|
def create_information_message_box(
|
|
269
|
-
|
|
357
|
+
text,
|
|
270
358
|
top_margin = 25,
|
|
271
359
|
bottom_margin = 25,
|
|
272
360
|
left_margin = 25,
|
|
@@ -283,7 +371,7 @@ def create_information_message_box(
|
|
|
283
371
|
label_border_width = 0,
|
|
284
372
|
label_border_color = "#ffffff",
|
|
285
373
|
label_border_radius = 0,
|
|
286
|
-
|
|
374
|
+
button_text = "Aceptar",
|
|
287
375
|
button_font_family = "Segoe UI",
|
|
288
376
|
button_font_size = 14,
|
|
289
377
|
button_font_color = "#ffffff",
|
|
@@ -319,8 +407,8 @@ def create_information_message_box(
|
|
|
319
407
|
message_box.setLayout(main_layout)
|
|
320
408
|
main_layout.setContentsMargins(left_margin, top_margin, right_margin, bottom_margin)
|
|
321
409
|
main_layout.setSpacing(spacing)
|
|
322
|
-
|
|
323
|
-
|
|
410
|
+
text_label = create_label(
|
|
411
|
+
text = text,
|
|
324
412
|
font_family = label_font_family,
|
|
325
413
|
font_size = label_font_size,
|
|
326
414
|
font_color= label_font_color,
|
|
@@ -330,10 +418,10 @@ def create_information_message_box(
|
|
|
330
418
|
border_color = label_border_color,
|
|
331
419
|
border_radius = label_border_radius
|
|
332
420
|
)
|
|
333
|
-
main_layout.addWidget(
|
|
421
|
+
main_layout.addWidget(text_label)
|
|
334
422
|
|
|
335
423
|
accept_button = create_button(
|
|
336
|
-
|
|
424
|
+
text = button_text,
|
|
337
425
|
font_family = button_font_family,
|
|
338
426
|
font_size = button_font_size,
|
|
339
427
|
font_color = button_font_color,
|
|
@@ -358,7 +446,7 @@ def create_information_message_box(
|
|
|
358
446
|
return message_box
|
|
359
447
|
|
|
360
448
|
def create_confirmation_message_box(
|
|
361
|
-
|
|
449
|
+
text,
|
|
362
450
|
top_margin = 25,
|
|
363
451
|
bottom_margin = 25,
|
|
364
452
|
left_margin = 25,
|
|
@@ -411,10 +499,10 @@ def create_confirmation_message_box(
|
|
|
411
499
|
confirm_message_box.setLayout(main_layout)
|
|
412
500
|
main_layout.setContentsMargins(left_margin, top_margin, right_margin, bottom_margin)
|
|
413
501
|
main_layout.setSpacing(main_spacing)
|
|
414
|
-
|
|
415
|
-
main_layout.addLayout(
|
|
416
|
-
|
|
417
|
-
|
|
502
|
+
text_layout = QHBoxLayout()
|
|
503
|
+
main_layout.addLayout(text_layout)
|
|
504
|
+
text_label = create_label(
|
|
505
|
+
text = text,
|
|
418
506
|
font_family = label_font_family,
|
|
419
507
|
font_size = label_font_size,
|
|
420
508
|
font_color = label_font_color,
|
|
@@ -424,12 +512,12 @@ def create_confirmation_message_box(
|
|
|
424
512
|
border_color = label_border_color,
|
|
425
513
|
border_radius = label_border_radius
|
|
426
514
|
)
|
|
427
|
-
|
|
515
|
+
text_layout.addWidget(text_label)
|
|
428
516
|
buttons_layout = QHBoxLayout()
|
|
429
517
|
main_layout.addLayout(buttons_layout)
|
|
430
518
|
buttons_layout.setSpacing(button_spacing)
|
|
431
519
|
confirm_button = create_button(
|
|
432
|
-
|
|
520
|
+
text = "Sí",
|
|
433
521
|
font_family = button_font_family,
|
|
434
522
|
font_size = button_font_size,
|
|
435
523
|
font_color = button_font_color,
|
|
@@ -452,7 +540,7 @@ def create_confirmation_message_box(
|
|
|
452
540
|
buttons_layout.addWidget(confirm_button)
|
|
453
541
|
confirm_button.clicked.connect(confirm_message_box.accept)
|
|
454
542
|
decline_button = create_button(
|
|
455
|
-
|
|
543
|
+
text = "No",
|
|
456
544
|
font_family = button_font_family,
|
|
457
545
|
font_size = button_font_size,
|
|
458
546
|
font_color = button_font_color,
|
|
@@ -509,7 +597,7 @@ def confirm_exit(
|
|
|
509
597
|
button_disabled_border_color = "#4a4a4a"
|
|
510
598
|
):
|
|
511
599
|
confirmation_message_box = create_confirmation_message_box(
|
|
512
|
-
|
|
600
|
+
text = "¿Está seguro de querer salir del programa?",
|
|
513
601
|
background_color = background_color,
|
|
514
602
|
border_width = border_width,
|
|
515
603
|
border_color = border_color,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
gui_utilities/gui_utilities.py,sha256=
|
|
1
|
+
gui_utilities/gui_utilities.py,sha256=EfG8zxrwFWc-cmfCwB9tEFoRKh7OK2vVjg-4QaMN3lg,28165
|
|
2
2
|
gui_utilities/icons/focused_hide_text_icon.png,sha256=0Ysx7vC-mEVfuSBWx1Zw-UhpqvrTCcIvnQ926wFmuK4,13084
|
|
3
3
|
gui_utilities/icons/focused_show_text_icon.png,sha256=gmZU7RR4FN-9VSzpD00ZkQ8UGbihO2y808Kh3b_TaEg,6739
|
|
4
4
|
gui_utilities/icons/hide_text_icon.png,sha256=f5jq6KaAygWNjzP_Ah6dw6eu8q5ml3m56JTeNSTSgEU,7207
|
|
5
5
|
gui_utilities/icons/show_text_icon.png,sha256=8Vdp2XickPEM-eTb1-qBXf3qmHldSzllMZZfObir9p8,5376
|
|
6
6
|
gui_utilities/tlds/tlds_list.txt,sha256=wIWmAQGVNsY0ZJy7qPW8kItDTCE4PTq8wcUhC2hpjkw,10916
|
|
7
|
-
gui_utilities-1.
|
|
8
|
-
gui_utilities-1.
|
|
9
|
-
gui_utilities-1.
|
|
10
|
-
gui_utilities-1.
|
|
11
|
-
gui_utilities-1.
|
|
7
|
+
gui_utilities-1.1.0.dist-info/licenses/LICENSE,sha256=NNoMFs43kWl1J-aqq7_EsPlBjL5XTccWjZlwrlCR-Xc,1093
|
|
8
|
+
gui_utilities-1.1.0.dist-info/METADATA,sha256=AHfq2NN6eQi8jEq8k2u2DHcmQpw4YIiTa-tnl7rHsBQ,265
|
|
9
|
+
gui_utilities-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
gui_utilities-1.1.0.dist-info/top_level.txt,sha256=c4C84nMT41keiX9b1AJJZDBU3kA38c7vOmP9kDie8Lk,14
|
|
11
|
+
gui_utilities-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|