From 56a5b15f04a884583ecd23f6178820764deaf160 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 29 Sep 2023 16:29:10 -0400 Subject: [PATCH] skip over a keyfile that didn't have a parameter in the key file --- qtrun.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/qtrun.py b/qtrun.py index 5da601c..c071f1a 100755 --- a/qtrun.py +++ b/qtrun.py @@ -115,16 +115,25 @@ def load(self): widget = element.itemAt(widget_index).widget() if isinstance(widget, QtWidgets.QLineEdit): - widget.setText(''.join(default_values[widget.objectName()])) + try: + widget.setText(''.join(default_values[widget.objectName()])) + except: + print("Skipping resetting new entry",widget.objectName()) elif isinstance(widget, QtWidgets.QRadioButton) or isinstance(widget, QtWidgets.QCheckBox): - if widget.text() in default_values[widget.objectName()]: - widget.setChecked(True) + try: + if widget.text() in default_values[widget.objectName()]: + widget.setChecked(True) + except: + print("Skipping resetting new button",widget.objectName()) elif isinstance(widget, QtWidgets.QSlider): - multiplier = self.slider_multiplier.pop(0) - widget.setValue(int(float(''.join(default_values[widget.objectName()]))*multiplier)) - self.slider_multiplier.append(multiplier) + try: + multiplier = self.slider_multiplier.pop(0) + widget.setValue(int(float(''.join(default_values[widget.objectName()]))*multiplier)) + self.slider_multiplier.append(multiplier) + except: + print("Skipping resetting new slider",widget.objectName()) def quit(self): self.close()