class SummaryWidget(QWidget): """General widget for controlling a power supply.""" def __init__(self, name, visible_props, parent=None): """Build UI with dclink name.""" super().__init__(parent) self._name = PVName(name) self._psmodel = PSSearch.conv_psname_2_psmodel(name) self._pstype = PSSearch.conv_psname_2_pstype(name) self.visible_props = sort_propties(visible_props) self.filled_widgets = set() self._prefixed_name = self._name.substitute(prefix=VACA_PREFIX) self._analog_name = get_analog_name(self._name) self._strength_name = get_strength_name(self._name) self._is_pulsed = IsPulsed.match(self._name) self._is_linac = IsLinac.match(self._name) self._li_has_not_strength = LIQuadHasNotStrength.match(self._name) self._is_fofb = FastCorrector.match(self._name) self._is_dclink = IsDCLink.match(self._name) self._is_regatron = self._psmodel == 'REGATRON_DCLink' self._is_reg_slave = self._pstype == 'as-dclink-regatron-slave' self._bbb_name = '' self._udc_name = '' if not self._is_pulsed and not self._is_linac and \ not self._is_regatron and not self._is_fofb: self._bbb_name = PSSearch.conv_psname_2_bbbname(self._name) self._udc_name = PSSearch.conv_psname_2_udc(self._name) self._has_opmode = not self._is_linac and not self._is_pulsed\ and not self._is_fofb self._has_ctrlmode = not self._is_regatron and not self._is_linac\ and not self._is_fofb self._has_pwrstate = not self._is_reg_slave self._has_reset = not self._is_linac and not self._is_fofb\ and not self._is_reg_slave self._has_ctrlloop = not self._is_linac and not self._is_pulsed\ and not self._is_regatron self._has_parmupdt = not self._is_linac and not self._is_regatron\ and not self._is_fofb self._has_wfmupdt = self._has_parmupdt and not self._is_dclink self._has_analsp = not self._is_reg_slave self._has_analrb = not self._is_regatron self._has_analmon = not self._is_fofb self._has_strength = bool(self._strength_name and not self._li_has_not_strength) self._has_strength_mon = self._has_strength and not self._is_fofb self._has_trim = HasTrim.match(self._name) self._create_pvs() self._setup_ui() @property def devname(self): """PS name.""" return self._name @property def bbbname(self): """BBB name.""" return self._bbb_name @property def udcname(self): """UDC name.""" return self._udc_name def _setup_ui(self): """Setups widget UI.""" lay = QHBoxLayout() lay.setContentsMargins(0, 0, 0, 0) lay.setSpacing(10) self._widgets_dict = dict() self.detail_wid = self._build_widget(name='detail', orientation='v') self._widgets_dict['detail'] = self.detail_wid lay.addWidget(self.detail_wid) if self._bbb_name: self.bbb_wid = self._build_widget(name='bbb', orientation='v') self._widgets_dict['bbb'] = self.bbb_wid lay.addWidget(self.bbb_wid) if self._udc_name: self.udc_wid = self._build_widget(name='udc', orientation='v') self._widgets_dict['udc'] = self.udc_wid lay.addWidget(self.udc_wid) if self._has_opmode: self.opmode_wid = self._build_widget(name='opmode', orientation='v') self._widgets_dict['opmode'] = self.opmode_wid lay.addWidget(self.opmode_wid) if self._has_ctrlmode: self.ctrlmode_wid = self._build_widget(name='ctrlmode', orientation='v') self._widgets_dict['ctrlmode'] = self.ctrlmode_wid lay.addWidget(self.ctrlmode_wid) self.state_wid = self._build_widget(name='state') self._widgets_dict['state'] = self.state_wid lay.addWidget(self.state_wid) if self._is_pulsed: self.pulse_wid = self._build_widget(name='pulse') self._widgets_dict['pulse'] = self.pulse_wid lay.addWidget(self.pulse_wid) self.intlk_wid = self._build_widget(name='intlk') self._widgets_dict['intlk'] = self.intlk_wid lay.addWidget(self.intlk_wid) if self._is_linac: self.conn_wid = self._build_widget(name='conn') self._widgets_dict['conn'] = self.conn_wid lay.addWidget(self.conn_wid) if self._has_reset: self.reset_wid = self._build_widget(name='reset') self._widgets_dict['reset'] = self.reset_wid lay.addWidget(self.reset_wid) if self._has_ctrlloop: self.ctrlloop_wid = self._build_widget(name='ctrlloop') self._widgets_dict['ctrlloop'] = self.ctrlloop_wid lay.addWidget(self.ctrlloop_wid) if self._has_wfmupdt: self.wfmupdate_wid = self._build_widget(name='wfmupdate') self._widgets_dict['wfmupdate'] = self.wfmupdate_wid lay.addWidget(self.wfmupdate_wid) if self._has_parmupdt: self.updparms_wid = self._build_widget(name='updparms') self._widgets_dict['updparms'] = self.updparms_wid lay.addWidget(self.updparms_wid) self.setpoint_wid = self._build_widget(name='setpoint', orientation='v') self._widgets_dict['setpoint'] = self.setpoint_wid lay.addWidget(self.setpoint_wid) if self._has_analrb: self.readback_wid = self._build_widget(name='readback', orientation='v') self._widgets_dict['readback'] = self.readback_wid lay.addWidget(self.readback_wid) if self._has_analmon: self.monitor_wid = self._build_widget(name='monitor', orientation='v') self._widgets_dict['monitor'] = self.monitor_wid lay.addWidget(self.monitor_wid) if self._has_strength: self.strength_sp_wid = self._build_widget(name='strength_sp', orientation='v') self._widgets_dict['strength_sp'] = self.strength_sp_wid lay.addWidget(self.strength_sp_wid) self.strength_rb_wid = self._build_widget(name='strength_rb', orientation='v') self._widgets_dict['strength_rb'] = self.strength_rb_wid lay.addWidget(self.strength_rb_wid) if self._has_strength_mon: self.strength_mon_wid = self._build_widget(name='strength_mon', orientation='v') self._widgets_dict['strength_mon'] = self.strength_mon_wid lay.addWidget(self.strength_mon_wid) if self._has_trim: self.trim_wid = self._build_widget(name='trim', orientation='v') self._widgets_dict['trim'] = self.trim_wid lay.addWidget(self.trim_wid) _widths = get_prop2width(self._name) for name, widget in self._widgets_dict.items(): width = _widths[name] widget.setStyleSheet('#' + name + '{min-width:' + str(width) + 'em;' 'max-width:' + str(width) + 'em;}') widget.setSizePolicy(QSzPlcy.Fixed, QSzPlcy.Fixed) widget.setVisible(name in self.visible_props) self.setStyleSheet(""" PyDMStateButton{ min-width: 2.5em; max-width: 2.5em; min-height: 1.5em; max-height: 1.5em; } QLed{ min-width: 1.5em; max-width: 1.5em; min-height: 1.5em; max-height: 1.5em; } QLabel{ min-height: 1.5em; max-height: 1.5em; qproperty-alignment: AlignCenter; } """) lay.addStretch() self.setLayout(lay) for prop in self.visible_props: self.fillWidget(prop) def _create_pvs(self): if self._has_opmode: if self._is_reg_slave: self._opmode_sts = self._prefixed_name.substitute( propty='ModState-Mon') elif self._is_regatron: self._opmode_sts = self._prefixed_name.substitute( propty='OpMode-Sts') else: self._opmode_sel = self._prefixed_name.substitute( propty='OpMode-Sel') self._opmode_sts = self._prefixed_name.substitute( propty='OpMode-Sts') if self._has_ctrlmode: self._ctrlmode_sts = self._prefixed_name.substitute( propty='CtrlMode-Mon') if self._has_pwrstate: self._pwrstate_sel = self._prefixed_name.substitute( propty='PwrState-Sel') self._pwrstate_sts = self._prefixed_name.substitute( propty='PwrState-Sts') if self._is_pulsed: self._pulse_sel = self._prefixed_name.substitute( propty='Pulse-Sel') self._pulse_sts = self._prefixed_name.substitute( propty='Pulse-Sts') # interlock if self._is_pulsed: self._intlk = list() for i in range(1, 8): self._intlk.append( self._prefixed_name.substitute(propty='Intlk' + str(i) + '-Mon')) if 'Sept' not in self._name.dev: self._intlk.append( self._prefixed_name.substitute(propty='Intlk8-Mon')) elif self._is_linac: self._intlk = self._prefixed_name.substitute( propty='StatusIntlk-Mon') elif self._is_regatron: if not self._is_reg_slave: self._generr = self._prefixed_name.substitute( propty='GenIntlk-Mon') self._genwrn = self._prefixed_name.substitute( propty='GenWarn-Mon') elif self._is_fofb: self._intlk = [ self._prefixed_name.substitute( propty='PSAmpOverCurrFlagL-Sts'), self._prefixed_name.substitute( propty='PSAmpOverCurrFlagR-Sts'), self._prefixed_name.substitute( propty='PSAmpOverTempFlagL-Sts'), self._prefixed_name.substitute( propty='PSAmpOverTempFlagR-Sts'), ] else: self._soft_intlk = self._prefixed_name.substitute( propty='IntlkSoft-Mon') self._hard_intlk = self._prefixed_name.substitute( propty='IntlkHard-Mon') if self._is_linac: self._conn = self._prefixed_name.substitute(propty='Connected-Mon') if self._has_reset: self._reset_intlk = self._prefixed_name.substitute( propty='Reset-Cmd') if self._has_ctrlloop: self._ctrlloop_sel = self._prefixed_name.substitute( propty='CtrlLoop-Sel') self._ctrlloop_sts = self._prefixed_name.substitute( propty='CtrlLoop-Sts') if self._has_wfmupdt: self._wfmupdate_sel = self._prefixed_name.substitute( propty='WfmUpdateAuto-Sel') self._wfmupdate_sts = self._prefixed_name.substitute( propty='WfmUpdateAuto-Sts') if self._has_parmupdt: self._updparms_cmd = self._prefixed_name.substitute( propty='ParamUpdate-Cmd') # analog control sp = self._analog_name if self._has_analsp: self._analog_sp = self._prefixed_name.substitute( propty='{}-SP'.format(sp)) if self._has_analrb: self._analog_rb = self._prefixed_name.substitute( propty='{}-RB'.format(sp)) if self._has_analmon: if self._is_reg_slave: self._analog_mon = self._prefixed_name.substitute( propty='ModOutVolt-Mon') else: self._analog_mon = self._prefixed_name.substitute( propty='{}-Mon'.format(sp)) # strength if self._has_strength: st = self._strength_name self._strength_sp = self._prefixed_name.substitute( propty='{}-SP'.format(st)) self._strength_rb = self._prefixed_name.substitute( propty='{}-RB'.format(st)) if self._has_strength_mon: self._strength_mon = self._prefixed_name.substitute( propty='{}-Mon'.format(st)) def _build_widget(self, name='', orientation='h'): widget = QWidget(self) widget.setObjectName(name) if orientation == 'h': lay = QHBoxLayout(widget) else: lay = QVBoxLayout(widget) lay.setSpacing(0) lay.setContentsMargins(0, 3, 0, 3) return widget def fillWidget(self, name): if name in self.filled_widgets: return if name == 'detail': self.detail_bt = QPushButton(self) if self._name.dev == 'DCLink': self.detail_bt.setIcon(qta.icon('fa5s.list-ul')) self.detail_bt.setToolTip(self._name) else: self.detail_bt.setText(self._name) self.detail_wid.layout().addWidget(self.detail_bt) elif name == 'bbb' and self._bbb_name: self.bbb_lb = QLabel(self._bbb_name, self) self.bbb_wid.layout().addWidget(self.bbb_lb) elif name == 'udc' and self._udc_name: self.udc_lb = QLabel(self._udc_name, self) self.udc_wid.layout().addWidget(self.udc_lb) elif name == 'opmode' and self._has_opmode: opmode_list = list() if 'Voltage' not in self._analog_name: self.opmode_cb = SiriusEnumComboBox(self, self._opmode_sel) opmode_list.append(self.opmode_cb) self.opmode_lb = PyDMLabel(self, self._opmode_sts) opmode_list.append(self.opmode_lb) for wid in opmode_list: self.opmode_wid.layout().addWidget(wid) elif name == 'ctrlmode' and self._has_ctrlmode: self.ctrlmode_lb = PyDMLabel(self, self._ctrlmode_sts) self.ctrlmode_wid.layout().addWidget(self.ctrlmode_lb) elif name == 'state' and self._has_pwrstate: self.state_bt = PyDMStateButton(self, self._pwrstate_sel) self.state_led = SiriusLedState(self, self._pwrstate_sts) self.state_wid.layout().addWidget(self.state_bt) self.state_wid.layout().addWidget(self.state_led) elif name == 'pulse' and self._is_pulsed: self.pulse_bt = PyDMStateButton(self, self._pulse_sel) self.pulse_led = SiriusLedState(self, self._pulse_sts) self.pulse_wid.layout().addWidget(self.pulse_bt) self.pulse_wid.layout().addWidget(self.pulse_led) elif name == 'intlk': if self._is_pulsed: self.intlk_led = PyDMLedMultiChannel( self, channels2values={ch: 1 for ch in self._intlk}) self.intlk_wid.layout().addWidget(self.intlk_led) elif self._is_linac: if IsLinacSpect.match(self.devname): self.intlk_led = LISpectIntlkLed(self) else: self.intlk_led = PyDMLedMultiChannel(self, channels2values={ self._intlk: { 'value': _PS_LI_INTLK, 'comp': 'lt' } }) self.intlk_wid.layout().addWidget(self.intlk_led) elif self._is_regatron: if not self._is_reg_slave: self.generr_led = SiriusLedAlert(self, self._generr) self.genwrn_led = SiriusLedAlert(self, self._genwrn) self.intlk_wid.layout().addWidget(self.generr_led) self.intlk_wid.layout().addWidget(self.genwrn_led) elif self._is_fofb: self.intlk_led = PyDMLedMultiChannel( self, channels2values={ch: 1 for ch in self._intlk}) self.intlk_wid.layout().addWidget(self.intlk_led) else: self.soft_intlk_led = SiriusLedAlert(self, self._soft_intlk) self.hard_intlk_led = SiriusLedAlert(self, self._hard_intlk) self.intlk_wid.layout().addWidget(self.soft_intlk_led) self.intlk_wid.layout().addWidget(self.hard_intlk_led) elif name == 'conn' and self._is_linac: self.conn_led = PyDMLedMultiChannel( self, channels2values={self._conn: 0}) self.conn_wid.layout().addWidget(self.conn_led) elif name == 'reset' and self._has_reset: self.reset_bt = PyDMPushButton(parent=self, init_channel=self._reset_intlk, pressValue=1) self.reset_bt.setIcon(qta.icon('fa5s.sync')) self.reset_bt.setObjectName('reset_bt') self.reset_bt.setStyleSheet( '#reset_bt{min-width:25px; max-width:25px; icon-size:20px;}') self.reset_wid.layout().addWidget(self.reset_bt) elif name == 'ctrlloop' and self._has_ctrlloop: if self._is_fofb: self.ctrlloop_bt = PyDMStateButton(self, self._ctrlloop_sel) else: self.ctrlloop_bt = PyDMStateButton(self, self._ctrlloop_sel, invert=True) self.ctrlloop_lb = PyDMLabel(self, self._ctrlloop_sts) self.ctrlloop_wid.layout().addWidget(self.ctrlloop_bt) self.ctrlloop_wid.layout().addWidget(self.ctrlloop_lb) elif name == 'wfmupdate' and self._has_wfmupdt: self.wfmupdate_bt = PyDMStateButton(self, self._wfmupdate_sel) self.wfmupdate_led = SiriusLedState(self, self._wfmupdate_sts) self.wfmupdate_wid.layout().addWidget(self.wfmupdate_bt) self.wfmupdate_wid.layout().addWidget(self.wfmupdate_led) elif name == 'updparms' and self._has_parmupdt: self.updparms_bt = PyDMPushButton(parent=self, init_channel=self._updparms_cmd, pressValue=1) self.updparms_bt.setIcon(qta.icon('fa5s.redo-alt')) self.updparms_bt.setObjectName('updparms_bt') self.updparms_bt.setStyleSheet( '#updparms_bt{min-width:25px;max-width:25px;icon-size:20px;}') self.updparms_wid.layout().addWidget(self.updparms_bt) elif name == 'setpoint' and self._has_analsp: self.setpoint = PyDMSpinboxScrollbar(self, self._analog_sp) if self._is_fofb: self.setpoint.spinbox.precisionFromPV = False self.setpoint.spinbox.precision = 6 self.setpoint_wid.layout().addWidget(self.setpoint) elif name == 'readback' and self._has_analrb: self.readback = PyDMLabel(self, self._analog_rb) if self._is_fofb: self.readback.precisionFromPV = False self.readback.precision = 6 self.readback_wid.layout().addWidget(self.readback) elif name == 'monitor' and self._has_analmon: self.monitor = PyDMLabel(self, self._analog_mon) self.monitor_wid.layout().addWidget(self.monitor) elif name == 'strength_sp' and self._has_strength: self.strength_sp_le = PyDMSpinboxScrollbar(self, self._strength_sp) self.strength_sp_wid.layout().addWidget(self.strength_sp_le) elif name == 'strength_rb' and self._has_strength: self.strength_rb_lb = PyDMLabel(parent=self, init_channel=self._strength_rb) self.strength_rb_lb.showUnits = True self.strength_rb_wid.layout().addWidget(self.strength_rb_lb) elif name == 'strength_mon' and self._has_strength_mon: self.strength_mon_lb = PyDMLabel(parent=self, init_channel=self._strength_mon) self.strength_mon_lb.showUnits = True self.strength_mon_wid.layout().addWidget(self.strength_mon_lb) elif name == 'trim' and self._has_trim: self.trim_bt = QPushButton(qta.icon('fa5s.angle-right'), '', self) self.trim_wid.layout().addWidget(self.trim_bt) self.filled_widgets.add(name) def get_detail_button(self): """Return psname button.""" return self.detail_bt def get_trim_button(self): """Return trim button.""" if self._has_trim: return self.trim_bt return None def set_opmode_slowref(self): """Set power supply OpMode to SlowRef.""" if hasattr(self, 'opmode_cb'): if self.opmode_cb.isEnabled(): index = self.opmode_cb.findText('SlowRef') self.opmode_cb.internal_combo_box_activated_int(index) def turn_on(self): """Turn power supply on.""" if hasattr(self, 'state_bt'): if self.state_bt.isEnabled(): if not self.state_bt.value: self.state_bt.send_value() def turn_off(self): """Turn power supply off.""" if hasattr(self, 'state_bt'): if self.state_bt.isEnabled(): if self.state_bt.value: self.state_bt.send_value() def ctrlloop_close(self): """Close control loop.""" if hasattr(self, 'ctrlloop_bt'): if self.ctrlloop_bt.isEnabled(): if not self.ctrlloop_bt.value: self.ctrlloop_bt.send_value() def ctrlloop_open(self): """Open control loop.""" if hasattr(self, 'ctrlloop_bt'): if self.ctrlloop_bt.isEnabled(): if self.ctrlloop_bt.value: self.ctrlloop_bt.send_value() def pulse_on(self): """Turn power supply on.""" if hasattr(self, 'pulse_bt'): if self.pulse_bt.isEnabled(): if not self.pulse_bt.value: self.pulse_bt.send_value() def pulse_off(self): """Turn power supply off.""" if hasattr(self, 'pulse_bt'): if self.pulse_bt.isEnabled(): if self.pulse_bt.value: self.pulse_bt.send_value() def wfmupdate_on(self): """Enable WfmUpdateAuto.""" if hasattr(self, 'wfmupdate_bt'): if self.wfmupdate_bt.isEnabled(): if not self.wfmupdate_bt.value: self.wfmupdate_bt.send_value() def wfmupdate_off(self): """Disable WfmUpdateAuto.""" if hasattr(self, 'wfmupdate_bt'): if self.wfmupdate_bt.isEnabled(): if self.wfmupdate_bt.value: self.wfmupdate_bt.send_value() def reset(self): """Reset power supply.""" if hasattr(self, 'reset_bt'): if self.reset_bt.isEnabled(): self.reset_bt.sendValue() def update_params(self): """Update power supply parameters.""" if hasattr(self, 'updparms_bt'): if self.updparms_bt.isEnabled(): self.updparms_bt.sendValue()
def _setupUi(self): cw = QWidget(self) self.setCentralWidget(cw) lay = QFormLayout(cw) lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) # title self.title_label = QLabel('<h3>' + self.title + '<h3>', self, alignment=Qt.AlignCenter) self.title_label.setObjectName('title') pal = self.title_label.palette() pal.setColor(QPalette.Background, self.background) self.title_label.setAutoFillBackground(True) self.title_label.setPalette(pal) lay.addRow(self.title_label) label_enbl = QLabel('Enable: ', self) self.bt_enbl = PyDMStateButton( self, self.dev.substitute(propty='Enbl' + self.mtyp + 'Mark' + self.idx + '-Sel')) self.bt_enbl.shape = 1 self.led_enbl = SiriusLedState( self, self.dev.substitute(propty='Enbl' + self.mtyp + 'Mark' + self.idx + '-Sts')) hbox_enbl = QHBoxLayout() hbox_enbl.addWidget(self.bt_enbl) hbox_enbl.addWidget(self.led_enbl) lay.addRow(label_enbl, hbox_enbl) label_enblautomax = QLabel('Auto Max Peak: ', self) ch_enblautomax = self.dev.substitute(propty='Enbl' + self.mtyp + 'MaxAuto' + self.idx + '-Sel') self.enblAutoMaxChannel = SiriusConnectionSignal(ch_enblautomax) self.enblAutoMaxChannel.new_value_signal[int].connect( self._handle_values_visibility) self.bt_enblautomax = PyDMStateButton(self, ch_enblautomax) self.bt_enblautomax.shape = 1 self.led_enblautomax = SiriusLedState( self, self.dev.substitute(propty='Enbl' + self.mtyp + 'MaxAuto' + self.idx + '-Sts')) hbox_enblautomax = QHBoxLayout() hbox_enblautomax.addWidget(self.bt_enblautomax) hbox_enblautomax.addWidget(self.led_enblautomax) lay.addRow(label_enblautomax, hbox_enblautomax) label_x = QLabel(' X: ', self) self.sb_x = PyDMLineEdit( self, self.dev.substitute(propty=self.mtyp + 'MarkX' + self.idx + '-SP')) self.lb_x = PyDMLabel( self, self.dev.substitute(propty=self.mtyp + 'MarkX' + self.idx + '-RB')) hbox_x = QHBoxLayout() hbox_x.addWidget(self.sb_x) hbox_x.addWidget(self.lb_x) lay.addRow(label_x, hbox_x) label_y = QLabel(' Y: ', self) self.lb_y = PyDMLabel( self, self.dev.substitute(propty=self.mtyp + 'MarkY' + self.idx + '-Mon')) hbox_y = QHBoxLayout() hbox_y.addWidget(self.lb_y) if self.mtyp == 'D': self.lb_dynamicY = PyDMLabel( self, self.dev.substitute(propty='DynamicDX' + self.idx + '-Mon')) self.lb_dynamicY.setVisible(False) hbox_y.addWidget(self.lb_dynamicY) lay.addRow(label_y, hbox_y) self.pb_max = PyDMPushButton( parent=self, label='Mark Max Peak', pressValue=1, init_channel=self.dev.substitute(propty=self.mtyp + 'MarkMax' + self.idx + '-Cmd')) self.pb_maxnext = PyDMPushButton( parent=self, label='Mark Max Next', pressValue=1, init_channel=self.dev.substitute(propty=self.mtyp + 'MarkMaxNext' + self.idx + '-Cmd')) self.pb_maxright = PyDMPushButton( parent=self, label='Mark Max Right', pressValue=1, init_channel=self.dev.substitute( propty=self.mtyp + 'MarkMaxRight' + self.idx + '-Cmd')) self.pb_maxleft = PyDMPushButton( parent=self, label='Mark Max Left', pressValue=1, init_channel=self.dev.substitute(propty=self.mtyp + 'MarkMaxLeft' + self.idx + '-Cmd')) vbox_cmd = QVBoxLayout() vbox_cmd.addWidget(self.pb_max) vbox_cmd.addWidget(self.pb_maxnext) vbox_cmd.addWidget(self.pb_maxright) vbox_cmd.addWidget(self.pb_maxleft) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(vbox_cmd) if self.mtyp == '' and self.idx == '1': lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) label_enblautomin = QLabel('Enable Auto Min: ', self) self.bt_enblautomin = PyDMStateButton( self, self.dev.substitute(propty='EnblMinAuto-Sel')) self.bt_enblautomin.shape = 1 self.led_enblautomin = SiriusLedState( self, self.dev.substitute(propty='EnblMinAuto-Sts')) hbox_enblautomin = QHBoxLayout() hbox_enblautomin.addWidget(self.bt_enblautomin) hbox_enblautomin.addWidget(self.led_enblautomin) lay.addRow(label_enblautomin, hbox_enblautomin) label_enbllimit = QLabel('Enable Mark Limit: ', self) self.bt_enbllimit = PyDMStateButton( self, self.dev.substitute(propty='EnblMarkLimit-Sel')) self.bt_enbllimit.shape = 1 self.led_enbllimit = SiriusLedState( self, self.dev.substitute(propty='EnblMarkLimit-Sts')) hbox_enbllimit = QHBoxLayout() hbox_enbllimit.addWidget(self.bt_enbllimit) hbox_enbllimit.addWidget(self.led_enbllimit) lay.addRow(label_enbllimit, hbox_enbllimit) label_limright = QLabel('Mark Limit Right: ', self) self.sb_limright = PyDMLineEdit( self, self.dev.substitute(propty='MarkLimitRight-SP')) self.lb_limright = PyDMLabel( self, self.dev.substitute(propty='MarkLimitRight-RB')) hbox_limright = QHBoxLayout() hbox_limright.addWidget(self.sb_limright) hbox_limright.addWidget(self.lb_limright) lay.addRow(label_limright, hbox_limright) label_limleft = QLabel('Mark Limit Left: ', self) self.sb_limleft = PyDMLineEdit( self, self.dev.substitute(propty='MarkLimitLeft-SP')) self.lb_limleft = PyDMLabel( self, self.dev.substitute(propty='MarkLimitLeft-RB')) hbox_limleft = QHBoxLayout() hbox_limleft.addWidget(self.sb_limleft) hbox_limleft.addWidget(self.lb_limleft) lay.addRow(label_limleft, hbox_limleft) self.setStyleSheet(""" QLed{ min-width:1.29em; max-width:1.29em; } #title { min-height:1.29em; max-height:1.29em; qproperty-alignment: "AlignVCenter | AlignHCenter"; } PyDMLabel, PyDMSpinbox, PyDMEnumComboBox, PyDMStateButton{ min-width:6em; max-width:6em; }""")
def _setupUi(self): self._lb_bl = QLabel('<h4>' + self._beamline + '</h4>', self, alignment=Qt.AlignCenter) self._pb_dev = QPushButton(self._device, self) connect_newprocess( self._pb_dev, ['sirius-hla-si-id-control.py', '-dev', self._device]) self._sb_phs = PyDMSpinbox(self, self.dev_pref.substitute(propty='Phase-SP')) self._sb_phs.showStepExponent = False self._lb_phs = PyDMLabel(self, self.dev_pref.substitute(propty='Phase-Mon')) self._sb_kx = PyDMSpinbox(self, self.dev_pref.substitute(propty='Kx-SP')) self._sb_kx.showStepExponent = False self._lb_kx = PyDMLabel(self, self.dev_pref.substitute(propty='Kx-Mon')) self._sb_phsspd = PyDMSpinbox( self, self.dev_pref.substitute(propty='PhaseSpeed-SP')) self._sb_phsspd.showStepExponent = False self._lb_phsspd = PyDMLabel( self, self.dev_pref.substitute(propty='PhaseSpeed-Mon')) self._pb_start = PyDMPushButton(self, label='', icon=qta.icon('fa5s.play')) self._pb_start.setToolTip( 'Start automatic motion towards previously entered setpoint.') self._pb_start.channel = self.dev_pref.substitute(propty='DevCtrl-Cmd') self._pb_start.pressValue = 3 # Start self._pb_start.setObjectName('Start') self._pb_start.setStyleSheet( '#Start{min-width:30px; max-width:30px; icon-size:25px;}') self._pb_stop = PyDMPushButton(self, label='', icon=qta.icon('fa5s.stop')) self._pb_stop.setToolTip('Stop all motion, lock all brakes.') self._pb_stop.channel = self.dev_pref.substitute(propty='DevCtrl-Cmd') self._pb_stop.pressValue = 1 # Stop self._pb_stop.setObjectName('Stop') self._pb_stop.setStyleSheet( '#Stop{min-width:30px; max-width:30px; icon-size:25px;}') self._led_ismov = SiriusLedState( self, self.dev_pref.substitute(propty='Moving-Mon')) self._led_status = PyDMLedMultiChannel( self, { self.dev_pref.substitute(propty='Alarm-Mon'): 0, self.dev_pref.substitute(propty='IntlkInStop-Mon'): 0, self.dev_pref.substitute(propty='IntlkInEOpnGap-Mon'): 0, self.dev_pref.substitute(propty='IntlkOutPwrEnbld-Mon'): 1, self.dev_pref.substitute(propty='IsOperational-Mon'): 1 }) self._sb_blenbl = PyDMStateButton( self, self.dev_pref.substitute(propty='BeamLineCtrlEnbl-Sel')) self._led_blenbl = SiriusLedState( self, self.dev_pref.substitute(propty='BeamLineCtrlEnbl-Sts')) self._led_blmon = SiriusLedState( self, self.dev_pref.substitute(propty='BeamLineCtrl-Mon')) self.widgets = { 'Beamline': ([ self._lb_bl, ], 'v'), 'Device': ([ self._pb_dev, ], 'v'), 'Alarms': ([ self._led_status, ], 'v'), 'Phase': ([self._sb_phs, self._lb_phs], 'v'), 'Kx': ([self._sb_kx, self._lb_kx], 'v'), 'Phase Speed': ([self._sb_phsspd, self._lb_phsspd], 'v'), 'Start': ([ self._pb_start, ], 'v'), 'Stop': ([ self._pb_stop, ], 'v'), 'Moving': ([ self._led_ismov, ], 'v'), 'BeamLine Enable': ([self._sb_blenbl, self._led_blenbl], 'h'), 'Beamline Control': ([ self._led_blmon, ], 'v'), } layout = QHBoxLayout(self) for name, size in self.widgets_widths: objname = name.replace(' ', '') group = self.widgets[name] items, ori = group widget = QWidget(self) lay = QVBoxLayout() if ori == 'v' else QHBoxLayout() lay.setContentsMargins(0, 0, 0, 0) lay.setAlignment(Qt.AlignCenter) lay.setSpacing(0) widget.setLayout(lay) for item in items: lay.addWidget(item) widget.setObjectName(objname) widget.setStyleSheet( '#' + objname + '{{min-width:{0}em; max-width:{0}em;}}'.format(str(size))) layout.addWidget(widget)
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 _roiLayout(self): # StartX lbl_roistartx = QLabel('Start X [MHz]', self) self.le_roistartx = PyDMLineEdit( self, self.device.substitute(propty='ROIOffsetX-SP')) self.le_roistartx.precisionFromPV = True self.lb_roistartx = PyDMLabel( self, self.device.substitute(propty='ROIOffsetX-RB')) hbox_roistartx = QHBoxLayout() hbox_roistartx.addWidget(self.le_roistartx) hbox_roistartx.addWidget(self.lb_roistartx) # Width lbl_roiwidth = QLabel('Width [MHz]', self) self.le_roiwidth = PyDMLineEdit( self, self.device.substitute(propty='ROIWidth-SP')) self.le_roiwidth.precisionFromPV = True self.lb_roiwidth = PyDMLabel( self, self.device.substitute(propty='ROIWidth-RB')) hbox_roiwidth = QHBoxLayout() hbox_roiwidth.addWidget(self.le_roiwidth) hbox_roiwidth.addWidget(self.lb_roiwidth) # StartY lbl_roistarty = QLabel('Start Y [ms]', self) self.le_roistarty = PyDMLineEdit( self, self.device.substitute(propty='ROIOffsetY-SP')) self.le_roistarty.precisionFromPV = True self.lb_roistarty = PyDMLabel( self, self.device.substitute(propty='ROIOffsetY-RB')) hbox_roistarty = QHBoxLayout() hbox_roistarty.addWidget(self.le_roistarty) hbox_roistarty.addWidget(self.lb_roistarty) # Height lbl_roiheight = QLabel('Height [ms]', self) self.le_roiheight = PyDMLineEdit( self, self.device.substitute(propty='ROIHeight-SP')) self.le_roiheight.precisionFromPV = True self.lb_roiheight = PyDMLabel( self, self.device.substitute(propty='ROIHeight-RB')) hbox_roiheight = QHBoxLayout() hbox_roiheight.addWidget(self.le_roiheight) hbox_roiheight.addWidget(self.lb_roiheight) # Auto adjust lbl_roiauto = QLabel('Auto Positioning', self) self.bt_roiauto = PyDMStateButton( self, self.device.substitute(propty='ROIAuto-Sel')) self.bt_roiauto.shape = 1 self.led_roiauto = SiriusLedState( self, self.device.substitute(propty='ROIAuto-Sts')) hbox_roiauto = QHBoxLayout() hbox_roiauto.addWidget(self.bt_roiauto) hbox_roiauto.addWidget(self.led_roiauto) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_roistartx, hbox_roistartx) lay.addRow(lbl_roiwidth, hbox_roiwidth) lay.addRow(lbl_roistarty, hbox_roistarty) lay.addRow(lbl_roiheight, hbox_roiheight) lay.addRow(lbl_roiauto, hbox_roiauto) return lay
def _setupUi(self): label = QLabel('<h3>' + self._title + '</h3>', self, alignment=Qt.AlignCenter) self._process_image = SiriusProcessImage(self, device=self._device_analysis, orientation='H', convertion_set=False) self._process_image.image_view.colorMapMax = 2**16 - 1 # IOC control gbox_ctrl = QGroupBox('Analysis Control') lay_ctrl = QGridLayout(gbox_ctrl) self._ld_enbl = QLabel('Start/Stop: ') self._sb_enbl = PyDMStateButton( gbox_ctrl, self._device_analysis + ':MeasureCtrl-Sel') self._lb_enbl = PyDMLabel(gbox_ctrl, self._device_analysis + ':MeasureCtrl-Sts') self._ld_rate = QLabel('Acq. Rate: ') self._sb_rate = SiriusSpinbox( gbox_ctrl, self._device_analysis + ':MeasureRate-SP') self._sb_rate.showStepExponent = False self._lb_rate = PyDMLabel(gbox_ctrl, self._device_analysis + ':MeasureRate-RB') self._ld_tgtx = QLabel('Target X: ') self._sb_tgtx = SiriusSpinbox(gbox_ctrl, self._device_analysis + ':TargetPosX-SP') self._sb_tgtx.showStepExponent = False self._lb_tgtx = PyDMLabel(gbox_ctrl, self._device_analysis + ':TargetPosX-RB') self._ld_tgty = QLabel('Target Y: ') self._sb_tgty = SiriusSpinbox(gbox_ctrl, self._device_analysis + ':TargetPosY-SP') self._sb_tgty.showStepExponent = False self._lb_tgty = PyDMLabel(gbox_ctrl, self._device_analysis + ':TargetPosY-RB') lay_ctrl.setAlignment(Qt.AlignTop) lay_ctrl.addWidget(self._ld_enbl, 0, 0, 2, 1) lay_ctrl.addWidget(self._sb_enbl, 0, 1) lay_ctrl.addWidget(self._lb_enbl, 1, 1) lay_ctrl.addWidget(self._ld_rate, 2, 0, 2, 1) lay_ctrl.addWidget(self._sb_rate, 2, 1) lay_ctrl.addWidget(self._lb_rate, 3, 1) lay_ctrl.addWidget(self._ld_tgtx, 4, 0, 2, 1) lay_ctrl.addWidget(self._sb_tgtx, 4, 1) lay_ctrl.addWidget(self._lb_tgtx, 5, 1) lay_ctrl.addWidget(self._ld_tgty, 6, 0, 2, 1) lay_ctrl.addWidget(self._sb_tgty, 6, 1) lay_ctrl.addWidget(self._lb_tgty, 7, 1) gbox_sofb = QGroupBox('SOFB Bump [urad]') lay_sofb = QGridLayout(gbox_sofb) ldx = QLabel('X:') ldy = QLabel('Y:') ldd = QLabel('Delta') lda = QLabel('Applied') pre = self._device_analysis lb_dbmpx = SiriusLabel(gbox_sofb, pre + ':NeededDeltaBumpX-Mon') lb_dbmpy = SiriusLabel(gbox_sofb, pre + ':NeededDeltaBumpY-Mon') lb_bmpx = SiriusLabel(gbox_sofb, pre + ':AppliedBumpX-Mon') lb_bmpy = SiriusLabel(gbox_sofb, pre + ':AppliedBumpY-Mon') pb_app = PyDMPushButton(gbox_sofb, 'Apply', pressValue=1, init_channel=pre + ':ApplyBump-Cmd') pb_app.showConfirmDialog = True pb_app.confirmMessage = \ 'This action will change the reference orbit used in SOFB.\n' +\ pb_app.confirmMessage lb_app = PyDMLabel(gbox_sofb, init_channel=pre + ':ApplyStatus-Mon') lay_sofb.setAlignment(Qt.AlignTop) lay_sofb.addWidget(ldd, 0, 1, alignment=Qt.AlignCenter) lay_sofb.addWidget(lda, 0, 2, alignment=Qt.AlignCenter) lay_sofb.addWidget(ldx, 1, 0, alignment=Qt.AlignLeft) lay_sofb.addWidget(ldy, 2, 0, alignment=Qt.AlignLeft) lay_sofb.addWidget(lb_dbmpx, 1, 1) lay_sofb.addWidget(lb_dbmpy, 2, 1) lay_sofb.addWidget(lb_bmpx, 1, 2) lay_sofb.addWidget(lb_bmpy, 2, 2) hbl = QHBoxLayout() hbl.addStretch() hbl.addWidget(pb_app) hbl.addWidget(lb_app) hbl.addStretch() lay_sofb.addLayout(hbl, 3, 0, 1, 3) lay_sofb.setRowStretch(4, 5) # Camera Acquisition Status gbox_acqsett = QGroupBox('Camera Acquisition Statuses') lay_acqsett = QGridLayout(gbox_acqsett) self._ld_acqtime = QLabel('Acquire Time: ') self._sb_acqtime = SiriusSpinbox( gbox_ctrl, self._device_cam + ':cam1:AcquireTime') self._sb_acqtime.showStepExponent = False self._sb_acqtime.limitsFromChannel = False self._sb_acqtime.setRange(0.001, 10) self._lb_acqtime = PyDMLabel( gbox_acqsett, self._device_cam + ':cam1:AcquireTime_RBV') self._lb_acqtime.showUnits = True self._ld_acqperd = QLabel('Acquire Period: ') self._sb_acqperd = SiriusSpinbox( gbox_ctrl, self._device_cam + ':cam1:AcquirePeriod') self._sb_acqperd.showStepExponent = False self._sb_acqperd.limitsFromChannel = False self._sb_acqperd.setRange(0.001, 10) self._lb_acqperd = PyDMLabel( gbox_acqsett, self._device_cam + ':cam1:AcquirePeriod_RBV') self._lb_acqperd.showUnits = True self._ld_numimgs = QLabel('# Images: ') self._lb_numimgs = PyDMLabel(gbox_acqsett, self._device_cam + ':cam1:NumImages_RBV') self._ld_imgmode = QLabel('Image Mode: ') self._lb_imgmode = PyDMLabel(gbox_acqsett, self._device_cam + ':cam1:ImageMode_RBV') self._ld_acqsts = QLabel('Acquire Status: ') self._pb_acqsts = PyDMStateButton(gbox_acqsett, self._device_cam + ':cam1:Acquire') self._lb_acqsts = SiriusLedState( gbox_acqsett, self._device_cam + ':cam1:Acquire_RBV') self._ld_capsts = QLabel('Capture Status: ') self._pb_capsts = PyDMStateButton(gbox_acqsett, self._device_cam + ':HDF1:Capture') self._lb_capsts = SiriusLedState( gbox_acqsett, self._device_cam + ':HDF1:Capture_RBV') lay_acqsett.addWidget(self._ld_acqtime, 0, 0, 2, 1) lay_acqsett.addWidget(self._sb_acqtime, 0, 1) lay_acqsett.addWidget(self._lb_acqtime, 1, 1) lay_acqsett.addWidget(self._ld_acqperd, 2, 0, 2, 1) lay_acqsett.addWidget(self._sb_acqperd, 2, 1) lay_acqsett.addWidget(self._lb_acqperd, 3, 1) lay_acqsett.addWidget(self._ld_acqsts, 4, 0, 2, 1) lay_acqsett.addWidget(self._pb_acqsts, 4, 1) lay_acqsett.addWidget(self._lb_acqsts, 5, 1) lay_acqsett.addWidget(self._ld_capsts, 6, 0, 2, 1) lay_acqsett.addWidget(self._pb_capsts, 6, 1) lay_acqsett.addWidget(self._lb_capsts, 7, 1) lay_acqsett.addWidget(self._ld_numimgs, 8, 0) lay_acqsett.addWidget(self._lb_numimgs, 8, 1) lay_acqsett.addWidget(self._ld_imgmode, 9, 0) lay_acqsett.addWidget(self._lb_imgmode, 9, 1) lay_acqsett.setRowStretch(10, 20) self.cw = QWidget() self.cw.setStyleSheet('PyDMLabel{qproperty-alignment: AlignCenter;}') lay = QGridLayout(self.cw) lay.addWidget(label, 0, 0, 1, 3) lay.addWidget(self._process_image, 1, 0, 2, 1) lay.addWidget(gbox_ctrl, 1, 1) lay.addWidget(gbox_sofb, 2, 1) lay.addWidget(gbox_acqsett, 1, 2, 2, 1) lay.setColumnStretch(0, 7) lay.setColumnStretch(1, 2) self.setCentralWidget(self.cw)
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 _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 _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
def _setupIOCControlLayout(self): lay = QGridLayout() lb_sts = QLabel('<h4>Status</h4>', self) self.led_sts = _StatusLed(self, self.ioc_prefix.substitute( propty='Status-Mon')) lay.addWidget(lb_sts, 0, 0) lay.addWidget(self.led_sts, 0, 1, alignment=Qt.AlignLeft) lb_conf = QLabel('<h4>Configuration</h4>') self.bt_dtls = QPushButton(qta.icon('fa5s.list-ul'), '', self) _hlautil.connect_window( self.bt_dtls, _CorrParamsDetailWindow, parent=self, acc=self.acc, opticsparam=self.param, prefix=self.prefix, fams=self.fams) lay.addWidget(lb_conf, 2, 0, 1, 2) lay.addWidget(self.bt_dtls, 2, 2, alignment=Qt.AlignRight) lb_cname = QLabel('Name', self) self.le_cname = _ConfigLineEdit( self, self.ioc_prefix.substitute( propty='ConfigName-SP')) self.lb_cname = PyDMLabel(self, self.ioc_prefix.substitute( propty='ConfigName-RB')) lay.addWidget(lb_cname, 3, 0) lay.addWidget(self.le_cname, 3, 1, 1, 2) lay.addWidget(self.lb_cname, 4, 1, 1, 2) row = 5 if self.acc == 'SI': lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Fixed), 5, 0) row = 6 if self.param == 'chrom': lb_meas_chrom = QLabel('<h4>Chrom. Measurement</h4>') lay.addWidget(lb_meas_chrom, 6, 0, 1, 3) lb_meas_chrom_dfRF = QLabel('ΔFreq RF [Hz]', self) self.sb_meas_chrom_dfRF = PyDMSpinbox( self, self.ioc_prefix.substitute( propty='MeasChromDeltaFreqRF-SP')) self.sb_meas_chrom_dfRF.showStepExponent = False self.lb_meas_chrom_dfRF = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasChromDeltaFreqRF-RB')) lay.addWidget(lb_meas_chrom_dfRF, 7, 0) lay.addWidget(self.sb_meas_chrom_dfRF, 7, 1) lay.addWidget(self.lb_meas_chrom_dfRF, 7, 2) lb_meas_chrom_wait = QLabel('Wait Tune [s]', self) self.sb_meas_chrom_wait = PyDMSpinbox( self, self.ioc_prefix.substitute( propty='MeasChromWaitTune-SP')) self.sb_meas_chrom_wait.showStepExponent = False self.lb_meas_chrom_wait = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasChromWaitTune-RB')) lay.addWidget(lb_meas_chrom_wait, 8, 0) lay.addWidget(self.sb_meas_chrom_wait, 8, 1) lay.addWidget(self.lb_meas_chrom_wait, 8, 2) lb_meas_chrom_nrsteps = QLabel('Nr Steps', self) self.sb_meas_chrom_nrsteps = PyDMSpinbox( self, self.ioc_prefix.substitute( propty='MeasChromNrSteps-SP')) self.sb_meas_chrom_nrsteps.showStepExponent = False self.lb_meas_chrom_nrsteps = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasChromNrSteps-RB')) lay.addWidget(lb_meas_chrom_nrsteps, 9, 0) lay.addWidget(self.sb_meas_chrom_nrsteps, 9, 1) lay.addWidget(self.lb_meas_chrom_nrsteps, 9, 2) lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Fixed), 10, 0) lb_meas_chrom_x = QLabel('Meas. Chrom X', self) self.lb_meas_chrom_x = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasChromX-Mon')) lay.addWidget(lb_meas_chrom_x, 11, 0) lay.addWidget(self.lb_meas_chrom_x, 11, 1) lb_meas_chrom_y = QLabel('Meas. Chrom Y', self) self.lb_meas_chrom_y = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasChromY-Mon')) lay.addWidget(lb_meas_chrom_y, 12, 0) lay.addWidget(self.lb_meas_chrom_y, 12, 1) lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Fixed), 13, 0) self.lb_meas_chrom_sts = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasChromStatus-Mon')) self.bt_meas_chrom_start = PyDMPushButton( self, icon=qta.icon('fa5s.play'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasChrom-Cmd'), pressValue=_Const.MeasCmd.Start) self.bt_meas_chrom_start.setObjectName('start') self.bt_meas_chrom_start.setStyleSheet( '#start{min-width:25px; max-width:25px; icon-size:20px;}') self.bt_meas_chrom_stop = PyDMPushButton( self, icon=qta.icon('fa5s.stop'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasChrom-Cmd'), pressValue=_Const.MeasCmd.Stop) self.bt_meas_chrom_stop.setObjectName('stop') self.bt_meas_chrom_stop.setStyleSheet( '#stop{min-width:25px; max-width:25px; icon-size:20px;}') self.bt_meas_chrom_rst = PyDMPushButton( self, icon=qta.icon('fa5s.sync'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasChrom-Cmd'), pressValue=_Const.MeasCmd.Reset) self.bt_meas_chrom_rst.setObjectName('rst') self.bt_meas_chrom_rst.setStyleSheet( '#rst{min-width:25px; max-width:25px; icon-size:20px;}') hbox_cmd = QHBoxLayout() hbox_cmd.addWidget(self.bt_meas_chrom_start) hbox_cmd.addWidget(self.bt_meas_chrom_stop) hbox_cmd.addWidget(self.bt_meas_chrom_rst) lay.addWidget(self.lb_meas_chrom_sts, 14, 0, 1, 2) lay.addLayout(hbox_cmd, 14, 2) lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Fixed), 15, 0) row = 15 # configuration measurement lb_meas_conf = QLabel('<h4>Config. Measurement</h4>') lay.addWidget(lb_meas_conf, row+1, 0, 1, 3) mag_type = 'Q' if self.param == 'tune' else 'S' unit = '[1/m]' if self.param == 'tune' else '[1/m2]' lb_meas_conf_dfamF = QLabel( 'Fam. Δ'+self.intstrength+' '+mag_type+'F '+unit, self) self.sb_meas_conf_dfamF = PyDMSpinbox( self, self.ioc_prefix.substitute( propty='MeasConfigDelta'+self.intstrength + 'Fam'+mag_type+'F-SP')) self.sb_meas_conf_dfamF.showStepExponent = False self.lb_meas_conf_dfamF = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasConfigDelta'+self.intstrength + 'Fam'+mag_type+'F-RB')) lay.addWidget(lb_meas_conf_dfamF, row+2, 0) lay.addWidget(self.sb_meas_conf_dfamF, row+2, 1) lay.addWidget(self.lb_meas_conf_dfamF, row+2, 2) lb_meas_conf_dfamD = QLabel( 'Fam. Δ'+self.intstrength+' '+mag_type+'D '+unit, self) self.sb_meas_conf_dfamD = PyDMSpinbox( self, self.ioc_prefix.substitute( propty='MeasConfigDelta'+self.intstrength + 'Fam'+mag_type+'D-SP')) self.sb_meas_conf_dfamD.showStepExponent = False self.lb_meas_conf_dfamD = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasConfigDelta'+self.intstrength + 'Fam'+mag_type+'D-RB')) lay.addWidget(lb_meas_conf_dfamD, row+3, 0) lay.addWidget(self.sb_meas_conf_dfamD, row+3, 1) lay.addWidget(self.lb_meas_conf_dfamD, row+3, 2) lb_meas_conf_wait = QLabel('Wait [s]', self) self.sb_meas_conf_wait = PyDMSpinbox( self, self.ioc_prefix.substitute(propty='MeasConfigWait-SP')) self.sb_meas_conf_wait.showStepExponent = False self.lb_meas_conf_wait = PyDMLabel( self, self.ioc_prefix.substitute(propty='MeasConfigWait-RB')) lay.addWidget(lb_meas_conf_wait, row+4, 0) lay.addWidget(self.sb_meas_conf_wait, row+4, 1) lay.addWidget(self.lb_meas_conf_wait, row+4, 2) lb_meas_conf_cname = QLabel('Name to save', self) self.le_meas_conf_name = PyDMLineEdit( self, self.ioc_prefix.substitute(propty='MeasConfigName-SP')) self.lb_meas_conf_name = PyDMLabel( self, self.ioc_prefix.substitute(propty='MeasConfigName-RB')) lay.addWidget(lb_meas_conf_cname, row+5, 0) lay.addWidget(self.le_meas_conf_name, row+5, 1, 1, 2) lay.addWidget(self.lb_meas_conf_name, row+6, 1, 1, 2) lb_meas_conf_save = QLabel('Force Save', self) self.bt_meas_conf_save = PyDMPushButton( self, icon=qta.icon('mdi.content-save'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasConfigSave-Cmd'), pressValue=1) self.bt_meas_conf_save.setObjectName('save') self.bt_meas_conf_save.setStyleSheet( '#save{min-width:25px; max-width:25px; icon-size:20px;}') lay.addWidget(lb_meas_conf_save, row+7, 0) lay.addWidget( self.bt_meas_conf_save, row+7, 1, alignment=Qt.AlignLeft) lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Fixed), row+8, 0) self.lb_meas_conf_sts = PyDMLabel( self, self.ioc_prefix.substitute( propty='MeasConfigStatus-Mon')) self.bt_meas_conf_start = PyDMPushButton( self, icon=qta.icon('fa5s.play'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasConfig-Cmd'), pressValue=_Const.MeasCmd.Start) self.bt_meas_conf_start.setObjectName('start') self.bt_meas_conf_start.setStyleSheet( '#start{min-width:25px; max-width:25px; icon-size:20px;}') self.bt_meas_conf_stop = PyDMPushButton( self, icon=qta.icon('fa5s.stop'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasConfig-Cmd'), pressValue=_Const.MeasCmd.Stop) self.bt_meas_conf_stop.setObjectName('stop') self.bt_meas_conf_stop.setStyleSheet( '#stop{min-width:25px; max-width:25px; icon-size:20px;}') self.bt_meas_conf_rst = PyDMPushButton( self, icon=qta.icon('fa5s.sync'), label='', init_channel=self.ioc_prefix.substitute( propty='MeasConfig-Cmd'), pressValue=_Const.MeasCmd.Reset) self.bt_meas_conf_rst.setObjectName('rst') self.bt_meas_conf_rst.setStyleSheet( '#rst{min-width:25px; max-width:25px; icon-size:20px;}') hbox_cmd = QHBoxLayout() hbox_cmd.addWidget(self.bt_meas_conf_start) hbox_cmd.addWidget(self.bt_meas_conf_stop) hbox_cmd.addWidget(self.bt_meas_conf_rst) lay.addWidget(self.lb_meas_conf_sts, row+9, 0, 1, 2) lay.addLayout(hbox_cmd, row+9, 2) lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Fixed), row+10, 0) # correction settings lb_corr = QLabel('<h4>Settings</h4>') lay.addWidget(lb_corr, row+11, 0, 1, 3) lb_meth = QLabel('Method', self) self.cb_method = PyDMEnumComboBox( self, self.ioc_prefix.substitute(propty='CorrMeth-Sel')) self.lb_method = PyDMLabel( self, self.ioc_prefix.substitute(propty='CorrMeth-Sts')) lay.addWidget(lb_meth, row+12, 0) lay.addWidget(self.cb_method, row+12, 1) lay.addWidget(self.lb_method, row+12, 2) lb_grp = QLabel('Grouping', self) self.cb_group = PyDMEnumComboBox( self, self.ioc_prefix.substitute(propty='CorrGroup-Sel')) self.lb_group = PyDMLabel( self, self.ioc_prefix.substitute(propty='CorrGroup-Sts')) lay.addWidget(lb_grp, row+13, 0) lay.addWidget(self.cb_group, row+13, 1) lay.addWidget(self.lb_group, row+13, 2) if self.param == 'tune': lb_sync = QLabel('Sync', self) self.bt_sync = PyDMStateButton( self, self.ioc_prefix.substitute(propty='SyncCorr-Sel')) self.bt_sync.shape = 1 self.lb_sync = PyDMLabel( self, self.ioc_prefix.substitute(propty='SyncCorr-Sts')) lay.addWidget(lb_sync, row+14, 0) lay.addWidget(self.bt_sync, row+14, 1) lay.addWidget(self.lb_sync, row+14, 2) row = row + 15 lay.addItem( QSpacerItem(1, 20, QSzPly.Ignored, QSzPly.Expanding), row, 0) return lay