BcdaQWidgets: bcdaqwidgets.bcdaqwidgets¶
BcdaQWidgets: PyEpics-aware PyQt widgets for the APS
Copyright (c) 2009-2017, UChicago Argonne, LLC. See LICENSE file for details.
The bcdaqwidgets [1] module provides a set of PyQt4 widgets that are EPICS-aware. These include:
widget | description |
---|---|
BcdaQLabel |
EPICS-aware QLabel widget |
BcdaQLineEdit |
EPICS-aware QLineEdit widget |
BcdaQPushButton |
EPICS-aware QPushButton widget |
BcdaQMomentaryButton |
sends a value when pressed or released, label does not change |
BcdaQToggleButton |
toggles boolean PV when pressed |
BcdaQLabel_RBV |
makes motor RBV field background green when motor is moving |
[1] | BCDA: Beam line Controls and Data Acquisition group of the Advanced Photon Source, Argonne National Laboratory, http://www.aps.anl.gov/bcda |
Note
bcdaqwidgets must be imported AFTER importing PyQt4
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQLabel
(pvname=None, useAlarmState=False, bgColorPv=None)[source]¶ Provide the value of an EPICS PV on a PyQt4.QtGui.QLabel
USAGE:
import bcdaqwidgets ... widget = bcdaqwidgets.BcdaQLabel() widget.ca_connect("example:m1.RBV")
Parameters: - pvname (str) – epics process variable name for this widget
- useAlarmState (bool) – change the text color based on pv severity
- bgColorPv (str) – update widget’s background color based on this pv’s value
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQLabel_RBV
(*args, **kw)[source]¶ makes motor readback field (BcdaQLabel) background green when motor is moving
EXAMPLE:
pvname = 'ioc:m1' w = bcdaqwidgets.BcdaQLabel_RBV() layout.addWidget(w) w.ca_connect(pvname+'.RBV')
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQLineEdit
(pvname=None, useAlarmState=False)[source]¶ Provide the value of an EPICS PV on a PyQt4.QtGui.QLineEdit
USAGE:
import bcdaqwidgets ... widget = bcdaqwidgets.BcdaQLineEdit() widget.ca_connect("example:m1.VAL")
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQMomentaryButton
(label='', pvname=None, pressed_value=None, released_value=None)[source]¶ Send a value when released, label does not change if PV changes.
It only acts on mouse pressed signal.
This is a special case of a BcdaQPushButton where the text on the button does not respond to changes of the value of the attached EPICS PV.
It is a good choice to use, for example, for a motor STOP button.
USAGE:
import bcdaqwidgets ... widget = bcdaqwidgets.BcdaQMomentaryButton('Stop') widget.ca_connect("example:m1.STOP") widget.SetPressedValue(1)
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQPushButton
(label='', pvname=None, pressed_value=None, released_value=None)[source]¶ Provide a QtGui.QPushButton connected to an EPICS PV
It is necessary to also call the SetPressedValue() and/or SetReleasedValue() method to define the value to be sent to the EPICS PV with the corresponding push button event. If left unconfigured, no action will be taken.
USAGE:
import bcdaqwidgets ... widget = bcdaqwidgets.BcdaQPushButton() widget.ca_connect("example:bo0") widget.SetReleasedValue(1)
-
SetBackgroundColor
(*args, **kw)[source]¶ set the background color of the QPushButton() via its stylesheet
-
SetPressedValue
(value)[source]¶ specify the value to be sent to the EPICS PV when the button is pressed
-
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQSignalDef
[source]¶ Define the signals used to communicate between the PyEpics thread and the PyQt4 (main Qt4 GUI) thread.
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQToggleButton
(pvname=None)[source]¶ Toggles boolean PV when pressed
This is a special case of a BcdaQPushButton where the text on the button changes with the value of the attached EPICS PV. In this case, the displayed value is the name of the next state of the EPICS PV when the button is pressed.
It is a good choice to use, for example, for an ON/OFF button.
USAGE:
import bcdaqwidgets ... widget = bcdaqwidgets.BcdaQToggleButton() widget.ca_connect("example:room_light") widget.SetReleasedValue(1)
-
class
bcdaqwidgets.bcdaqwidgets.
BcdaQWidgetSuper
(pvname=None, useAlarmState=False)[source]¶ superclass for EPICS-aware widgets
-
bcdaqwidgets.bcdaqwidgets.
RBV_BcdaQLabel
¶ alias of
BcdaQLabel_RBV
-
class
bcdaqwidgets.bcdaqwidgets.
StyleSheet
(widget, sty={})[source]¶ manage style sheet settings for a Qt widget
Example:
widget = QtGui.QLabel('example label') sty = bcdaqwidgets.StyleSheet(widget) sty.updateStyleSheet({ 'font': 'bold', 'color': 'white', 'background-color': 'dodgerblue', 'qproperty-alignment': 'AlignCenter', })
-
bcdaqwidgets.bcdaqwidgets.
typesafe_enum
(*sequential, **named)[source]¶ typesafe enum
EXAMPLE:
>>> Numbers = typesafe_enum('ZERO', 'ONE', 'TWO', four='IV') >>> Numbers.ZERO 0 >>> Numbers.ONE 1 >>> Numbers.four IV
See: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-typesafe_enum-in-python