diff --git a/src/sardana/pool/poolmeasurementgroup.py b/src/sardana/pool/poolmeasurementgroup.py index c335b16f7..5758599f7 100644 --- a/src/sardana/pool/poolmeasurementgroup.py +++ b/src/sardana/pool/poolmeasurementgroup.py @@ -803,6 +803,9 @@ def set_configuration_from_user(self, cfg): try: channel = pool.get_element_by_full_name(ch_name) except KeyError: + if not ch_data['enabled']: + user_config_channel[ch_name] = ch_data + continue raise ValueError( '{} is not defined'.format(ch_data['name'])) diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py b/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py index 3d6171800..bd1eb9f7b 100644 --- a/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py +++ b/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py @@ -465,20 +465,23 @@ def flags(self, index): taurus_role = self.role(index.column()) if taurus_role == ChannelView.Channel: # channel column is not editable return flags - elif taurus_role in (ChannelView.Timer, - ChannelView.Monitor, - ChannelView.Synchronizer, - ChannelView.Synchronization): - ch_name, ch_data = index.internalPointer().itemData() - if not ch_data['_controller_name'].startswith("__"): - ch_info = self.getAvailableChannels()[ch_name] - # only timerable channels accept these configurations - if ch_info['type'] in ('CTExpChannel', - 'OneDExpChannel', - 'TwoDExpChannel'): - flags |= Qt.Qt.ItemIsEditable - else: - flags |= Qt.Qt.ItemIsEditable + ch_name, ch_data = index.internalPointer().itemData() + external = ch_data['_controller_name'].startswith("__") + if not external: + ch_info = self.getAvailableChannels().get(ch_name) + defined = ch_info is not None + if not defined: + return flags + timerable = ch_info['type'] in ('CTExpChannel', + 'OneDExpChannel', + 'TwoDExpChannel') + if taurus_role in (ChannelView.Timer, + ChannelView.Monitor, + ChannelView.Synchronizer, + ChannelView.Synchronization): + if external or not timerable: + return flags + flags |= Qt.Qt.ItemIsEditable return flags def data(self, index, role=Qt.Qt.DisplayRole): @@ -498,10 +501,11 @@ def data(self, index, role=Qt.Qt.DisplayRole): ctrlname = ch_data['_controller_name'] if ctrlname.startswith("__"): return None - ch_info = self.getAvailableChannels()[ch_name] - if ch_info['type'] not in ('CTExpChannel', - 'OneDExpChannel', - 'TwoDExpChannel'): + ch_info = self.getAvailableChannels().get(ch_name) + if (ch_info is not None + and ch_info['type'] not in ('CTExpChannel', + 'OneDExpChannel', + 'TwoDExpChannel')): return None unitdict = self.getPyData(ctrlname=ctrlname) key = self.data_keys_map[taurus_role] @@ -512,8 +516,11 @@ def data(self, index, role=Qt.Qt.DisplayRole): ctrlname = ch_data['_controller_name'] if ctrlname.startswith("__"): return None - ch_info = self.getAvailableChannels()[ch_name] - if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'): + ch_info = self.getAvailableChannels().get(ch_name) + if (ch_info is not None + and ch_info['type'] in ('CTExpChannel', + 'OneDExpChannel', + 'TwoDExpChannel')): unitdict = self.getPyData(ctrlname=ctrlname) key = self.data_keys_map[taurus_role] master_full_name = unitdict.get(key, None)