How to use the pydm.widgets.channel.PyDMChannel function in pydm

To help you get started, we’ve selected a few pydm 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 slaclab / pydm / tests / test_utils / fake_widgets.py View on Github external
def channels(self):
        """
        Return list of channels, in this case one channel with every field
        filled except for the waveform fields.

        :rtyp: list of :class:Channel
        """
        return [Channel(address=self.channel,
                        value_slot=self.recv_value,
                        value_signal=self.send_value_signal,
                        connection_slot=self.recv_conn,
                        severity_slot=self.recv_sevr,
                        write_access_slot=self.recv_rwacc,
                        enum_strings_slot=self.recv_enums,
                        unit_slot=self.recv_units,
                        prec_slot=self.recv_prec)]
github slaclab / pydm / tests / test_utils / fake_widgets.py View on Github external
def channels(self):
        """
        Return list of channels, in this case one channel with every field
        filled except for the value fields.

        :rtyp: list of :class:Channel
        """
        return [Channel(address=self.channel,
                        waveform_slot=self.recv_waveform,
                        waveform_signal=self.send_waveform_signal,
                        connection_slot=self.recv_conn,
                        severity_slot=self.recv_sevr,
                        write_access_slot=self.recv_rwacc,
                        enum_strings_slot=self.recv_enums,
                        unit_slot=self.recv_units,
                        prec_slot=self.recv_prec)]
github slaclab / pydm / pydm / widgets / waveformplot.py View on Github external
def x_address(self, new_address):
        """
        The address of the channel used to get the x axis waveform data.

        Parameters
        -------
        new_address: str
        """
        if new_address is None or len(str(new_address)) < 1:
            self.x_channel = None
            return
        self.x_channel = PyDMChannel(
                            address=new_address,
                            connection_slot=self.xConnectionStateChanged,
                            value_slot=self.receiveXWaveform)
github slaclab / pydm / pydm / widgets / rules.py View on Github external
for idx, rule in enumerate(rules):
                channels_list = rule.get('channels', [])

                item = dict()
                item['rule'] = rule
                item['calculate'] = False
                item['values'] = [None] * len(channels_list)
                item['conn'] = [False] * len(channels_list)
                item['channels'] = []

                for ch_idx, ch in enumerate(channels_list):
                    conn_cb = functools.partial(self.callback_conn, widget_ref,
                                                idx, ch_idx)
                    value_cb = functools.partial(self.callback_value, widget_ref,
                                                 idx, ch_idx, ch['trigger'])
                    c = PyDMChannel(ch['channel'], connection_slot=conn_cb,
                                    value_slot=value_cb)
                    item['channels'].append(c)
                    c.connect()

                self.widget_map[widget_ref].append(item)
github slaclab / pydm / pydm / widgets / waveformplot.py View on Github external
def y_address(self, new_address):
        """
        The address of the channel used to get the y axis waveform data.

        Parameters
        ----------
        new_address: str
        """
        if new_address is None or len(str(new_address)) < 1:
            self.y_channel = None
            return
        self.y_channel = PyDMChannel(
                            address=new_address,
                            connection_slot=self.yConnectionStateChanged,
                            value_slot=self.receiveYWaveform)
github slaclab / pydm / pydm / widgets / tab_bar.py View on Github external
# Disconnect the channel if we already had one in
            chan = idx.get("channel", None)
            if chan:
                self._channels.remove(chan)
                self.tab_channels[index]["channel"] = None
                chan.disconnect()
                del chan
        else:
            chan = None
            self.tab_channels[index] = dict()

        self.tab_channels[index]["address"] = str(channel)
        self.set_initial_icon_for_tab(index)
        if channel:
            # Create PyDMChannel and connecdt
            chan = PyDMChannel(address=str(channel),
                               connection_slot=partial(self.connection_changed_for_tab, index),
                               severity_slot=partial(self.alarm_changed_for_tab, index))
            self.tab_channels[index]["channel"] = chan
            chan.connect()
            self._channels.append(chan)
github slaclab / pydm / pydm / widgets / image.py View on Github external
def widthChannel(self, value):
        """
        The channel address in use for the image width .

        Parameters
        ----------
        value : str
            Channel address
        """
        if self._widthchannel != value:
            # Disconnect old channel
            if self._widthchannel:
                self._widthchannel.disconnect()
            # Create and connect new channel
            self._widthchannel = PyDMChannel(
                            address=value,
                            connection_slot=self.connectionStateChanged,
                            value_slot=self.image_width_changed,
                            severity_slot=self.alarmSeverityChanged)
            self._channels[1] = self._widthchannel
            self._widthchannel.connect()
github slaclab / pydm / examples / camviewer / camviewer.py View on Github external
self.imageChannel = self.cameras[new_camera]["image"]
        self.widthChannel = self.cameras[new_camera]["roi_width"] or self.cameras[new_camera]["max_width"]
        self.maxWidthChannel = self.cameras[new_camera]["max_width"]
        self.maxHeightChannel = self.cameras[new_camera]["max_height"]
        self.roiXChannel = self.cameras[new_camera]["roi_x"]
        self.roiYChannel = self.cameras[new_camera]["roi_y"]
        self.roiWidthChannel = self.cameras[new_camera]["roi_width"]
        self.roiHeightChannel = self.cameras[new_camera]["roi_height"]

        self._channels = [PyDMChannel(address=self.imageChannel, connection_slot=self.connectionStateChanged, value_slot=self.receiveImageWaveform, severity_slot=self.alarmSeverityChanged),
                                            PyDMChannel(address=self.widthChannel, value_slot=self.receiveImageWidth),
                                            PyDMChannel(address=self.maxWidthChannel, value_slot=self.receiveMaxWidth),
                                            PyDMChannel(address=self.maxHeightChannel, value_slot=self.receiveMaxHeight)]
        if self.roiXChannel and self.roiYChannel and self.roiWidthChannel and self.roiHeightChannel:
            self._channels.extend([PyDMChannel(address=self.roiXChannel, value_slot=self.receiveRoiX, value_signal=self.roi_x_signal, write_access_slot=self.roiWriteAccessChanged),
                                                         PyDMChannel(address=self.roiYChannel, value_slot=self.receiveRoiY, value_signal=self.roi_y_signal),
                                                         PyDMChannel(address=self.roiWidthChannel, value_slot=self.receiveRoiWidth, value_signal=self.roi_w_signal),
                                                         PyDMChannel(address=self.roiHeightChannel, value_slot=self.receiveRoiHeight, value_signal=self.roi_h_signal)])
            self.ui.roiXLineEdit.setEnabled(True)
            self.ui.roiYLineEdit.setEnabled(True)
            self.ui.roiWLineEdit.setEnabled(True)
            self.ui.roiHLineEdit.setEnabled(True)
        else:
            self.ui.roiXLineEdit.clear()
            self.ui.roiXLineEdit.setEnabled(False)
            self.ui.roiYLineEdit.clear()
            self.ui.roiYLineEdit.setEnabled(False)
            self.ui.roiWLineEdit.clear()
            self.ui.roiWLineEdit.setEnabled(False)
            self.ui.roiHLineEdit.clear()
            self.ui.roiHLineEdit.setEnabled(False)
        establish_widget_connections(self)
github slaclab / pydm / pydm / widgets / scatterplot.py View on Github external
def y_address(self, new_address):
        """
        The address of the channel used to get the y axis data.

        Parameters
        ----------
        new_address: str
        """
        if new_address is None or len(str(new_address)) < 1:
            self.y_channel = None
            return
        self.y_channel = PyDMChannel(
            address=new_address,
            connection_slot=self.yConnectionStateChanged,
            value_slot=self.receiveYValue)