Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Fix udef elem expconf #1667

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sardana/pool/poolmeasurementgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']))

Expand Down
47 changes: 27 additions & 20 deletions src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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]
Expand All @@ -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)
Expand Down