How to use the sardana.taurus.core.tango.sardana.ChannelView function in sardana

To help you get started, we’ve selected a few sardana examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
ChannelView.Output, ChannelView.ValueRefEnabled,
                           ChannelView.ValueRefPattern):
            data = qvalue
        elif taurus_role == ChannelView.DataType:
            if len(qvalue.strip()) == 0:
                # empty strings are considered as unspecified data type
                try:
                    ch_data.pop(key)
                except KeyError:
                    pass  # data_type key may not be there if not specified
                return
            else:
                data = qvalue
        elif taurus_role == ChannelView.PlotType:
            data = PlotType[qvalue]
        elif taurus_role == ChannelView.Normalization:
            data = Normalization[qvalue]
        elif taurus_role == ChannelView.PlotAxes:
            data = [a for a in qvalue.split('|')]
        elif taurus_role == ChannelView.Shape:
            s = qvalue
            try:
                data = eval(s, {}, {})
                if not isinstance(data, (tuple, list)):
                    raise ValueError
            except:
                from taurus.core.util.log import Logger
                Logger(self.__class__.__name__).error('Invalid shape %s', s)
                data = ()
        else:
            raise NotImplementedError('Unknown role')
        ch_data[key] = data
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
def getElementTypeIcon(t):
    if t == ChannelView.Channel:
        return getIcon(":/actions/system-shutdown.svg")
    elif t == ChannelView.Enabled:
        return getIcon(":/status/true.svg")
    elif t == ChannelView.Output:
        return getThemeIcon("utilities-terminal")
    elif t == ChannelView.PlotType:
        return getIcon(":/apps/utilities-system-monitor.svg")
    elif t == ChannelView.PlotAxes:
        return getIcon(":/apps/utilities-system-monitor.svg")
    elif t == ChannelView.Timer:
        return getIcon(":/status/flag-green-clock.svg")
    elif t == ChannelView.Monitor:
        return getIcon(":/status/flag-green.svg")
    elif t == ChannelView.Trigger:
        return getIcon(":/actions/system-shutdown.svg")
    elif t == ChannelView.NXPath:
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
return "Channel"
    elif t == ChannelView.Enabled:
        return "Channel active or not"
    elif t == ChannelView.Output:
        return "Channel output active or not"
    elif t == ChannelView.Shape:
        return "Shape of the data (using numpy convention). For example, a scalar will have shape=(), a spectrum of 10 elements will have shape=(10,) and an image of 20x30 will be shape=(20,30)"
    elif t == ChannelView.DataType:
        return "Type of data for storing (valid types are: char, float32, float64, [u]int{8|16|32|64})",
    elif t == ChannelView.PlotType:
        return "Plot type for this channel "
    elif t == ChannelView.PlotAxes:
        return "Independent variables to be used in the plot of this channel"
    elif t == ChannelView.Timer:
        return "The channel to be used as the timer"
    elif t == ChannelView.Monitor:
        return "The channel to be used as a monitor for stopping the acquisition"
    elif t == ChannelView.Trigger:
        return "The channel to be used for triggering the acquisition"
    elif t == ChannelView.Conditioning:
        return "An expression to evaluate on the data when displaying it"
    elif t == ChannelView.Normalization:
        return "Normalization mode for the data"
    elif t == ChannelView.NXPath:
        return "Location of the data of this channel within the NeXus tree"
    return "Unknown"
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
class MntGrpChannelItem(BaseMntGrpChannelItem):

    itemdata_keys_map = {ChannelView.Channel: 'label',
                         ChannelView.Enabled: 'enabled',
                         ChannelView.Output: 'output',
                         ChannelView.Shape: 'shape',
                         ChannelView.DataType: 'data_type',
                         ChannelView.PlotType: 'plot_type',
                         ChannelView.PlotAxes: 'plot_axes',
                         #                         ChannelView.Timer:'timer',
                         #                         ChannelView.Monitor:'monitor',
                         #                         ChannelView.Synchronization:'trigger',
                         ChannelView.ValueRefEnabled: 'value_ref_enabled',
                         ChannelView.ValueRefPattern: 'value_ref_pattern',
                         ChannelView.Conditioning: 'conditioning',
                         ChannelView.Normalization: 'normalization',
                         ChannelView.NXPath: 'nexus_path',
                         }

    def data(self, index):
        """Returns the data of this node for the given index

        :return: (object) the data for the given index
        """
        taurus_role = index.model().role(index.column())
        ch_name, ch_data = self.itemData()
        key = self.itemdata_keys_map[taurus_role]
        ret = ch_data[key]
        if taurus_role == ChannelView.PlotType:
            ret = PlotType[ret]
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
return "Type of data for storing (valid types are: char, float32, float64, [u]int{8|16|32|64})",
    elif t == ChannelView.PlotType:
        return "Plot type for this channel "
    elif t == ChannelView.PlotAxes:
        return "Independent variables to be used in the plot of this channel"
    elif t == ChannelView.Timer:
        return "The channel to be used as the timer"
    elif t == ChannelView.Monitor:
        return "The channel to be used as a monitor for stopping the acquisition"
    elif t == ChannelView.Synchronization:
        return "The channel to be used for triggering the acquisition"
    elif t == ChannelView.ValueRefEnabled:
        return "Channel value referencing active or not"
    elif t == ChannelView.ValueRefPattern:
        return "Channel value referencing pattern"
    elif t == ChannelView.Conditioning:
        return "An expression to evaluate on the data when displaying it"
    elif t == ChannelView.Normalization:
        return "Normalization mode for the data"
    elif t == ChannelView.NXPath:
        return "Location of the data of this channel within the NeXus tree"
    elif t == ChannelView.Synchronizer:
        return "Synchronization element"
    return "Unknown"
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
"""Returns the prefered role for the item.
        This implementation returns ChannelView.Unknown

        This method should be able to return any kind of python object as long
        as the model that is used is compatible.

        :return: (MacroView) the role in form of element type"""
        return ChannelView.Unknown


