gui-utilities 1.2.18__tar.gz → 1.2.22__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gui_utilities
3
- Version: 1.2.18
3
+ Version: 1.2.22
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,5 +1,5 @@
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, QSizePolicy
2
+ from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QLineEdit, QComboBox, QDialog, QToolButton, QWidgetAction, QCheckBox, QTableWidget, QHeaderView
3
3
  from PyQt6.QtGui import QIcon
4
4
  import re
5
5
  import requests
@@ -491,50 +491,6 @@ def create_checkbox(
491
491
  check_box.setStyleSheet(style_sheet)
492
492
  return check_box
493
493
 
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
494
  def create_information_message_box(
539
495
  text,
540
496
  top_margin = 25,
@@ -581,16 +537,10 @@ def create_information_message_box(
581
537
  button_disabled_border_width = 2,
582
538
  button_disabled_border_color = "#4a4a4a"
583
539
  ):
584
- # Calculador de padding horizontal del label (valor único que devolverá el ResponsiveDialog)
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)
540
+ message_box = QDialog()
590
541
  message_box.setObjectName("message_box")
591
542
  message_box.setWindowFlags(Qt.WindowType.FramelessWindowHint)
592
- message_box.setMinimumWidth(240)
593
- message_box.setMaximumWidth(480)
543
+ message_box.setFixedWidth(360)
594
544
  style_sheet = f"""
595
545
  QDialog#message_box {{
596
546
  background-color: {background_color};
@@ -599,18 +549,15 @@ def create_information_message_box(
599
549
  }}
600
550
  """
601
551
  message_box.setStyleSheet(style_sheet)
602
-
603
552
  main_layout = QVBoxLayout(message_box)
604
553
  message_box.setLayout(main_layout)
605
554
  main_layout.setContentsMargins(left_margin, top_margin, right_margin, bottom_margin)
606
555
  main_layout.setSpacing(spacing)
607
-
608
- # Creación del label (usamos create_label existente)
609
556
  text_label = create_label(
610
557
  text = text,
611
558
  font_family = label_font_family,
612
559
  font_size = label_font_size,
613
- font_color = label_font_color,
560
+ font_color= label_font_color,
614
561
  background_color = "transparent",
615
562
  padding = label_padding,
616
563
  padding_top = label_padding_top,
@@ -621,17 +568,8 @@ def create_information_message_box(
621
568
  border_color = label_border_color,
622
569
  border_radius = label_border_radius
623
570
  )
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
571
  main_layout.addWidget(text_label)
630
-
631
- # Registramos el label para que el diálogo lo ajuste en resizeEvent
632
- message_box.register_responsive_label(text_label)
633
-
634
- # Botón
572
+ text_label.setWordWrap(True)
635
573
  accept_button = create_button(
636
574
  text = button_text,
637
575
  font_family = button_font_family,
@@ -659,18 +597,8 @@ def create_information_message_box(
659
597
  )
660
598
  main_layout.addWidget(accept_button)
661
599
  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
600
  return message_box
672
-
673
-
601
+
674
602
  def create_confirmation_message_box(
675
603
  text,
676
604
  top_margin = 25,
@@ -717,14 +645,10 @@ def create_confirmation_message_box(
717
645
  button_disabled_border_width = 2,
718
646
  button_disabled_border_color = "#4a4a4a"
719
647
  ):
720
- def _label_padding_total():
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)
648
+ confirm_message_box = QDialog()
724
649
  confirm_message_box.setObjectName("confirm_message_box")
725
650
  confirm_message_box.setWindowFlags(Qt.WindowType.FramelessWindowHint)
726
- confirm_message_box.setMinimumWidth(240)
727
- confirm_message_box.setMaximumWidth(480)
651
+ confirm_message_box.setFixedWidth(360)
728
652
  style_sheet = f"""
729
653
  QDialog#confirm_message_box {{
730
654
  background-color: {background_color};
@@ -733,12 +657,10 @@ def create_confirmation_message_box(
733
657
  }}
734
658
  """
735
659
  confirm_message_box.setStyleSheet(style_sheet)
736
-
737
660
  main_layout = QVBoxLayout(confirm_message_box)
738
661
  confirm_message_box.setLayout(main_layout)
739
662
  main_layout.setContentsMargins(left_margin, top_margin, right_margin, bottom_margin)
740
663
  main_layout.setSpacing(main_spacing)
741
-
742
664
  text_label = create_label(
743
665
  text = text,
744
666
  font_family = label_font_family,
@@ -754,16 +676,11 @@ def create_confirmation_message_box(
754
676
  border_color = label_border_color,
755
677
  border_radius = label_border_radius
756
678
  )
757
-
758
- text_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
759
- text_label.setWordWrap(True)
760
679
  main_layout.addWidget(text_label)
761
- confirm_message_box.register_responsive_label(text_label)
762
-
680
+ text_label.setWordWrap(True)
763
681
  buttons_layout = QHBoxLayout()
764
682
  main_layout.addLayout(buttons_layout)
765
683
  buttons_layout.setSpacing(button_spacing)
766
-
767
684
  confirm_button = create_button(
768
685
  text = "Sí",
769
686
  font_family = button_font_family,
@@ -791,7 +708,6 @@ def create_confirmation_message_box(
791
708
  )
792
709
  buttons_layout.addWidget(confirm_button)
793
710
  confirm_button.clicked.connect(confirm_message_box.accept)
794
-
795
711
  decline_button = create_button(
796
712
  text = "No",
797
713
  font_family = button_font_family,
@@ -819,13 +735,6 @@ def create_confirmation_message_box(
819
735
  )
820
736
  buttons_layout.addWidget(decline_button)
821
737
  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
738
  return confirm_message_box
830
739
 
831
740
  def create_list_table(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gui_utilities
3
- Version: 1.2.18
3
+ Version: 1.2.22
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,6 +1,6 @@
1
1
  [project]
2
2
  name = "gui_utilities"
3
- version = "1.2.18"
3
+ version = "1.2.22"
4
4
  description = "Librería de utilidades gráficas en PyQt6"
5
5
  authors = [{name = "Guido Iván Gross", email = "grossguidoivan@gmail.com"}]
6
6
  requires-python = ">=3.8"
File without changes
File without changes
File without changes