gui-utilities 1.2.18__tar.gz → 1.3.4__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.
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/PKG-INFO +1 -1
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities/gui_utilities.py +97 -135
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities.egg-info/PKG-INFO +1 -1
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/pyproject.toml +1 -1
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/LICENSE +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/README.md +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities/icons/focused_hide_text_icon.png +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities/icons/focused_show_text_icon.png +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities/icons/hide_text_icon.png +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities/icons/show_text_icon.png +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities/tlds/tlds_list.txt +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities.egg-info/SOURCES.txt +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities.egg-info/dependency_links.txt +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities.egg-info/requires.txt +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/gui_utilities.egg-info/top_level.txt +0 -0
- {gui_utilities-1.2.18 → gui_utilities-1.3.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from PyQt6.QtCore import Qt, QObject, QEvent, QSize
|
|
2
|
-
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QLineEdit, QComboBox, QDialog, QToolButton, QWidgetAction, QCheckBox, QTableWidget, QHeaderView
|
|
3
|
-
from PyQt6.QtGui import QIcon
|
|
2
|
+
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QLineEdit, QComboBox, QDialog, QToolButton, QWidgetAction, QCheckBox, QTableWidget, QHeaderView
|
|
3
|
+
from PyQt6.QtGui import QIcon, QFont, QFontMetrics
|
|
4
4
|
import re
|
|
5
5
|
import requests
|
|
6
6
|
import importlib.resources
|
|
@@ -27,10 +27,10 @@ def create_form(
|
|
|
27
27
|
title_font_color = "#ffffff",
|
|
28
28
|
title_background_color = "#1e1e1e",
|
|
29
29
|
title_padding = 15,
|
|
30
|
+
title_padding_left = None,
|
|
30
31
|
title_padding_top = None,
|
|
31
32
|
title_padding_right = None,
|
|
32
33
|
title_padding_bottom = None,
|
|
33
|
-
title_padding_left = None,
|
|
34
34
|
title_border_width = 0,
|
|
35
35
|
title_border_color = "#ffffff",
|
|
36
36
|
title_border_radius = 0
|
|
@@ -44,10 +44,10 @@ def create_form(
|
|
|
44
44
|
font_color = title_font_color,
|
|
45
45
|
background_color = title_background_color,
|
|
46
46
|
padding = title_padding,
|
|
47
|
+
padding_left = title_padding_left,
|
|
47
48
|
padding_top = title_padding_top,
|
|
48
49
|
padding_right = title_padding_right,
|
|
49
50
|
padding_bottom = title_padding_bottom,
|
|
50
|
-
padding_left = title_padding_left,
|
|
51
51
|
border_width = title_border_width,
|
|
52
52
|
border_color = title_border_color,
|
|
53
53
|
border_radius = title_border_radius
|
|
@@ -85,6 +85,46 @@ def create_form(
|
|
|
85
85
|
body_layout.setStretch(1, 4)
|
|
86
86
|
return main_layout
|
|
87
87
|
|
|
88
|
+
def create_header(
|
|
89
|
+
title,
|
|
90
|
+
margin_left = 25,
|
|
91
|
+
margin_top = 25,
|
|
92
|
+
margin_right = 25,
|
|
93
|
+
margin_bottom = 25,
|
|
94
|
+
title_font_family = "Segoe UI",
|
|
95
|
+
title_font_size = 36,
|
|
96
|
+
title_font_color = "#ffffff",
|
|
97
|
+
title_background_color = "#1e1e1e",
|
|
98
|
+
title_padding = 15,
|
|
99
|
+
title_padding_left = None,
|
|
100
|
+
title_padding_top = None,
|
|
101
|
+
title_padding_right = None,
|
|
102
|
+
title_padding_bottom = None,
|
|
103
|
+
title_border_width = 0,
|
|
104
|
+
title_border_color = "#ffffff",
|
|
105
|
+
title_border_radius = 0
|
|
106
|
+
):
|
|
107
|
+
main_layout = QVBoxLayout()
|
|
108
|
+
main_layout.setContentsMargins(margin_left, margin_top, margin_right, margin_bottom)
|
|
109
|
+
title_layout = create_title(
|
|
110
|
+
text = title,
|
|
111
|
+
font_family = title_font_family,
|
|
112
|
+
font_size = title_font_size,
|
|
113
|
+
font_color = title_font_color,
|
|
114
|
+
background_color = title_background_color,
|
|
115
|
+
padding = title_padding,
|
|
116
|
+
padding_left = title_padding_left,
|
|
117
|
+
padding_top = title_padding_top,
|
|
118
|
+
padding_right = title_padding_right,
|
|
119
|
+
padding_bottom = title_padding_bottom,
|
|
120
|
+
border_width = title_border_width,
|
|
121
|
+
border_color = title_border_color,
|
|
122
|
+
border_radius = title_border_radius
|
|
123
|
+
)
|
|
124
|
+
main_layout.addLayout(title_layout)
|
|
125
|
+
main_layout.addStretch()
|
|
126
|
+
return main_layout
|
|
127
|
+
|
|
88
128
|
def create_title(
|
|
89
129
|
text,
|
|
90
130
|
font_family = "Segoe UI",
|
|
@@ -92,10 +132,10 @@ def create_title(
|
|
|
92
132
|
font_color = "#ffffff",
|
|
93
133
|
background_color = "#1e1e1e",
|
|
94
134
|
padding = 15,
|
|
135
|
+
padding_left = None,
|
|
95
136
|
padding_top = None,
|
|
96
137
|
padding_right = None,
|
|
97
138
|
padding_bottom = None,
|
|
98
|
-
padding_left = None,
|
|
99
139
|
border_width = 0,
|
|
100
140
|
border_color = "#ffffff",
|
|
101
141
|
border_radius = 0
|
|
@@ -111,10 +151,10 @@ def create_title(
|
|
|
111
151
|
font_weight = "bold",
|
|
112
152
|
background_color = background_color,
|
|
113
153
|
padding = padding,
|
|
154
|
+
padding_left = padding_left,
|
|
114
155
|
padding_top = padding_top,
|
|
115
156
|
padding_right = padding_right,
|
|
116
157
|
padding_bottom = padding_bottom,
|
|
117
|
-
padding_left = padding_left,
|
|
118
158
|
border_width = border_width,
|
|
119
159
|
border_color = border_color,
|
|
120
160
|
border_radius = border_radius
|
|
@@ -130,29 +170,29 @@ def create_label(
|
|
|
130
170
|
font_weight = "normal",
|
|
131
171
|
background_color = "#1e1e1e",
|
|
132
172
|
padding = 15,
|
|
173
|
+
padding_left = None,
|
|
133
174
|
padding_top = None,
|
|
134
175
|
padding_right = None,
|
|
135
176
|
padding_bottom = None,
|
|
136
|
-
padding_left = None,
|
|
137
177
|
border_width = 0,
|
|
138
178
|
border_color = "#ffffff",
|
|
139
179
|
border_radius = 0
|
|
140
180
|
):
|
|
141
181
|
label = QLabel(text)
|
|
182
|
+
padding_left_value = padding_left if padding_left is not None else padding
|
|
142
183
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
143
184
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
144
185
|
padding_bottom_value = padding_bottom if padding_bottom is not None else padding
|
|
145
|
-
padding_left_value = padding_left if padding_left is not None else padding
|
|
146
186
|
style = f"""
|
|
147
187
|
font-family: {font_family};
|
|
148
188
|
font-size: {font_size}px;
|
|
149
189
|
color: {font_color};
|
|
150
190
|
font-weight: {font_weight};
|
|
151
191
|
background-color: {background_color};
|
|
192
|
+
padding-left: {padding_left_value}px;
|
|
152
193
|
padding-top: {padding_top_value}px;
|
|
153
194
|
padding-right: {padding_right_value}px;
|
|
154
195
|
padding-bottom: {padding_bottom_value}px;
|
|
155
|
-
padding-left: {padding_left_value}px;
|
|
156
196
|
border: {border_width}px solid {border_color};
|
|
157
197
|
border-radius: {border_radius}px;
|
|
158
198
|
"""
|
|
@@ -167,10 +207,10 @@ def create_button(
|
|
|
167
207
|
font_weight = "bold",
|
|
168
208
|
background_color = "#1e1e1e",
|
|
169
209
|
padding = 15,
|
|
210
|
+
padding_left = None,
|
|
170
211
|
padding_top = None,
|
|
171
212
|
padding_right = None,
|
|
172
213
|
padding_bottom = None,
|
|
173
|
-
padding_left = None,
|
|
174
214
|
border_width = 2,
|
|
175
215
|
border_color = "#5c5c5c",
|
|
176
216
|
border_radius = 0,
|
|
@@ -185,11 +225,22 @@ def create_button(
|
|
|
185
225
|
disabled_border_width = 2,
|
|
186
226
|
disabled_border_color = "#4a4a4a"
|
|
187
227
|
):
|
|
188
|
-
button = QPushButton(
|
|
228
|
+
button = QPushButton()
|
|
229
|
+
button.setMaximumWidth(360)
|
|
230
|
+
padding_left_value = padding_left if padding_left is not None else padding
|
|
189
231
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
190
232
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
191
233
|
padding_bottom_value = padding_bottom if padding_bottom is not None else padding
|
|
192
|
-
|
|
234
|
+
max_text_width = 360 - padding_left_value - padding_right_value - 2 * border_width
|
|
235
|
+
font = QFont(font_family, font_size)
|
|
236
|
+
if font_weight == "bold": font.setWeight(QFont.Weight.Bold)
|
|
237
|
+
else: font.setWeight(QFont.Weight.Normal)
|
|
238
|
+
metrics = QFontMetrics(font)
|
|
239
|
+
text_width = metrics.horizontalAdvance(text)
|
|
240
|
+
if text_width > max_text_width:
|
|
241
|
+
html_text = f"<html><div style = \"white-space: normal; text-align: center;\">{text}</div><html>"
|
|
242
|
+
button.setText(html_text)
|
|
243
|
+
else: button.setText(text)
|
|
193
244
|
style_sheet = f"""
|
|
194
245
|
QPushButton {{
|
|
195
246
|
font-family: {font_family};
|
|
@@ -197,10 +248,10 @@ def create_button(
|
|
|
197
248
|
color: {font_color};
|
|
198
249
|
font-weight: {font_weight};
|
|
199
250
|
background-color: {background_color};
|
|
251
|
+
padding-left: {padding_left_value}px;
|
|
200
252
|
padding-top: {padding_top_value}px;
|
|
201
253
|
padding-right: {padding_right_value}px;
|
|
202
254
|
padding-bottom: {padding_bottom_value}px;
|
|
203
|
-
padding-left: {padding_left_value}px;
|
|
204
255
|
border: {border_width}px solid {border_color};
|
|
205
256
|
border-radius: {border_radius}px;
|
|
206
257
|
}}
|
|
@@ -229,10 +280,10 @@ def create_text_box(
|
|
|
229
280
|
font_weight = "normal",
|
|
230
281
|
background_color = "#1e1e1e",
|
|
231
282
|
padding = 15,
|
|
283
|
+
padding_left = None,
|
|
232
284
|
padding_top = None,
|
|
233
285
|
padding_right = None,
|
|
234
286
|
padding_bottom = None,
|
|
235
|
-
padding_left = None,
|
|
236
287
|
border_width = 2,
|
|
237
288
|
border_color = "#5c5c5c",
|
|
238
289
|
border_radius = 0,
|
|
@@ -254,10 +305,10 @@ def create_text_box(
|
|
|
254
305
|
):
|
|
255
306
|
text_box = QLineEdit()
|
|
256
307
|
text_box.setPlaceholderText(placeholder_text)
|
|
308
|
+
padding_left_value = padding_left if padding_left is not None else padding
|
|
257
309
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
258
310
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
259
311
|
padding_bottom_value = padding_bottom if padding_bottom is not None else padding
|
|
260
|
-
padding_left_value = padding_left if padding_left is not None else padding
|
|
261
312
|
style_sheet = f"""
|
|
262
313
|
QLineEdit {{
|
|
263
314
|
font-family: {font_family};
|
|
@@ -265,10 +316,10 @@ def create_text_box(
|
|
|
265
316
|
color: {font_color};
|
|
266
317
|
font-weight: {font_weight};
|
|
267
318
|
background-color: {background_color};
|
|
319
|
+
padding-left: {padding_left_value}px;
|
|
268
320
|
padding-top: {padding_top_value}px;
|
|
269
321
|
padding-right: {padding_right_value}px;
|
|
270
322
|
padding-bottom: {padding_bottom_value}px;
|
|
271
|
-
padding-left: {padding_left_value}px;
|
|
272
323
|
border: {border_width}px solid {border_color};
|
|
273
324
|
border-radius: {border_radius}px;
|
|
274
325
|
}}
|
|
@@ -343,10 +394,10 @@ def create_combo_box(
|
|
|
343
394
|
font_color = "#ffffff",
|
|
344
395
|
background_color = "#1e1e1e",
|
|
345
396
|
padding = 15,
|
|
397
|
+
padding_left = None,
|
|
346
398
|
padding_top = None,
|
|
347
399
|
padding_right = None,
|
|
348
400
|
padding_bottom = None,
|
|
349
|
-
padding_left = None,
|
|
350
401
|
border_width = 2,
|
|
351
402
|
border_color = "#5c5c5c",
|
|
352
403
|
border_radius = 0,
|
|
@@ -368,10 +419,10 @@ def create_combo_box(
|
|
|
368
419
|
combo_box.addItems(items)
|
|
369
420
|
combo_box.setCurrentIndex(-1)
|
|
370
421
|
|
|
422
|
+
padding_left_value = padding_left if padding_left is not None else padding
|
|
371
423
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
372
424
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
373
425
|
padding_bottom_value = padding_bottom if padding_bottom is not None else padding
|
|
374
|
-
padding_left_value = padding_left if padding_left is not None else padding
|
|
375
426
|
|
|
376
427
|
def get_stylesheet(font_color):
|
|
377
428
|
return f"""
|
|
@@ -380,10 +431,10 @@ def create_combo_box(
|
|
|
380
431
|
font-size: {font_size}px;
|
|
381
432
|
color: {font_color};
|
|
382
433
|
background-color: {background_color};
|
|
434
|
+
padding-left: {padding_left_value}px;
|
|
383
435
|
padding-top: {padding_top_value}px;
|
|
384
436
|
padding-right: {padding_right_value}px;
|
|
385
437
|
padding-bottom: {padding_bottom_value}px;
|
|
386
|
-
padding-left: {padding_left_value}px;
|
|
387
438
|
border: {border_width}px solid {border_color};
|
|
388
439
|
border-radius: {border_radius}px;
|
|
389
440
|
}}
|
|
@@ -422,10 +473,10 @@ def create_checkbox(
|
|
|
422
473
|
font_color = "#ffffff",
|
|
423
474
|
background_color = "#1e1e1e",
|
|
424
475
|
padding = 5,
|
|
476
|
+
padding_left = None,
|
|
425
477
|
padding_top = None,
|
|
426
478
|
padding_right = None,
|
|
427
479
|
padding_bottom = None,
|
|
428
|
-
padding_left = None,
|
|
429
480
|
indicator_background_color = "#1e1e1e",
|
|
430
481
|
indicator_border_width = 1,
|
|
431
482
|
indicator_border_color = "#5c5c5c",
|
|
@@ -445,20 +496,20 @@ def create_checkbox(
|
|
|
445
496
|
disabled_border_color = "#4a4a4a"
|
|
446
497
|
):
|
|
447
498
|
check_box = QCheckBox(text)
|
|
499
|
+
padding_left_value = padding_left if padding_left is not None else padding
|
|
448
500
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
449
501
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
450
502
|
padding_bottom_value = padding_bottom if padding_bottom is not None else padding
|
|
451
|
-
padding_left_value = padding_left if padding_left is not None else padding
|
|
452
503
|
style_sheet = f"""
|
|
453
504
|
QCheckBox {{
|
|
454
505
|
font-family: {font_family};
|
|
455
506
|
font-size: {font_size}px;
|
|
456
507
|
color: {font_color};
|
|
457
508
|
background-color: {background_color};
|
|
509
|
+
padding-left: {padding_left_value}px;
|
|
458
510
|
padding-top: {padding_top_value}px;
|
|
459
511
|
padding-right: {padding_right_value}px;
|
|
460
512
|
padding-bottom: {padding_bottom_value}px;
|
|
461
|
-
padding-left: {padding_left_value}px;
|
|
462
513
|
}}
|
|
463
514
|
QCheckBox::indicator {{
|
|
464
515
|
image: none;
|
|
@@ -487,60 +538,16 @@ def create_checkbox(
|
|
|
487
538
|
background-color: {disabled_background_color};
|
|
488
539
|
border: {disabled_border_width}px solid {disabled_border_color};
|
|
489
540
|
}}
|
|
490
|
-
"""
|
|
541
|
+
"""
|
|
491
542
|
check_box.setStyleSheet(style_sheet)
|
|
492
543
|
return check_box
|
|
493
544
|
|
|
494
|
-
class _ResponsiveDialog(QDialog):
|
|
495
|
-
"""
|
|
496
|
-
Subclase de QDialog que ajusta dinámicamente el ancho máximo del label principal
|
|
497
|
-
según el ancho actual del diálogo y los márgenes proporcionados.
|
|
498
|
-
"""
|
|
499
|
-
def __init__(self, left_margin, right_margin, label_padding_total_getter, *args, **kwargs):
|
|
500
|
-
super().__init__(*args, **kwargs)
|
|
501
|
-
self._left_margin = left_margin
|
|
502
|
-
self._right_margin = right_margin
|
|
503
|
-
# label_padding_total_getter: callable que devuelve número de px que ocupa padding horizontal del label
|
|
504
|
-
self._label_padding_total_getter = label_padding_total_getter
|
|
505
|
-
self._responsive_labels = []
|
|
506
|
-
|
|
507
|
-
def register_responsive_label(self, label_widget):
|
|
508
|
-
# Guardamos la referencia para ajustarla en resizeEvent
|
|
509
|
-
if label_widget not in self._responsive_labels:
|
|
510
|
-
self._responsive_labels.append(label_widget)
|
|
511
|
-
|
|
512
|
-
def resizeEvent(self, event):
|
|
513
|
-
# Calculamos ancho disponible y aplicamos a cada label registrado
|
|
514
|
-
total_padding = self._label_padding_total_getter() or 0
|
|
515
|
-
avail = max(0, self.width() - self._left_margin - self._right_margin - total_padding)
|
|
516
|
-
for lbl in self._responsive_labels:
|
|
517
|
-
lbl.setMaximumWidth(avail)
|
|
518
|
-
super().resizeEvent(event)
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
def _compute_label_horizontal_padding(label_padding, padding_top, padding_right, padding_bottom, padding_left):
|
|
522
|
-
"""
|
|
523
|
-
Normaliza y calcula el total horizontal de padding entrado por parámetros.
|
|
524
|
-
Si label_padding está definido y paddings individuales no, se usa.
|
|
525
|
-
"""
|
|
526
|
-
# Si padding individual está dado, priorizarlo
|
|
527
|
-
left = padding_left if padding_left is not None else None
|
|
528
|
-
right = padding_right if padding_right is not None else None
|
|
529
|
-
if left is None and right is None:
|
|
530
|
-
# usar label_padding para ambos lados (si está definido)
|
|
531
|
-
if label_padding is None:
|
|
532
|
-
return 0
|
|
533
|
-
return 2 * label_padding
|
|
534
|
-
# si alguno es None, tratar como 0
|
|
535
|
-
return (left or 0) + (right or 0)
|
|
536
|
-
|
|
537
|
-
|
|
538
545
|
def create_information_message_box(
|
|
539
546
|
text,
|
|
540
|
-
top_margin = 25,
|
|
541
|
-
bottom_margin = 25,
|
|
542
547
|
left_margin = 25,
|
|
548
|
+
top_margin = 25,
|
|
543
549
|
right_margin = 25,
|
|
550
|
+
bottom_margin = 25,
|
|
544
551
|
spacing = 10,
|
|
545
552
|
background_color = "#1e1e1e",
|
|
546
553
|
border_width = 2,
|
|
@@ -550,10 +557,10 @@ def create_information_message_box(
|
|
|
550
557
|
label_font_size = 14,
|
|
551
558
|
label_font_color = "#ffffff",
|
|
552
559
|
label_padding = 15,
|
|
560
|
+
label_padding_left = None,
|
|
553
561
|
label_padding_top = None,
|
|
554
562
|
label_padding_right = None,
|
|
555
563
|
label_padding_bottom = None,
|
|
556
|
-
label_padding_left = None,
|
|
557
564
|
label_border_width = 0,
|
|
558
565
|
label_border_color = "#ffffff",
|
|
559
566
|
label_border_radius = 0,
|
|
@@ -563,10 +570,10 @@ def create_information_message_box(
|
|
|
563
570
|
button_font_color = "#ffffff",
|
|
564
571
|
button_background_color = "#1e1e1e",
|
|
565
572
|
button_padding = 15,
|
|
573
|
+
button_padding_left = None,
|
|
566
574
|
button_padding_top = None,
|
|
567
575
|
button_padding_right = None,
|
|
568
576
|
button_padding_bottom = None,
|
|
569
|
-
button_padding_left = None,
|
|
570
577
|
button_border_width = 2,
|
|
571
578
|
button_border_color = "#5c5c5c",
|
|
572
579
|
button_border_radius = 0,
|
|
@@ -581,16 +588,10 @@ def create_information_message_box(
|
|
|
581
588
|
button_disabled_border_width = 2,
|
|
582
589
|
button_disabled_border_color = "#4a4a4a"
|
|
583
590
|
):
|
|
584
|
-
|
|
585
|
-
def _label_padding_total():
|
|
586
|
-
return _compute_label_horizontal_padding(label_padding, label_padding_top, label_padding_right, label_padding_bottom, label_padding_left)
|
|
587
|
-
|
|
588
|
-
# Usamos la subclase de diálogo que ajusta dinámicamente
|
|
589
|
-
message_box = _ResponsiveDialog(left_margin, right_margin, _label_padding_total)
|
|
591
|
+
message_box = QDialog()
|
|
590
592
|
message_box.setObjectName("message_box")
|
|
591
593
|
message_box.setWindowFlags(Qt.WindowType.FramelessWindowHint)
|
|
592
|
-
message_box.
|
|
593
|
-
message_box.setMaximumWidth(480)
|
|
594
|
+
message_box.setFixedWidth(360)
|
|
594
595
|
style_sheet = f"""
|
|
595
596
|
QDialog#message_box {{
|
|
596
597
|
background-color: {background_color};
|
|
@@ -599,39 +600,28 @@ def create_information_message_box(
|
|
|
599
600
|
}}
|
|
600
601
|
"""
|
|
601
602
|
message_box.setStyleSheet(style_sheet)
|
|
602
|
-
|
|
603
603
|
main_layout = QVBoxLayout(message_box)
|
|
604
604
|
message_box.setLayout(main_layout)
|
|
605
605
|
main_layout.setContentsMargins(left_margin, top_margin, right_margin, bottom_margin)
|
|
606
606
|
main_layout.setSpacing(spacing)
|
|
607
|
-
|
|
608
|
-
# Creación del label (usamos create_label existente)
|
|
609
607
|
text_label = create_label(
|
|
610
608
|
text = text,
|
|
611
609
|
font_family = label_font_family,
|
|
612
610
|
font_size = label_font_size,
|
|
613
|
-
font_color
|
|
611
|
+
font_color= label_font_color,
|
|
614
612
|
background_color = "transparent",
|
|
615
613
|
padding = label_padding,
|
|
614
|
+
padding_left = label_padding_left,
|
|
616
615
|
padding_top = label_padding_top,
|
|
617
616
|
padding_right = label_padding_right,
|
|
618
617
|
padding_bottom = label_padding_bottom,
|
|
619
|
-
padding_left = label_padding_left,
|
|
620
618
|
border_width = label_border_width,
|
|
621
619
|
border_color = label_border_color,
|
|
622
620
|
border_radius = label_border_radius
|
|
623
621
|
)
|
|
624
|
-
|
|
625
|
-
# Políticas que permiten usar todo el ancho disponible y wrap solo cuando sea necesario
|
|
626
|
-
text_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
|
|
627
|
-
text_label.setWordWrap(True)
|
|
628
|
-
|
|
629
622
|
main_layout.addWidget(text_label)
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
message_box.register_responsive_label(text_label)
|
|
633
|
-
|
|
634
|
-
# Botón
|
|
623
|
+
text_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
624
|
+
text_label.setWordWrap(True)
|
|
635
625
|
accept_button = create_button(
|
|
636
626
|
text = button_text,
|
|
637
627
|
font_family = button_font_family,
|
|
@@ -639,10 +629,10 @@ def create_information_message_box(
|
|
|
639
629
|
font_color = button_font_color,
|
|
640
630
|
background_color = button_background_color,
|
|
641
631
|
padding = button_padding,
|
|
632
|
+
padding_left = button_padding_left,
|
|
642
633
|
padding_top = button_padding_top,
|
|
643
634
|
padding_right = button_padding_right,
|
|
644
635
|
padding_bottom = button_padding_bottom,
|
|
645
|
-
padding_left = button_padding_left,
|
|
646
636
|
border_width = button_border_width,
|
|
647
637
|
border_color = button_border_color,
|
|
648
638
|
border_radius = button_border_radius,
|
|
@@ -659,24 +649,14 @@ def create_information_message_box(
|
|
|
659
649
|
)
|
|
660
650
|
main_layout.addWidget(accept_button)
|
|
661
651
|
accept_button.clicked.connect(message_box.accept)
|
|
662
|
-
|
|
663
|
-
# Ajustes finales: forzamos un tamaño inicial coherente
|
|
664
|
-
message_box.adjustSize()
|
|
665
|
-
# aseguramos ancho dentro de min/max
|
|
666
|
-
final_w = message_box.width()
|
|
667
|
-
if final_w < message_box.minimumWidth(): final_w = message_box.minimumWidth()
|
|
668
|
-
if final_w > message_box.maximumWidth(): final_w = message_box.maximumWidth()
|
|
669
|
-
message_box.resize(final_w, message_box.height())
|
|
670
|
-
|
|
671
652
|
return message_box
|
|
672
|
-
|
|
673
|
-
|
|
653
|
+
|
|
674
654
|
def create_confirmation_message_box(
|
|
675
655
|
text,
|
|
676
|
-
top_margin = 25,
|
|
677
|
-
bottom_margin = 25,
|
|
678
656
|
left_margin = 25,
|
|
657
|
+
top_margin = 25,
|
|
679
658
|
right_margin = 25,
|
|
659
|
+
bottom_margin = 25,
|
|
680
660
|
main_spacing = 10,
|
|
681
661
|
button_spacing = 10,
|
|
682
662
|
background_color = "#1e1e1e",
|
|
@@ -687,10 +667,10 @@ def create_confirmation_message_box(
|
|
|
687
667
|
label_font_size = 14,
|
|
688
668
|
label_font_color = "#ffffff",
|
|
689
669
|
label_padding = 15,
|
|
670
|
+
label_padding_left = None,
|
|
690
671
|
label_padding_top = None,
|
|
691
672
|
label_padding_right = None,
|
|
692
673
|
label_padding_bottom = None,
|
|
693
|
-
label_padding_left = None,
|
|
694
674
|
label_border_width = 0,
|
|
695
675
|
label_border_color = "#ffffff",
|
|
696
676
|
label_border_radius = 0,
|
|
@@ -699,10 +679,10 @@ def create_confirmation_message_box(
|
|
|
699
679
|
button_font_color = "#ffffff",
|
|
700
680
|
button_background_color = "#1e1e1e",
|
|
701
681
|
button_padding = 15,
|
|
682
|
+
button_padding_left = None,
|
|
702
683
|
button_padding_top = None,
|
|
703
684
|
button_padding_right = None,
|
|
704
685
|
button_padding_bottom = None,
|
|
705
|
-
button_padding_left = None,
|
|
706
686
|
button_border_width = 2,
|
|
707
687
|
button_border_color = "#5c5c5c",
|
|
708
688
|
button_border_radius = 0,
|
|
@@ -717,14 +697,10 @@ def create_confirmation_message_box(
|
|
|
717
697
|
button_disabled_border_width = 2,
|
|
718
698
|
button_disabled_border_color = "#4a4a4a"
|
|
719
699
|
):
|
|
720
|
-
|
|
721
|
-
return _compute_label_horizontal_padding(label_padding, label_padding_top, label_padding_right, label_padding_bottom, label_padding_left)
|
|
722
|
-
|
|
723
|
-
confirm_message_box = _ResponsiveDialog(left_margin, right_margin, _label_padding_total)
|
|
700
|
+
confirm_message_box = QDialog()
|
|
724
701
|
confirm_message_box.setObjectName("confirm_message_box")
|
|
725
702
|
confirm_message_box.setWindowFlags(Qt.WindowType.FramelessWindowHint)
|
|
726
|
-
confirm_message_box.
|
|
727
|
-
confirm_message_box.setMaximumWidth(480)
|
|
703
|
+
confirm_message_box.setFixedWidth(360)
|
|
728
704
|
style_sheet = f"""
|
|
729
705
|
QDialog#confirm_message_box {{
|
|
730
706
|
background-color: {background_color};
|
|
@@ -733,12 +709,10 @@ def create_confirmation_message_box(
|
|
|
733
709
|
}}
|
|
734
710
|
"""
|
|
735
711
|
confirm_message_box.setStyleSheet(style_sheet)
|
|
736
|
-
|
|
737
712
|
main_layout = QVBoxLayout(confirm_message_box)
|
|
738
713
|
confirm_message_box.setLayout(main_layout)
|
|
739
714
|
main_layout.setContentsMargins(left_margin, top_margin, right_margin, bottom_margin)
|
|
740
715
|
main_layout.setSpacing(main_spacing)
|
|
741
|
-
|
|
742
716
|
text_label = create_label(
|
|
743
717
|
text = text,
|
|
744
718
|
font_family = label_font_family,
|
|
@@ -746,24 +720,20 @@ def create_confirmation_message_box(
|
|
|
746
720
|
font_color = label_font_color,
|
|
747
721
|
background_color = "transparent",
|
|
748
722
|
padding = label_padding,
|
|
723
|
+
padding_left = label_padding_left,
|
|
749
724
|
padding_top = label_padding_top,
|
|
750
725
|
padding_right = label_padding_right,
|
|
751
726
|
padding_bottom = label_padding_bottom,
|
|
752
|
-
padding_left = label_padding_left,
|
|
753
727
|
border_width = label_border_width,
|
|
754
728
|
border_color = label_border_color,
|
|
755
729
|
border_radius = label_border_radius
|
|
756
730
|
)
|
|
757
|
-
|
|
758
|
-
text_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
|
|
759
|
-
text_label.setWordWrap(True)
|
|
760
731
|
main_layout.addWidget(text_label)
|
|
761
|
-
|
|
762
|
-
|
|
732
|
+
text_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
733
|
+
text_label.setWordWrap(True)
|
|
763
734
|
buttons_layout = QHBoxLayout()
|
|
764
735
|
main_layout.addLayout(buttons_layout)
|
|
765
736
|
buttons_layout.setSpacing(button_spacing)
|
|
766
|
-
|
|
767
737
|
confirm_button = create_button(
|
|
768
738
|
text = "Sí",
|
|
769
739
|
font_family = button_font_family,
|
|
@@ -771,10 +741,10 @@ def create_confirmation_message_box(
|
|
|
771
741
|
font_color = button_font_color,
|
|
772
742
|
background_color = button_background_color,
|
|
773
743
|
padding = button_padding,
|
|
744
|
+
padding_left = button_padding_left,
|
|
774
745
|
padding_top = button_padding_top,
|
|
775
746
|
padding_right = button_padding_right,
|
|
776
747
|
padding_bottom = button_padding_bottom,
|
|
777
|
-
padding_left = button_padding_left,
|
|
778
748
|
border_width = button_border_width,
|
|
779
749
|
border_color = button_border_color,
|
|
780
750
|
border_radius = button_border_radius,
|
|
@@ -791,7 +761,6 @@ def create_confirmation_message_box(
|
|
|
791
761
|
)
|
|
792
762
|
buttons_layout.addWidget(confirm_button)
|
|
793
763
|
confirm_button.clicked.connect(confirm_message_box.accept)
|
|
794
|
-
|
|
795
764
|
decline_button = create_button(
|
|
796
765
|
text = "No",
|
|
797
766
|
font_family = button_font_family,
|
|
@@ -799,10 +768,10 @@ def create_confirmation_message_box(
|
|
|
799
768
|
font_color = button_font_color,
|
|
800
769
|
background_color = button_background_color,
|
|
801
770
|
padding = button_padding,
|
|
771
|
+
padding_left = button_padding_left,
|
|
802
772
|
padding_top = button_padding_top,
|
|
803
773
|
padding_right = button_padding_right,
|
|
804
774
|
padding_bottom = button_padding_bottom,
|
|
805
|
-
padding_left = button_padding_left,
|
|
806
775
|
border_width = button_border_width,
|
|
807
776
|
border_color = button_border_color,
|
|
808
777
|
border_radius = button_border_radius,
|
|
@@ -819,13 +788,6 @@ def create_confirmation_message_box(
|
|
|
819
788
|
)
|
|
820
789
|
buttons_layout.addWidget(decline_button)
|
|
821
790
|
decline_button.clicked.connect(confirm_message_box.reject)
|
|
822
|
-
|
|
823
|
-
confirm_message_box.adjustSize()
|
|
824
|
-
final_w = confirm_message_box.width()
|
|
825
|
-
if final_w < confirm_message_box.minimumWidth(): final_w = confirm_message_box.minimumWidth()
|
|
826
|
-
if final_w > confirm_message_box.maximumWidth(): final_w = confirm_message_box.maximumWidth()
|
|
827
|
-
confirm_message_box.resize(final_w, confirm_message_box.height())
|
|
828
|
-
|
|
829
791
|
return confirm_message_box
|
|
830
792
|
|
|
831
793
|
def create_list_table(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|