Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, parent=None, init_channel=None):
QWidget.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
self.value = 0
self.setLayout(QGridLayout(self))
self._on_color = QColor(0, 255, 0)
self._off_color = QColor(100, 100, 100)
self._disconnected_color = QColor(255, 255, 255)
self._invalid_color = QColor(255, 0, 255)
self._pen_style = Qt.SolidLine
self._line_pen = QPen(self._pen_style)
self._orientation = Qt.Vertical
# This is kind of ridiculous, importing QTabWidget just to get a 4-item enum thats usable in Designer.
# PyQt5 lets you define custom enums that you can use in designer with QtCore.Q_ENUMS(), doesn't exist in PyQt4.
self._labels = []
def __init__(self, parent=None, init_channel=None):
QFrame.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
self._disable_on_disconnect = False
self.alarmSensitiveBorder = False
def __init__(self, parent=None, init_channel=None):
QtWidgets.QWidget.__init__(self, parent)
PyDMWidget.__init__(self, init_channel)
self._items = {}
self.setLayout(QtWidgets.QVBoxLayout())
self.widget = QtWidgets.QTreeWidget(self)
self.widget.setHeaderLabels(['Key', 'Value'])
self.layout().addWidget(self.widget)
self._items['root'] = self.widget.invisibleRootItem()
self._visited_items = set(['root'])
self._rotation = 0.0
self._brush = QBrush(Qt.SolidPattern)
self._original_brush = None
self._painter = QPainter()
self._pen = QPen(Qt.NoPen)
self._pen_style = Qt.NoPen
self._pen_cap_style = Qt.SquareCap
self._pen_join_style = Qt.MiterJoin
self._pen_width = 0
self._pen_color = QColor(0, 0, 0)
self._pen.setCapStyle(self._pen_cap_style)
self._pen.setJoinStyle(self._pen_join_style)
self._original_pen_style = self._pen_style
self._original_pen_color = self._pen_color
QWidget.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
self.alarmSensitiveBorder = False
self._normalize_data = False
self._auto_downsample = True
self._show_axes = False
# Set default reading order of numpy array data to Fortranlike.
self._reading_order = ReadingOrder.Fortranlike
self._redraw_rate = 30
# Set color map limits.
self.cm_min = 0.0
self.cm_max = 255.0
plot_item = PlotItem()
ImageView.__init__(self, parent, view=plot_item)
PyDMWidget.__init__(self)
self._channels = [None, None]
self.thread = None
self.axes = dict({'t': None, "x": 0, "y": 1, "c": None})
self.showAxes = self._show_axes
# Hide some itens of the widget.
self.ui.histogram.hide()
self.getImageItem().sigImageChanged.disconnect(
self.ui.histogram.imageChanged)
self.ui.roiBtn.hide()
self.ui.menuBtn.hide()
# Make a right-click menu for changing the color map.
self.cm_group = QActionGroup(self)
self.cmap_for_action = {}
for cm in self.color_maps:
def __init__(self, parent=None, init_channel=None):
QWidget.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
if 'Index' not in PyDMSymbol.RULE_PROPERTIES:
PyDMSymbol.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
PyDMSymbol.RULE_PROPERTIES.update(
{'Index': ['set_current_key', object]})
self.app = QApplication.instance()
self._current_key = 0
self._state_images_string = ""
self._state_images = {} # Keyed on state values (ints), values are (filename, qpixmap or qsvgrenderer) tuples.
self._aspect_ratio_mode = Qt.KeepAspectRatio
self._sizeHint = self.minimumSizeHint()
self._painter = QPainter()
def __init__(self, parent=None, init_channel=None):
QFrame.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
self._show_value = True
self._show_limits = True
self.scale_indicator = QScale()
self.value_label = QLabel()
self.lower_label = QLabel()
self.upper_label = QLabel()
self.value_label.setText('')
self.lower_label.setText('')
self.upper_label.setText('')
self._value_position = Qt.TopEdge
self._limits_from_channel = True
self._user_lower_limit = 0
self._user_upper_limit = 0
def __init__(self, parent=None, init_channel=None):
QLabel.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
if 'Text' not in PyDMLabel.RULE_PROPERTIES:
PyDMLabel.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
PyDMLabel.RULE_PROPERTIES.update(
{'Text': ['value_changed', str]})
self.app = QApplication.instance()
self.setTextFormat(Qt.PlainText)
self.setTextInteractionFlags(Qt.NoTextInteraction)
self.setText("PyDMLabel")
self._display_format_type = self.DisplayFormat.Default
self._string_encoding = "utf_8"
if is_pydm_app():
self._string_encoding = self.app.get_string_encoding()