gui-utilities 1.0.0__tar.gz → 1.1.0__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 gui-utilities might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gui_utilities
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Librería de utilidades gráficas en PyQt6
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -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
- message,
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(message)
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
- message,
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(message)
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
- message,
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
- button_message = "Aceptar",
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
- message_label = create_label(
323
- message = message,
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(message_label)
421
+ main_layout.addWidget(text_label)
334
422
 
335
423
  accept_button = create_button(
336
- message = button_message,
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
- message,
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
- message_layout = QHBoxLayout()
415
- main_layout.addLayout(message_layout)
416
- message_label = create_label(
417
- message = message,
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
- message_layout.addWidget(message_label)
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
- message = "Sí",
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
- message = "No",
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
- message = "¿Está seguro de querer salir del programa?",
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gui_utilities
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Librería de utilidades gráficas en PyQt6
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -1,10 +1,8 @@
1
1
  [project]
2
2
  name = "gui_utilities"
3
- version = "1.0.0"
3
+ version = "1.1.0"
4
4
  description = "Librería de utilidades gráficas en PyQt6"
5
- authors = [
6
- {name = "Guido Iván Gross", email = "grossguidoivan@gmail.com"}
7
- ]
5
+ authors = [{name = "Guido Iván Gross", email = "grossguidoivan@gmail.com"}]
8
6
  requires-python = ">=3.8"
9
7
  dependencies = ["PyQt6"]
10
8
 
File without changes
File without changes
File without changes