From b8f06d163c8ae273ec023d0516a131a78ebfc48f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= Date: Fri, 16 Feb 2024 17:45:25 +0100 Subject: [PATCH] Fix combobox signal handing not supporting str * Signal handling in PyQt6 is more generic and the `activated` signal emits only the index, see: https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QComboBox.html#PySide6.QtWidgets.PySide6.QtWidgets.QComboBox.activated Signed-off-by: Joao Goncalves --- activity_browser/ui/tables/LCA_setup.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/activity_browser/ui/tables/LCA_setup.py b/activity_browser/ui/tables/LCA_setup.py index c97b8e4ff..ecf5084c0 100644 --- a/activity_browser/ui/tables/LCA_setup.py +++ b/activity_browser/ui/tables/LCA_setup.py @@ -19,8 +19,7 @@ class CSList(QtWidgets.QComboBox): def __init__(self, parent=None): super(CSList, self).__init__(parent) - # Runs even if selection doesn't change - self.activated['QString'].connect(self.set_cs) + self.activated.connect(self.set_cs) signals.calculation_setup_selected.connect(self.sync) def sync(self, name): @@ -31,9 +30,8 @@ def sync(self, name): self.blockSignals(False) self.setCurrentIndex(keys.index(name)) - @staticmethod - def set_cs(name: str): - signals.calculation_setup_selected.emit(name) + def set_cs(self, index: int): + signals.calculation_setup_selected.emit(self.itemText(index)) @property def name(self) -> str: