Esempio n. 1
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 Qt.QVariant(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 Qt.QVariant()
            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 Qt.QVariant()
            else:
                master_info = self.getAvailableChannels()[master_full_name]
                return Qt.QVariant(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 Qt.QVariant()
            else:
                trigger_name = all_triggers[trigger_fullname]
                return Qt.QVariant(trigger_name['name'])

        return Qt.QVariant()
Esempio n. 2
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
Esempio n. 3
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()
            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'):
                return None
            unitdict = self.getPyData(ctrlname=ctrlname)
            key = self.data_keys_map[taurus_role]
            synchronization = unitdict[key]
            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
Esempio n. 4
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()
Esempio n. 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.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()