def defineMagnetRow(self, prefix, magnet_number, row, layout): widget = QtGui.QLabel('PM%d' % magnet_number) layout.addWidget(widget, row, 0) widget = bcdaqwidgets.BcdaQLineEdit() widget.ca_connect(prefix + ':H%d:setCurrentC' % magnet_number) layout.addWidget(widget, row, 1) widget = bcdaqwidgets.BcdaQLabel() widget.ca_connect(prefix + ':PM%d:X:positionM' % magnet_number) widget.useAlarmState = True layout.addWidget(widget, row, 2) widget = bcdaqwidgets.BcdaQLineEdit() widget.ca_connect(prefix + ':V%d:setCurrentC' % magnet_number) layout.addWidget(widget, row, 3) widget = bcdaqwidgets.BcdaQLabel() widget.ca_connect(prefix + ':PM%d:Y:positionM' % magnet_number) widget.useAlarmState = True layout.addWidget(widget, row, 4) widget = bcdaqwidgets.BcdaQLabel() widget.ca_connect(prefix + ':PM%d:intensityM' % magnet_number) layout.addWidget(widget, row, 5)
def __init__(self, parent=None, pvname=None): QtGui.QWidget.__init__(self, parent) self.sig = bcdaqwidgets.BcdaQSignalDef() self.sig.newBgColor.connect(self.SetBackgroundColor) self.toggle = False layout = QtGui.QFormLayout() self.setLayout(layout) lbl = QtGui.QLabel('PV') wid = QtGui.QLabel(str(pvname)) layout.addRow(lbl, wid) self.value = bcdaqwidgets.BcdaQLabel() layout.addRow(QtGui.QLabel('BcdaQLabel'), self.value) self.setWindowTitle("Demo bcdaqwidgets module") if pvname is not None: self.ca_connect(pvname) lbl = QtGui.QLabel('BcdaQLabel with alarm colors') wid = bcdaqwidgets.BcdaQLabel(pvname=pvname, useAlarmState=True) layout.addRow(lbl, wid) lbl = QtGui.QLabel('RBV_BcdaQLabel') wid = bcdaqwidgets.RBV_BcdaQLabel() wid.ca_connect(pvname + '.RBV') layout.addRow(lbl, wid) lbl = QtGui.QLabel('BcdaQLineEdit') wid = bcdaqwidgets.BcdaQLineEdit(pvname=pvname) layout.addRow(lbl, wid) lbl = QtGui.QLabel('BcdaQLineEdit') wid = bcdaqwidgets.BcdaQLineEdit(pvname=pvname + '.TWV') layout.addRow(lbl, wid) pvname = pvname.split('.')[0] + '.TWF' lbl = QtGui.QLabel('BcdaQMomentaryButton') wid = bcdaqwidgets.BcdaQMomentaryButton(label='tweak +', pvname=pvname + '.TWF') wid.SetPressedValue(1) layout.addRow(lbl, wid) pvname = pvname.split('.')[0] + '.TWR' lbl = QtGui.QLabel('BcdaQMomentaryButton') wid = bcdaqwidgets.BcdaQMomentaryButton(label='tweak -', pvname=pvname + '.TWR') wid.SetPressedValue(1) layout.addRow(lbl, wid)
def create_GUI(self): '''define controls AND set the layout''' self.controls = {} for field in ['DESC', 'NAME', 'EGU',]: self.controls[field] = bcdaqwidgets.BcdaQLabel() for field in ['VAL', 'TWV',]: self.controls[field] = bcdaqwidgets.BcdaQLineEdit() self.controls['RBV'] = bcdaqwidgets.BcdaQLabel_RBV() for label, field in {'Stop':'STOP', '>':'TWF', '<':'TWR'}.items(): self.controls[field] = bcdaqwidgets.BcdaQMomentaryButton(label) for label, field in {'*':'*10', '/':'/10'}.items(): self.controls[field] = QPushButton(label) self.pv = None for field in ['STOP', 'TWF', 'TWR',]: self.controls[field].SetPressedValue(1) layout = QVBoxLayout() for field in ['DESC', 'NAME', 'EGU', 'RBV', 'VAL']: layout.addWidget(self.controls[field]) tweak_frame = QFrame(self) tweak_layout = QHBoxLayout() for field in ['TWR', '/10', 'TWV', '*10', 'TWF']: tweak_layout.addWidget(self.controls[field]) tweak_frame.setLayout(tweak_layout) layout.addWidget(tweak_frame) layout.addWidget(self.controls['STOP']) self.setLayout(layout) self.setWindowTitle("Motor panel")
def build_motor_widgets(motor, column): w = bcdaqwidgets.RBV_BcdaQLabel() layout.addWidget(w, 1, column) self.motors[motor].w_RBV = w w = bcdaqwidgets.BcdaQLineEdit() layout.addWidget(w, 2, column) self.motors[motor].w_VAL = w
def __init__(self, ui_file=None, logger=None, logfile=None, config=None, *args, **kw): '''make this class callable from pvMail application''' self.ui = uic.loadUi(PvMail.get_pkg_file_path(ui_file or MAIN_UI_FILE)) # PySide way: # http://stackoverflow.com/questions/7144313/loading-qtdesigners-ui-files-in-pyside/18293756#18293756 self.ui.history.clear() self.logger = logger self.logfile = logfile self.config = config or ini_config.Config() self.setStatus('starting') self.email_address_model = EmailListModel([], self.ui) self.pvmail = None self.watching = False # menu item handlers self.ui.actionSend_test_email.triggered.connect(self.doSendTestMessage) self.ui.actionE_xit.triggered.connect(self.doClose) self.ui.actionAbout_pvMail.triggered.connect(self.doAbout) # button handlers self.ui.w_btn_run.clicked.connect(self.doRun) self.ui.w_btn_stop.clicked.connect(self.doStop) # the list of email recipients self.ui.emails.setModel(self.email_address_model) # adjust dynamic labels self.ui.config_file_name.setText(config.ini_file) self.ui.log_file_name.setText(str(logfile)) self.ui.w_running_stopped.setText('stopped') self.ui.l_pv_trigger = QtGui.QLabel('trigger') self.ui.pv_trigger = bcdaqwidgets.BcdaQLabel() self.ui.pv_trigger.setToolTip('PV not connected, no text available') self.ui.formLayout.addRow(self.ui.l_pv_trigger, self.ui.pv_trigger) self.triggerSignal = PvMailSignalDef() self.triggerSignal.EPICS_monitor.connect(self.onTrigger_gui_thread) self.ui.l_pv_message = QtGui.QLabel('message') self.ui.pv_message = bcdaqwidgets.BcdaQLineEdit() self.ui.pv_message.setToolTip('PV not connected, no text available') self.ui.pv_message.setReadOnly(True) self.ui.formLayout.addRow(self.ui.l_pv_message, self.ui.pv_message) self.messageSignal = PvMailSignalDef() self.messageSignal.EPICS_monitor.connect(self.onMessage_gui_thread) self.setStatus('ready')
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) layout = QtGui.QFormLayout() self.setLayout(layout) lbl = QtGui.QLabel('trigger') pb = bcdaqwidgets.BcdaQToggleButton('pvMail:trigger') layout.addRow(lbl, pb) lbl = QtGui.QLabel('message') msg = bcdaqwidgets.BcdaQLineEdit('pvMail:message') layout.addRow(lbl, msg)
def source(self, prefix): panel = QtGui.QGroupBox() layout = QtGui.QGridLayout() panel.setLayout(layout) panel.setFlat(True) panel.setTitle('source') layout.setColumnStretch(1, 1) layout.setColumnStretch(2, 1) widget = QtGui.QLabel('cathode') layout.addWidget(widget, 0, 0) widget = bcdaqwidgets.BcdaQLineEdit() widget.ca_connect(prefix + ':cathodeCurrentC') layout.addWidget(widget, 0, 1) widget = bcdaqwidgets.BcdaQLabel() widget.ca_connect(prefix + ':cathodeTempM') widget.useAlarmState = True layout.addWidget(widget, 0, 2) return panel