def _specViewLayout(self): dev = self.device.substitute(dev='TuneProc') # Mode lbl_mode = QLabel('Mode', self) self.cb_mode = PyDMEnumComboBox(self, dev.substitute(propty='SpecMode-Sel')) self.lb_mode = PyDMLabel(self, dev.substitute(propty='SpecMode-Sts')) hbox_mode = QHBoxLayout() hbox_mode.addWidget(self.cb_mode) hbox_mode.addWidget(self.lb_mode) # Time window lbl_timewdw = QLabel('Time Window [ms]', self) self.le_timewdw = PyDMLineEdit(self, dev.substitute(propty='SpecTime-SP')) self.le_timewdw.precisionFromPV = True self.lb_timewdw = PyDMLabel(self, dev.substitute(propty='SpecTime-RB')) hbox_timewdw = QHBoxLayout() hbox_timewdw.addWidget(self.le_timewdw) hbox_timewdw.addWidget(self.lb_timewdw) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_mode, hbox_mode) lay.addRow(lbl_timewdw, hbox_timewdw) return lay
def _setupUi(self): self.scrn_view = SiriusScrnView(prefix=self._prefix, device=self._scrn) self.cb_scrntype = PyDMEnumComboBox( self, self._scrn_pref.substitute(propty='ScrnType-Sel')) self.l_scrntype = PyDMLabel( self, self._scrn_pref.substitute(propty='ScrnType-Sts')) self.led_scrntype = PyDMLed( self, self._scrn_pref.substitute(propty='ScrnType-Sts'), color_list=[ PyDMLed.LightGreen, PyDMLed.Red, PyDMLed.Red, PyDMLed.Yellow ]) self.led_scrntype.shape = 2 lay = QGridLayout() lay.addWidget( QLabel('<h3>Screen View</h3>', self, alignment=Qt.AlignCenter), 0, 0, 1, 4) lay.addItem(QSpacerItem(20, 20, QSzPlcy.Fixed, QSzPlcy.Fixed), 1, 0) lay.addWidget( QLabel('Select Screen Type: ', self, alignment=Qt.AlignRight), 2, 0) lay.addWidget(self.cb_scrntype, 2, 1) lay.addWidget(self.l_scrntype, 2, 2) lay.addWidget(self.led_scrntype, 2, 3) lay.addItem(QSpacerItem(20, 40, QSzPlcy.Fixed, QSzPlcy.Fixed), 4, 0) lay.addWidget(self.scrn_view, 5, 0, 1, 4) self.setLayout(lay)
def display_secData(self): '''Build the secondary data widget''' group = QGroupBox() sc_glay = QGridLayout() countx = 0 for text, channel in self.bpm_sec_data.items(): if text != "Orientation": text_lb = QLabel(text, self) sc_glay.addWidget(text_lb, countx, 0, 1, 1) channel_lb = self.dataItem(channel, 1) channel_lb.showUnits = True sc_glay.addWidget(channel_lb, countx, 1, 1, 1) else: text_lb = QLabel(text, self) text_lb.setAlignment(Qt.AlignCenter) sc_glay.addWidget(text_lb, countx, 0, 1, 2) selection = PyDMEnumComboBox(init_channel=self.prefix + self.device_name + ":" + channel) sc_glay.addWidget(selection, countx + 1, 0, 1, 2) countx += 1 sc_glay.setAlignment(Qt.AlignTop) group.setLayout(sc_glay) return group
def _setupCoeffSettingsWidget(self): ld_coefchoo = QLabel('Choose Set', self, alignment=Qt.AlignRight) cb_coefchoo = PyDMEnumComboBox(self, self.dev_pref + ':LDSET') pb_coefload = PyDMPushButton(parent=self, label='Apply Set', icon=qta.icon('mdi.upload'), init_channel=self.dev_pref + ':BO_CPCOEFF', pressValue=1) pb_coefload.setStyleSheet("icon-size:20px;") pb_coefvrfy = PyDMPushButton(parent=self, label='Verify Set', icon=qta.icon('mdi.check-circle-outline'), init_channel=self.dev_pref + ':BO_CVERIFY', pressValue=1) pb_coefvrfy.setStyleSheet("icon-size:20px;") ld_gen = QLabel('<h4>Generate Coefficients</h4>', self, alignment=Qt.AlignCenter) ld_gengain = QLabel('Gain [0-1]', self, alignment=Qt.AlignRight) sb_gengain = PyDMSpinbox(self, self.dev_pref + ':FLT_GAIN') sb_gengain.showStepExponent = False ld_genphs = QLabel('Phase [°]', self, alignment=Qt.AlignRight) sb_genphs = PyDMSpinbox(self, self.dev_pref + ':FLT_PHASE') sb_genphs.showStepExponent = False ld_genfreq = QLabel('Frequency [0-1]', self, alignment=Qt.AlignRight) sb_genfreq = PyDMSpinbox(self, self.dev_pref + ':FLT_FREQ') sb_genfreq.showStepExponent = False ld_genntap = QLabel('Number of taps', self, alignment=Qt.AlignRight) sb_genntap = PyDMSpinbox(self, self.dev_pref + ':FLT_TAPS') sb_genntap.showStepExponent = False wid = QWidget(self) lay_genset = QGridLayout(wid) lay_genset.setVerticalSpacing(6) lay_genset.setHorizontalSpacing(9) lay_genset.addWidget(ld_gen, 0, 1, 1, 2) lay_genset.addWidget(ld_gengain, 1, 1) lay_genset.addWidget(sb_gengain, 1, 2) lay_genset.addWidget(ld_genphs, 2, 1) lay_genset.addWidget(sb_genphs, 2, 2) lay_genset.addWidget(ld_genfreq, 3, 1) lay_genset.addWidget(sb_genfreq, 3, 2) lay_genset.addWidget(ld_genntap, 4, 1) lay_genset.addWidget(sb_genntap, 4, 2) lay_genset.addWidget(ld_coefchoo, 5, 1) lay_genset.addWidget(cb_coefchoo, 5, 2) lay = QGridLayout() lay_genset.addLayout(lay, 6, 1, 1, 2) lay.addWidget(pb_coefload, 0, 0) lay.addWidget(pb_coefvrfy, 0, 2) lay.setColumnStretch(1, 2) lay_genset.setRowStretch(7, 2) lay_genset.setColumnStretch(0, 2) lay_genset.setColumnStretch(3, 2) return wid
def _setupFBSettingsWidget(self): gbox_settings = QGroupBox('FeedBack Settings', self) ld_fbpatt = QLabel('Feedback Mask', self) le_fbpatt = PyDMLineEdit(self, self.dev_pref + ':FB_PATTERN') ld_cfpatt = QLabel('Alternate Mask', self) le_cfpatt = PyDMLineEdit(self, self.dev_pref + ':CF_PATTERN') ld_alter_inuse = QLabel('Alternate Set In Use', self) led_alter_inuse = SiriusLedState( self, self.dev_pref + ':CF_PATTERN_SUB.VALB') ld_fbenbl = QLabel('Enable', self) pb_fbenbl = PyDMStateButton(self, self.dev_pref + ':FBCTRL') ld_coefsel = QLabel('Coeficient Set', self) cb_coefsel = PyDMEnumComboBox(self, self.dev_pref + ':SETSEL') ld_sftgain = QLabel('Shift Gain', self) sb_sftgain = PyDMSpinbox(self, self.dev_pref + ':SHIFTGAIN') sb_sftgain.showStepExponent = False ld_downspl = QLabel('Downsampling', self) sb_downspl = PyDMSpinbox(self, self.dev_pref + ':PROC_DS') sb_downspl.showStepExponent = False ld_satthrs = QLabel('Sat. Threshold [%]', self) sb_satthrs = PyDMSpinbox(self, self.dev_pref + ':SAT_THRESHOLD') sb_satthrs.showStepExponent = False lay_patt = QGridLayout() lay_patt.addWidget(ld_fbpatt, 0, 0) lay_patt.addWidget(le_fbpatt, 0, 1) lay_patt.addWidget(ld_cfpatt, 1, 0) lay_patt.addWidget(le_cfpatt, 1, 1) lay_patt.addWidget(ld_alter_inuse, 2, 0) lay_patt.addWidget(led_alter_inuse, 2, 1) lay = QGridLayout(gbox_settings) lay.addWidget(ld_fbenbl, 0, 1) lay.addWidget(pb_fbenbl, 0, 2) lay.addWidget(ld_downspl, 0, 4) lay.addWidget(sb_downspl, 0, 5) lay.addWidget(ld_coefsel, 1, 1) lay.addWidget(cb_coefsel, 1, 2) lay.addWidget(ld_sftgain, 1, 4) lay.addWidget(sb_sftgain, 1, 5) lay.addWidget(ld_satthrs, 2, 1) lay.addWidget(sb_satthrs, 2, 2) lay.addLayout(lay_patt, 4, 1, 1, 5) lay.setColumnStretch(0, 3) lay.setColumnStretch(6, 3) lay.setColumnStretch(3, 2) lay.setRowStretch(3, 2) lay.setRowStretch(5, 3) return gbox_settings
def _setupGPIOSelectionWidget(self): # # GPIO Selection ld_gpiosel = QLabel('<h4>Select GPIO</h4>', self) cb_gpiosel = PyDMEnumComboBox(self, self.dev_pref + ':GPIO_SEL') gbox_gpiosel = QGroupBox(self) lay_gpiosel = QHBoxLayout(gbox_gpiosel) lay_gpiosel.addWidget(ld_gpiosel) lay_gpiosel.addWidget(cb_gpiosel) return gbox_gpiosel
def _setupFeedbackSettings(self): ld_fbenbl = QLabel('Enable', self) pb_fbenbl = PyDMStateButton(self, self.dev_pref+':FBCTRL') ld_coefsel = QLabel('Coeficient Set', self) cb_coefsel = PyDMEnumComboBox(self, self.dev_pref+':SETSEL') ld_sftgain = QLabel('Shift Gain', self) sb_sftgain = PyDMSpinbox(self, self.dev_pref+':SHIFTGAIN') sb_sftgain.showStepExponent = False ld_downspl = QLabel('Downsampling', self) sb_downspl = PyDMSpinbox(self, self.dev_pref+':PROC_DS') sb_downspl.showStepExponent = False ld_satthrs = QLabel('Sat. Threshold [%]', self) sb_satthrs = PyDMSpinbox(self, self.dev_pref+':SAT_THRESHOLD') sb_satthrs.showStepExponent = False lay = QGridLayout() lay.addWidget(ld_fbenbl, 1, 0) lay.addWidget(pb_fbenbl, 1, 1) lay.addWidget(ld_coefsel, 2, 0) lay.addWidget(cb_coefsel, 2, 1) lay.addWidget(ld_sftgain, 3, 0) lay.addWidget(sb_sftgain, 3, 1) lay.addWidget(ld_downspl, 4, 0) lay.addWidget(sb_downspl, 4, 1) lay.addWidget(ld_satthrs, 5, 0) lay.addWidget(sb_satthrs, 5, 1) if self._is_resumed: wid = QWidget() wid.setLayout(lay) fb_label = QLabel( '<h4>Feedback Settings</h4>', self, alignment=Qt.AlignCenter) lay.setContentsMargins(0, 0, 0, 0) lay.setVerticalSpacing(12) lay.addWidget(fb_label, 0, 0, 1, 2) else: wid = QGroupBox('Feedback Settings', self) wid.setLayout(lay) ld_gensts = QLabel('Setup Status', self) led_gensts = SiriusLedAlert(self, self.dev_pref+':ERRSUM') lay.addWidget(ld_gensts, 6, 0) lay.addWidget(led_gensts, 6, 1) return wid
def _create_formlayout_groupbox(self, title, props): grpbx = CustomGroupBox(title, self) fbl = QFormLayout(grpbx) grpbx.layoutf = fbl fbl.setLabelAlignment(Qt.AlignVCenter) for prop in props: if len(prop) == 2: pv1, txt = prop isdata = True elif len(prop) == 3: pv1, txt, isdata = prop hbl = QHBoxLayout() not_enum = pv1.endswith('-SP') pv2 = pv1.replace('-SP', '-RB').replace('-Sel', '-Sts') if pv2 != pv1: if not_enum: chan1 = self.get_pvname(pv1, is_data=isdata) wid = SiriusSpinbox(self, init_channel=chan1) wid.setStyleSheet("min-width:5em;") wid.showStepExponent = False wid.limitsFromChannel = False pvn = self.data_prefix + pv1 wid.setMinimum(self.bpmdb[pvn].get('low', -1e10)) wid.setMaximum(self.bpmdb[pvn].get('high', 1e10)) else: wid = PyDMEnumComboBox( self, init_channel=self.get_pvname(pv1, is_data=isdata)) wid.setStyleSheet("min-width:5em;") wid.setObjectName(pv1.replace('-', '')) hbl.addWidget(wid) lab = SiriusLabel( self, init_channel=self.get_pvname(pv2, is_data=isdata)) lab.setObjectName(pv2.replace('-', '')) lab.showUnits = True lab.setStyleSheet("min-width:5em;") hbl.addWidget(lab) lab = QLabel(txt) lab.setObjectName(pv1.split('-')[0]) lab.setStyleSheet("min-width:8em;") fbl.addRow(lab, hbl) return grpbx
def create_pair_sel(self, parent, pvname, device=None, is_vert=False): """.""" device = device or self.device basename = _PVName(device).substitute(prefix=self.prefix, propty_name=pvname) wid = QWidget(parent) if is_vert: lay = QVBoxLayout(wid) else: lay = QHBoxLayout(wid) lay.setContentsMargins(0, 0, 0, 0) pdm_cbbx = PyDMEnumComboBox(wid, basename.substitute(propty_suffix='Sel')) pdm_lbl = PyDMLabel(wid, basename.substitute(propty_suffix='Sts')) pdm_lbl.setAlignment(Qt.AlignCenter) lay.addWidget(pdm_cbbx) lay.addWidget(pdm_lbl) wid.sp_wid = pdm_cbbx wid.rb_wid = pdm_lbl return wid
def _setupPhaseServoLoopWidget(self): # # Phase Servo Loop ld_gpiolctrl = QLabel('Loop Ctrl', self) cb_gpiolctrl = PyDMStateButton(self, self.dev_pref + ':FBELT_SERVO_MODE') ld_gpiolsign = QLabel('Loop Sign', self) cb_gpiolsign = PyDMEnumComboBox(self, self.dev_pref + ':FBELT_SERVO_SIGN') ld_gpiogain = QLabel('Gain', self) sb_gpiogain = PyDMSpinbox(self, self.dev_pref + ':FBELT_SERVO_GAIN') sb_gpiogain.showStepExponent = False ld_gpiooff = QLabel('Offset', self) sb_gpiooff = PyDMSpinbox(self, self.dev_pref + ':FBELT_SERVO_OFFSET') sb_gpiooff.showStepExponent = False ld_gpiohtrk = QLabel('Hor. Trk.', self) cb_gpiohtrk = PyDMStateButton(self, self.dev_pref + ':FBELT_SERVO_X_TRACK') ld_gpiovtrk = QLabel('Vert. Trk.', self) cb_gpiovtrk = PyDMStateButton(self, self.dev_pref + ':FBELT_SERVO_Y_TRACK') gbox_phsloop = QGroupBox('Phase Servo Loop', self) lay_phsloop = QGridLayout(gbox_phsloop) lay_phsloop.addWidget(ld_gpiolctrl, 0, 0) lay_phsloop.addWidget(cb_gpiolctrl, 0, 1) lay_phsloop.addWidget(ld_gpiolsign, 1, 0) lay_phsloop.addWidget(cb_gpiolsign, 1, 1) lay_phsloop.addWidget(ld_gpiogain, 2, 0) lay_phsloop.addWidget(sb_gpiogain, 2, 1) lay_phsloop.addWidget(ld_gpiooff, 3, 0) lay_phsloop.addWidget(sb_gpiooff, 3, 1) lay_phsloop.addWidget(ld_gpiohtrk, 4, 0) lay_phsloop.addWidget(cb_gpiohtrk, 4, 1) lay_phsloop.addWidget(ld_gpiovtrk, 5, 0) lay_phsloop.addWidget(cb_gpiovtrk, 5, 1) return gbox_phsloop
def _create_scrn_summwidget(self, scrn_device, scrn_idx): """Create and return a screen detail widget.""" cb_scrn = QCheckBox(scrn_device.get_nickname(dev=True), self) self._scrns_sel_bg.addButton(cb_scrn) self._scrns_sel_bg.setId(cb_scrn, scrn_idx) if scrn_idx == self._currScrn: cb_scrn.setChecked(True) cb_scrn.clicked.connect(self._setScrnWidget) cb_scrn.setStyleSheet(""" min-width:6.5em; max-width:6.5em; font-weight:bold;""") led_camenbl = SiriusLedState( self, scrn_device.substitute(prefix=self.prefix, propty='CamEnbl-Sts')) led_camenbl.setStyleSheet("min-width:3.2em; max-width:3.2em;") cb_scrntype = PyDMEnumComboBox( self, scrn_device.substitute(prefix=self.prefix, propty='ScrnType-Sel')) cb_scrntype.setSizePolicy(QSzPlcy.Minimum, QSzPlcy.Fixed) cb_scrntype.setStyleSheet("min-width:4.5em;max-width:4.5em;") lb_scrntype = PyDMLabel( self, scrn_device.substitute(prefix=self.prefix, propty='ScrnType-Sts')) lb_scrntype.setStyleSheet("min-width:4.5em; max-width:4.5em;") lb_scrntype.setAlignment(Qt.AlignCenter) led_scrntype = PyDMLed(self, scrn_device.substitute(prefix=self.prefix, propty='ScrnType-Sts'), color_list=[ PyDMLed.LightGreen, PyDMLed.Red, PyDMLed.Red, PyDMLed.Yellow ]) led_scrntype.shape = 2 led_scrntype.setStyleSheet("""min-width:4.5em; max-width:4.5em;""") wid = QWidget() lay = QGridLayout(wid) lay.setAlignment(Qt.AlignCenter) lay.addWidget(cb_scrn, 1, 1) lay.addWidget(led_camenbl, 1, 2) lay.addWidget(cb_scrntype, 1, 3) lay.addWidget(lb_scrntype, 1, 4) lay.addWidget(led_scrntype, 2, 4) return wid
def connection_changed(self, connected): build = (self._node is None) and (self._connected != connected and connected is True) super(Process, self).connection_changed(connected) if not build: return self._node = nodeFromAddress(self.channel) self._path = self.channel vb = QVBoxLayout() self.setLayout(vb) gb = QGroupBox('Process ({})'.format(self._node.name)) vb.addWidget(gb) vb = QVBoxLayout() gb.setLayout(vb) hb = QHBoxLayout() vb.addLayout(hb) w = PyDMPushButton(label='Start', pressValue=1, init_channel=self._path + '.Start') hb.addWidget(w) w = PyDMPushButton(label='Stop', pressValue=1, init_channel=self._path + '.Stop') hb.addWidget(w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignVCenter) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyRogueLineEdit(parent=None, init_channel=self._path + '.Running/disp') w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Running:', w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) w = PyDMScaleIndicator(parent=None, init_channel=self._path + '.Progress') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = False w.showValue = False w.showLimits = False w.showTicks = False w.barIndicator = True fl.addRow('Progress:', w) w = PyRogueLineEdit(parent=None, init_channel=self._path + '.Message/disp') w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Message:', w) # Auto add additional fields noAdd = ['enable', 'Start', 'Stop', 'Running', 'Progress', 'Message'] prc = nodeFromAddress(self.channel) for k, v in prc.nodes.items(): if v.name not in noAdd and not v.hidden: if v.disp == 'enum' and v.enum is not None and v.mode != 'RO' and v.typeStr != 'list': w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.{}'.format(v.name)) w.alarmSensitiveContent = False w.alarmSensitiveBorder = True elif v.minimum is not None and v.maximum is not None and v.disp == '{}' and ( v.mode != 'RO' or v.isCommand): w = PyDMSpinbox(parent=None, init_channel=self._path + '.{}'.format(v.name)) w.precision = 0 w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = True w.showStepExponent = False w.writeOnPress = True elif v.mode == 'RO' and not v.isCommand: w = PyDMLabel(parent=None, init_channel=self._path + '.{}/disp'.format(v.name)) w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = True else: w = PyRogueLineEdit(parent=None, init_channel=self._path + '.{}/disp'.format(v.name)) w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow(v.name + ':', w)
def _setupui(self): self.setLayout(QFormLayout()) self.layout().setSpacing(0) self.layout().addRow(QLabel( '<h4>Image Processing Detailed Controls</h4>', self, alignment=Qt.AlignTop | Qt.AlignHCenter)) wid = QWidget(self) wid.setLayout(QHBoxLayout()) sttbtn = PyDMEnumComboBox( wid, init_channel=self._dev+':ReadingOrder-Sel') lbl = SiriusLabel(wid, init_channel=self._dev+':ReadingOrder-Sts') wid.layout().addWidget(sttbtn) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Reading Order', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) sttbtn = PyDMStateButton(wid, init_channel=self._dev+':ImgFlipX-Sel') lbl = SiriusLedState(wid, init_channel=self._dev+':ImgFlipX-Sts') wid.layout().addWidget(sttbtn) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Flip Horintal', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) sttbtn = PyDMStateButton(wid, init_channel=self._dev+':ImgFlipY-Sel') lbl = SiriusLedState(wid, init_channel=self._dev+':ImgFlipY-Sts') wid.layout().addWidget(sttbtn) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Flip Vertical', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) spnbox = SiriusSpinbox(wid, init_channel=self._dev+':ImgCropLow-SP') lbl = SiriusLabel(wid, init_channel=self._dev+':ImgCropLow-RB') spnbox.showStepExponent = False wid.layout().addWidget(spnbox) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Min. Pixel Val.', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) sttbtn = PyDMStateButton(wid, init_channel=self._dev+':ImgCropUse-Sel') lbl = SiriusLedState(wid, init_channel=self._dev+':ImgCropUse-Sts') wid.layout().addWidget(sttbtn) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Crop Image Levels', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) spnbox = SiriusSpinbox(wid, init_channel=self._dev+':ImgCropHigh-SP') lbl = SiriusLabel(wid, init_channel=self._dev+':ImgCropHigh-RB') spnbox.showStepExponent = False wid.layout().addWidget(spnbox) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Max. Pixel Val.', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) if self._conv_set: spb = SiriusSpinbox(wid, init_channel=self._dev+':Px2mmScaleX-SP') lbl = SiriusLabel(wid, init_channel=self._dev+':Px2mmScaleX-RB') spb.showStepExponent = False wid.layout().addWidget(spb) wid.layout().addWidget(lbl) else: lbl = SiriusLabel(wid, init_channel=self._dev+':Px2mmScaleX-Cte') wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Pxl 2 mm Scale X', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) if self._conv_set: spb = SiriusSpinbox(wid, init_channel=self._dev+':Px2mmScaleY-SP') lbl = SiriusLabel(wid, init_channel=self._dev+':Px2mmScaleY-RB') spb.showStepExponent = False wid.layout().addWidget(spb) wid.layout().addWidget(lbl) else: lbl = SiriusLabel(wid, init_channel=self._dev+':Px2mmScaleY-Cte') wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Pxl 2 mm Scale Y', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) sttbtn = PyDMStateButton( wid, init_channel=self._dev+':Px2mmAutoCenter-Sel') lbl = SiriusLedState( wid, init_channel=self._dev+':Px2mmAutoCenter-Sts') wid.layout().addWidget(sttbtn) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Auto Center', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) spnbox = SiriusSpinbox(wid, init_channel=self._dev+':Px2mmCenterX-SP') lbl = SiriusLabel(wid, init_channel=self._dev+':Px2mmCenterX-RB') spnbox.showStepExponent = False wid.layout().addWidget(spnbox) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Pxl 2 mm Center X', self, alignment=Qt.AlignBottom), wid) wid = QWidget(self) wid.setLayout(QHBoxLayout()) spnbox = SiriusSpinbox(wid, init_channel=self._dev+':Px2mmCenterY-SP') lbl = SiriusLabel(wid, init_channel=self._dev+':Px2mmCenterY-RB') spnbox.showStepExponent = False wid.layout().addWidget(spnbox) wid.layout().addWidget(lbl) self.layout().addRow(QLabel( 'Pxl 2 mm Center Y', self, alignment=Qt.AlignBottom), wid)
def _setupUi(self): lay = QVBoxLayout() lay.addWidget( QLabel('<h3>Settings</h3>', self, alignment=Qt.AlignHCenter | Qt.AlignBottom)) lay.setStretch(0, 1) # Measure l_reliablemeas = QLabel('Reliability: ') self.led_ReliableMeas = SiriusLedAlert( self, self.dcct_prefix.substitute(propty='ReliableMeas-Mon')) l_curr = QLabel('Current [mA]: ', self, alignment=Qt.AlignRight) self.label_current = PyDMLabel( self, self.dcct_prefix.substitute(propty='Current-Mon')) self.led_StoredEBeam = SiriusLedState( self, self.dcct_prefix.substitute(propty='StoredEBeam-Mon')) hlay_current = QHBoxLayout() hlay_current.addWidget(self.label_current) hlay_current.addWidget(self.led_StoredEBeam) l_enbl = QLabel('Enable:', self) self.pydmstatebutton_Enbl = PyDMStateButton( self, self.dcct_prefix.substitute(propty='Enbl-Sel')) self.pydmstatebutton_Enbl.shape = 1 self.led_Enbl = SiriusLedState( self, self.dcct_prefix.substitute(propty='Enbl-Sts')) hlay_enbl = QHBoxLayout() hlay_enbl.addWidget(self.pydmstatebutton_Enbl) hlay_enbl.addWidget(self.led_Enbl) l_meastrig = QLabel('Trigger Source:', self) self.pydmenumcombobox_MeasTrg = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='MeasTrg-Sel')) self.pydmlabel_MeasTrg = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasTrg-Sts')) hlay_meastrig = QHBoxLayout() hlay_meastrig.addWidget(self.pydmenumcombobox_MeasTrg) hlay_meastrig.addWidget(self.pydmlabel_MeasTrg) if 'SI' in self.device: l_range = QLabel('Range: ', self) self.pydmenumcombobox_Range = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='Range-Sel')) self.pydmlabel_Range = PyDMLabel( self, self.dcct_prefix.substitute(propty='Range-Sts')) hlay_range = QHBoxLayout() hlay_range.addWidget(self.pydmenumcombobox_Range) hlay_range.addWidget(self.pydmlabel_Range) hlay_range.setContentsMargins(0, 0, 0, 0) l_measmode = QLabel('Mode: ', self) self.pydmenumcombobox_MeasMode = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='MeasMode-Sel')) self.pydmlabel_MeasMode = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasMode-Sts')) hlay_measmode = QHBoxLayout() hlay_measmode.addWidget(self.pydmenumcombobox_MeasMode) hlay_measmode.addWidget(self.pydmlabel_MeasMode) hlay_measmode.setContentsMargins(0, 0, 0, 0) glay_mode = QGridLayout() self.normalmode_widget = self._setupMeasSettingsWidget('Normal') self.fastmode_widget = self._setupMeasSettingsWidget('Fast') glay_mode.addWidget(self.normalmode_widget, 0, 0) glay_mode.addWidget(self.fastmode_widget, 0, 0) glay_mode.setContentsMargins(0, 0, 0, 0) self.mode_channel = SiriusConnectionSignal( self.dcct_prefix.substitute(propty='MeasMode-Sel')) self.mode_channel.new_value_signal.connect(self._showMeasModeSettings) # Details self.pb_details = QPushButton(qta.icon('fa5s.ellipsis-h'), '', self) self.pb_details.setToolTip('Open details') self.pb_details.setObjectName('detail') self.pb_details.setStyleSheet( "#detail{min-width:25px; max-width:25px; icon-size:20px;}") detail_window = create_window_from_widget(DCCTSettingsDetails, title=self.device + ' Settings Details') _hlautil.connect_window(self.pb_details, detail_window, self, prefix=self.prefix, device=self.device) gbox_gen = QGroupBox('Measure') glay_gen = QGridLayout(gbox_gen) glay_gen.setAlignment(Qt.AlignVCenter) glay_gen.addWidget(l_curr, 0, 0) glay_gen.addLayout(hlay_current, 0, 1) glay_gen.addWidget(l_reliablemeas, 1, 0) glay_gen.addWidget(self.led_ReliableMeas, 1, 1, alignment=Qt.AlignLeft) glay_gen.addWidget(l_enbl, 2, 0) glay_gen.addLayout(hlay_enbl, 2, 1) glay_gen.addWidget(l_meastrig, 3, 0) glay_gen.addLayout(hlay_meastrig, 3, 1) if 'SI' in self.device: glay_gen.addWidget(l_range, 4, 0) glay_gen.addLayout(hlay_range, 4, 1) glay_gen.addWidget(l_measmode, 5, 0) glay_gen.addLayout(hlay_measmode, 5, 1) glay_gen.addLayout(glay_mode, 6, 0, 1, 2) glay_gen.addWidget(self.pb_details, 7, 0, 1, 2, alignment=Qt.AlignRight) gbox_gen.setStyleSheet(""" .QLabel{ qproperty-alignment: 'AlignVCenter | AlignRight'; min-width: 6em;} PyDMLed{ min-width: 6em;}""") lay.addWidget(gbox_gen) lay.setStretch(1, 7) # Trigger self.trigger_widget = QGroupBox('Trigger') hbl = QHBoxLayout(self.trigger_widget) hbl.addWidget( HLTriggerSimple(self.trigger_widget, device=self.device.substitute(dis='TI'), prefix=self.prefix)) lay.addWidget(self.trigger_widget) lay.setStretch(2, 3) self.setLayout(lay) self.setStyleSheet(""" QSpinBox, QComboBox, QPushButton, PyDMSpinbox, PyDMEnumComboBox, PyDMLabel{ min-width:6em; max-width:6em;} .QLabel{max-height:1.5em;}""")
def _setupCurrentSettingsWidget(self): self._ld_storedebeam = QLabel('Stored EBeam?', self) self._ld_storedebeam.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._led_storedebeam = SiriusLedState( self, self.devname.substitute(propty='StoredEBeam-Mon')) self._ld_dcctfault = QLabel('DCCT Fault Check:', self) self._ld_dcctfault.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._bt_dcctfault = PyDMStateButton( self, self.devname.substitute(propty='DCCTFltCheck-Sel')) self._bt_dcctfault.shape = PyDMStateButton.Rounded self._led_dcctfault = SiriusLedState( self, self.devname.substitute(propty='DCCTFltCheck-Sts')) self._ld_seldcct = QLabel('Select DCCT:', self) self._ld_seldcct.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._cb_seldcct = PyDMEnumComboBox( self, self.devname.substitute(propty='DCCT-Sel')) self._lb_seldcct = PyDMLabel( self, self.devname.substitute(propty='DCCT-Sts')) self._lb_seldcct.setAlignment(Qt.AlignCenter) self._lb_seldcct.precision = 0 self._led_dcct13c4 = SiriusLedAlert( self, _PVName('SI-13C4:DI-DCCT:ReliableMeas-Mon').substitute( prefix=self.prefix)) self._lb_dcct13c4 = QLabel('DCCT 13C4', self) self._lb_dcct13c4.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._pb_13c4_detail = QPushButton(self) self._pb_13c4_detail.setObjectName('DCCT13C4_dtl') self._pb_13c4_detail.setStyleSheet( "#DCCT13C4_dtl{min-width:25px; max-width:25px; icon-size:20px;}") self._pb_13c4_detail.setIcon(qta.icon('fa5s.ellipsis-h')) connect_window(self._pb_13c4_detail, DCCTMain, self, prefix=self.prefix, device='SI-13C4:DI-DCCT') hlay_dcct13c4 = QHBoxLayout() hlay_dcct13c4.addItem( QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum)) hlay_dcct13c4.addWidget(self._led_dcct13c4) hlay_dcct13c4.addWidget(self._lb_dcct13c4) hlay_dcct13c4.addItem( QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum)) hlay_dcct13c4.addWidget(self._pb_13c4_detail) hlay_dcct13c4.addItem( QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum)) self._led_dcct14c4 = SiriusLedAlert( self, _PVName('SI-14C4:DI-DCCT:ReliableMeas-Mon').substitute( prefix=self.prefix)) self._lb_dcct14c4 = QLabel('DCCT 14C4', self) self._lb_dcct14c4.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._pb_14c4_detail = QPushButton(self) self._pb_14c4_detail.setObjectName('DCCT14C4_dtl') self._pb_14c4_detail.setStyleSheet( "#DCCT14C4_dtl{min-width:25px; max-width:25px; icon-size:20px;}") self._pb_14c4_detail.setIcon(qta.icon('fa5s.ellipsis-h')) connect_window(self._pb_14c4_detail, DCCTMain, self, prefix=self.prefix, device='SI-14C4:DI-DCCT') hlay_dcct14c4 = QHBoxLayout() hlay_dcct14c4.addItem( QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum)) hlay_dcct14c4.addWidget(self._led_dcct14c4) hlay_dcct14c4.addWidget(self._lb_dcct14c4) hlay_dcct14c4.addItem( QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum)) hlay_dcct14c4.addWidget(self._pb_14c4_detail) hlay_dcct14c4.addItem( QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum)) gbox = QGroupBox('Current Settings and Status', self) lay = QGridLayout(gbox) lay.addWidget(self._ld_storedebeam, 0, 0) lay.addWidget(self._led_storedebeam, 0, 1) lay.addWidget(self._ld_dcctfault, 1, 0) lay.addWidget(self._bt_dcctfault, 1, 1) lay.addWidget(self._led_dcctfault, 1, 2) lay.addWidget(self._ld_seldcct, 2, 0) lay.addWidget(self._cb_seldcct, 2, 1) lay.addWidget(self._lb_seldcct, 2, 2) lay.addItem(QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum), 3, 0) lay.addLayout(hlay_dcct13c4, 4, 0, 1, 3) lay.addLayout(hlay_dcct14c4, 5, 0, 1, 3) lay.setColumnStretch(0, 2) lay.setColumnStretch(1, 1) lay.setColumnStretch(2, 1) return gbox
def _setupWaveformsWidget(self): gp_bunsig = WfmGraph(self) gp_bunsig.setPlotTitle('Bunch Signal') gp_bunsig.getAxis('bottom').setLabel('Time (ms)') gp_bunsig.getAxis('left').setLabel('CNT') gp_bunsig.add_scatter_curve(ychannel=self.dev_pref + ':SB_RAW', xchannel=self.dev_pref + ':SB_TSC', color=QColor('blue'), lineStyle=Qt.SolidLine, nchannel=self.dev_pref + ':SB_RAW_SAMPLES') gp_mag = WfmGraph(self) gp_mag.setPlotTitle('Magnitude') gp_mag.getAxis('bottom').setLabel('Frequency (kHz)') gp_mag.getAxis('left').setLabel('dB') gp_mag.add_scatter_curve(ychannel=self.dev_pref + ':SB_MAG', xchannel=self.dev_pref + ':SB_FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_mag.add_marker(self.dev_pref + ':SB_PEAKFREQ1', self.dev_pref + ':SB_PEAK1', name='Mag', color=QColor('magenta'), symbol='o') gp_phs = WfmGraph(self) gp_phs.setPlotTitle('Phase') gp_phs.getAxis('bottom').setLabel('Frequency (kHz)') gp_phs.getAxis('left').setLabel('deg') gp_phs.add_scatter_curve(ychannel=self.dev_pref + ':SB_PHASE', xchannel=self.dev_pref + ':SB_FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_phs.add_marker(self.dev_pref + ':SB_PEAKFREQ1', self.dev_pref + ':SB_PHASE1', name='Phs', color=QColor('magenta'), symbol='o') ld_tfenbl = QLabel('Transfer Function Enable', self) cb_tfenbl = PyDMEnumComboBox(self, self.dev_pref + ':SB_TF_ENABLE') ld_nrptsfft = QLabel('Number of points for FFT/Window', self) cb_nrptsfft = PyDMEnumComboBox(self, self.dev_pref + ':SB_NFFT') ld_fftovlap = QLabel('Overlap (Autolimited to NFFT/2)', self) cb_fftovlap = PyDMEnumComboBox(self, self.dev_pref + ':SB_NOVERLAP') ld_delaycal = QLabel('Delay Cal [ns]', self) le_delaycal = PyDMLineEdit(self, self.dev_pref + ':SB_DEL_CAL') ld_avg = QLabel('Averaging', self) sb_avg = PyDMSpinbox(self, self.dev_pref + ':SB_SP_AVG') sb_avg.showStepExponent = False gbox_fftsett = QGroupBox(self) lay_fftsett = QGridLayout(gbox_fftsett) lay_fftsett.addWidget(ld_tfenbl, 0, 0) lay_fftsett.addWidget(cb_tfenbl, 0, 1) lay_fftsett.addWidget(ld_nrptsfft, 1, 0) lay_fftsett.addWidget(cb_nrptsfft, 1, 1) lay_fftsett.addWidget(ld_fftovlap, 2, 0) lay_fftsett.addWidget(cb_fftovlap, 2, 1) lay_fftsett.addWidget(ld_delaycal, 3, 0) lay_fftsett.addWidget(le_delaycal, 3, 1) lay_fftsett.addWidget(ld_avg, 4, 0) lay_fftsett.addWidget(sb_avg, 4, 1) lay_graph = QGridLayout() lay_graph.addWidget(gp_bunsig, 0, 0) lay_graph.addWidget(gp_mag, 0, 1) lay_graph.addWidget(gbox_fftsett, 1, 0) lay_graph.addWidget(gp_phs, 1, 1) ld_acqenbl = QLabel('Acq. Enable', self) cb_acqenbl = PyDMStateButton(self, self.dev_pref + ':SB_ACQ_EN') ld_acqsing = QLabel('Acq. Mode', self) cb_acqsing = PyDMEnumComboBox(self, self.dev_pref + ':SB_ACQ_SINGLE') ld_mean = QLabel('Mean', self, alignment=Qt.AlignCenter) lb_mean = PyDMLabel(self, self.dev_pref + ':SB_MEANVAL') ld_rms = QLabel('RMS', self, alignment=Qt.AlignCenter) lb_rms = PyDMLabel(self, self.dev_pref + ':SB_RMSVAL') ld_ampp2p = QLabel('Amp P-P', self, alignment=Qt.AlignCenter) lb_ampp2p = PyDMLabel(self, self.dev_pref + ':SB_AMP_PP') ld_bunid = QLabel('Bunch ID', self, alignment=Qt.AlignCenter) lb_bunid = PyDMLabel(self, self.dev_pref + ':SB_RAW_BUNCH_ID') gbox_acqctrl = QGroupBox('Acquisition control', self) lay_acqctrl = QGridLayout(gbox_acqctrl) lay_acqctrl.addWidget(ld_acqenbl, 0, 0) lay_acqctrl.addWidget(cb_acqenbl, 0, 1) lay_acqctrl.addWidget(ld_acqsing, 1, 0) lay_acqctrl.addWidget(cb_acqsing, 1, 1) lay_acqctrl.addItem(QSpacerItem(15, 1, QSzPlcy.Fixed, QSzPlcy.Ignored), 0, 2, 2, 1) lay_acqctrl.addWidget(ld_mean, 0, 3) lay_acqctrl.addWidget(lb_mean, 0, 4) lay_acqctrl.addWidget(ld_ampp2p, 0, 5) lay_acqctrl.addWidget(lb_ampp2p, 0, 6) lay_acqctrl.addWidget(ld_rms, 1, 3) lay_acqctrl.addWidget(lb_rms, 1, 4) lay_acqctrl.addWidget(ld_bunid, 1, 5) lay_acqctrl.addWidget(lb_bunid, 1, 6) # Marker ld_mkspan = QLabel('Span (kHz)', self, alignment=Qt.AlignCenter) le_mklow = PyDMLineEdit(self, self.dev_pref + ':SB_SP_LOW1') le_mkhigh = PyDMLineEdit(self, self.dev_pref + ':SB_SP_HIGH1') ld_mkmode = QLabel('Mode', self, alignment=Qt.AlignCenter) cb_mkmode = PyDMEnumComboBox(self, self.dev_pref + ':SB_SP_SEARCH1') ld_mkfreq = QLabel('Frequency', self, alignment=Qt.AlignCenter) lb_mkfreq = PyDMLabel(self, self.dev_pref + ':SB_PEAKFREQ1') lb_mkfreq.showUnits = True ld_mktune = QLabel('Tune', self, alignment=Qt.AlignCenter) lb_mktune = PyDMLabel(self, self.dev_pref + ':SB_PEAKTUNE1') lb_mktune.showUnits = True ld_mkmag = QLabel('Magnitude', self, alignment=Qt.AlignCenter) lb_mkmag = PyDMLabel(self, self.dev_pref + ':SB_PEAK1') lb_mkmag.showUnits = True ld_mkphs = QLabel('Phase', self, alignment=Qt.AlignCenter) lb_mkphs = PyDMLabel(self, self.dev_pref + ':SB_PHASE1') lb_mkphs.showUnits = True lay = QGridLayout() lay.addWidget(ld_mkfreq, 1, 0) lay.addWidget(lb_mkfreq, 2, 0) lay.addWidget(ld_mktune, 1, 1) lay.addWidget(lb_mktune, 2, 1) lay.addWidget(ld_mkmag, 1, 2) lay.addWidget(lb_mkmag, 2, 2) lay.addWidget(ld_mkphs, 1, 3) lay.addWidget(lb_mkphs, 2, 3) lay.setRowStretch(0, 2) lay.setRowStretch(3, 2) gbox_mk = QGroupBox('Marker', self) lay_mk = QGridLayout(gbox_mk) lay_mk.addWidget(ld_mkmode, 0, 0) lay_mk.addWidget(cb_mkmode, 0, 1) lay_mk.addWidget(ld_mkspan, 1, 0, 1, 2) lay_mk.addWidget(le_mklow, 2, 0) lay_mk.addWidget(le_mkhigh, 2, 1) lay_mk.addLayout(lay, 0, 2, 3, 1) wid = QWidget() lay = QGridLayout(wid) lay.addLayout(lay_graph, 0, 0, 1, 2) lay.addWidget(gbox_acqctrl, 1, 0) lay.addWidget(gbox_mk, 1, 1) lay.setRowStretch(0, 5) lay.setRowStretch(1, 1) lay.setColumnStretch(0, 1) lay.setColumnStretch(1, 1) return wid
def _setupUi(self): gp_mode = WfmGraph(self) gp_mode.setStyleSheet('min-height: 10em;') gp_mode.setPlotTitle('Modal Amplitudes') gp_mode.getAxis('bottom').setLabel('Mode Number') gp_mode.getAxis('left').setLabel('CNT') gp_mode.add_scatter_curve(ychannel=self.prop_pref + 'MD_MODES', color=QColor('red'), lineStyle=Qt.SolidLine) gp_spec = WfmGraph(self) gp_spec.setStyleSheet('min-height: 10em;') gp_spec.setPlotTitle('Single Mode Spectrum') gp_spec.getAxis('bottom').setLabel('Frequency (kHz)') gp_spec.getAxis('left').setLabel('CNT') gp_spec.add_scatter_curve(ychannel=self.prop_pref + 'MD_SPEC', xchannel=self.prop_pref + 'FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_spec.add_marker(name='Marker', xchannel=self.prop_pref + 'MD_PEAKFREQ', ychannel=self.prop_pref + 'MD_PEAK', color=QColor('red'), symbol='o') ld_enbl = QLabel('Acq. Enable', self) cb_enbl = PyDMStateButton(self, self.prop_pref + 'MD_ENABLE') ld_sel = QLabel('Acq. Mode', self) cb_sel = PyDMEnumComboBox(self, self.prop_pref + 'MD_SMODE') ld_sbnd = QLabel('Sideband', self, alignment=Qt.AlignRight) sb_sbnd = PyDMSpinbox(self, self.prop_pref + 'MD_FTUNE') sb_sbnd.showStepExponent = False sb_sbnd.showUnits = True ld_span = QLabel('Span', self, alignment=Qt.AlignRight) sb_span = PyDMSpinbox(self, self.prop_pref + 'MD_FSPAN') sb_span.showStepExponent = False sb_span.showUnits = True ld_mode = QLabel('Mode', self, alignment=Qt.AlignRight) sb_mode = PyDMSpinbox(self, self.prop_pref + 'MD_MSEL') sb_mode.showStepExponent = False ld_avg = QLabel('Sample Avg', self, alignment=Qt.AlignRight) sb_avg = PyDMSpinbox(self, self.prop_pref + 'MD_AVG') sb_avg.showStepExponent = False gb_ctrl = QGroupBox('Acquisition control', self) lay_ctrl = QGridLayout(gb_ctrl) lay_ctrl.addWidget(ld_enbl, 0, 0) lay_ctrl.addWidget(cb_enbl, 1, 0) lay_ctrl.addWidget(ld_sel, 2, 0) lay_ctrl.addWidget(cb_sel, 3, 0) lay_ctrl.addWidget(ld_sbnd, 0, 1) lay_ctrl.addWidget(sb_sbnd, 0, 2) lay_ctrl.addWidget(ld_span, 1, 1) lay_ctrl.addWidget(sb_span, 1, 2) lay_ctrl.addWidget(ld_mode, 2, 1) lay_ctrl.addWidget(sb_mode, 2, 2) lay_ctrl.addWidget(ld_avg, 3, 1) lay_ctrl.addWidget(sb_avg, 3, 2) # Markers ld_rng = QLabel('Range (kHz)', self, alignment=Qt.AlignCenter) le_low = PyDMLineEdit(self, self.prop_pref + 'MD_SP_LOW') le_high = PyDMLineEdit(self, self.prop_pref + 'MD_SP_HIGH') cb_mode = PyDMEnumComboBox(self, self.prop_pref + 'MD_SP_SEARCH') ld_mnum = QLabel('Mode #', self, alignment=Qt.AlignRight) lb_mnum = PyDMLabel(self, self.prop_pref + 'MD_MAXMODE') ld_mamp = QLabel('Mode Amp.', self, alignment=Qt.AlignRight) lb_mamp = PyDMLabel(self, self.prop_pref + 'MD_MAXVAL') ld_peak = QLabel('Value', self, alignment=Qt.AlignRight) lb_peak = PyDMLabel(self, self.prop_pref + 'MD_PEAK') ld_pfrq = QLabel('Freq', self, alignment=Qt.AlignRight) lb_pfrq = PyDMLabel(self, self.prop_pref + 'MD_PEAKFREQ') lb_pfrq.showUnits = True ld_tune = QLabel('Tune', self, alignment=Qt.AlignRight) lb_tune = PyDMLabel(self, self.prop_pref + 'MD_PEAKTUNE') gb_mark = QGroupBox('Marker', self) lay_mark = QGridLayout(gb_mark) lay_mark.addWidget(ld_rng, 0, 0) lay_mark.addWidget(le_low, 1, 0) lay_mark.addWidget(le_high, 2, 0) lay_mark.addWidget(cb_mode, 3, 0) lay_mark.addWidget(ld_mnum, 0, 1) lay_mark.addWidget(lb_mnum, 0, 2) lay_mark.addWidget(ld_mamp, 1, 1) lay_mark.addWidget(lb_mamp, 1, 2) lay_mark.addWidget(ld_peak, 2, 1) lay_mark.addWidget(lb_peak, 2, 2) lay_mark.addWidget(ld_pfrq, 3, 1) lay_mark.addWidget(lb_pfrq, 3, 2) lay_mark.addWidget(ld_tune, 4, 1) lay_mark.addWidget(lb_tune, 4, 2) ld_name = QLabel('<h2>' + self.acq_type + ' Modal Analysis</h2>', self, alignment=Qt.AlignCenter) self.setLayout(QHBoxLayout()) wid = QWidget(self) self.layout().addWidget(wid) set_bbb_color(wid, self._device) lay = QGridLayout(wid) lay.addWidget(ld_name, 0, 0, 1, 2) lay.addWidget(gp_mode, 1, 0, 1, 2) lay.addWidget(gp_spec, 2, 0, 1, 2) lay.addWidget(gb_ctrl, 3, 0) lay.addWidget(gb_mark, 3, 1) lay.setRowStretch(1, 2) lay.setRowStretch(2, 2)
def _setupUi(self): ld_maindev = QLabel('<h3>General Settings</h3>', self, alignment=Qt.AlignCenter) # # Delay Lines ld_adcclock = QLabel('ADC Clock', self) sb_adcclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL0') sb_adcclock.showStepExponent = False fr_adcclock = SiriusFrame(self, self.dev_pref + ':ECLDEL0_SUBWR') fr_adcclock.add_widget(sb_adcclock) ld_fidclock = QLabel('Fiducial Clock', self) sb_fidclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL1') sb_fidclock.showStepExponent = False fr_fidclock = SiriusFrame(self, self.dev_pref + ':ECLDEL1_SUBWR') fr_fidclock.add_widget(sb_fidclock) ld_fiducial = QLabel('Fiducial', self) sb_fiducial = PyDMSpinbox(self, self.dev_pref + ':ECLDEL2') sb_fiducial.showStepExponent = False fr_fiducial = SiriusFrame(self, self.dev_pref + ':ECLDEL2_SUBWR') fr_fiducial.add_widget(sb_fiducial) ld_dacclock = QLabel('DAC Clock', self) sb_dacclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL3') sb_dacclock.showStepExponent = False fr_dacclock = SiriusFrame(self, self.dev_pref + ':ECLDEL3_SUBWR') fr_dacclock.add_widget(sb_dacclock) gbox_delaylines = QGroupBox('Delay lines', self) lay_delaylines = QGridLayout(gbox_delaylines) lay_delaylines.addWidget(ld_adcclock, 0, 0) lay_delaylines.addWidget(fr_adcclock, 0, 1) lay_delaylines.addWidget(ld_fidclock, 1, 0) lay_delaylines.addWidget(fr_fidclock, 1, 1) lay_delaylines.addWidget(ld_fiducial, 2, 0) lay_delaylines.addWidget(fr_fiducial, 2, 1) lay_delaylines.addWidget(ld_dacclock, 3, 0) lay_delaylines.addWidget(fr_dacclock, 3, 1) # # Thresholds and offsets ld_lvl = QLabel('<h4>Level</h4>', self, alignment=Qt.AlignCenter) ld_enbl = QLabel('<h4>Enbl</h4>', self, alignment=Qt.AlignCenter) ld_v = QLabel('<h4>V</h4>', self, alignment=Qt.AlignCenter) ld_edge = QLabel('<h4>Edge</h4>', self, alignment=Qt.AlignCenter) ld_fid = QLabel('Fiducial', self) cb_fidlvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_FID') cb_fidlvlenbl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_FID_ENABLE') cb_fidlvlenbl.setStyleSheet('max-width:3em;') sb_fidv = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH9') sb_fidv.showStepExponent = False sb_fidv.showUnits = True fr_fidv = SiriusFrame(self, self.dev_pref + ':AD5644CH9_SUBWR') fr_fidv.add_widget(sb_fidv) ld_trg1 = QLabel('Trigger 1', self) cb_trg1lvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_TRIG1') cb_trg1lvlenbl = PyDMEnumComboBox( self, self.dev_pref + ':LEVEL_TRIG1_ENABLE') cb_trg1lvlenbl.setStyleSheet('max-width:3em;') sb_trg1lvlv = PyDMSpinbox(self, self.dev_pref + ':LEVEL_VTRIG1') sb_trg1lvlv.showStepExponent = False sb_trg1lvlv.showUnits = True fr_trg1lvlv = SiriusFrame(self, self.dev_pref + ':AD5644CH10_SUBWR') fr_trg1lvlv.add_widget(sb_trg1lvlv) cb_trg1edge = PyDMEnumComboBox(self, self.dev_pref + ':TRIG1INV') cb_trg1edge.setStyleSheet('max-width:3.2em;') ld_trg2 = QLabel('Trigger 2', self) cb_trg2lvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_TRIG2') cb_trg2lvlenbl = PyDMEnumComboBox( self, self.dev_pref + ':LEVEL_TRIG2_ENABLE') cb_trg2lvlenbl.setStyleSheet('max-width:3em;') sb_trg2lvlv = PyDMSpinbox(self, self.dev_pref + ':LEVEL_VTRIG2') sb_trg2lvlv.showStepExponent = False sb_trg2lvlv.showUnits = True fr_trg2lvlv = SiriusFrame(self, self.dev_pref + ':AD5644CH8_SUBWR') fr_trg2lvlv.add_widget(sb_trg2lvlv) cb_trg2edge = PyDMEnumComboBox(self, self.dev_pref + ':TRIG2INV') cb_trg2edge.setStyleSheet('max-width:3.2em;') ld_dacoff = QLabel('DAC Offset', self) sb_dacoff = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH11') sb_dacoff.showStepExponent = False sb_dacoff.showUnits = True fr_dacoff = SiriusFrame(self, self.dev_pref + ':AD5644CH11_SUBWR') fr_dacoff.add_widget(sb_dacoff) gbox_thoff = QGroupBox('Thresholds and Offsets', self) lay_thoff = QGridLayout(gbox_thoff) lay_thoff.addWidget(ld_lvl, 0, 1) lay_thoff.addWidget(ld_enbl, 0, 2) lay_thoff.addWidget(ld_v, 0, 3) lay_thoff.addWidget(ld_edge, 0, 4) lay_thoff.addWidget(ld_fid, 1, 0) lay_thoff.addWidget(cb_fidlvl, 1, 1) lay_thoff.addWidget(cb_fidlvlenbl, 1, 2) lay_thoff.addWidget(fr_fidv, 1, 3) lay_thoff.addWidget(ld_trg1, 2, 0) lay_thoff.addWidget(cb_trg1lvl, 2, 1) lay_thoff.addWidget(cb_trg1lvlenbl, 2, 2) lay_thoff.addWidget(fr_trg1lvlv, 2, 3) lay_thoff.addWidget(cb_trg1edge, 2, 4) lay_thoff.addWidget(ld_trg2, 3, 0) lay_thoff.addWidget(cb_trg2lvl, 3, 1) lay_thoff.addWidget(cb_trg2lvlenbl, 3, 2) lay_thoff.addWidget(fr_trg2lvlv, 3, 3) lay_thoff.addWidget(cb_trg2edge, 3, 4) lay_thoff.addWidget(ld_dacoff, 4, 0) lay_thoff.addWidget(fr_dacoff, 4, 3) lay_thoff.setColumnStretch(0, 3) lay_thoff.setColumnStretch(1, 2) lay_thoff.setColumnStretch(2, 1) lay_thoff.setColumnStretch(3, 5) lay_thoff.setColumnStretch(4, 1) # # FIR ld_sfir = QLabel('Shaper FIR ([C0 2^17 C2])', self) ld_firc0 = QLabel('C0', self) sb_firc0 = PyDMSpinbox(self, self.dev_pref + ':SHAPE_C0') sb_firc0.showStepExponent = False fr_firc0 = SiriusFrame(self, self.dev_pref + ':SHAPE_C0_SUBWR') fr_firc0.add_widget(sb_firc0) ld_firc2 = QLabel('C2', self) sb_firc2 = PyDMSpinbox(self, self.dev_pref + ':SHAPE_C2') sb_firc2.showStepExponent = False fr_firc2 = SiriusFrame(self, self.dev_pref + ':SHAPE_C2_SUBWR') fr_firc2.add_widget(sb_firc2) lay_fir = QHBoxLayout() lay_fir.addStretch() lay_fir.addWidget(ld_sfir) lay_fir.addStretch() lay_fir.addWidget(ld_firc0) lay_fir.addWidget(fr_firc0) lay_fir.addStretch() lay_fir.addWidget(ld_firc2) lay_fir.addWidget(fr_firc2) lay_fir.addStretch() lay = QGridLayout(self) lay.addWidget(ld_maindev, 0, 1, 1, 2) lay.addWidget(gbox_delaylines, 1, 1) lay.addWidget(gbox_thoff, 1, 2) lay.addLayout(lay_fir, 2, 1, 1, 2) lay.setColumnStretch(0, 3) lay.setColumnStretch(3, 3) lay.setRowStretch(3, 3) self.setStyleSheet("""SiriusFrame{max-height: 1.8em;}""")
def _setupUi(self): ld_dacs = QLabel('<h3>AD5644 DACs</h3>', self, alignment=Qt.AlignCenter) ld_dacch0 = QLabel('0', self, alignment=Qt.AlignCenter) ld_dacch0.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch0 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH0') sb_dacch0.showStepExponent = False sb_dacch0.showUnits = True fr_dacch0 = SiriusFrame(self, self.dev_pref + ':AD5644CH0_SUBWR') fr_dacch0.add_widget(sb_dacch0) ld_dacch1 = QLabel('1', self, alignment=Qt.AlignCenter) ld_dacch1.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch1 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH1') sb_dacch1.showStepExponent = False sb_dacch1.showUnits = True fr_dacch1 = SiriusFrame(self, self.dev_pref + ':AD5644CH1_SUBWR') fr_dacch1.add_widget(sb_dacch1) ld_dacch2 = QLabel('2', self, alignment=Qt.AlignCenter) ld_dacch2.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch2 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH2') sb_dacch2.showStepExponent = False sb_dacch2.showUnits = True fr_dacch2 = SiriusFrame(self, self.dev_pref + ':AD5644CH2_SUBWR') fr_dacch2.add_widget(sb_dacch2) ld_dacch3 = QLabel('3', self, alignment=Qt.AlignCenter) ld_dacch3.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch3 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH3') sb_dacch3.showStepExponent = False sb_dacch3.showUnits = True fr_dacch3 = SiriusFrame(self, self.dev_pref + ':AD5644CH3_SUBWR') fr_dacch3.add_widget(sb_dacch3) ld_dacref0 = QLabel('Ref\n0-3', self, alignment=Qt.AlignCenter) ld_dacref0.setStyleSheet('font-weight: bold; max-width: 3em;') cb_dacref0 = PyDMEnumComboBox(self, self.dev_pref + ':AD5644REF0_BO') ld_dacch4 = QLabel('4', self, alignment=Qt.AlignCenter) ld_dacch4.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch4 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH4') sb_dacch4.showStepExponent = False sb_dacch4.showUnits = True fr_dacch4 = SiriusFrame(self, self.dev_pref + ':AD5644CH4_SUBWR') fr_dacch4.add_widget(sb_dacch4) ld_dacch5 = QLabel('5', self, alignment=Qt.AlignCenter) ld_dacch5.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch5 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH5') sb_dacch5.showStepExponent = False sb_dacch5.showUnits = True fr_dacch5 = SiriusFrame(self, self.dev_pref + ':AD5644CH5_SUBWR') fr_dacch5.add_widget(sb_dacch5) ld_dacch6 = QLabel('6', self, alignment=Qt.AlignCenter) ld_dacch6.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch6 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH6') sb_dacch6.showStepExponent = False sb_dacch6.showUnits = True fr_dacch6 = SiriusFrame(self, self.dev_pref + ':AD5644CH6_SUBWR') fr_dacch6.add_widget(sb_dacch6) ld_dacch7 = QLabel('7', self, alignment=Qt.AlignCenter) ld_dacch7.setStyleSheet('font-weight: bold; max-width: 3em;') sb_dacch7 = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH7') sb_dacch7.showStepExponent = False sb_dacch7.showUnits = True fr_dacch7 = SiriusFrame(self, self.dev_pref + ':AD5644CH7_SUBWR') fr_dacch7.add_widget(sb_dacch7) ld_dacref1 = QLabel('Ref\n4-7', self, alignment=Qt.AlignCenter) ld_dacref1.setStyleSheet('font-weight: bold; max-width: 3em;') cb_dacref1 = PyDMEnumComboBox(self, self.dev_pref + ':AD5644REF1_BO') cb_dacmode = PyDMEnumComboBox(self, self.dev_pref + ':AD5644TEST_BO') lay = QGridLayout(self) lay.setAlignment(Qt.AlignCenter | Qt.AlignTop) lay.setHorizontalSpacing(15) lay.setVerticalSpacing(15) lay.addWidget(ld_dacs, 0, 1, 1, 5) lay.addWidget(ld_dacch0, 1, 1) lay.addWidget(fr_dacch0, 1, 2) lay.addWidget(ld_dacch1, 2, 1) lay.addWidget(fr_dacch1, 2, 2) lay.addWidget(ld_dacch2, 3, 1) lay.addWidget(fr_dacch2, 3, 2) lay.addWidget(ld_dacch3, 4, 1) lay.addWidget(fr_dacch3, 4, 2) lay.addWidget(ld_dacref0, 5, 1) lay.addWidget(cb_dacref0, 5, 2) lay.addWidget(ld_dacch4, 1, 4) lay.addWidget(fr_dacch4, 1, 5) lay.addWidget(ld_dacch5, 2, 4) lay.addWidget(fr_dacch5, 2, 5) lay.addWidget(ld_dacch6, 3, 4) lay.addWidget(fr_dacch6, 3, 5) lay.addWidget(ld_dacch7, 4, 4) lay.addWidget(fr_dacch7, 4, 5) lay.addWidget(ld_dacref1, 5, 4) lay.addWidget(cb_dacref1, 5, 5) lay.addWidget(cb_dacmode, 6, 1, 1, 5)
def connection_changed(self, connected): build = (self._node is None) and (self._connected != connected and connected is True) super(RunControl, self).connection_changed(connected) if not build: return self._node = nodeFromAddress(self.channel) self._path = self.channel vb = QVBoxLayout() self.setLayout(vb) gb = QGroupBox('Run Control ({})'.format(self._node.name)) vb.addWidget(gb) vb = QVBoxLayout() gb.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runRate') w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run Rate:', w) hb = QHBoxLayout() vb.addLayout(hb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runState') w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run State:', w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyDMLabel(parent=None, init_channel=self._path + '.runCount') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run Count:', w)
def _setupMeasSettingsWidget(self, mode): if mode == 'Normal': prefix = self.dcct_prefix visible = True elif mode == 'Fast': prefix = self.dcct_prefix.substitute(propty_name=mode) visible = False gbox_modesettings = QGroupBox(mode + ' Measurement Mode Settings', self) l_smpcnt = QLabel('Sample Count: ', self) spinbox_SampleCnt = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-SP')) spinbox_SampleCnt.showStepExponent = False label_SampleCnt = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-RB')) hlay_smpcnt = QHBoxLayout() hlay_smpcnt.addWidget(spinbox_SampleCnt) hlay_smpcnt.addWidget(label_SampleCnt) l_measperiod = QLabel('Period [s]: ', self) spinbox_MeasPeriod = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-SP')) spinbox_MeasPeriod.showStepExponent = False label_MeasPeriod = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-RB')) hlay_measperiod = QHBoxLayout() hlay_measperiod.addWidget(spinbox_MeasPeriod) hlay_measperiod.addWidget(label_MeasPeriod) l_measupdateperiod = QLabel('Measured Period [s]: ', self) label_MeasUpdatePeriod = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasUpdatePeriod-Mon')) l_imped = QLabel('Impedance: ', self) enumcombobox_Imped = PyDMEnumComboBox( self, prefix.substitute(propty=prefix.propty_name + 'Imped-Sel')) label_Imped = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'Imped-Sts')) hlay_imped = QHBoxLayout() hlay_imped.addWidget(enumcombobox_Imped) hlay_imped.addWidget(label_Imped) l_offset = QLabel('Relative Offset Enable: ', self) statebutton_RelEnbl = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'RelEnbl-Sel')) statebutton_RelEnbl.shape = 1 statebutton_RelEnbl.setStyleSheet('min-width:6em; max-width:6em;') label_RelEnbl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'RelEnbl-Sts')) hlay_offset = QHBoxLayout() hlay_offset.addWidget(statebutton_RelEnbl) hlay_offset.addWidget(label_RelEnbl) l_rellvl = QLabel('Relative Offset Level [V]: ', self) spinbox_RelLvl = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'RelLvl-SP')) spinbox_RelLvl.showStepExponent = False label_RelLvl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'RelLvl-RB')) label_RelLvl.precisionFromPV = False label_RelLvl.precision = 9 pushbutton_RelAcq = PyDMPushButton( parent=self, label='Acquire Offset', pressValue=1, init_channel=prefix.substitute(propty=prefix.propty_name + 'RelAcq-Cmd')) pushbutton_RelAcq.setAutoDefault(False) pushbutton_RelAcq.setDefault(False) hlay_rellvl = QHBoxLayout() hlay_rellvl.addWidget(spinbox_RelLvl) hlay_rellvl.addWidget(label_RelLvl) hlay_rellvl.addWidget(pushbutton_RelAcq) flay_modesettings = QFormLayout() flay_modesettings.setLabelAlignment(Qt.AlignRight) flay_modesettings.setFormAlignment(Qt.AlignHCenter) flay_modesettings.addRow(l_smpcnt, hlay_smpcnt) flay_modesettings.addRow(l_measperiod, hlay_measperiod) flay_modesettings.addRow(l_measupdateperiod, label_MeasUpdatePeriod) flay_modesettings.addRow(l_imped, hlay_imped) flay_modesettings.addRow(l_offset, hlay_offset) flay_modesettings.addRow(l_rellvl, hlay_rellvl) if mode == 'Normal': l_linesync = QLabel('Line Synchronization: ', self) statebutton_LineSync = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'LineSync-Sel')) statebutton_LineSync.shape = 1 statebutton_LineSync.setStyleSheet('min-width:6em; max-width:6em;') label_LineSync = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'LineSync-Sts')) hlay_linesync = QHBoxLayout() hlay_linesync.addWidget(statebutton_LineSync) hlay_linesync.addWidget(label_LineSync) label_avg = QLabel('<h4>Average Filter</h4>', self) l_avgenbl = QLabel('Enable: ', self) statebutton_AvgFilterEnbl = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterEnbl-Sel')) statebutton_AvgFilterEnbl.shape = 1 label_AvgFilterEnbl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterEnbl-Sts')) hlay_avgenbl = QHBoxLayout() hlay_avgenbl.addWidget(statebutton_AvgFilterEnbl) hlay_avgenbl.addWidget(label_AvgFilterEnbl) l_avgcnt = QLabel('Samples: ', self) spinbox_AvgFilterCount = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterCnt-SP')) spinbox_AvgFilterCount.showStepExponent = False label_AvgFilterCount = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterCnt-RB')) hlay_avgcnt = QHBoxLayout() hlay_avgcnt.addWidget(spinbox_AvgFilterCount) hlay_avgcnt.addWidget(label_AvgFilterCount) l_avgtyp = QLabel('Type: ', self) enumcombobox_AvgFilterTyp = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='AvgFilterTyp-Sel')) label_AvgFilterTyp = PyDMLabel( self, self.dcct_prefix.substitute(propty='AvgFilterTyp-Sts')) hlay_avgtyp = QHBoxLayout() hlay_avgtyp.addWidget(enumcombobox_AvgFilterTyp) hlay_avgtyp.addWidget(label_AvgFilterTyp) l_avgwin = QLabel('Noise window size [%]: ', self) spinbox_AvgFilterWind = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterWind-SP')) spinbox_AvgFilterWind.showStepExponent = False label_AvgFilterWind = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterWind-RB')) hlay_avgwin = QHBoxLayout() hlay_avgwin.addWidget(spinbox_AvgFilterWind) hlay_avgwin.addWidget(label_AvgFilterWind) flay_modesettings.addRow(l_linesync, hlay_linesync) flay_modesettings.addRow(QLabel('')) flay_modesettings.addRow(label_avg) flay_modesettings.addRow(l_avgenbl, hlay_avgenbl) flay_modesettings.addRow(l_avgcnt, hlay_avgcnt) flay_modesettings.addRow(l_avgtyp, hlay_avgtyp) flay_modesettings.addRow(l_avgwin, hlay_avgwin) gbox_modesettings.setLayout(flay_modesettings) gbox_modesettings.setVisible(visible) gbox_modesettings.setStyleSheet(""" PyDMSpinbox, PyDMLabel{ min-width:6em; max-width:6em; qproperty-alignment: AlignCenter;} PyDMLedMultiChannel, PyDMStateButton, PyDMEnumComboBox{ min-width:6em; max-width:6em;}""") return gbox_modesettings
def _setupControlsWidget(self): ld_growenbl = QLabel('Grow/Damp Enable', self) cb_growenbl = PyDMEnumComboBox(self, self.dev_pref + ':GDEN') ld_down = QLabel('Rec. Downsample ', self) sb_down = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_REC_DS') sb_down.showStepExponent = False ld_rawdata = QLabel('Raw Data', self) cb_rawdata = PyDMStateButton(self, self.dev_pref + ':' + self.TYPE + '_DUMP') ld_acqtime = QLabel('Acquisition Time', self) sb_acqtime = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_ACQTIME') sb_acqtime.showStepExponent = False sb_acqtime.showUnits = True ld_holdoff = QLabel('Hold-Off Time', self) sb_holdoff = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_HOLDTIME') sb_holdoff.showStepExponent = False sb_holdoff.showUnits = True ld_posttrg = QLabel('Post Trigger', self) sb_posttrg = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_POSTTIME') sb_posttrg.showStepExponent = False sb_posttrg.showUnits = True fr_posttrg = SiriusFrame( self, self.dev_pref + ':' + self.TYPE + '_POSTREG_SUBWR') fr_posttrg.add_widget(sb_posttrg) ld_growtime = QLabel('Growth Time', self) sb_growtime = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_GDTIME') sb_growtime.showStepExponent = False sb_growtime.showUnits = True fr_growtime = SiriusFrame( self, self.dev_pref + ':' + self.TYPE + '_GDREG_SUBWR') fr_growtime.add_widget(sb_growtime) ld_acqlen = QLabel('Acquisition Length', self) lb_acqlen = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_ACQ_TURNS') lb_acqlen.showUnits = True ld_psttrglen = QLabel('Post Trigger Length', self) lb_psttrglen = PyDMLabel( self, self.dev_pref + ':' + self.TYPE + '_POST_TURNS') lb_psttrglen.showUnits = True bt_modal = QPushButton('Modal Analysis', self) window = create_window_from_widget(_BbBModalAnalysis, title='SRAM Modal Analysis', icon=get_bbb_icon(), is_main=True) connect_window(bt_modal, window, self, prefix=self._prefix, device=self._device, acq_type=self.TYPE) gbox_dtacq = QGroupBox('Data Acquisition', self) lay_dtacq = QGridLayout(gbox_dtacq) lay_dtacq.addWidget(ld_growenbl, 0, 0) lay_dtacq.addWidget(cb_growenbl, 0, 1) lay_dtacq.addWidget(ld_down, 1, 0) lay_dtacq.addWidget(sb_down, 1, 1) lay_dtacq.addWidget(ld_rawdata, 2, 0) lay_dtacq.addWidget(cb_rawdata, 2, 1) lay_dtacq.addWidget(ld_acqtime, 3, 0) lay_dtacq.addWidget(sb_acqtime, 3, 1) lay_dtacq.addWidget(ld_holdoff, 4, 0) lay_dtacq.addWidget(sb_holdoff, 4, 1) lay_dtacq.addWidget(ld_posttrg, 5, 0) lay_dtacq.addWidget(fr_posttrg, 5, 1) lay_dtacq.addWidget(ld_growtime, 6, 0) lay_dtacq.addWidget(fr_growtime, 6, 1) lay_dtacq.addWidget(ld_acqlen, 7, 0) lay_dtacq.addWidget(lb_acqlen, 7, 1) lay_dtacq.addWidget(ld_psttrglen, 8, 0) lay_dtacq.addWidget(lb_psttrglen, 8, 1) lay_dtacq.addWidget(bt_modal, 9, 0, 1, 2) ld_acqtyp = QLabel('<h4>Acq Type</h4>', self, alignment=Qt.AlignCenter) cb_acqtyp = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_POSTSEL') gbox_acqtyp = QGroupBox(self) lay_acqtyp = QVBoxLayout(gbox_acqtyp) lay_acqtyp.addWidget(ld_acqtyp) lay_acqtyp.addWidget(cb_acqtyp) ld_trgexten = QLabel('Internal/External', self) cb_trgexten = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_HWTEN') ld_trginsel = QLabel('Selection', self) cb_trginsel = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_TRIG_IN_SEL') ld_trgarm = QLabel('Arm', self) cb_trgarm = PyDMStateButton(self, self.dev_pref + ':' + self.TYPE + '_ARM') lb_armmon = SiriusLedState( self, self.dev_pref + ':' + self.TYPE + '_ARM_MON') ld_trgbrarm = QLabel('Auto re-arm', self) cb_trgbrarm = PyDMStateButton( self, self.dev_pref + ':' + self.TYPE + '_BR_ARM') ld_rst = QLabel('Trigger 1/2 Cap.:', self) lb_rst1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_CAP_TRIG1') lb_rst2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_CAP_TRIG2') gbox_trig = QGroupBox('Trigger', self) lay_trig = QGridLayout(gbox_trig) lay_trig.setAlignment(Qt.AlignTop) lay_trig.addWidget(ld_trgexten, 0, 0) lay_trig.addWidget(cb_trgexten, 0, 1, 1, 2) lay_trig.addWidget(ld_trginsel, 1, 0) lay_trig.addWidget(cb_trginsel, 1, 1, 1, 2) lay_trig.addWidget(ld_trgarm, 2, 0) lay_trig.addWidget(cb_trgarm, 2, 1) lay_trig.addWidget(lb_armmon, 2, 2) lay_trig.addWidget(ld_trgbrarm, 3, 0) lay_trig.addWidget(cb_trgbrarm, 3, 1) lay_trig.addWidget(ld_rst, 4, 0) lay_trig.addWidget(lb_rst1, 4, 1) lay_trig.addWidget(lb_rst2, 4, 2) lay_trig.setRowStretch(5, 2) pixmap = QPixmap( _os.path.join(_os.path.abspath(_os.path.dirname(__file__)), 'grow_damp.png')) img_wid = QLabel(self) img_wid.setPixmap(pixmap) img_wid.setScaledContents(True) wid = QWidget() lay = QGridLayout(wid) lay.setContentsMargins(0, 0, 0, 0) lay.addWidget(gbox_acqtyp, 0, 0) lay.addWidget(gbox_dtacq, 1, 0) lay.addWidget(gbox_trig, 2, 0) lay.addWidget(img_wid, 4, 0) lay.setRowStretch(3, 5) lay.setRowStretch(5, 5) wid.setStyleSheet("SiriusFrame{max-height: 1.8em;}") return wid
def _setupWaveformsWidget(self): gp_mean = WfmGraph(self) gp_mean.setPlotTitle('Mean') gp_mean.getAxis('bottom').setLabel('Bunch number') gp_mean.getAxis('left').setLabel('CNT') gp_mean.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_MEAN', xchannel=self.dev_pref + ':' + self.TYPE + '_XSC', color=QColor('red'), lineStyle=Qt.SolidLine) gp_maxrms = WfmGraph(self) gp_maxrms.setPlotTitle('Max RMS Channel (filtered)') gp_maxrms.getAxis('bottom').setLabel('Time (ms)') gp_maxrms.getAxis('left').setLabel('CNT') gp_maxrms.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_MAXRMS', xchannel=self.dev_pref + ':' + self.TYPE + '_TSC', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_rms = WfmGraph(self) gp_rms.setPlotTitle('RMS') gp_rms.getAxis('bottom').setLabel('Bunch number') gp_rms.getAxis('left').setLabel('CNT') gp_rms.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_RMS', xchannel=self.dev_pref + ':' + self.TYPE + '_XSC', color=QColor('green'), lineStyle=Qt.SolidLine) gp_avgspe = WfmGraph(self) gp_avgspe.setPlotTitle('Average spectrum') gp_avgspe.getAxis('bottom').setLabel('Frequency (kHz)') gp_avgspe.getAxis('left').setLabel('dB') gp_avgspe.add_scatter_curve( ychannel=self.dev_pref + ':' + self.TYPE + '_SPEC', xchannel=self.dev_pref + ':' + self.TYPE + '_FREQ', color=QColor('blue'), lineStyle=Qt.SolidLine) gp_avgspe.add_marker( name='Marker 1', xchannel=self.dev_pref + ':' + self.TYPE + '_PEAKFREQ1', ychannel=self.dev_pref + ':' + self.TYPE + '_PEAK1', color=QColor('red'), symbol='o') gp_avgspe.add_marker( name='Marker 2', xchannel=self.dev_pref + ':' + self.TYPE + '_PEAKFREQ2', ychannel=self.dev_pref + ':' + self.TYPE + '_PEAK2', color=QColor('magenta'), symbol='s') lay_graph = QGridLayout() lay_graph.setContentsMargins(9, 9, 9, 9) lay_graph.addWidget(gp_mean, 0, 0) lay_graph.addWidget(gp_maxrms, 0, 1) lay_graph.addWidget(gp_rms, 1, 0) lay_graph.addWidget(gp_avgspe, 1, 1) ld_acqenbl = QLabel('Acq. Enable', self) cb_acqenbl = PyDMStateButton( self, self.dev_pref + ':' + self.TYPE + '_ACQ_EN') ld_acqsing = QLabel('Acq. Mode', self) cb_acqsing = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_ACQ_SINGLE') ld_mean = QLabel('Mean', self, alignment=Qt.AlignCenter) lb_mean = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_MEANVAL') ld_rms = QLabel('RMS', self, alignment=Qt.AlignCenter) lb_rms = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_RMSVAL') ld_ampp2p = QLabel('Amp P-P', self, alignment=Qt.AlignCenter) lb_ampp2p = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_AMP_PP') ld_maxrms = QLabel('Max RMS', self, alignment=Qt.AlignCenter) lb_maxrms = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_MAXRMSVAL') ld_bunpatt = QLabel('Bunch\npattern', self) le_bunpatt = PyDMLineEdit( self, self.dev_pref + ':' + self.TYPE + '_ACQ_PATTERN') ld_avg = QLabel('Sample Avg', self) sb_avg = PyDMSpinbox(self, self.dev_pref + ':' + self.TYPE + '_SP_AVG') sb_avg.showStepExponent = False gbox_acqctrl = QGroupBox('Acquisition control', self) lay_acqctrl = QGridLayout(gbox_acqctrl) lay_acqctrl.addWidget(ld_acqenbl, 0, 0) lay_acqctrl.addWidget(cb_acqenbl, 0, 1) lay_acqctrl.addWidget(ld_acqsing, 1, 0) lay_acqctrl.addWidget(cb_acqsing, 1, 1) lay_acqctrl.addWidget(ld_avg, 2, 0) lay_acqctrl.addWidget(sb_avg, 2, 1) lay_acqctrl.addItem(QSpacerItem(15, 1, QSzPlcy.Fixed, QSzPlcy.Ignored), 0, 2, 3, 1) lay_acqctrl.addWidget(ld_mean, 0, 3) lay_acqctrl.addWidget(lb_mean, 0, 4) lay_acqctrl.addWidget(ld_ampp2p, 0, 5) lay_acqctrl.addWidget(lb_ampp2p, 0, 6) lay_acqctrl.addWidget(ld_rms, 1, 3) lay_acqctrl.addWidget(lb_rms, 1, 4) lay_acqctrl.addWidget(ld_maxrms, 1, 5) lay_acqctrl.addWidget(lb_maxrms, 1, 6) lay_acqctrl.addWidget(ld_bunpatt, 2, 3) lay_acqctrl.addWidget(le_bunpatt, 2, 4, 1, 3) # Markers ld_mk1 = QLabel('1', self, alignment=Qt.AlignCenter) ld_mk2 = QLabel('2', self, alignment=Qt.AlignCenter) ld_span = QLabel('Span (kHz)', self, alignment=Qt.AlignCenter) ld_mode = QLabel('Mode', self, alignment=Qt.AlignCenter) ld_val = QLabel('Value', self, alignment=Qt.AlignCenter) ld_pfrq = QLabel('Freq', self, alignment=Qt.AlignCenter) ld_tune = QLabel('Tune', self, alignment=Qt.AlignCenter) le_low1 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_LOW1') le_high1 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_HIGH1') cb_mode1 = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_SP_SEARCH1') lb_peak1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAK1') lb_peak1.showUnits = True lb_pfrq1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKFREQ1') lb_pfrq1.showUnits = True lb_tune1 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKTUNE1') le_low2 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_LOW2') le_high2 = PyDMLineEdit(self, self.dev_pref + ':' + self.TYPE + '_SP_HIGH2') cb_mode2 = PyDMEnumComboBox( self, self.dev_pref + ':' + self.TYPE + '_SP_SEARCH2') lb_peak2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAK2') lb_peak2.showUnits = True lb_pfrq2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKFREQ2') lb_pfrq2.showUnits = True lb_tune2 = PyDMLabel(self, self.dev_pref + ':' + self.TYPE + '_PEAKTUNE2') gbox_mark = QGroupBox('Markers', self) lay_mark = QGridLayout(gbox_mark) lay_mark.addWidget(ld_span, 0, 1, 1, 2) lay_mark.addWidget(ld_mode, 0, 3) lay_mark.addWidget(ld_val, 0, 4) lay_mark.addWidget(ld_pfrq, 0, 5) lay_mark.addWidget(ld_tune, 0, 6) lay_mark.addWidget(ld_mk1, 1, 0) lay_mark.addWidget(le_low1, 1, 1) lay_mark.addWidget(le_high1, 1, 2) lay_mark.addWidget(cb_mode1, 1, 3) lay_mark.addWidget(lb_peak1, 1, 4) lay_mark.addWidget(lb_pfrq1, 1, 5) lay_mark.addWidget(lb_tune1, 1, 6) lay_mark.addWidget(ld_mk2, 2, 0) lay_mark.addWidget(le_low2, 2, 1) lay_mark.addWidget(le_high2, 2, 2) lay_mark.addWidget(cb_mode2, 2, 3) lay_mark.addWidget(lb_peak2, 2, 4) lay_mark.addWidget(lb_pfrq2, 2, 5) lay_mark.addWidget(lb_tune2, 2, 6) wid = QWidget() lay = QGridLayout(wid) lay.setContentsMargins(0, 0, 0, 0) lay.addLayout(lay_graph, 0, 0, 1, 2) lay.addWidget(gbox_acqctrl, 1, 0) lay.addWidget(gbox_mark, 1, 1) lay.setRowStretch(0, 5) lay.setRowStretch(1, 1) lay.setColumnStretch(0, 1) lay.setColumnStretch(1, 1) return wid
def _setupUi(self): if self._driver_num is None: ld_drive = QLabel( '<h3>Drive Pattern Generator</h3>', self, alignment=Qt.AlignCenter) else: ld_drive = QWidget(self) ld_drive.setLayout(QHBoxLayout()) labd = QLabel( f'<h3>Driver {self._driver_num:d}, NCO BITS: </h3>', ld_drive, alignment=Qt.AlignRight) labd.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) lab = PyDMLabel( ld_drive, self.dev_pref+'BITS') lab.setStyleSheet('font-size: 13pt; font-weight: bold;') lab.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) ld_drive.layout().addStretch() ld_drive.layout().addWidget(labd) ld_drive.layout().addWidget(lab) ld_drive.layout().addStretch() ld_amp = QLabel('Amplitude', self) sb_amp = PyDMSpinbox(self, self.dev_pref+'AMPL') sb_amp.showStepExponent = False ld_freq = QLabel('Frequency', self) sb_freq = PyDMSpinbox(self, self.dev_pref+'FREQ') sb_freq.showStepExponent = False ld_wav = QLabel('Waveform', self) cb_wav = PyDMEnumComboBox(self, self.dev_pref+'WAVEFORM') ld_tmod = QLabel('Time MODulation', self) cb_tmod = PyDMStateButton(self, self.dev_pref+'MOD') ld_span = QLabel('Span', self) sb_span = PyDMSpinbox(self, self.dev_pref+'SPAN') sb_span.showStepExponent = False ld_perd = QLabel('Period', self) sb_perd = PyDMSpinbox(self, self.dev_pref+'PERIOD') sb_perd.showStepExponent = False ld_patt = QLabel('Drive Pattern', self) le_patt = PyDMLineEdit(self, self.dev_pref+'PATTERN') lb_actfreq = PyDMLabel(self, self.dev_pref+'FREQ_ACT_STRING') lb_actspan = PyDMLabel(self, self.dev_pref+'SPAN_ACT_STRING') lb_actperd = PyDMLabel(self, self.dev_pref+'PERIOD_ACT') lay = QGridLayout(self) lay.addWidget(ld_drive, 0, 1, 1, 3) lay.addWidget(ld_tmod, 2, 1) lay.addWidget(cb_tmod, 2, 2) lay.addWidget(ld_amp, 3, 1) lay.addWidget(sb_amp, 3, 2) lay.addWidget(ld_freq, 4, 1) lay.addWidget(lb_actfreq, 4, 3) lay.addWidget(sb_freq, 4, 2) lay.addWidget(ld_wav, 5, 1) lay.addWidget(cb_wav, 5, 2) lay.addWidget(ld_span, 6, 1) lay.addWidget(sb_span, 6, 2) lay.addWidget(lb_actspan, 6, 3) lay.addWidget(ld_perd, 7, 1) lay.addWidget(sb_perd, 7, 2) lay.addWidget(lb_actperd, 7, 3) lay.addWidget(ld_patt, 8, 1) lay.addWidget(le_patt, 8, 2, 1, 2) lay.addItem(QSpacerItem(1, 10), 9, 1) lay.addItem(QSpacerItem(1, 10), 13, 1) if self._driver_num in {None, 1}: pixmap = QPixmap(_os.path.join( _os.path.abspath(_os.path.dirname(__file__)), 'drive.png')) il_drive = QLabel(self) il_drive.setPixmap(pixmap) il_drive.setScaledContents(True) lay.addWidget(il_drive, 14, 1, 1, 3, alignment=Qt.AlignCenter) else: wid = QWidget(self) wid.setLayout(QHBoxLayout()) wid.layout().addStretch() propty = f':PHTRK_LOOPCTRL{self._driver_num:d}' pv = self._prefix + self._device + propty lab = SiriusLabel(self, init_channel=pv) lab.enum_strings = ['Tracking Off', 'Tracking On'] lab.displayFormat = lab.DisplayFormat.String frame = SiriusFrame(self, pv, is_float=True) frame.borderWidth = 2 frame.add_widget(lab) wid.layout().addWidget(frame) wid.layout().addStretch() lab = QLabel('Track. Freq: ', self) wid.layout().addWidget(lab) propty = f':PHTRK_FREQ{self._driver_num:d}' pv = self._prefix + self._device + propty freq = PyDMLabel(self, init_channel=pv) wid.layout().addWidget(freq) wid.layout().addStretch() lay.addWidget(wid, 14, 1, 1, 3) lay.setRowStretch(15, 5) lay.setColumnStretch(0, 5) lay.setColumnStretch(4, 5)
def _setupControlsWidget(self): ld_acqtime = QLabel('Acquisition Time [ms]', self) sb_acqtime = PyDMSpinbox(self, self.dev_pref + ':SB_ACQTIME') sb_acqtime.showStepExponent = False ld_bunid = QLabel('Bunch Number', self) sb_bunid = PyDMSpinbox(self, self.dev_pref + ':SB_BUNCH_ID') sb_bunid.showStepExponent = False ld_acqsmpl = QLabel('Acq Samples', self) lb_acqsmpl = PyDMLabel(self, self.dev_pref + ':SB_ACQ_SAMPLES') ld_currbun = QLabel('Current Bunch', self) lb_currbun = PyDMLabel(self, self.dev_pref + ':SB_RAW_BUNCH_ID') gbox_dtacq = QGroupBox('Data Acquisition', self) lay_dtacq = QGridLayout(gbox_dtacq) lay_dtacq.addWidget(ld_acqtime, 0, 0) lay_dtacq.addWidget(sb_acqtime, 0, 1) lay_dtacq.addWidget(ld_bunid, 1, 0) lay_dtacq.addWidget(sb_bunid, 1, 1) lay_dtacq.addWidget(ld_acqsmpl, 2, 0) lay_dtacq.addWidget(lb_acqsmpl, 2, 1) lay_dtacq.addWidget(ld_currbun, 3, 0) lay_dtacq.addWidget(lb_currbun, 3, 1) ld_trgexten = QLabel('Internal/External', self) cb_trgexten = PyDMEnumComboBox(self, self.dev_pref + ':SB_EXTEN') ld_trginsel = QLabel('Selection', self) cb_trginsel = PyDMEnumComboBox(self, self.dev_pref + ':SB_TRIG_IN_SEL') ld_trgarm = QLabel('Arm', self) cb_trgarm = PyDMStateButton(self, self.dev_pref + ':SB_ARM') lb_armmon = SiriusLedState(self, self.dev_pref + ':SB_ARM_MON') ld_trgbrarm = QLabel('Auto re-arm', self) cb_trgbrarm = PyDMStateButton(self, self.dev_pref + ':SB_BR_ARM') gbox_trig = QGroupBox('Trigger', self) lay_trig = QGridLayout(gbox_trig) lay_trig.addWidget(ld_trgexten, 0, 0) lay_trig.addWidget(cb_trgexten, 0, 1, 1, 2) lay_trig.addWidget(ld_trginsel, 1, 0) lay_trig.addWidget(cb_trginsel, 1, 1, 1, 2) lay_trig.addWidget(ld_trgarm, 2, 0) lay_trig.addWidget(cb_trgarm, 2, 1) lay_trig.addWidget(lb_armmon, 2, 2) lay_trig.addWidget(ld_trgbrarm, 3, 0) lay_trig.addWidget(cb_trgbrarm, 3, 1) ld_phtrkctrl = QLabel('<h4>Controls</h4>', self, alignment=Qt.AlignCenter) ld_bunnr = QLabel('Bunch Number', self) sb_bunnr = PyDMSpinbox(self, self.dev_pref + ':SB_BUNCH_ID') sb_bunnr.showStepExponent = False ld_gain = QLabel('Gain', self) sb_gain = PyDMSpinbox(self, self.dev_pref + ':PHTRK_GAIN') sb_gain.showStepExponent = False ld_sp = QLabel('Setpoint [deg]', self) sb_sp = PyDMSpinbox(self, self.dev_pref + ':PHTRK_SETPT') sb_sp.showStepExponent = False ld_range = QLabel('Range [kHz]', self) sb_range = PyDMSpinbox(self, self.dev_pref + ':PHTRK_RANGE') sb_range.showStepExponent = False ld_dec = QLabel('Decimation', self) sb_dec = PyDMSpinbox(self, self.dev_pref + ':PHTRK_DECIM') sb_dec.showStepExponent = False ld_rate = QLabel('Rate', self) lb_rate = PyDMLabel(self, self.dev_pref + ':PHTRK_RATE') lb_rate.showUnits = True ld_bw = QLabel('Bandwidth', self) lb_bw = PyDMLabel(self, self.dev_pref + ':PHTRK_BANDWIDTH') lb_bw.showUnits = True ld_loopctrl = QLabel('Loop Control', self) cb_loopctrl = PyDMStateButton(self, self.dev_pref + ':PHTRK_LOOPCTRL') ld_drv2 = QLabel('Use Drive 2', self) cb_drv2 = PyDMStateButton(self, self.dev_pref + ':DRIVE2_TRACK') ld_mod = QLabel('Modulation', self) cb_mod = PyDMStateButton(self, self.dev_pref + ':PHTRK_MOD') lay_phtrkctrl = QGridLayout() lay_phtrkctrl.addWidget(ld_phtrkctrl, 0, 0, 1, 2) lay_phtrkctrl.addWidget(ld_bunnr, 1, 0) lay_phtrkctrl.addWidget(sb_bunnr, 1, 1) lay_phtrkctrl.addWidget(ld_gain, 2, 0) lay_phtrkctrl.addWidget(sb_gain, 2, 1) lay_phtrkctrl.addWidget(ld_sp, 3, 0) lay_phtrkctrl.addWidget(sb_sp, 3, 1) lay_phtrkctrl.addWidget(ld_range, 4, 0) lay_phtrkctrl.addWidget(sb_range, 4, 1) lay_phtrkctrl.addWidget(ld_dec, 5, 0) lay_phtrkctrl.addWidget(sb_dec, 5, 1) lay_phtrkctrl.addWidget(ld_rate, 6, 0) lay_phtrkctrl.addWidget(lb_rate, 6, 1) lay_phtrkctrl.addWidget(ld_bw, 7, 0) lay_phtrkctrl.addWidget(lb_bw, 7, 1) lay_phtrkctrl.addWidget(ld_loopctrl, 8, 0) lay_phtrkctrl.addWidget(cb_loopctrl, 8, 1) lay_phtrkctrl.addWidget(ld_drv2, 9, 0) lay_phtrkctrl.addWidget(cb_drv2, 9, 1) lay_phtrkctrl.addWidget(ld_mod, 10, 0) lay_phtrkctrl.addWidget(cb_mod, 10, 1) ld_phtrkdata = QLabel('<h4>Data</h4>', self, alignment=Qt.AlignCenter) ld_mag = QLabel('Magnitude', self) lb_mag = PyDMLabel(self, self.dev_pref + ':PHTRK_MAG') lb_mag.showUnits = True ld_trgain = QLabel('Transfer Gain', self) lb_trgain = PyDMLabel(self, self.dev_pref + ':PHTRK_TFGAIN') lb_trgain.showUnits = True ld_nshift = QLabel('Normalizing Shift', self) lb_nshift = PyDMLabel(self, self.dev_pref + ':PHTRK_SHIFT') ld_phase = QLabel('Phase', self) lb_phase = PyDMLabel(self, self.dev_pref + ':PHTRK_PHASE') lb_phase.showUnits = True ld_error = QLabel('Error', self) lb_error = PyDMLabel(self, self.dev_pref + ':PHTRK_ERROR') lb_error.showUnits = True ld_trfreq = QLabel('Tracking Frequency', self) lb_trfreq = PyDMLabel(self, self.dev_pref + ':PHTRK_FREQ0') lb_trfreq.showUnits = True ld_trtune = QLabel('Tracking Tune', self) lb_trtune = PyDMLabel(self, self.dev_pref + ':PHTRK_TUNE') lay_phtrkdata = QGridLayout() lay_phtrkdata.addWidget(ld_phtrkdata, 0, 0, 1, 2) lay_phtrkdata.addWidget(ld_mag, 1, 0) lay_phtrkdata.addWidget(lb_mag, 1, 1) lay_phtrkdata.addWidget(ld_trgain, 2, 0) lay_phtrkdata.addWidget(lb_trgain, 2, 1) lay_phtrkdata.addWidget(ld_nshift, 3, 0) lay_phtrkdata.addWidget(lb_nshift, 3, 1) lay_phtrkdata.addWidget(ld_phase, 4, 0) lay_phtrkdata.addWidget(lb_phase, 4, 1) lay_phtrkdata.addWidget(ld_error, 5, 0) lay_phtrkdata.addWidget(lb_error, 5, 1) lay_phtrkdata.addWidget(ld_trfreq, 6, 0) lay_phtrkdata.addWidget(lb_trfreq, 6, 1) lay_phtrkdata.addWidget(ld_trtune, 7, 0) lay_phtrkdata.addWidget(lb_trtune, 7, 1) gbox_phtrk = QGroupBox('Phase Tracking', self) lay_phtrk = QGridLayout(gbox_phtrk) lay_phtrk.setHorizontalSpacing(20) lay_phtrk.addLayout(lay_phtrkctrl, 0, 0) lay_phtrk.addLayout(lay_phtrkdata, 1, 0) gbox_phtrk.setStyleSheet(""" PyDMLabel{ min-width: 6em; max-width: 6em; }""") wid = QWidget() lay = QGridLayout(wid) lay.addWidget(gbox_dtacq, 0, 0) lay.addWidget(gbox_trig, 1, 0) lay.addWidget(gbox_phtrk, 2, 0) return wid
def _get_config_widget(self, parent): gb_pos = QGroupBox('Image Processing ', parent) meth_sp = PyDMEnumComboBox( gb_pos, init_channel=self._dev+':CalcMethod-Sel') meth_lb = SiriusLabel(gb_pos, init_channel=self._dev+':CalcMethod-Sts') meth_ld = QLabel('Method', gb_pos) nrpt_ld = QLabel('Num. Pts.', gb_pos) nrpt_sp = SiriusSpinbox( gb_pos, init_channel=self._dev+':NrAverages-SP') nrpt_sp.showStepExponent = False rdb = PyDMLabel(gb_pos, init_channel=self._dev+':NrAverages-RB') rdb.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) slsh = QLabel('/', gb_pos, alignment=Qt.AlignCenter) slsh.setStyleSheet('min-width:0.7em; max-width:0.7em;') cnt = PyDMLabel(gb_pos, init_channel=self._dev+':BufferSize-Mon') cnt.setAlignment(Qt.AlignRight | Qt.AlignVCenter) cnt.setToolTip('Current Buffer Size') pbt = PyDMPushButton( gb_pos, init_channel=self._dev+':ResetBuffer-Cmd', pressValue=1) pbt.setToolTip('Reset Buffer') pbt.setIcon(qta.icon('mdi.delete-empty')) pbt.setObjectName('rst') pbt.setStyleSheet( '#rst{min-width:25px; max-width:25px; icon-size:20px;}') nrpt_wd = QWidget(gb_pos) hbl = QHBoxLayout(nrpt_wd) hbl.addWidget(pbt) hbl.addStretch() hbl.addWidget(cnt) hbl.addWidget(slsh) hbl.addWidget(rdb) rsx_sp = SiriusSpinbox(gb_pos, init_channel=self._dev+':ROISizeX-SP') rsx_sp.showStepExponent = False rsx_lb = SiriusLabel(gb_pos, init_channel=self._dev+':ROISizeX-RB') rsx_ld = QLabel('ROI Size X', gb_pos) rsy_sp = SiriusSpinbox(gb_pos, init_channel=self._dev+':ROISizeY-SP') rsy_sp.showStepExponent = False rsy_lb = SiriusLabel(gb_pos, init_channel=self._dev+':ROISizeY-RB') rsy_ld = QLabel('ROI Size Y', gb_pos) ra_bt = PyDMStateButton( gb_pos, init_channel=self._dev+':ROIAutoCenter-Sel') ra_lb = SiriusLabel( gb_pos, init_channel=self._dev+':ROIAutoCenter-Sts') ra_ld = QLabel('Auto Center:', gb_pos) rcx_sp = SiriusSpinbox(gb_pos, init_channel=self._dev+':ROICenterX-SP') rcx_sp.showStepExponent = False rcx_lb = SiriusLabel(gb_pos, init_channel=self._dev+':ROICenterX-RB') rcx_ld = QLabel('ROI Center X', gb_pos) rcy_sp = SiriusSpinbox(gb_pos, init_channel=self._dev+':ROICenterY-SP') rcy_sp.showStepExponent = False rcy_lb = SiriusLabel(gb_pos, init_channel=self._dev+':ROICenterY-RB') rcy_ld = QLabel('ROI Center Y', gb_pos) sts_bt = QPushButton(qta.icon('fa5s.ellipsis-h'), '', gb_pos) sts_bt.setToolTip('Open Detailed Configs') sts_bt.setObjectName('sts') sts_bt.setStyleSheet( '#sts{min-width:25px; max-width:25px; icon-size:20px;}') Window = create_window_from_widget( _DetailedWidget, title='Image Processing Detailed Configs') connect_window( sts_bt, Window, gb_pos, device=self._dev, convertion_set=self._conv_set) hlay = QHBoxLayout() hlay.addWidget(sts_bt, alignment=Qt.AlignRight) lay = QGridLayout(gb_pos) if self._ori == 'V': lay.addWidget(meth_ld, 0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(meth_sp, 0, 1) lay.addWidget(meth_lb, 1, 1) lay.addWidget(nrpt_ld, 2, 0, alignment=Qt.AlignLeft) lay.addWidget(nrpt_sp, 2, 1) lay.addWidget(nrpt_wd, 3, 0, 1, 2) lay.addWidget(rsx_ld, 4+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rsx_sp, 4+0, 1) lay.addWidget(rsx_lb, 4+1, 1) lay.addWidget(rsy_ld, 6+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rsy_sp, 6+0, 1) lay.addWidget(rsy_lb, 6+1, 1) lay.addWidget(sts_bt, 0, 0+4, alignment=Qt.AlignRight) lay.addWidget(ra_ld, 2+0, 0+3, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(ra_bt, 2+0, 1+3) lay.addWidget(ra_lb, 2+1, 1+3, alignment=Qt.AlignLeft) lay.addWidget(rcx_ld, 4+0, 0+3, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rcx_sp, 4+0, 1+3) lay.addWidget(rcx_lb, 4+1, 1+3) lay.addWidget(rcy_ld, 6+0, 0+3, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rcy_sp, 6+0, 1+3) lay.addWidget(rcy_lb, 6+1, 1+3) else: lay.addWidget(meth_ld, 0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(meth_sp, 0, 1) lay.addWidget(meth_lb, 1, 1) lay.addWidget(nrpt_ld, 2, 0, alignment=Qt.AlignLeft) lay.addWidget(nrpt_sp, 2, 1) lay.addWidget(nrpt_wd, 3, 0, 1, 2) lay.addWidget(rsx_ld, 4+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rsx_sp, 4+0, 1) lay.addWidget(rsx_lb, 4+1, 1) lay.addWidget(rsy_ld, 6+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rsy_sp, 6+0, 1) lay.addWidget(rsy_lb, 6+1, 1) lay.addWidget(ra_ld, 8+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(ra_bt, 8+0, 1) lay.addWidget(ra_lb, 8+1, 1, alignment=Qt.AlignLeft) lay.addWidget(rcx_ld, 10+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rcx_sp, 10+0, 1) lay.addWidget(rcx_lb, 10+1, 1) lay.addWidget(rcy_ld, 12+0, 0, 2, 1, alignment=Qt.AlignLeft) lay.addWidget(rcy_sp, 12+0, 1) lay.addWidget(rcy_lb, 12+1, 1) lay.addWidget(sts_bt, 14, 0, alignment=Qt.AlignLeft) lay.setRowStretch(15, 5) return gb_pos
def __init__(self, *, path, top, parent, variable): QTreeWidgetItem.__init__(self, parent) self._top = top self._parent = parent self._var = variable self._path = path self._depth = parent._depth + 1 w = PyDMLabel(parent=None, init_channel=self._path + '/name') w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fm = QFontMetrics(w.font()) width = int(fm.width(self._path.split('.')[-1]) * 1.1) rightEdge = width + (self._top._tree.indentation() * self._depth) if rightEdge > self._top._colWidths[0]: self._top._colWidths[0] = rightEdge self._top._tree.setItemWidget(self, 0, w) self.setToolTip(0, self._var.description) self.setText(1, self._var.mode) self.setText(2, self._var.typeStr) self.setToolTip(0, self._var.description) if self._var.isCommand and not self._var.arg: w = PyDMPushButton(label='Exec', pressValue=1, init_channel=self._path + '/disp') elif self._var.disp == 'enum' and self._var.enum is not None and ( self._var.mode != 'RO' or self._var.isCommand) and self._var.typeStr != 'list': w = PyDMEnumComboBox(parent=None, init_channel=self._path) w.alarmSensitiveContent = False w.alarmSensitiveBorder = True w.installEventFilter(self._top) elif self._var.minimum is not None and self._var.maximum is not None and self._var.disp == '{}' and ( self._var.mode != 'RO' or self._var.isCommand): w = PyDMSpinbox(parent=None, init_channel=self._path) w.precision = 0 w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = True w.showStepExponent = False w.writeOnPress = True w.installEventFilter(self._top) elif self._var.mode == 'RO' and not self._var.isCommand: w = PyDMLabel(parent=None, init_channel=self._path + '/disp') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = True else: w = PyRogueLineEdit(parent=None, init_channel=self._path + '/disp') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = True #w.displayFormat = 'String' if self._var.isCommand: self._top._tree.setItemWidget(self, 4, w) width = fm.width('0xAAAAAAAA ') if width > self._top._colWidths[4]: self._top._colWidths[4] = width else: self._top._tree.setItemWidget(self, 3, w) width = fm.width('0xAAAAAAAA ') if width > self._top._colWidths[3]: self._top._colWidths[3] = width if self._var.units: self.setText(5, str(self._var.units))
def _measLayout(self): # Acquisition lbl_acq = QLabel('Acquisition', self) self.bt_acq = PyDMStateButton( self, self.device.substitute(propty='SpecAnaGetSpec-Sel')) self.bt_acq.shape = 1 self.led_acq = SiriusLedState( self, self.device.substitute(propty='SpecAnaGetSpec-Sts')) hbox_acq = QHBoxLayout() hbox_acq.addWidget(self.bt_acq) hbox_acq.addWidget(self.led_acq) # Excitation lbl_drive = QLabel('Excitation', self) self.bt_drive = PyDMStateButton( self, self.device.substitute(propty='Enbl-Sel')) self.bt_drive.shape = 1 value = 0b111 if self.section == 'BO' else 1 self.led_drive = PyDMLedMultiChannel( parent=self, channels2values={self.device.substitute(propty='Enbl-Sts'): value}) self.led_drive.setOffColor(PyDMLed.DarkGreen) hbox_drive = QHBoxLayout() hbox_drive.addWidget(self.bt_drive) hbox_drive.addWidget(self.led_drive) # Excitation Status Detailed gbox_enblsts = QGridLayout() lbl_enblsts = QLabel('Excitation\nEnable Status\nDetailed', self, alignment=Qt.AlignVCenter | Qt.AlignRight) if self.section == 'BO': # # Carrier Generator self.led_carrier = SiriusLedState( self, self.device.substitute(propty='EnblCarrierGen-Sts')) gbox_enblsts.addWidget(self.led_carrier, 0, 0) gbox_enblsts.addWidget(QLabel('Carrier Generator'), 0, 1) # # Noise Generator self.led_noise = SiriusLedState( self, self.device.substitute(propty='EnblNoiseGen-Sts')) gbox_enblsts.addWidget(self.led_noise, 1, 0) gbox_enblsts.addWidget(QLabel('Noise Generator'), 1, 1) else: # # Noise Generator self.led_trkgen = SiriusLedState( self, self.device.substitute(propty='SpecAnaTrkGen-Sts')) gbox_enblsts.addWidget(self.led_trkgen, 1, 0) gbox_enblsts.addWidget(QLabel('Tracking Generator'), 1, 1) # # Amplifier self.led_amp = SiriusLedState( self, self.device.substitute(propty='EnblAmp-Sts')) gbox_enblsts.addWidget(self.led_amp, 2, 0) gbox_enblsts.addWidget(QLabel('Amplifier'), 2, 1) if self.section == 'BO': # Frame Count lbl_acqcnt = QLabel('Frame Count', self) dev = self.device.substitute(dev='TuneProc') self.lb_acqcnt = PyDMLabel(self, dev.substitute(propty='FrameCount-Mon')) self.lb_acqcnt.setAlignment(Qt.AlignCenter) self.led_acqcnt = PyDMLedMultiChannel(parent=self) self.trigNrPulseChannel = SiriusConnectionSignal( self.trigger.substitute(prefix=self.prefix, propty='NrPulses-RB')) self.trigNrPulseChannel.new_value_signal[int].connect( self._updateNrAcq) hbox_acqcnt = QHBoxLayout() hbox_acqcnt.addWidget(self.lb_acqcnt) hbox_acqcnt.addWidget(self.led_acqcnt) # Nr. Samples p/ spec lbl_nrsmp = QLabel('Nr. Samples p/ Spec.', self) self.lb_nrsmp = PyDMLabel(parent=self, init_channel=self.device.substitute( dev='TuneProc', propty_name='SwePts', propty_suffix='RB')) if self.section == 'SI': # Acquisition Time lbl_acqtime = QLabel('Acq. Time', self) self.cb_acqtime = PyDMEnumComboBox( parent=self, init_channel=self.device.substitute(dev='TuneProc', propty_name='Trace', propty_suffix='Mon', field='SCAN')) # Sweep time lbl_swetime = QLabel('Sweep Time [ms]', self) self.lb_swetime = PyDMLabel(parent=self, init_channel=self.device.substitute( dev='TuneProc', propty_name='SweTime', propty_suffix='Mon')) # Span lbl_span = QLabel('Span [kHz]', self) self.le_span = PyDMLineEdit(self, self.device.substitute(propty='Span-SP')) self.le_span.precisionFromPV = True self.lb_span = PyDMLabel(self, self.device.substitute(propty='Span-RB')) hbox_span = QHBoxLayout() hbox_span.addWidget(self.le_span) hbox_span.addWidget(self.lb_span) # RBW lbl_rbw = QLabel('RBW', self) if self.section == 'BO': self.cb_rbw = PyDMEnumComboBox( self, self.device.substitute(propty='SpecAnaRBW-Sel')) else: items = [ '1 Hz', '2 Hz', '3 Hz', '5 Hz', '10 Hz', '20 Hz', '30 Hz', '50 Hz', '100 Hz', '200 Hz', '300 Hz', '500 Hz', '1 kHz', '2 kHz', '3 kHz', '5 kHz', '6.25 kHz', '10 kHz', '20 kHz', '30 kHz', '50 kHz', '100 kHz', '200 kHz', '300 kHz', '500 kHz', '1 MHz', '2 MHz', '3 MHz', '5 MHz', '10 MHz' ] self.cb_rbw = SiriusStringComboBox( self, self.device.substitute(propty='SpecAnaRBW-Sel'), items=items) self.lb_rbw = PyDMLabel( self, self.device.substitute(propty='SpecAnaRBW-Sts')) hbox_rbw = QHBoxLayout() hbox_rbw.addWidget(self.cb_rbw) hbox_rbw.addWidget(self.lb_rbw) # Harmonic lbl_h = QLabel('Harmonic (n)', self) self.sb_h = PyDMSpinbox(self, self.device.substitute(propty='RevN-SP')) self.sb_h.showStepExponent = False self.sb_h.precisionFromPV = True self.lb_h = PyDMLabel(self, self.device.substitute(propty='RevN-RB')) hbox_h = QHBoxLayout() hbox_h.addWidget(self.sb_h) hbox_h.addWidget(self.lb_h) # Harmonic Frequency lbl_Fh = QLabel('Harm. Freq. [kHz]', self) self.lb_Fh = PyDMLabel(parent=self) self.lb_Fh.setToolTip('Frf/(h*n)') self.lb_Fh.channel = self.device.substitute(propty='FreqRevN-Mon') # Frequency Offset lbl_foff = QLabel('Frequency Offset [kHz]', self) self.sb_foff = PyDMSpinbox(self, self.device.substitute(propty='FreqOff-SP')) self.sb_foff.showStepExponent = False self.sb_foff.precisionFromPV = True self.lb_foff = PyDMLabel(self, self.device.substitute(propty='FreqOff-RB')) hbox_foff = QHBoxLayout() hbox_foff.addWidget(self.sb_foff) hbox_foff.addWidget(self.lb_foff) # Center Frequency lbl_Fc = QLabel('Center Frequency [MHz]', self) self.le_Fc = PyDMLineEdit( self, self.device.substitute(propty='CenterFreq-SP')) self.le_Fc.precisionFromPV = True self.lb_Fc = PyDMLabel(self, self.device.substitute(propty='CenterFreq-RB')) hbox_Fc = QHBoxLayout() hbox_Fc.addWidget(self.le_Fc) hbox_Fc.addWidget(self.lb_Fc) # Lock Center Freq. lbl_autoFc = QLabel('Lock Center Frequency ', self) self.bt_autoFc = PyDMStateButton( self, self.device.substitute(propty='CenterFreqAuto-Sel')) self.bt_autoFc.shape = 1 self.led_autoFc = SiriusLedState( self, self.device.substitute(propty='CenterFreqAuto-Sts')) hbox_autoFc = QHBoxLayout() hbox_autoFc.addWidget(self.bt_autoFc) hbox_autoFc.addWidget(self.led_autoFc) # Amplifier Gain lbl_drivegain = QLabel('Amplifier Gain [dB]', self) self.sb_drivegain = PyDMSpinbox( self, self.device.substitute(propty='AmpGain-SP')) self.sb_drivegain.showStepExponent = False self.sb_drivegain.precisionFromPV = True self.lb_drivegain = PyDMLabel( self, self.device.substitute(propty='AmpGain-RB')) hbox_drivegain = QHBoxLayout() hbox_drivegain.addWidget(self.sb_drivegain) hbox_drivegain.addWidget(self.lb_drivegain) if self.section == 'BO': # Auto Configure Excitation lbl_driveauto = QLabel('Auto Config. Excit.', self) self.bt_driveauto = PyDMStateButton( self, self.device.substitute(propty='DriveAuto-Sel')) self.bt_driveauto.shape = 1 self.led_driveauto = SiriusLedState( self, self.device.substitute(propty='DriveAuto-Sts')) hbox_driveauto = QHBoxLayout() hbox_driveauto.addWidget(self.bt_driveauto) hbox_driveauto.addWidget(self.led_driveauto) # Noise Amplitude lbl_noiseamp = QLabel('Noise Amplitude [V]', self) self.sb_noiseamp = PyDMSpinbox( self, self.device.substitute(propty='NoiseAmpl-SP')) self.sb_noiseamp.showStepExponent = False self.sb_noiseamp.precisionFromPV = True self.lb_noiseamp = PyDMLabel( self, self.device.substitute(propty='NoiseAmpl-RB')) hbox_noiseamp = QHBoxLayout() hbox_noiseamp.addWidget(self.sb_noiseamp) hbox_noiseamp.addWidget(self.lb_noiseamp) else: # Noise Amplitude lbl_trkgenlvl = QLabel('Trk. Gen. Power [dBm]', self) self.sb_trkgenlvl = PyDMLineEdit( self, self.device.substitute(propty='SpecAnaTrkGenLvl-SP')) self.lb_trkgenlvl = PyDMLabel( self, self.device.substitute(propty='SpecAnaTrkGenLvl-RB')) hbox_trkgenlvl = QHBoxLayout() hbox_trkgenlvl.addWidget(self.sb_trkgenlvl) hbox_trkgenlvl.addWidget(self.lb_trkgenlvl) # Spectrum Acquisition lbl_getspec = QLabel('Spectrum Acq.', self) self.cb_getspec = PyDMStateButton( parent=self, init_channel=self.device.substitute(dev='TuneProc', propty_name='GetSpectrum', propty_suffix='Sel')) self.cb_getspec.shape = 1 self.lb_getspec = PyDMLed(parent=self, init_channel=self.device.substitute( dev='TuneProc', propty_name='GetSpectrum', propty_suffix='Sts')) hbox_getspec = QHBoxLayout() hbox_getspec.addWidget(self.cb_getspec) hbox_getspec.addWidget(self.lb_getspec) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_acq, hbox_acq) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_drive, hbox_drive) lay.addRow(lbl_enblsts, gbox_enblsts) if self.section == 'BO': lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_acqcnt, hbox_acqcnt) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_nrsmp, self.lb_nrsmp) if self.section == 'SI': lay.addRow(lbl_acqtime, self.cb_acqtime) lay.addRow(lbl_swetime, self.lb_swetime) lay.addRow(lbl_span, hbox_span) lay.addRow(lbl_rbw, hbox_rbw) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_h, hbox_h) lay.addRow(lbl_Fh, self.lb_Fh) lay.addRow(lbl_foff, hbox_foff) lay.addRow(lbl_Fc, hbox_Fc) lay.addRow(lbl_autoFc, hbox_autoFc) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_drivegain, hbox_drivegain) if self.section == 'BO': lay.addRow(lbl_driveauto, hbox_driveauto) lay.addRow(lbl_noiseamp, hbox_noiseamp) else: lay.addRow(lbl_trkgenlvl, hbox_trkgenlvl) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_getspec, hbox_getspec) return lay
def _setupLifetimeSettigsWidget(self): self._ld_calcmode = QLabel('Calc Mode:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._cb_calcmode = PyDMEnumComboBox( self, self.devname.substitute(propty='LtFitMode-Sel')) self._lb_calcmode = SiriusLabel( self, self.devname.substitute(propty='LtFitMode-Sts')) self._lb_calcmode.setAlignment(Qt.AlignCenter) self._ld_curroffset = QLabel('Current\nOffset [mA]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._sb_curroffset = SiriusSpinbox( self, self.devname.substitute(propty='CurrOffset-SP')) self._sb_curroffset.showStepExponent = False self._lb_curroffset = PyDMLabel( self, self.devname.substitute(propty='CurrOffset-RB')) self._lb_curroffset.setAlignment(Qt.AlignCenter) self._ld_buffer = QLabel('<h4>Buffer</h4>', self, alignment=Qt.AlignCenter) self._pb_plussett = QPushButton('+', self) self._pb_plussett.setStyleSheet('max-height:0.9em; max-width:0.9em;') self._pb_plussett.released.connect(self._handle_intvl_sett_visibility) self._ld_maxintvl = QLabel('Max. Sampling\nInterval [s]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._ld_maxintvl.setToolTip( "Timestamp settings use 2 parameters to define the\n" "timestamp interval.\n\n" "If 'Max. Sampling Interval' == -1:\n" " use 'Last Time' and 'First Time' parameters.\n" "Else:\n" " use 'Max. Sampling Interval' and last timestamp set.\n\n" "Default: use 'Max. Sampling Interval' and 'Last Time'.") hlay_maxintvl = QHBoxLayout() hlay_maxintvl.addWidget(self._pb_plussett) hlay_maxintvl.addWidget(self._ld_maxintvl) self._sb_maxintvl = PyDMSpinbox( self, self.devname.substitute(propty='MaxSplIntvl-SP')) self._sb_maxintvl.precisionFromPV = True self._sb_maxintvl.showStepExponent = False self._lb_maxintvl = PyDMLabel( self, self.devname.substitute(propty='MaxSplIntvl-RB')) self._lb_maxintvl.setAlignment(Qt.AlignCenter) self._lb_maxintvl.precisionFromPV = True self._ld_firstsmpl = QLabel('First Time [s]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._ld_firstsmpl.setVisible(False) self._le_firstsmpl = PyDMLineEdit( self, self.devname.substitute(propty='FrstSplTime-SP')) self._le_firstsmpl.setVisible(False) self._lb_firstsmpl_dcct = PyDMLabel( self, self.devname.substitute(propty='FrstSplTime-RB')) self._lb_firstsmpl_dcct.setVisible(False) self._lb_firstsmpl_bpm = PyDMLabel( self, self.devname.substitute(propty='FrstSplTimeBPM-RB')) self._lb_firstsmpl_bpm.setVisible(False) self._pb_firstnow = QPushButton(qta.icon('mdi.clock-end'), '', self) self._pb_firstnow.setObjectName('firstnow') self._pb_firstnow.setStyleSheet( '#firstnow{min-width:25px; max-width:25px; icon-size:20px;}') self._pb_firstnow.setToolTip('Click to set current timestamp') self._pb_firstnow.released.connect(self._update_first_time) self._pb_firstnow.setVisible(False) hbox_sp_first = QHBoxLayout() hbox_sp_first.addWidget(self._le_firstsmpl) hbox_sp_first.addWidget(self._pb_firstnow) self._ld_lastsmpl = QLabel('Last Time [s]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._ld_lastsmpl.setToolTip( "If 'Last Time' == -1, use current timestamp.") self._ld_lastsmpl.setVisible(False) self._le_lastsmpl = PyDMLineEdit( self, self.devname.substitute(propty='LastSplTime-SP')) self._le_lastsmpl.setVisible(False) self._lb_lastsmpl_dcct = PyDMLabel( self, self.devname.substitute(propty='LastSplTime-RB')) self._lb_lastsmpl_dcct.setVisible(False) self._lb_lastsmpl_bpm = PyDMLabel( self, self.devname.substitute(propty='LastSplTimeBPM-RB')) self._lb_lastsmpl_bpm.setVisible(False) self._pb_lastnow = QPushButton(qta.icon('mdi.clock-end'), '', self) self._pb_lastnow.setObjectName('lastnow') self._pb_lastnow.setStyleSheet( '#lastnow{min-width:25px; max-width:25px; icon-size:20px;}') self._pb_lastnow.setToolTip('Click to set current timestamp') self._pb_lastnow.released.connect(self._update_last_time) self._pb_lastnow.setVisible(False) hbox_sp_last = QHBoxLayout() hbox_sp_last.addWidget(self._le_lastsmpl) hbox_sp_last.addWidget(self._pb_lastnow) self._ld_smplintvl = QLabel('Samples\nInterval [s]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._lb_smplintvl_dcct = PyDMLabel( self, self.devname.substitute(propty='SplIntvl-Mon')) self._lb_smplintvl_bpm = PyDMLabel( self, self.devname.substitute(propty='SplIntvlBPM-Mon')) self._lb_smplintvl_bpm.setVisible(False) self._ld_intvlbtwspl = QLabel('Interval Between\nSamples [s]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._sb_intvlbtwspl = PyDMSpinbox( self, self.devname.substitute(propty='MinIntvlBtwSpl-SP')) self._sb_intvlbtwspl.precisionFromPV = True self._sb_intvlbtwspl.showStepExponent = False self._lb_intvlbtwspl = PyDMLabel( self, self.devname.substitute(propty='MinIntvlBtwSpl-RB')) self._lb_intvlbtwspl.setAlignment(Qt.AlignCenter) self._lb_intvlbtwspl.precisionFromPV = True self._ld_bufautoreset = QLabel('Auto Reset:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._cb_bufautoreset = PyDMEnumComboBox( self, self.devname.substitute(propty='BuffAutoRst-Sel')) self._lb_bufautoreset = PyDMLabel( self, self.devname.substitute(propty='BuffAutoRst-Sts')) self._ld_bufdcurr = QLabel('Auto Reset Delta\nCurrent [mA]:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._sb_bufdcurr = PyDMSpinbox( self, self.devname.substitute(propty='BuffAutoRstDCurr-SP')) self._sb_bufdcurr.showStepExponent = False self._lb_bufdcurr = PyDMLabel( self, self.devname.substitute(propty='BuffAutoRstDCurr-RB')) self._ld_bufsize = QLabel('Size:', self, alignment=Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._lb_bufsize_dcct = PyDMLabel( self, self.devname.substitute(propty='BuffSize-Mon')) self._lb_bufsize_dcct.setAlignment(Qt.AlignCenter) self._lb_bufsize_bpm = PyDMLabel( self, self.devname.substitute(propty='BuffSizeBPM-Mon')) self._lb_bufsize_bpm.setAlignment(Qt.AlignCenter) self._lb_bufsize_bpm.setVisible(False) self._pb_bufreset = PyDMPushButton( self, label='', icon=qta.icon('mdi.delete-empty'), pressValue=1, init_channel=self.devname.substitute(propty='BuffRst-Cmd')) self._pb_bufreset.setObjectName('reset') self._pb_bufreset.setStyleSheet( "#reset{min-width:25px; max-width:25px; icon-size:20px;}") self._ld_sep = QLabel('/', self) self._lb_bufsizetot_dcct = PyDMLabel( self, self.devname.substitute(propty='BuffSizeTot-Mon')) self._lb_bufsizetot_dcct.setStyleSheet("min-width:5em; max-width:5em;") self._lb_bufsizetot_dcct.setAlignment(Qt.AlignCenter) self._lb_bufsizetot_dcct.precision = 0 self._lb_bufsizetot_bpm = PyDMLabel( self, self.devname.substitute(propty='BuffSizeTotBPM-Mon')) self._lb_bufsizetot_bpm.setStyleSheet("min-width:5em; max-width:5em;") self._lb_bufsizetot_bpm.setAlignment(Qt.AlignCenter) self._lb_bufsizetot_bpm.precision = 0 self._lb_bufsizetot_bpm.setVisible(False) glay_bufsize = QGridLayout() glay_bufsize.addWidget(self._lb_bufsize_dcct, 0, 0) glay_bufsize.addWidget(self._lb_bufsize_bpm, 0, 0) glay_bufsize.addWidget(self._pb_bufreset, 0, 1) glay_bufsize.addWidget(self._ld_sep, 0, 2) glay_bufsize.addWidget(self._lb_bufsizetot_dcct, 0, 3) glay_bufsize.addWidget(self._lb_bufsizetot_bpm, 0, 3) glay_bufsize.setColumnStretch(0, 5) glay_bufsize.setColumnStretch(1, 2) glay_bufsize.setColumnStretch(2, 1) glay_bufsize.setColumnStretch(3, 5) gbox = QGroupBox('Lifetime Settings', self) lay = QGridLayout(gbox) lay.addWidget(self._ld_calcmode, 0, 0) lay.addWidget(self._cb_calcmode, 0, 1) lay.addWidget(self._lb_calcmode, 0, 2) lay.addWidget(self._ld_curroffset, 1, 0) lay.addWidget(self._sb_curroffset, 1, 1) lay.addWidget(self._lb_curroffset, 1, 2) lay.addItem(QSpacerItem(1, 1, QSzPlcy.Expanding, QSzPlcy.Minimum), 2, 1) lay.addWidget(self._ld_buffer, 3, 0, 1, 3) lay.addLayout(hlay_maxintvl, 4, 0) lay.addWidget(self._sb_maxintvl, 4, 1) lay.addWidget(self._lb_maxintvl, 4, 2) lay.addWidget(self._ld_firstsmpl, 5, 0) lay.addLayout(hbox_sp_first, 5, 1, 1, 2) lay.addWidget(self._lb_firstsmpl_dcct, 6, 1, 1, 2) lay.addWidget(self._lb_firstsmpl_bpm, 6, 1, 1, 2) lay.addWidget(self._ld_lastsmpl, 7, 0) lay.addLayout(hbox_sp_last, 7, 1, 1, 2) lay.addWidget(self._lb_lastsmpl_dcct, 8, 1, 1, 2) lay.addWidget(self._lb_lastsmpl_bpm, 8, 1, 1, 2) lay.addWidget(self._ld_smplintvl, 9, 0) lay.addWidget(self._lb_smplintvl_dcct, 9, 1) lay.addWidget(self._lb_smplintvl_bpm, 9, 1) lay.addWidget(self._ld_intvlbtwspl, 10, 0) lay.addWidget(self._sb_intvlbtwspl, 10, 1) lay.addWidget(self._lb_intvlbtwspl, 10, 2) lay.addItem(QSpacerItem(20, 5, QSzPlcy.Minimum, QSzPlcy.Fixed), 11, 1) lay.addWidget(self._ld_bufautoreset, 12, 0) lay.addWidget(self._cb_bufautoreset, 12, 1) lay.addWidget(self._lb_bufautoreset, 12, 2) lay.addWidget(self._ld_bufdcurr, 13, 0) lay.addWidget(self._sb_bufdcurr, 13, 1) lay.addWidget(self._lb_bufdcurr, 13, 2) lay.addItem(QSpacerItem(20, 5, QSzPlcy.Minimum, QSzPlcy.Fixed), 14, 1) lay.addWidget(self._ld_bufsize, 15, 0) lay.addLayout(glay_bufsize, 15, 1, 1, 2) return gbox
def _setupGeneralSettingsWidget(self): gbox_generalsettings = QGroupBox('General Measurement Settings', self) l_enbl = QLabel('Enable:', self) self.pydmstatebutton_Enbl = PyDMStateButton( self, self.dcct_prefix.substitute(propty='Enbl-Sel')) self.pydmstatebutton_Enbl.shape = 1 self.led_Enbl = SiriusLedState( self, self.dcct_prefix.substitute(propty='Enbl-Sts')) hlay_enbl = QHBoxLayout() hlay_enbl.addWidget(self.pydmstatebutton_Enbl) hlay_enbl.addWidget(self.led_Enbl) l_meastrig = QLabel('Trigger Source: ', self) self.pydmenumcombobox_MeasTrg = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='MeasTrg-Sel')) self.pydmlabel_MeasTrg = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasTrg-Sts')) hlay_meastrig = QHBoxLayout() hlay_meastrig.addWidget(self.pydmenumcombobox_MeasTrg) hlay_meastrig.addWidget(self.pydmlabel_MeasTrg) l_trigmiss = QLabel('Trigger Is Missing?', self) self.led_TrgMiss = SiriusLedAlert( self, self.dcct_prefix.substitute(propty='TrgIsMissing-Mon')) hlay_trigmiss = QHBoxLayout() hlay_trigmiss.addWidget(self.led_TrgMiss) hlay_trigmiss.setAlignment(Qt.AlignLeft) l_range = QLabel('Range: ', self) self.pydmenumcombobox_Range = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='Range-Sel')) self.pydmlabel_Range = PyDMLabel( self, self.dcct_prefix.substitute(propty='Range-Sts')) hlay_range = QHBoxLayout() hlay_range.addWidget(self.pydmenumcombobox_Range) hlay_range.addWidget(self.pydmlabel_Range) l_lowlimenbl = QLabel('Low Beam Current Detection: ', self) self.pydmstatebutton_LowLimEnbl = PyDMStateButton( self, self.dcct_prefix.substitute(propty='LowLimEnbl-Sel')) self.pydmstatebutton_LowLimEnbl.shape = 1 self.pydmlabel_LowLimEnbl = PyDMLabel( self, self.dcct_prefix.substitute(propty='LowLimEnbl-Sts')) hlay_lowlimenbl = QHBoxLayout() hlay_lowlimenbl.addWidget(self.pydmstatebutton_LowLimEnbl) hlay_lowlimenbl.addWidget(self.pydmlabel_LowLimEnbl) l_currthold = QLabel('Current Threshold [mA]: ', self) self.pydmspinbox_CurrThold = PyDMSpinbox( self, self.dcct_prefix.substitute(propty='CurrThold-SP')) self.pydmspinbox_CurrThold.showStepExponent = False self.pydmlabel_CurrThold = PyDMLabel( self, self.dcct_prefix.substitute(propty='CurrThold-RB')) hlay_currthold = QHBoxLayout() hlay_currthold.addWidget(self.pydmspinbox_CurrThold) hlay_currthold.addWidget(self.pydmlabel_CurrThold) l_hfreject = QLabel('High Frequency Rejection: ', self) self.pydmstatebutton_HFReject = PyDMStateButton( self, self.dcct_prefix.substitute(propty='HFReject-Sel')) self.pydmstatebutton_HFReject.shape = 1 self.pydmlabel_HFReject = PyDMLabel( self, self.dcct_prefix.substitute(propty='HFReject-Sts')) hlay_hfreject = QHBoxLayout() hlay_hfreject.addWidget(self.pydmstatebutton_HFReject) hlay_hfreject.addWidget(self.pydmlabel_HFReject) l_measmode = QLabel('Mode: ', self) self.pydmenumcombobox_MeasMode = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='MeasMode-Sel')) self.pydmlabel_MeasMode = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasMode-Sts')) hlay_measmode = QHBoxLayout() hlay_measmode.addWidget(self.pydmenumcombobox_MeasMode) hlay_measmode.addWidget(self.pydmlabel_MeasMode) flay_generalsettings = QFormLayout() flay_generalsettings.setLabelAlignment(Qt.AlignRight) flay_generalsettings.setFormAlignment(Qt.AlignCenter) flay_generalsettings.addRow(l_enbl, hlay_enbl) flay_generalsettings.addRow(l_meastrig, hlay_meastrig) flay_generalsettings.addRow(l_trigmiss, hlay_trigmiss) flay_generalsettings.addRow(l_range, hlay_range) flay_generalsettings.addItem( QSpacerItem(1, 10, QSzPly.Ignored, QSzPly.Preferred)) flay_generalsettings.addRow(l_lowlimenbl, hlay_lowlimenbl) flay_generalsettings.addRow(l_currthold, hlay_currthold) flay_generalsettings.addRow(l_hfreject, hlay_hfreject) flay_generalsettings.addItem( QSpacerItem(1, 10, QSzPly.Ignored, QSzPly.Preferred)) flay_generalsettings.addRow(l_measmode, hlay_measmode) gbox_generalsettings.setLayout(flay_generalsettings) return gbox_generalsettings