diff --git a/mne_pipeline_hd/gui/parameter_widgets.py b/mne_pipeline_hd/gui/parameter_widgets.py index 3d7ca4f..6423b51 100644 --- a/mne_pipeline_hd/gui/parameter_widgets.py +++ b/mne_pipeline_hd/gui/parameter_widgets.py @@ -618,10 +618,11 @@ def set_value(self, value): # Signal valueChanged is already emitted after first setValue, # which leads to second param_value being 0 without being # preserved in self.loaded_value - self._external_set = True - self.param_widget1.setValue(value[0]) - self.param_widget2.setValue(value[1]) - self._external_set = False + if len(value) == 2: + self._external_set = True + self.param_widget1.setValue(value[0]) + self.param_widget2.setValue(value[1]) + self._external_set = False def _get_param(self): if not self._external_set: diff --git a/mne_pipeline_hd/tests/test_parameter_widgets.py b/mne_pipeline_hd/tests/test_parameter_widgets.py index d9fc029..322c097 100644 --- a/mne_pipeline_hd/tests/test_parameter_widgets.py +++ b/mne_pipeline_hd/tests/test_parameter_widgets.py @@ -154,8 +154,7 @@ def test_basic_param_guis(qtbot, gui_name): } kwargs["type_kwargs"][type_gui_name] = t_kwargs gui = gui_class(data=parameters, name=gui_name, **kwargs) - for gui_type, type_gui_name in gui.gui_types.items(): - type_idx = gui.types.index(gui_type) + for type_idx, (gui_type, type_gui_name) in enumerate(gui.gui_types.items()): gui.change_type(type_idx) gui.set_param(parameters[type_gui_name]) assert gui.get_value() == parameters[type_gui_name]