def setDataSource(self, data_source): old_ds = self.dataSource() if old_ds is not None: old_ds.environmentChanged.disconnect(self.on_environment_changed) if data_source is not None: data_source.environmentChanged.connect(self.on_environment_changed) TaurusBaseModel.setDataSource(self, data_source)
def setDataSource(self, pool): if self._data_src is not None: self._data_src.controllerClassesUpdated.disconnect( self.controllerClassesUpdated) if pool is not None: pool.controllerClassesUpdated.connect( self.controllerClassesUpdated) TaurusBaseModel.setDataSource(self, pool)
def setDataSource(self, ms): if self._data_src is not None: self._data_src.macrosUpdated.disconnect( self.macrosUpdated) if ms is not None: ms.macrosUpdated.connect( self.macrosUpdated) TaurusBaseModel.setDataSource(self, ms)
def setDataSource(self, data_source): old_ds = self.dataSource() if old_ds is not None: Qt.QObject.disconnect(old_ds, Qt.SIGNAL('environmentChanged'), self.on_environment_changed) if data_source is not None: Qt.QObject.connect(data_source, Qt.SIGNAL('environmentChanged'), self.on_environment_changed) TaurusBaseModel.setDataSource(self, data_source)
def data(self, index, role=Qt.Qt.DisplayRole): """Reimplemented from :meth:`TaurusBaseModel.data` :return: (object) the data for the given index """ # Try with the normal TaurusBaseModel item-oriented approach try: return TaurusBaseModel.data(self, index, role=role) except: pass # For those things which are inter-item, we handle them here taurus_role = self.role(index.column()) if taurus_role == ChannelView.Synchronization: ch_name, ch_data = index.internalPointer().itemData() unitdict = self.getPyData(ctrlname=ch_data['_controller_name']) key = self.data_keys_map[taurus_role] try: synchronization = unitdict[key] except KeyError: # backwards compatibility for configurations before SEP6 synchronization = unitdict.get('trigger_type', None) if synchronization is not None: msg = ("trigger_type configuration parameter is deprecated" " in favor of synchronization. Re-apply" " configuration in order to upgrade.") self.warning(msg) return AcqSynchType[synchronization] elif taurus_role in (ChannelView.Timer, ChannelView.Monitor): ch_name, ch_data = index.internalPointer().itemData() ctrlname = ch_data['_controller_name'] if ctrlname.startswith("__"): return None ch_info = self.getAvailableChannels()[ch_name] if 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) else: key = taurus_role == ChannelView.Timer and 'timer' or 'monitor' master_full_name = self._mgconfig.get(key, None) if master_full_name is None: return None else: master_info = self.getAvailableChannels()[master_full_name] return master_info['name'] elif taurus_role == ChannelView.Synchronizer: ch_name, ch_data = index.internalPointer().itemData() ctrlname = ch_data['_controller_name'] key = self.data_keys_map[taurus_role] ctrl_data = self.getPyData(ctrlname=ctrlname) trigger_fullname = ctrl_data.get(key, None) all_triggers = self.getAvailableTriggers() if trigger_fullname is None: return None else: trigger_name = all_triggers[trigger_fullname] return trigger_name['name'] return None
def flags(self, index): flags = TaurusBaseModel.flags(self, index) taurus_role = self.role(index.column()) if taurus_role == ChannelView.Channel: #channel column is not editable return flags elif taurus_role == ChannelView.Trigger: ch_name, ch_data = index.internalPointer().itemData() if not ch_data['_controller_name'].startswith("__"): ch_info = self.getAvailableChannels()[ch_name] #only timer/monitor columns of counter timers are editable if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'): flags |= Qt.Qt.ItemIsEditable elif taurus_role in (ChannelView.Timer, ChannelView.Monitor): ch_name, ch_data = index.internalPointer().itemData() if not ch_data['_controller_name'].startswith("__"): #ch_info = self.getAvailableChannels()[ch_name] #if 'CTExpChannel' == ch_info['type']: #only timer/monitor columns of counter timers are editable # flags |= Qt.Qt.ItemIsEditable flags |= Qt.Qt.ItemIsEditable else: flags |= Qt.Qt.ItemIsEditable return flags
def data(self, index, role=Qt.Qt.DisplayRole): """Reimplemented from :meth:`TaurusBaseModel.data` :return: (object) the data for the given index """ #Try with the normal TaurusBaseModel item-oriented approach try: return TaurusBaseModel.data(self, index, role=role) except: pass #For those things which are inter-item, we handle them here taurus_role = self.role(index.column()) if taurus_role == ChannelView.Trigger: ch_name, ch_data = index.internalPointer().itemData() unitdict = self.getPyData(ctrlname=ch_data['_controller_name'], unitid=ch_data['_unit_id']) key = self.data_keys_map[taurus_role] return Qt.QVariant(AcqTriggerType[unitdict.get(key, None)]) elif taurus_role in (ChannelView.Timer, ChannelView.Monitor): ch_name, ch_data = index.internalPointer().itemData() ctrlname = ch_data['_controller_name'] if ctrlname.startswith("__"): return Qt.QVariant() ch_info = self.getAvailableChannels()[ch_name] if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'): unitdict = self.getPyData(ctrlname=ctrlname, unitid=ch_data['_unit_id']) key = self.data_keys_map[taurus_role] master_full_name = unitdict.get(key, None) else: key = taurus_role == ChannelView.Timer and 'timer' or 'monitor' master_full_name = self._mgconfig.get(key, None) if master_full_name is None: return Qt.QVariant() else: master_info = self.getAvailableChannels()[master_full_name] return Qt.QVariant(master_info['name']) return Qt.QVariant()
def setDataSource(self, ms): if self._data_src is not None: Qt.QObject.disconnect(self._data_src, Qt.SIGNAL('macrosUpdated'), self.macrosUpdated) if ms is not None: Qt.QObject.connect(ms, Qt.SIGNAL('macrosUpdated'), self.macrosUpdated) TaurusBaseModel.setDataSource(self, ms)
def setDataSource(self, data_src): self._dirty = False TaurusBaseModel.setDataSource(self, data_src)
def __init__(self, parent=None, data=None): TaurusBaseModel.__init__(self, parent=parent, data=data) self._mgconfig = None self._dirty = False
def __init__(self, parent=None, data=None): TaurusBaseModel.__init__(self, parent=parent, data=data) self.setSelectables(self.ColumnRoles[0])
def __init__(self, parent=None, data=None): TaurusBaseModel.__init__(self, parent=parent, data=data)
def setDataSource(self, ms): if self._data_src is not None: self._data_src.macrosUpdated.disconnect(self.macrosUpdated) if ms is not None: ms.macrosUpdated.connect(self.macrosUpdated) TaurusBaseModel.setDataSource(self, ms)
def setDataSource(self, pool): if self._data_src is not None: Qt.QObject.disconnect(self._data_src, Qt.SIGNAL('controllerClassesUpdated'), self.controllerClassesUpdated) if pool is not None: Qt.QObject.connect(pool, Qt.SIGNAL('controllerClassesUpdated'), self.controllerClassesUpdated) TaurusBaseModel.setDataSource(self, pool)