def _onDataChanged(self, viewer_ctrl): if viewer_ctrl is None or not supported(viewer_ctrl.data_type, viewer_ctrl.viewer_type, self.item_config.supported_data_types, self.item_config.supported_viewer_types): self._toolbar_view.setEnabled(False) else: self._toolbar_view.setEnabled(True)
def supports(self, viewer_ctrl: ViewerController) -> bool: """ Checks if the connection to the viewer controller is possible :param viewer_ctrl: the viewer controller to check :return: True if supported, False otherwise """ return viewer_ctrl is not None and supported( viewer_ctrl.data_type, viewer_ctrl.viewer_type, self.supported_data_types, self.supported_viewer_types)
def f(vc: ViewerController, a=action, c=ctrl): dt = vc.data_type if vc else None vt = vc.viewer_type if vc else None enabled = supported(dt, vt, c.item_config.supported_data_types, c.item_config.supported_viewer_types) a.setEnabled(enabled)
def supports(self, viewer_ctrl: ViewerController) -> bool: return viewer_ctrl is not None and supported( viewer_ctrl.data_type, viewer_ctrl.viewer_type, self.item_config.supported_data_types, self.item_config.supported_viewer_types)