Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
    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
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
    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()
Пример #9
0
 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)
Пример #10
0
 def setDataSource(self, data_src):
     self._dirty = False
     TaurusBaseModel.setDataSource(self, data_src)
Пример #11
0
 def __init__(self, parent=None, data=None):
     TaurusBaseModel.__init__(self, parent=parent, data=data)
     self._mgconfig = None
     self._dirty = False
Пример #12
0
 def __init__(self, parent=None, data=None):
     TaurusBaseModel.__init__(self, parent=parent, data=data)
     self.setSelectables(self.ColumnRoles[0])
Пример #13
0
 def __init__(self, parent=None, data=None):
     TaurusBaseModel.__init__(self, parent=parent, data=data)
Пример #14
0
 def __init__(self, parent=None, data=None):
     TaurusBaseModel.__init__(self, parent=parent, data=data)
     self._mgconfig = None
     self._dirty = False
Пример #15
0
 def __init__(self, parent=None, data=None):
     TaurusBaseModel.__init__(self, parent=parent, data=data)
     self.setSelectables(self.ColumnRoles[0])
Пример #16
0
 def __init__(self, parent=None, data=None):
     TaurusBaseModel.__init__(self, parent=parent, data=data)
Пример #17
0
 def setDataSource(self, data_src):
     self._dirty = False
     TaurusBaseModel.setDataSource(self, data_src)
Пример #18
0
 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)
Пример #19
0
 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)