diff --git a/src/pymmcore_widgets/_device_property_table.py b/src/pymmcore_widgets/_device_property_table.py index 65f4c76d7..f5eb6b50f 100644 --- a/src/pymmcore_widgets/_device_property_table.py +++ b/src/pymmcore_widgets/_device_property_table.py @@ -1,5 +1,6 @@ from __future__ import annotations +from logging import getLogger from typing import Iterable, cast from fonticon_mdi6 import MDI6 @@ -31,6 +32,8 @@ DeviceType.Serial: MDI6.serial_port, } +logger = getLogger(__name__) + class DevicePropertyTable(QTableWidget): """Table of all currently loaded device properties. @@ -140,18 +143,24 @@ def _rebuild_table(self) -> None: for i, prop in enumerate(props): item = QTableWidgetItem(f"{prop.device}-{prop.name}") item.setData(self.PROP_ROLE, prop) - # TODO: make sure to add icons for all possible device types - icon_string = ICONS.get(prop.deviceType(), None) + icon_string = ICONS.get(prop.deviceType()) if icon_string: item.setIcon(icon(icon_string, color="Gray")) self.setItem(i, 0, item) - wdg = PropertyWidget( - prop.device, - prop.name, - mmcore=self._mmc, - connect_core=self._connect_core, - ) + try: + wdg = PropertyWidget( + prop.device, + prop.name, + mmcore=self._mmc, + connect_core=self._connect_core, + ) + except Exception as e: + logger.error( + f"Error creating widget for {prop.device}-{prop.name}: {e}" + ) + continue + self.setCellWidget(i, 1, wdg) if not self._prop_widgets_enabled: wdg.setEnabled(False)