diff --git a/examples/channel_config_widget.py b/examples/channel_config_widget.py index 7df4c8c56..ae7a2a1ec 100644 --- a/examples/channel_config_widget.py +++ b/examples/channel_config_widget.py @@ -4,7 +4,7 @@ from pymmcore_widgets import OpticalConfigDialog core = CMMCorePlus().instance() -core.loadSystemConfiguration(r"c:\Users\Admin\Desktop\test.cfg") +core.loadSystemConfiguration() app = QApplication([]) ocd = OpticalConfigDialog() ocd.load_group("Channel") diff --git a/src/pymmcore_widgets/_oc_dialog.py b/src/pymmcore_widgets/_oc_dialog.py index dc09fdc90..ba0d3c1d5 100644 --- a/src/pymmcore_widgets/_oc_dialog.py +++ b/src/pymmcore_widgets/_oc_dialog.py @@ -20,6 +20,7 @@ QVBoxLayout, QWidget, ) +from superqt.utils import signals_blocked from pymmcore_widgets._device_property_table import DevicePropertyTable from pymmcore_widgets._objective_widget import ObjectivesWidget @@ -31,6 +32,7 @@ def __init__( ) -> None: super().__init__(parent) self._core = mmcore or CMMCorePlus.instance() + self._model = ConfigGroup("") self.groups = QComboBox(self) self.groups.addItems(self._core.getAvailableConfigGroups()) @@ -154,9 +156,10 @@ def _activate_oc(self) -> None: def load_group(self, group: str) -> None: self.groups.setCurrentText(group) - self._name_list.clear() - for n in self._core.getAvailableConfigs(group): - self._add_editable_item(n) + with signals_blocked(self._name_list): + self._name_list.clear() + for n in self._core.getAvailableConfigs(group): + self._add_editable_item(n) self._model = ConfigGroup.create_from_core(self._core, group) self._name_list.setCurrentRow(0)