Skip to content

Commit

Permalink
Fix combobox signal handing not supporting str
Browse files Browse the repository at this point in the history
* 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 <jsvgoncalves@gmail.com>
  • Loading branch information
jsvgoncalves committed Feb 17, 2024
1 parent 9ba7360 commit b8f06d1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions activity_browser/ui/tables/LCA_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down

0 comments on commit b8f06d1

Please sign in to comment.