class MntGrpChannelItem(BaseMntGrpChannelItem):

    itemdata_keys_map = {ChannelView.Channel:'label',
                         ChannelView.Enabled:'enabled',
                         ChannelView.Output:'output',
                         ChannelView.Shape:'shape',
                         ChannelView.DataType:'data_type',
                         ChannelView.PlotType:'plot_type',
                         ChannelView.PlotAxes:'plot_axes',
#                         ChannelView.Timer:'timer',
#                         ChannelView.Monitor:'monitor',
#                         ChannelView.Trigger:'trigger',
                         ChannelView.Conditioning:'conditioning',
                         ChannelView.Normalization:'normalization',
                         ChannelView.NXPath:'nexus_path'
                         }

    def data(self, index):
        """Returns the data of this node for the given index

        :return: (object) the data for the given index
        """
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
def getElementTypeIcon(t):
    if t == ChannelView.Channel:
        return getIcon(":/actions/system-shutdown.svg")
    elif t == ChannelView.Enabled:
        return getIcon(":/status/true.svg")
    elif t == ChannelView.Output:
        return getThemeIcon("utilities-terminal")
    elif t == ChannelView.PlotType:
        return getIcon(":/apps/utilities-system-monitor.svg")
    elif t == ChannelView.PlotAxes:
        return getIcon(":/apps/utilities-system-monitor.svg")
    elif t == ChannelView.Timer:
        return getIcon(":/status/flag-green-clock.svg")
    elif t == ChannelView.Monitor:
        return getIcon(":/status/flag-green.svg")
    elif t == ChannelView.Synchronization:
        return getIcon(":/actions/system-shutdown.svg")
    elif t == ChannelView.NXPath:
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
old_value = Qt.from_qvariant(model.data(index), str)
            new_value = str(editor.currentText())
            if new_value == old_value:
                return
            ch_name, ch_data = index.internalPointer().itemData()
            channels = getChannelConfigs(dataSource, ctrls=[ch_data['_controller_name']], units=[ch_data['_unit_id']])
            affected = [d['name'] for n, d in channels]
            if len(affected) > 1:
                op = Qt.QMessageBox.question(editor, "Caution: multiple channels affected",
                                            "This change will also affect the following channels:\n- %s \nContinue?" % "\n- ".join(affected),
                                            Qt.QMessageBox.Yes | Qt.QMessageBox.Cancel)
                if op != Qt.QMessageBox.Yes:
                    return
            data = Qt.QVariant(new_value)
            model.setData(index, data)
        elif taurus_role in (ChannelView.Timer, ChannelView.Monitor):
            key = taurus_role == ChannelView.Timer and 'timer' or 'monitor'
            old_value = Qt.from_qvariant(model.data(index), str)
            new_value = str(editor.currentText())
            if new_value == old_value:
                return
            ch_name, ch_data = index.internalPointer().itemData()
            all_channels = model.getAvailableChannels()
            # if it is a timer capable type of element
            ch_info = all_channels[ch_name]
            selected_master = editor.itemData(editor.currentIndex())
            if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
                affected = []
                unit_data = model.getPyData(ctrlname=ch_data['_controller_name'], unitid=ch_data['_unit_id'])
                channels = getChannelConfigs(dataSource, ctrls=[ch_data['_controller_name']], units=[ch_data['_unit_id']])
                for n, d in channels:
                    affected.append(d['name'])
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
This implementation returns ChannelView.Unknown

        This method should be able to return any kind of python object as long
        as the model that is used is compatible.

        :return: (MacroView) the role in form of element type"""
        return ChannelView.Unknown


class MntGrpChannelItem(BaseMntGrpChannelItem):

    itemdata_keys_map = {ChannelView.Channel:'label',
                         ChannelView.Enabled:'enabled',
                         ChannelView.Output:'output',
                         ChannelView.Shape:'shape',
                         ChannelView.DataType:'data_type',
                         ChannelView.PlotType:'plot_type',
                         ChannelView.PlotAxes:'plot_axes',
#                         ChannelView.Timer:'timer',
#                         ChannelView.Monitor:'monitor',
#                         ChannelView.Trigger:'trigger',
                         ChannelView.Conditioning:'conditioning',
                         ChannelView.Normalization:'normalization',
                         ChannelView.NXPath:'nexus_path'
                         }

    def data(self, index):
        """Returns the data of this node for the given index

        :return: (object) the data for the given index
        """
        taurus_role = index.model().role(index.column())
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
def getElementTypeToolTip(t):
    """Wrapper to prevent loading qtgui when this module is imported"""
    if t == ChannelView.Channel:
        return "Channel"
    elif t == ChannelView.Enabled:
        return "Channel active or not"
    elif t == ChannelView.Output:
        return "Channel output active or not"
    elif t == ChannelView.Shape:
        return "Shape of the data (using numpy convention). For example, a scalar will have shape=(), a spectrum of 10 elements will have shape=(10,) and an image of 20x30 will be shape=(20,30)"
    elif t == ChannelView.DataType:
        return "Type of data for storing (valid types are: char, float32, float64, [u]int{8|16|32|64})",
    elif t == ChannelView.PlotType:
        return "Plot type for this channel "
    elif t == ChannelView.PlotAxes:
        return "Independent variables to be used in the plot of this channel"
    elif t == ChannelView.Timer:
        return "The channel to be used as the timer"
    elif t == ChannelView.Monitor:
        return "The channel to be used as a monitor for stopping the acquisition"
    elif t == ChannelView.Synchronization:
        return "The channel to be used for triggering the acquisition"
    elif t == ChannelView.ValueRefEnabled: