How to use the pydm.widgets.base.PyDMWritableWidget 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 pcdshub / typhon / typhos / textedit.py View on Github external
"""
import logging

import numpy as np
from qtpy import QtWidgets

from pydm.widgets.base import PyDMWritableWidget

from . import variety

logger = logging.getLogger(__name__)


@variety.uses_key_handlers
@variety.use_for_variety_write('text-multiline')
class TyphosTextEdit(QtWidgets.QWidget, PyDMWritableWidget):
    """
    A writable, multiline text editor with support for PyDM Channels.

    Parameters
    ----------
    parent : QWidget
        The parent widget.

    init_channel : str, optional
        The channel to be used by the widget.
    """

    def __init__(self, parent=None, init_channel=None, variety_metadata=None,
                 ophyd_signal=None):

        self._display_text = None
github slaclab / pydm / pydm / widgets / line_edit.py View on Github external
import locale
from functools import partial
import numpy as np

import logging
logger = logging.getLogger(__name__)

from qtpy.QtWidgets import QLineEdit, QMenu, QApplication
from qtpy.QtCore import Property, Q_ENUMS
from .. import utilities
from .base import PyDMWritableWidget, TextFormatter
from .display_format import DisplayFormat, parse_value_for_display


class PyDMLineEdit(QLineEdit, TextFormatter, PyDMWritableWidget, DisplayFormat):
    Q_ENUMS(DisplayFormat)
    DisplayFormat = DisplayFormat
    """
    A QLineEdit (writable text field) with support for Channels and more
    from PyDM.
    This widget offers an unit conversion menu when users Right Click
    into it.

    Parameters
    ----------
    parent : QWidget
        The parent widget for the Label
    init_channel : str, optional
        The channel to be used by the widget.
    """
github slaclab / pydm / pydm / widgets / pushbutton.py View on Github external
import hashlib

from qtpy.QtWidgets import QPushButton, QMessageBox, QInputDialog, QLineEdit
from qtpy.QtCore import Slot, Property
from .base import PyDMWritableWidget

import logging
logger = logging.getLogger(__name__)


class PyDMPushButton(QPushButton, PyDMWritableWidget):
    """
    Basic PushButton to send a fixed value.

    The PyDMPushButton is meant to hold a specific value, and send that value
    to a channel when it is clicked, much like the MessageButton does in EDM.
    The PyDMPushButton works in two different modes of operation, first, a
    fixed value can be given to the :attr:`.pressValue` attribute, whenever the
    button is clicked a signal containing this value will be sent to the
    connected channel. This is the default behavior of the button. However, if
    the :attr:`.relativeChange` is set to True, the fixed value will be added
    to the current value of the channel. This means that the button will
    increment a channel by a fixed amount with every click, a consistent
    relative move

    Parameters
    ----------
github slaclab / pydm / pydm / widgets / enum_combo_box.py View on Github external
import logging
logger = logging.getLogger(__name__)

import six
from qtpy.QtWidgets import QComboBox
from qtpy.QtCore import Slot, Qt
from .base import PyDMWritableWidget
from .. import data_plugins


class PyDMEnumComboBox(QComboBox, PyDMWritableWidget):
    """
    A QComboBox with support for Channels and more from PyDM

    Parameters
    ----------
    parent : QWidget
        The parent widget for the Label
    init_channel : str, optional
        The channel to be used by the widget.

    Signals
    -------
    send_value_signal : int, float, str, bool or np.ndarray
        Emitted when the user changes the value.
    activated : int, str
        Emitted when the user chooses an item in the combobox.
github slaclab / pydm / pydm / widgets / waveformtable.py View on Github external
from qtpy.QtWidgets import QTableWidget, QTableWidgetItem, QApplication
from qtpy.QtGui import QCursor
from qtpy.QtCore import Slot, Property, Qt, QEvent
import numpy as np
from .base import PyDMWritableWidget


class PyDMWaveformTable(QTableWidget, PyDMWritableWidget):
    """
    A QTableWidget with support for Channels and more from PyDM.

    Values of the array are displayed in the selected number of columns.
    The number of rows is determined by the size of the waveform.
    It is possible to define the labels of each row and column.

    Parameters
    ----------
    parent : QWidget
        The parent widget for the Label
    init_channel : str, optional
        The channel to be used by the widget.
    """

    def __init__(self, parent=None, init_channel=None):
github slaclab / pydm / pydm / widgets / waveformtable.py View on Github external
def check_enable_state(self):
        """
        For PyDMWaveformTable, we want to make the individual cells
        editable when we have write access.
        """
        PyDMWritableWidget.check_enable_state(self)
        self.setEnabled(True)
        if self._write_access and self._connected:
            self._itemsFlags = Qt.ItemIsSelectable|Qt.ItemIsEditable|Qt.ItemIsEnabled
        elif self._connected:
            self._itemsFlags = Qt.ItemIsSelectable|Qt.ItemIsEnabled
        else:
            self._itemsFlags = Qt.ItemIsSelectable
        for col in range(0, self.columnCount()):
            for row in range(0, self.rowCount()):
                item = self.item(row, col)
                if item is not None:
                    item.setFlags(self._itemsFlags)