예제 #1
0
    def _statusWidget(self):
        label_Conn = QLabel('Connection:', self)
        hbox_Conn = create_propty_layout(parent=self,
                                         prefix=self.cam_prefix,
                                         propty='Connection',
                                         propty_type='mon')

        label_Temp = QLabel('Temperature State:', self)
        self.lb_Temp = PyDMLabel(self,
                                 self.cam_prefix.substitute(propty='Temp-Mon'))
        self.lb_Temp.setStyleSheet('min-width:7.1em; max-width:7.1em;')
        self.lb_Temp.setAlignment(Qt.AlignCenter)
        self.led_TempState = SiriusLedAlert(
            self, self.cam_prefix.substitute(propty='TempState-Mon'))
        self.led_TempState.setStyleSheet('min-width:1.29em; max-width:1.29em;')
        self.lb_TempState = PyDMLabel(
            self, self.cam_prefix.substitute(propty='TempState-Mon'))
        self.lb_TempState.setStyleSheet('min-width:2.5em; max-width:2.5em;')
        hbox_Temp = QHBoxLayout()
        hbox_Temp.addWidget(self.lb_Temp)
        hbox_Temp.addWidget(self.led_TempState)
        hbox_Temp.addWidget(self.lb_TempState)

        label_LastErr = QLabel('Last Error:', self)
        hbox_LastErr = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='LastErr',
                                            propty_type='mon',
                                            cmd={
                                                'label': 'Clear Last Error',
                                                'pressValue': 1,
                                                'name': 'ClearLastErr'
                                            })

        label_Reset = QLabel('Reset Camera:', self)
        self.pb_dtl = PyDMPushButton(
            label='',
            icon=qta.icon('fa5s.sync'),
            parent=self,
            pressValue=1,
            init_channel=self.cam_prefix.substitute(propty='Rst-Cmd'))
        self.pb_dtl.setObjectName('reset')
        self.pb_dtl.setStyleSheet(
            "#reset{min-width:25px; max-width:25px; icon-size:20px;}")

        wid = QWidget()
        flay = QFormLayout(wid)
        flay.setLabelAlignment(Qt.AlignRight)
        flay.setFormAlignment(Qt.AlignHCenter)
        flay.addRow(label_Conn, hbox_Conn)
        flay.addRow(label_Temp, hbox_Temp)
        flay.addRow(label_LastErr, hbox_LastErr)
        flay.addRow(label_Reset, self.pb_dtl)
        return wid
예제 #2
0
파일: status.py 프로젝트: lnls-sirius/hla
    def setupui(self):
        vbl = QVBoxLayout(self)

        tip = 'Configure ' + ('Acquisition' if self.is_orb else 'Correctors')
        pv = 'TrigAcqConfig-Cmd' if self.is_orb else 'CorrConfig-Cmd'
        conf = PyDMPushButton(self,
                              init_channel=self.devpref.substitute(propty=pv),
                              pressValue=1)
        conf.setToolTip(tip)
        conf.setIcon(qta.icon('fa5s.sync'))
        conf.setObjectName('conf')
        conf.setStyleSheet(
            '#conf{min-width:25px; max-width:25px; icon-size:20px;}')
        vbl.addWidget(conf)

        pv = 'Orb' if self.is_orb else 'Corr'
        pdm_led = SiriusLedAlert(
            self, self.devpref.substitute(propty=pv + 'Status-Mon'))

        hbl = QHBoxLayout()
        hbl.setSpacing(9)
        hbl.addWidget(pdm_led)
        hbl.addWidget(QLabel('Global Status', self))
        hbl.addStretch()
        hbl.addWidget(conf)
        vbl.addItem(hbl)

        grpbx = self.creategroupbox()
        vbl.addWidget(grpbx)
예제 #3
0
파일: settings.py 프로젝트: lnls-sirius/hla
    def _setupReliableMeasWidget(self):
        gbox_reliablemeas = QGroupBox('Measure Reliability Status', self)
        gbox_reliablemeas.setStyleSheet("""
            .QLabel{min-height:1.29em; max-height:1.29em;}
        """)

        lay_reliablemeas = QGridLayout(gbox_reliablemeas)
        relmeas_count = self._db['ReliableMeasLabels-Cte']['count']
        self.relmeas_labels = list()
        for idx in range(relmeas_count):
            led = SiriusLedAlert(parent=self,
                                 init_channel=self.dcct_prefix.substitute(
                                     propty='ReliableMeas-Mon'),
                                 bit=idx)
            lay_reliablemeas.addWidget(led, idx, 0)
            lbl = QLabel('', self)
            self.relmeas_labels.append(lbl)
            lay_reliablemeas.addWidget(lbl, idx, 1)
        lay_reliablemeas.setColumnStretch(0, 1)
        lay_reliablemeas.setColumnStretch(1, 10)

        self.reliablemeas_channel = _PV(
            self.dcct_prefix.substitute(propty='ReliableMeasLabels-Cte'),
            callback=self._updateReliableMeasLabels)

        return gbox_reliablemeas
예제 #4
0
파일: HLPosAng.py 프로젝트: lnls-sirius/hla
    def _setupStatusLayout(self):
        self.log = PyDMLogLabel(
            self, self.posang_prefix.substitute(propty='Log-Mon'))
        self.lb_sts0 = QLabel(Const.STATUSLABELS[0], self)
        self.led_sts0 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=0)
        self.lb_sts1 = QLabel(Const.STATUSLABELS[1], self)
        self.led_sts1 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=1)
        self.lb_sts2 = QLabel(Const.STATUSLABELS[2], self)
        self.led_sts2 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=2)
        self.lb_sts3 = QLabel(Const.STATUSLABELS[3], self)
        self.led_sts3 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=3)
        self.pb_config = PyDMPushButton(
            self, label='Config Correctors', pressValue=1,
            init_channel=self.posang_prefix.substitute(propty='ConfigPS-Cmd'))

        lay = QGridLayout()
        lay.setVerticalSpacing(12)
        lay.setHorizontalSpacing(12)
        lay.addWidget(self.log, 0, 0, 6, 1)
        lay.addWidget(self.lb_sts0, 1, 2)
        lay.addWidget(self.led_sts0, 1, 1)
        lay.addWidget(self.lb_sts1, 2, 2)
        lay.addWidget(self.led_sts1, 2, 1)
        lay.addWidget(self.lb_sts2, 3, 2)
        lay.addWidget(self.led_sts2, 3, 1)
        lay.addWidget(self.lb_sts3, 4, 2)
        lay.addWidget(self.led_sts3, 4, 1)
        lay.addWidget(self.pb_config, 5, 1, 1, 2)

        if self._tl == 'TS':
            self.led_corrtype = PyDMLedMultiChannel(
                self, {self.posang_prefix.substitute(
                        propty='CH1-Cte'): self.corrs['CH1']})
            self.lb_corrtype = QLabel(
                'Control ' + ('CH-Sept' if self._is_chsept else 'Sept-Sept'))
            lay.addWidget(self.led_corrtype, 0, 1)
            lay.addWidget(self.lb_corrtype, 0, 2)
        return lay
예제 #5
0
    def _ctrlmode_layout(self):
        ctrlmode_layout = QHBoxLayout()

        self.ctrlmode_led = SiriusLedAlert(parent=self,
                                           init_channel=self._ctrlmode_pv)
        self.ctrlmode_label = PyDMLabel(parent=self,
                                        init_channel=self._ctrlmode_pv)

        ctrlmode_layout.addStretch()
        ctrlmode_layout.addWidget(self.ctrlmode_led)
        ctrlmode_layout.addWidget(self.ctrlmode_label)

        return ctrlmode_layout
예제 #6
0
 def get_widgets(self):
     widgets = list()
     sz_polc = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     for idx in range(len(self.devnames[self.dev][0])):
         wid = QWidget(self.parent())
         led = SiriusLedAlert()
         led.setParent(wid)
         led.setSizePolicy(sz_polc)
         tooltip = self.devnames[self.dev][1][idx]
         tooltip += '; Pos = {0:5.1f} m'.format(self.devpos[self.dev][idx])
         led.setToolTip(tooltip)
         hbl = QHBoxLayout(wid)
         hbl.setContentsMargins(0, 0, 0, 0)
         hbl.addWidget(led)
         widgets.append(wid)
     return widgets
예제 #7
0
파일: status.py 프로젝트: lnls-sirius/hla
 def creategroupbox(self):
     wid = QGroupBox('Detailed Status', self)
     fbl = QFormLayout(wid)
     if self.is_orb:
         items = self._csorb.StsLblsOrb._fields
         name = 'Orb'
     else:
         items = self._csorb.StsLblsCorr._fields
         name = 'Corr'
     channel = self.devpref.substitute(propty=name + 'Status-Mon')
     for bit, label in enumerate(items):
         led = SiriusLedAlert(self, channel, bit)
         lab = QLabel(label, self)
         fbl.addRow(led, lab)
     return wid
예제 #8
0
    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
예제 #9
0
 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)
예제 #10
0
    def _statusWidget(self):
        self._ld_alarm = QLabel('Alarms', self, alignment=Qt.AlignCenter)
        self._led_alarm = SiriusLedAlert(
            self, self.dev_pref.substitute(propty='Alarm-Mon'))
        self._pb_alarmdetail = QPushButton(qta.icon('fa5s.ellipsis-h'), '',
                                           self)
        self._pb_alarmdetail.setObjectName('dtl')
        self._pb_alarmdetail.setStyleSheet(
            "#dtl{min-width:25px; max-width:25px; icon-size:20px;}")
        connect_window(self._pb_alarmdetail,
                       APUAlarmDetails,
                       self,
                       prefix=self._prefix,
                       device=self._device)

        self._ld_intlk = QLabel('Interlocks', self, alignment=Qt.AlignCenter)
        self._led_intlkresume = PyDMLedMultiChannel(
            self, {
                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._pb_intlkdetail = QPushButton(qta.icon('fa5s.ellipsis-h'), '',
                                           self)
        self._pb_intlkdetail.setObjectName('dtl')
        self._pb_intlkdetail.setStyleSheet(
            "#dtl{min-width:25px; max-width:25px; icon-size:20px;}")
        connect_window(self._pb_intlkdetail,
                       APUInterlockDetails,
                       self,
                       prefix=self._prefix,
                       device=self._device)

        self._ld_hwsys = QLabel('Hardware\n&LowLevel',
                                self,
                                alignment=Qt.AlignCenter)
        self._led_hwsysresume = PyDMLedMultiChannel(
            self, {
                self.dev_pref.substitute(propty='StateHw-Mon'): {
                    'value': [0x4C, 0x3C],
                    'comp': 'in'
                },
                self.dev_pref.substitute(propty='State-Mon'): {
                    'value': [1, 4],
                    'comp': 'in'
                },
                self.dev_pref.substitute(propty='IsOperational-Mon'): 1
            })
        self._led_hwsysresume.offColor = PyDMLed.Yellow
        self._led_hwsysresume.onColor = PyDMLed.LightGreen
        self._pb_hwsysdetail = QPushButton(qta.icon('fa5s.ellipsis-h'), '',
                                           self)
        self._pb_hwsysdetail.setObjectName('dtl')
        self._pb_hwsysdetail.setStyleSheet(
            "#dtl{min-width:25px; max-width:25px; icon-size:20px;}")
        connect_window(self._pb_hwsysdetail,
                       APUHardLLDetails,
                       self,
                       prefix=self._prefix,
                       device=self._device)

        self._ld_reset = QLabel('Reset', self, alignment=Qt.AlignCenter)
        self._pb_reset = PyDMPushButton(self,
                                        label='',
                                        icon=qta.icon('fa5s.sync'))
        self._pb_reset.setToolTip('Reset active alarms.')
        self._pb_reset.channel = self.dev_pref.substitute(propty='DevCtrl-Cmd')
        self._pb_reset.pressValue = 2  # Reset
        self._pb_reset.setObjectName('Reset')
        self._pb_reset.setStyleSheet(
            '#Reset{min-width:30px; max-width:30px; icon-size:25px;}')

        gbox_alrmintlk = QGroupBox('Status')
        lay_alrmintlk = QGridLayout(gbox_alrmintlk)
        lay_alrmintlk.addWidget(self._pb_alarmdetail, 0, 0)
        lay_alrmintlk.addWidget(self._ld_alarm, 0, 1)
        lay_alrmintlk.addWidget(self._led_alarm, 0, 2)
        lay_alrmintlk.addWidget(self._pb_intlkdetail, 1, 0)
        lay_alrmintlk.addWidget(self._ld_intlk, 1, 1)
        lay_alrmintlk.addWidget(self._led_intlkresume, 1, 2)
        lay_alrmintlk.addWidget(self._pb_hwsysdetail, 2, 0)
        lay_alrmintlk.addWidget(self._ld_hwsys, 2, 1)
        lay_alrmintlk.addWidget(self._led_hwsysresume, 2, 2)
        lay_alrmintlk.addWidget(self._ld_reset, 3, 1)
        lay_alrmintlk.addWidget(self._pb_reset, 3, 2)
        return gbox_alrmintlk
예제 #11
0
class BaslerCamSettings(QTabWidget):
    def __init__(self, parent=None, device='', prefix=''):
        super().__init__(parent)
        self.prefix = prefix
        self.device = SiriusPVName(device).substitute(prefix=prefix)
        self.cam_prefix = self.device.substitute(prefix=prefix)
        self.setObjectName(self.device.sec + 'App')
        self._setupUi()

    def _setupUi(self):
        self.addTab(self._infoWidget(), 'Gen. Info')
        self.addTab(self._statusWidget(), 'Status')
        self.addTab(self._acquisitionWidget(), 'Acquisition')
        self.addTab(self._imgIntesityAndBGWidget(), 'Intensity and BG')
        self.addTab(self._ROIWidget(), 'ROI')
        self.setCurrentIndex(2)
        self.setStyleSheet('#' + self.device.sec +
                           'App{min-width: 31em; max-width: 31em;}')

    def _infoWidget(self):
        label_DevID = QLabel('Device ID:', self)
        hbox_DevID = create_propty_layout(parent=self,
                                          prefix=self.cam_prefix,
                                          width=15,
                                          propty='DeviceID',
                                          propty_type='cte')
        hbox_DevID.setAlignment(Qt.AlignLeft)

        label_DevVers = QLabel('Device Version:', self)
        hbox_DevVers = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            width=15,
                                            propty='DeviceVersion',
                                            propty_type='cte')
        hbox_DevVers.setAlignment(Qt.AlignLeft)

        label_DevModelName = QLabel('Device Model Name:', self)
        hbox_DevModelName = create_propty_layout(parent=self,
                                                 prefix=self.cam_prefix,
                                                 width=15,
                                                 propty='DeviceModelName',
                                                 propty_type='cte')
        hbox_DevModelName.setAlignment(Qt.AlignLeft)

        label_DevVendorName = QLabel('Device Vendor Name:', self)
        hbox_DevVendorName = create_propty_layout(parent=self,
                                                  prefix=self.cam_prefix,
                                                  width=15,
                                                  propty='DeviceVendorName',
                                                  propty_type='cte')
        hbox_DevVendorName.setAlignment(Qt.AlignLeft)

        label_DevFirmVers = QLabel('Firmware Version:', self)
        hbox_DevFirmVers = create_propty_layout(parent=self,
                                                prefix=self.cam_prefix,
                                                width=15,
                                                propty='DeviceFirmwareVersion',
                                                propty_type='cte')
        hbox_DevFirmVers.setAlignment(Qt.AlignLeft)

        label_SensorHeight = QLabel('Sensor Height [pixels]:', self)
        hbox_SensorHeight = create_propty_layout(parent=self,
                                                 prefix=self.cam_prefix,
                                                 width=15,
                                                 propty='SensorHeight',
                                                 propty_type='cte')
        hbox_SensorHeight.setAlignment(Qt.AlignLeft)

        label_SensorWidth = QLabel('Sensor Width [pixels]:', self)
        hbox_SensorWidth = create_propty_layout(parent=self,
                                                prefix=self.cam_prefix,
                                                width=15,
                                                propty='SensorWidth',
                                                propty_type='cte')
        hbox_SensorWidth.setAlignment(Qt.AlignLeft)

        wid = QWidget()
        flay = QFormLayout(wid)
        flay.setLabelAlignment(Qt.AlignRight)
        flay.setFormAlignment(Qt.AlignHCenter)
        flay.addRow(label_DevID, hbox_DevID)
        flay.addRow(label_DevVers, hbox_DevVers)
        flay.addRow(label_DevModelName, hbox_DevModelName)
        flay.addRow(label_DevVendorName, hbox_DevVendorName)
        flay.addRow(label_DevFirmVers, hbox_DevFirmVers)
        flay.addRow(label_SensorHeight, hbox_SensorHeight)
        flay.addRow(label_SensorWidth, hbox_SensorWidth)
        return wid

    def _statusWidget(self):
        label_Conn = QLabel('Connection:', self)
        hbox_Conn = create_propty_layout(parent=self,
                                         prefix=self.cam_prefix,
                                         propty='Connection',
                                         propty_type='mon')

        label_Temp = QLabel('Temperature State:', self)
        self.lb_Temp = PyDMLabel(self,
                                 self.cam_prefix.substitute(propty='Temp-Mon'))
        self.lb_Temp.setStyleSheet('min-width:7.1em; max-width:7.1em;')
        self.lb_Temp.setAlignment(Qt.AlignCenter)
        self.led_TempState = SiriusLedAlert(
            self, self.cam_prefix.substitute(propty='TempState-Mon'))
        self.led_TempState.setStyleSheet('min-width:1.29em; max-width:1.29em;')
        self.lb_TempState = PyDMLabel(
            self, self.cam_prefix.substitute(propty='TempState-Mon'))
        self.lb_TempState.setStyleSheet('min-width:2.5em; max-width:2.5em;')
        hbox_Temp = QHBoxLayout()
        hbox_Temp.addWidget(self.lb_Temp)
        hbox_Temp.addWidget(self.led_TempState)
        hbox_Temp.addWidget(self.lb_TempState)

        label_LastErr = QLabel('Last Error:', self)
        hbox_LastErr = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='LastErr',
                                            propty_type='mon',
                                            cmd={
                                                'label': 'Clear Last Error',
                                                'pressValue': 1,
                                                'name': 'ClearLastErr'
                                            })

        label_Reset = QLabel('Reset Camera:', self)
        self.pb_dtl = PyDMPushButton(
            label='',
            icon=qta.icon('fa5s.sync'),
            parent=self,
            pressValue=1,
            init_channel=self.cam_prefix.substitute(propty='Rst-Cmd'))
        self.pb_dtl.setObjectName('reset')
        self.pb_dtl.setStyleSheet(
            "#reset{min-width:25px; max-width:25px; icon-size:20px;}")

        wid = QWidget()
        flay = QFormLayout(wid)
        flay.setLabelAlignment(Qt.AlignRight)
        flay.setFormAlignment(Qt.AlignHCenter)
        flay.addRow(label_Conn, hbox_Conn)
        flay.addRow(label_Temp, hbox_Temp)
        flay.addRow(label_LastErr, hbox_LastErr)
        flay.addRow(label_Reset, self.pb_dtl)
        return wid

    def _acquisitionWidget(self):
        label_CamEnbl = QLabel('Acquire Enable Status:', self)
        hbox_CamEnbl = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='Enbl',
                                            propty_type='enbldisabl')

        label_FrameCnt = QLabel('Frame Count:', self)
        hbox_FrameCnt = create_propty_layout(parent=self,
                                             prefix=self.cam_prefix,
                                             propty='FrameCnt',
                                             propty_type='mon')

        label_AcqMode = QLabel('Acquire Mode:', self)
        hbox_AcqMode = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='AcqMode',
                                            propty_type='enum')

        label_AcqPeriod = QLabel('Acquire Period [s]:', self)
        hbox_AcqPeriod = create_propty_layout(parent=self,
                                              prefix=self.cam_prefix,
                                              propty='AcqPeriod',
                                              propty_type='sprb')

        label_AcqPeriodLowLim = QLabel('Acquire Period Low Limit [s]:', self)
        hbox_AcqPeriodLowLim = create_propty_layout(parent=self,
                                                    prefix=self.cam_prefix,
                                                    propty='AcqPeriodLowLim',
                                                    propty_type='sprb')

        label_ExpMode = QLabel('Exposure Mode:', self)
        hbox_ExpMode = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='ExposureMode',
                                            propty_type='enum')

        label_ExpTime = QLabel('Exposure Time [us]:', self)
        hbox_ExpTime = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='ExposureTime',
                                            propty_type='sprb')

        label_Gain = QLabel('Gain [dB]:', self)
        hbox_Gain = create_propty_layout(parent=self,
                                         prefix=self.cam_prefix,
                                         propty='Gain',
                                         propty_type='sprb',
                                         cmd={
                                             'label': '',
                                             'pressValue': 1,
                                             'width': '25',
                                             'height': '25',
                                             'icon': qta.icon('mdi.auto-fix'),
                                             'icon-size': '20',
                                             'toolTip': 'Auto Gain',
                                             'name': 'AutoGain'
                                         })

        label_TransformType = QLabel('Transform Type:', self)
        hbox_TransformType = create_propty_layout(parent=self,
                                                  prefix=self.cam_prefix,
                                                  propty='TransformType',
                                                  propty_type='enum')

        label_BlackLevel = QLabel('Black Level [gray va]:', self)
        hbox_BlackLevel = create_propty_layout(parent=self,
                                               prefix=self.cam_prefix,
                                               propty='BlackLevel',
                                               propty_type='sprb')

        label_DebouncerPeriod = QLabel('Debouncer Period [us]:', self)
        hbox_DebouncerPeriod = create_propty_layout(parent=self,
                                                    prefix=self.cam_prefix,
                                                    propty='DebouncerPeriod',
                                                    propty_type='sprb')

        self.pb_advanced = QPushButton('Advanced', self)
        my_window = create_window_from_widget(
            BaslerCamAcqAdvSettings,
            is_main=False,
            title='Basler Camera Advanced Acquisition Settings')
        util.connect_window(self.pb_advanced,
                            my_window,
                            parent=self,
                            device=self.device,
                            prefix=self.prefix)
        hbox_adv = QHBoxLayout()
        hbox_adv.addWidget(self.pb_advanced, alignment=Qt.AlignRight)

        wid = QWidget()
        flay = QFormLayout(wid)
        flay.setLabelAlignment(Qt.AlignRight)
        flay.setFormAlignment(Qt.AlignHCenter)
        flay.addRow(label_CamEnbl, hbox_CamEnbl)
        flay.addRow(label_FrameCnt, hbox_FrameCnt)
        flay.addRow(label_AcqMode, hbox_AcqMode)
        flay.addRow(label_AcqPeriod, hbox_AcqPeriod)
        flay.addRow(label_AcqPeriodLowLim, hbox_AcqPeriodLowLim)
        flay.addRow(label_ExpMode, hbox_ExpMode)
        flay.addRow(label_ExpTime, hbox_ExpTime)
        flay.addRow(label_Gain, hbox_Gain)
        flay.addRow(label_BlackLevel, hbox_BlackLevel)
        flay.addRow(label_DebouncerPeriod, hbox_DebouncerPeriod)
        flay.addRow(label_TransformType, hbox_TransformType)
        flay.addRow(hbox_adv)
        return wid

    def _imgIntesityAndBGWidget(self):
        label_EnblAdjust = QLabel('Enable Scale and Offset Adjust:', self)
        hbox_EnblAdjust = create_propty_layout(parent=self,
                                               prefix=self.cam_prefix,
                                               propty='EnblOffsetScale',
                                               propty_type='enbldisabl')

        label_AutoAdjust = QLabel('Automatic Intensity Adjust:', self)
        hbox_AutoAdjust = create_propty_layout(parent=self,
                                               prefix=self.cam_prefix,
                                               propty='AutoOffsetScale',
                                               cmd={
                                                   'label': 'Auto Adjust',
                                                   'pressValue': 1,
                                                   'name': 'AutoOffsetScale'
                                               })

        label_PixelScale = QLabel('Pixel Scale:', self)
        hbox_PixelScale = create_propty_layout(parent=self,
                                               prefix=self.cam_prefix,
                                               propty='PixelScale',
                                               propty_type='sprb',
                                               use_linedit=True)

        label_PixelOffset = QLabel('Pixel Offset:', self)
        hbox_PixelOffset = create_propty_layout(parent=self,
                                                prefix=self.cam_prefix,
                                                propty='PixelOffset',
                                                propty_type='sprb',
                                                use_linedit=True)

        label_EnblLowClip = QLabel('Enable Low Cliping:', self)
        hbox_EnblLowClip = create_propty_layout(parent=self,
                                                prefix=self.cam_prefix,
                                                propty='EnblLowClip',
                                                propty_type='enbldisabl')

        label_LowClip = QLabel('Minimum Intensity for Low Cliping:', self)
        hbox_LowClip = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='LowClip',
                                            propty_type='sprb',
                                            use_linedit=True)

        label_EnblHighClip = QLabel('Enable High Cliping:', self)
        hbox_EnblHighClip = create_propty_layout(parent=self,
                                                 prefix=self.cam_prefix,
                                                 propty='EnblHighClip',
                                                 propty_type='enbldisabl')

        label_HighClip = QLabel('Maximum Intensity for High Cliping:', self)
        hbox_HighClip = create_propty_layout(parent=self,
                                             prefix=self.cam_prefix,
                                             propty='HighClip',
                                             propty_type='sprb',
                                             use_linedit=True)

        label_EnblBG = QLabel('Enable BG Subtraction:', self)
        hbox_EnblBG = create_propty_layout(parent=self,
                                           prefix=self.cam_prefix,
                                           propty='EnblBGSubtraction',
                                           propty_type='enbldisabl')

        label_SaveBG = QLabel('Save BG:', self)
        hbox_SaveBG = create_propty_layout(parent=self,
                                           prefix=self.cam_prefix,
                                           propty='SaveBG',
                                           cmd={
                                               'label': 'Save',
                                               'pressValue': 1,
                                               'name': 'SaveBG'
                                           })

        label_ValidBG = QLabel('Is valid BG?', self)
        hbox_ValidBG = create_propty_layout(parent=self,
                                            prefix=self.cam_prefix,
                                            propty='ValidBG',
                                            propty_type='mon')

        wid = QWidget()
        flay = QFormLayout(wid)
        flay.setLabelAlignment(Qt.AlignRight)
        flay.setFormAlignment(Qt.AlignHCenter)
        flay.addRow(label_EnblAdjust, hbox_EnblAdjust)
        flay.addRow(label_AutoAdjust, hbox_AutoAdjust)
        flay.addRow(label_PixelScale, hbox_PixelScale)
        flay.addRow(label_PixelOffset, hbox_PixelOffset)
        flay.addRow(label_EnblLowClip, hbox_EnblLowClip)
        flay.addRow(label_LowClip, hbox_LowClip)
        flay.addRow(label_EnblHighClip, hbox_EnblHighClip)
        flay.addRow(label_HighClip, hbox_HighClip)
        flay.addRow(label_EnblBG, hbox_EnblBG)
        flay.addRow(label_SaveBG, hbox_SaveBG)
        flay.addRow(label_ValidBG, hbox_ValidBG)
        return wid

    def _ROIWidget(self):
        label_MaxWidth = QLabel('Maximum Width [pixels]:', self)
        self.PyDMLabel_MaxWidth = PyDMLabel(
            self, self.cam_prefix.substitute(propty='SensorWidth-Cte'))
        self.PyDMLabel_MaxWidth.setStyleSheet(
            """max-width:7.10em; max-height:1.29em;""")

        label_MaxHeight = QLabel('Maximum Height [pixels]:', self)
        self.PyDMLabel_MaxHeight = PyDMLabel(
            self, self.cam_prefix.substitute(propty='SensorHeight-Cte'))
        self.PyDMLabel_MaxHeight.setStyleSheet(
            """max-width:7.10em; max-height:1.29em;""")

        label_ROIWidth = QLabel('Width [pixels]:', self)
        hbox_ROIWidth = create_propty_layout(parent=self,
                                             prefix=self.cam_prefix,
                                             propty='AOIWidth',
                                             propty_type='sprb')

        label_ROIHeight = QLabel('Heigth [pixels]:', self)
        hbox_ROIHeight = create_propty_layout(parent=self,
                                              prefix=self.cam_prefix,
                                              propty='AOIHeight',
                                              propty_type='sprb')

        label_ROIOffsetX = QLabel('Offset X [pixels]:', self)
        hbox_ROIOffsetX = create_propty_layout(parent=self,
                                               prefix=self.cam_prefix,
                                               propty='AOIOffsetX',
                                               propty_type='sprb')

        label_ROIOffsetY = QLabel('Offset Y [pixels]:', self)
        hbox_ROIOffsetY = create_propty_layout(parent=self,
                                               prefix=self.cam_prefix,
                                               propty='AOIOffsetY',
                                               propty_type='sprb')

        label_AutoCenterX = QLabel('Auto Center X:', self)
        hbox_AutoCenterX = create_propty_layout(parent=self,
                                                prefix=self.cam_prefix,
                                                propty='AOIAutoCenterX',
                                                propty_type='offon')

        label_AutoCenterY = QLabel('Auto Center Y:', self)
        hbox_AutoCenterY = create_propty_layout(parent=self,
                                                prefix=self.cam_prefix,
                                                propty='AOIAutoCenterY',
                                                propty_type='offon')

        wid = QWidget()
        flay = QFormLayout(wid)
        flay.setLabelAlignment(Qt.AlignRight)
        flay.setFormAlignment(Qt.AlignHCenter)
        flay.addRow(label_MaxWidth, self.PyDMLabel_MaxWidth)
        flay.addRow(label_MaxHeight, self.PyDMLabel_MaxHeight)
        flay.addRow(label_ROIWidth, hbox_ROIWidth)
        flay.addRow(label_ROIHeight, hbox_ROIHeight)
        flay.addRow(label_ROIOffsetX, hbox_ROIOffsetX)
        flay.addRow(label_ROIOffsetY, hbox_ROIOffsetY)
        flay.addRow(label_AutoCenterX, hbox_AutoCenterX)
        flay.addRow(label_AutoCenterY, hbox_AutoCenterY)
        return wid
예제 #12
0
파일: settings.py 프로젝트: lnls-sirius/hla
    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;}""")
예제 #13
0
파일: settings.py 프로젝트: lnls-sirius/hla
    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
예제 #14
0
파일: HLPosAng.py 프로젝트: lnls-sirius/hla
    def _setupUi(self):
        cwt = QWidget(self)
        self.setCentralWidget(cwt)

        # label
        lab = QLabel(
            '<h3>'+self._tl+' Position and Angle Correction</h3>', cwt)
        lab.setStyleSheet("""
            min-height:1.55em; max-height: 1.55em;
            qproperty-alignment: 'AlignVCenter | AlignRight';
            background-color: qlineargradient(spread:pad, x1:1, y1:0.0227273,
                              x2:0, y2:0, stop:0 rgba(173, 190, 207, 255),
                              stop:1 rgba(213, 213, 213, 255));""")

        # apply button
        self.pb_updateref = PyDMPushButton(
            self, 'Update Reference', pressValue=1,
            init_channel=self.posang_prefix.substitute(
                propty='SetNewRefKick-Cmd'))
        self.pb_updateref.setStyleSheet(
            'min-height: 2.4em; max-height: 2.4em;')
        self.led_needrefupdt = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='NeedRefUpdate-Mon'))
        self.ch_needrefupdt = SiriusConnectionSignal(
            self.posang_prefix.substitute(propty='NeedRefUpdate-Mon'))
        self.ch_needrefupdt.new_value_signal[int].connect(
            self._handle_need_update_ref_led)
        self.led_needrefupdt.setStyleSheet(
            'QLed{min-width: 1.29em; max-width: 1.29em;}')
        box_ref = QHBoxLayout()
        box_ref.setContentsMargins(0, 0, 0, 0)
        box_ref.addWidget(self.pb_updateref)
        box_ref.addWidget(self.led_needrefupdt)

        # delta setters
        self.hgbox = QGroupBox('Horizontal', self)
        self.hgbox.setLayout(self._setupDeltaControlLayout('x'))

        self.vgbox = QGroupBox('Vertical', self)
        self.vgbox.setLayout(self._setupDeltaControlLayout('y'))

        # correctors
        self.corrgbox = QGroupBox('Correctors', self)
        self.corrgbox.setLayout(self._setupCorrectorsLayout())

        # status
        self.statgbox = QGroupBox('Correction Status', self)
        self.statgbox.setLayout(self._setupStatusLayout())

        glay = QGridLayout(cwt)
        glay.setHorizontalSpacing(12)
        glay.setVerticalSpacing(12)
        glay.addWidget(lab, 0, 0, 1, 2)
        glay.addLayout(box_ref, 1, 0, 1, 2)
        glay.addWidget(self.hgbox, 2, 0)
        glay.addWidget(self.vgbox, 2, 1)
        glay.addWidget(self.corrgbox, 3, 0, 1, 2)
        glay.addWidget(self.statgbox, 4, 0, 1, 2)

        # menu
        act_settings = self.menuBar().addAction('Settings')
        _hlautil.connect_window(act_settings, CorrParamsDetailWindow,
                                parent=self, tl=self._tl, prefix=self._prefix)

        # stlesheet
        self.setStyleSheet("""
            PyDMSpinbox{
                min-width: 5em; max-width: 5em;
            }
            PyDMLabel, PyDMSpinboxScrollbar{
                min-width: 6em; max-width: 6em;
            }
            QPushButton{
                min-width: 8em;
            }
            QLabel{
                min-height: 1.35em;
                qproperty-alignment: AlignCenter;
            }
        """)
예제 #15
0
파일: HLPosAng.py 프로젝트: lnls-sirius/hla
class PosAngCorr(SiriusMainWindow):
    """Main Class."""

    def __init__(self, parent=None, prefix='', tl=None):
        """Class construc."""
        super(PosAngCorr, self).__init__(parent)
        if not prefix:
            self._prefix = _VACA_PREFIX
        else:
            self._prefix = prefix
        self._tl = tl.upper()
        base_name = _PVName('TL-Glob:AP-PosAng')
        self.posang_prefix = base_name.substitute(
            prefix=self._prefix, sec=self._tl)
        self.setObjectName(self._tl+'App')
        self.setWindowTitle(self._tl + ' Position and Angle Correction Window')

        if self._tl == 'TS':
            self._is_chsept = False
            ch3_pv = _PV(self.posang_prefix.substitute(propty='CH3-Cte'),
                         connection_timeout=1)
            if not ch3_pv.wait_for_connection():
                self._is_chsept = True

        if tl == 'ts':
            corr_h = (Const.TS_CORRH_POSANG_CHSEPT if self._is_chsept
                      else Const.TS_CORRH_POSANG_SEPTSEPT)
            corr_v = Const.TS_CORRV_POSANG
        elif tl == 'tb':
            corr_h = Const.TB_CORRH_POSANG
            corr_v = Const.TB_CORRV_POSANG

        self.corrs = dict()
        self.corrs['CH1'] = _PVName(corr_h[0])
        self.corrs['CH2'] = _PVName(corr_h[1])
        if len(corr_h) == 3:
            self.corrs['CH3'] = _PVName(corr_h[2])
        self.corrs['CV1'] = _PVName(corr_v[0])
        self.corrs['CV2'] = _PVName(corr_v[1])
        if len(corr_v) == 4:
            self.corrs['CV3'] = _PVName(corr_v[2])
            self.corrs['CV4'] = _PVName(corr_v[3])

        self._just_need_update = False
        self._update_ref_action = False
        self._my_input_widgets = list()
        self._setupUi()
        self.setFocus(True)
        self.setFocusPolicy(Qt.StrongFocus)

        self._ask_message = QMessageBox(self)
        self._ask_message.setWindowTitle('Message')
        self._ask_message.setText(
            'The '+self._tl+' PosAng IOC indicates reference needs to '
            'be updated! Do you want to update the reference?')
        self._ask_message.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
        self._ask_message.setDefaultButton(QMessageBox.No)
        self.app = QApplication.instance()
        self.app.focusChanged.connect(self._spinbox_onfocus)

    def _setupUi(self):
        cwt = QWidget(self)
        self.setCentralWidget(cwt)

        # label
        lab = QLabel(
            '<h3>'+self._tl+' Position and Angle Correction</h3>', cwt)
        lab.setStyleSheet("""
            min-height:1.55em; max-height: 1.55em;
            qproperty-alignment: 'AlignVCenter | AlignRight';
            background-color: qlineargradient(spread:pad, x1:1, y1:0.0227273,
                              x2:0, y2:0, stop:0 rgba(173, 190, 207, 255),
                              stop:1 rgba(213, 213, 213, 255));""")

        # apply button
        self.pb_updateref = PyDMPushButton(
            self, 'Update Reference', pressValue=1,
            init_channel=self.posang_prefix.substitute(
                propty='SetNewRefKick-Cmd'))
        self.pb_updateref.setStyleSheet(
            'min-height: 2.4em; max-height: 2.4em;')
        self.led_needrefupdt = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='NeedRefUpdate-Mon'))
        self.ch_needrefupdt = SiriusConnectionSignal(
            self.posang_prefix.substitute(propty='NeedRefUpdate-Mon'))
        self.ch_needrefupdt.new_value_signal[int].connect(
            self._handle_need_update_ref_led)
        self.led_needrefupdt.setStyleSheet(
            'QLed{min-width: 1.29em; max-width: 1.29em;}')
        box_ref = QHBoxLayout()
        box_ref.setContentsMargins(0, 0, 0, 0)
        box_ref.addWidget(self.pb_updateref)
        box_ref.addWidget(self.led_needrefupdt)

        # delta setters
        self.hgbox = QGroupBox('Horizontal', self)
        self.hgbox.setLayout(self._setupDeltaControlLayout('x'))

        self.vgbox = QGroupBox('Vertical', self)
        self.vgbox.setLayout(self._setupDeltaControlLayout('y'))

        # correctors
        self.corrgbox = QGroupBox('Correctors', self)
        self.corrgbox.setLayout(self._setupCorrectorsLayout())

        # status
        self.statgbox = QGroupBox('Correction Status', self)
        self.statgbox.setLayout(self._setupStatusLayout())

        glay = QGridLayout(cwt)
        glay.setHorizontalSpacing(12)
        glay.setVerticalSpacing(12)
        glay.addWidget(lab, 0, 0, 1, 2)
        glay.addLayout(box_ref, 1, 0, 1, 2)
        glay.addWidget(self.hgbox, 2, 0)
        glay.addWidget(self.vgbox, 2, 1)
        glay.addWidget(self.corrgbox, 3, 0, 1, 2)
        glay.addWidget(self.statgbox, 4, 0, 1, 2)

        # menu
        act_settings = self.menuBar().addAction('Settings')
        _hlautil.connect_window(act_settings, CorrParamsDetailWindow,
                                parent=self, tl=self._tl, prefix=self._prefix)

        # stlesheet
        self.setStyleSheet("""
            PyDMSpinbox{
                min-width: 5em; max-width: 5em;
            }
            PyDMLabel, PyDMSpinboxScrollbar{
                min-width: 6em; max-width: 6em;
            }
            QPushButton{
                min-width: 8em;
            }
            QLabel{
                min-height: 1.35em;
                qproperty-alignment: AlignCenter;
            }
        """)

    def _setupDeltaControlLayout(self, axis=''):
        # pos
        label_pos = QLabel("<h4>Δ"+axis+"</h4>", self)
        sb_deltapos = PyDMSpinbox(self, self.posang_prefix.substitute(
            propty='DeltaPos'+axis.upper()+'-SP'))
        sb_deltapos.step_exponent = -2
        sb_deltapos.update_step_size()
        sb_deltapos.showStepExponent = False
        lb_deltapos = PyDMLabel(self, self.posang_prefix.substitute(
            propty='DeltaPos'+axis.upper()+'-RB'))
        lb_deltapos.showUnits = True
        self._my_input_widgets.append(sb_deltapos)
        # ang
        label_ang = QLabel("<h4>Δ"+axis+"'</h4>", self)
        sb_deltaang = PyDMSpinbox(self, self.posang_prefix.substitute(
            propty='DeltaAng'+axis.upper()+'-SP'))
        sb_deltaang.step_exponent = -2
        sb_deltaang.update_step_size()
        sb_deltaang.showStepExponent = False
        lb_deltaang = PyDMLabel(self, self.posang_prefix.substitute(
            propty='DeltaAng'+axis.upper()+'-RB'))
        lb_deltaang.showUnits = True
        self._my_input_widgets.append(sb_deltaang)

        lay = QGridLayout()
        lay.setVerticalSpacing(12)
        lay.setHorizontalSpacing(12)
        lay.addItem(
            QSpacerItem(10, 0, QSzPlcy.Expanding, QSzPlcy.Ignored), 0, 0)
        lay.addWidget(label_pos, 0, 1)
        lay.addWidget(sb_deltapos, 0, 2)
        lay.addWidget(lb_deltapos, 0, 3)
        lay.addWidget(label_ang, 1, 1)
        lay.addWidget(sb_deltaang, 1, 2)
        lay.addWidget(lb_deltaang, 1, 3)
        lay.addItem(
            QSpacerItem(10, 0, QSzPlcy.Expanding, QSzPlcy.Ignored), 0, 4)
        return lay

    def _setupCorrectorsLayout(self):
        lay = QGridLayout()
        lay.setVerticalSpacing(9)
        lay.setHorizontalSpacing(9)

        label_kicksp = QLabel('<h4>Kick-SP</h4>', self)
        label_kickrb = QLabel('<h4>Kick-RB</h4>', self)
        label_kickref = QLabel('<h4>RefKick-Mon</h4>', self)
        lay.addWidget(label_kicksp, 0, 2)
        lay.addWidget(label_kickrb, 0, 3)
        lay.addWidget(label_kickref, 0, 4)

        idx = 1
        for corrid, corr in self.corrs.items():
            pbt = QPushButton(qta.icon('fa5s.list-ul'), '', self)
            pbt.setObjectName('pbt')
            pbt.setStyleSheet("""
                #pbt{
                    min-width:25px; max-width:25px;
                    min-height:25px; max-height:25px;
                    icon-size:20px;}
                """)
            if corr.dis == 'PU':
                _hlautil.connect_window(
                    pbt, _PUDetailWindow, self, devname=corr)
            else:
                _hlautil.connect_window(
                    pbt, _PSDetailWindow, self, psname=corr)
            lb_name = QLabel(corr, self)
            le_sp = PyDMSpinboxScrollbar(
                self, corr.substitute(prefix=self._prefix, propty='Kick-SP'))
            le_sp.spinbox.setAlignment(Qt.AlignCenter)
            le_sp.scrollbar.limitsFromPV = True
            lb_rb = PyDMLabel(self, corr.substitute(
                prefix=self._prefix, propty='Kick-RB'))
            lb_ref = PyDMLabel(self, self.posang_prefix.substitute(
                propty='RefKick'+corrid+'-Mon'))

            lay.addWidget(pbt, idx, 0, alignment=Qt.AlignTop)
            lay.addWidget(
                lb_name, idx, 1, alignment=Qt.AlignLeft | Qt.AlignTop)
            lay.addWidget(le_sp, idx, 2, alignment=Qt.AlignTop)
            lay.addWidget(lb_rb, idx, 3, alignment=Qt.AlignTop)
            lay.addWidget(lb_ref, idx, 4, alignment=Qt.AlignTop)
            idx += 1

        if self._tl == 'TB':
            pref = self._prefix + ('-' if self._prefix else '')
            lay.addItem(QSpacerItem(0, 8, QSzPlcy.Ignored, QSzPlcy.Fixed))

            label_voltsp = QLabel('<h4>Amplitude-SP</h4>', self)
            label_voltrb = QLabel('<h4>Amplitude-RB</h4>', self)
            lay.addWidget(label_voltsp, idx+2, 2)
            lay.addWidget(label_voltrb, idx+2, 3)

            lb_kly2_name = QLabel('Klystron 2', self)
            le_kly2_sp = PyDMSpinboxScrollbar(
                self, pref+'LA-RF:LLRF:KLY2:SET_AMP')
            le_kly2_sp.spinbox.precisionFromPV = False
            le_kly2_sp.spinbox.precision = 2
            le_kly2_sp.spinbox.setAlignment(Qt.AlignCenter)
            le_kly2_sp.scrollbar.limitsFromPV = True
            lb_kly2_rb = PyDMLabel(self, pref+'LA-RF:LLRF:KLY2:GET_AMP')
            lb_kly2_rb.precisionFromPV = False
            lb_kly2_rb.precision = 2
            lay.addWidget(lb_kly2_name, idx+3, 1,
                          alignment=Qt.AlignLeft | Qt.AlignTop)
            lay.addWidget(le_kly2_sp, idx+3, 2, alignment=Qt.AlignTop)
            lay.addWidget(lb_kly2_rb, idx+3, 3, alignment=Qt.AlignTop)
            self._kckr_name = _PVName('BO-01D:PU-InjKckr')
        else:
            self._kckr_name = _PVName('SI-01SA:PU-InjNLKckr')

        label_voltsp = QLabel('<h4>Voltage-SP</h4>', self)
        label_voltrb = QLabel('<h4>Voltage-RB</h4>', self)
        lay.addWidget(label_voltsp, idx+4, 2)
        lay.addWidget(label_voltrb, idx+4, 3)

        lay.addItem(QSpacerItem(0, 8, QSzPlcy.Ignored, QSzPlcy.Fixed))
        pb_kckr = QPushButton(qta.icon('fa5s.list-ul'), '', self)
        pb_kckr.setObjectName('pb')
        pb_kckr.setStyleSheet("""
            #pb{
                min-width:25px; max-width:25px;
                min-height:25px; max-height:25px;
                icon-size:20px;}
            """)
        lb_kckr_name = QLabel(self._kckr_name, self)
        _hlautil.connect_window(
            pb_kckr, _PUDetailWindow, self, devname=self._kckr_name)
        lb_kckr_sp = PyDMSpinboxScrollbar(
            self, self._kckr_name.substitute(
                prefix=self._prefix, propty='Voltage-SP'))
        lb_kckr_sp.scrollbar.limitsFromPV = True
        lb_kckr_rb = PyDMLabel(self, self._kckr_name.substitute(
            prefix=self._prefix, propty='Voltage-RB'))
        lay.addWidget(pb_kckr, idx+5, 0, alignment=Qt.AlignTop)
        lay.addWidget(
            lb_kckr_name, idx+5, 1, alignment=Qt.AlignLeft | Qt.AlignTop)
        lay.addWidget(lb_kckr_sp, idx+5, 2, alignment=Qt.AlignTop)
        lay.addWidget(lb_kckr_rb, idx+5, 3, alignment=Qt.AlignTop)
        return lay

    def _setupStatusLayout(self):
        self.log = PyDMLogLabel(
            self, self.posang_prefix.substitute(propty='Log-Mon'))
        self.lb_sts0 = QLabel(Const.STATUSLABELS[0], self)
        self.led_sts0 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=0)
        self.lb_sts1 = QLabel(Const.STATUSLABELS[1], self)
        self.led_sts1 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=1)
        self.lb_sts2 = QLabel(Const.STATUSLABELS[2], self)
        self.led_sts2 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=2)
        self.lb_sts3 = QLabel(Const.STATUSLABELS[3], self)
        self.led_sts3 = SiriusLedAlert(
            self, self.posang_prefix.substitute(propty='Status-Mon'), bit=3)
        self.pb_config = PyDMPushButton(
            self, label='Config Correctors', pressValue=1,
            init_channel=self.posang_prefix.substitute(propty='ConfigPS-Cmd'))

        lay = QGridLayout()
        lay.setVerticalSpacing(12)
        lay.setHorizontalSpacing(12)
        lay.addWidget(self.log, 0, 0, 6, 1)
        lay.addWidget(self.lb_sts0, 1, 2)
        lay.addWidget(self.led_sts0, 1, 1)
        lay.addWidget(self.lb_sts1, 2, 2)
        lay.addWidget(self.led_sts1, 2, 1)
        lay.addWidget(self.lb_sts2, 3, 2)
        lay.addWidget(self.led_sts2, 3, 1)
        lay.addWidget(self.lb_sts3, 4, 2)
        lay.addWidget(self.led_sts3, 4, 1)
        lay.addWidget(self.pb_config, 5, 1, 1, 2)

        if self._tl == 'TS':
            self.led_corrtype = PyDMLedMultiChannel(
                self, {self.posang_prefix.substitute(
                        propty='CH1-Cte'): self.corrs['CH1']})
            self.lb_corrtype = QLabel(
                'Control ' + ('CH-Sept' if self._is_chsept else 'Sept-Sept'))
            lay.addWidget(self.led_corrtype, 0, 1)
            lay.addWidget(self.lb_corrtype, 0, 2)
        return lay

    def _set_correctors_channels(self, corrs):
        self.centralwidget.pushButton_CH1.setText(corrs[0])
        _hlautil.connect_window(
            self.centralwidget.pushButton_CH1, _PSDetailWindow, self,
            psname=corrs[0])
        self.centralwidget.PyDMLabel_KickRBCH1.channel = (
            corrs[0].substitute(prefix=self._prefix, propty='Kick-RB'))

        self.centralwidget.pushButton_CH2.setText(corrs[1])
        if corrs[1].dis == 'PU':
            _hlautil.connect_window(
                self.centralwidget.pushButton_CH2, _PUDetailWindow, self,
                devname=corrs[1])
        else:
            _hlautil.connect_window(
                self.centralwidget.pushButton_CH2, _PSDetailWindow, self,
                psname=corrs[1])
        self.centralwidget.PyDMLabel_KickRBCH2.channel = (
            corrs[1].substitute(prefix=self._prefix, propty='Kick-RB'))

        self.centralwidget.pushButton_CV1.setText(corrs[2])
        _hlautil.connect_window(
            self.centralwidget.pushButton_CV1, _PSDetailWindow, self,
            psname=corrs[2])
        self.centralwidget.PyDMLabel_KickRBCV1.channel = (
            corrs[2].substitute(prefix=self._prefix, propty='Kick-RB'))

        self.centralwidget.pushButton_CV2.setText(corrs[3])
        _hlautil.connect_window(
            self.centralwidget.pushButton_CV2, _PSDetailWindow, self,
            psname=corrs[3])
        self.centralwidget.PyDMLabel_KickRBCV2.channel = (
            corrs[3].substitute(prefix=self._prefix, propty='Kick-RB'))

    def _handle_need_update_ref_led(self, value):
        self._just_need_update = bool(value)

    def _spinbox_onfocus(self, old_focus, new_focus):
        if not self._update_ref_action and not self._just_need_update:
            return

        if self.led_needrefupdt.value != 0:
            if new_focus in self._my_input_widgets and self._just_need_update:
                ans = self._ask_message.exec_()
                if ans == QMessageBox.No:
                    self._update_ref_action = False
                else:
                    self._update_ref_action = True
                    self.pb_updateref.sendValue()
                self._just_need_update = False
예제 #16
0
    def _get_acq_commom_params_grpbx(self):
        grp_bx = QGroupBox('Common Parameters', self)
        fbl = QFormLayout(grp_bx)

        lbl = QLabel('Non-linear Corr.', grp_bx, alignment=Qt.AlignCenter)
        wid = self.create_pair_butled(grp_bx, 'PolyCalibration')
        fbl.addRow(lbl, wid)
        self._set_detailed([lbl, wid])

        lbl = QLabel('Channel Rate', grp_bx, alignment=Qt.AlignCenter)
        wid = self.create_pair_sel(grp_bx, 'TrigAcqChan')
        fbl.addRow(lbl, wid)

        lbl = QLabel('Trigger Type', grp_bx, alignment=Qt.AlignCenter)
        wid = self.create_pair_sel(grp_bx, 'TrigAcqTrigger')
        fbl.addRow(lbl, wid)
        self._set_detailed([lbl, wid])

        lbl = QLabel('Repeat', grp_bx, alignment=Qt.AlignCenter)
        wid = self.create_pair_butled(grp_bx, 'TrigAcqRepeat')
        fbl.addRow(lbl, wid)
        self._set_detailed([lbl, wid])

        if self.isring:
            lbl = QLabel('Nr of Shots', grp_bx, alignment=Qt.AlignCenter)
            wid = self.create_pair(grp_bx, 'TrigNrShots')
            fbl.addRow(lbl, wid)
            self._set_detailed([lbl, wid])

        lbl = QLabel('SamplesPre', grp_bx, alignment=Qt.AlignCenter)
        wid = self.create_pair(grp_bx, 'TrigNrSamplesPre')
        fbl.addRow(lbl, wid)
        lbl = QLabel('SamplesPost', grp_bx, alignment=Qt.AlignCenter)
        wid = self.create_pair(grp_bx, 'TrigNrSamplesPost')
        fbl.addRow(lbl, wid)

        lbl = QLabel('Acquisition:', grp_bx, alignment=Qt.AlignCenter)
        strt = PyDMPushButton(
            grp_bx,
            label='',
            init_channel=self.devpref.substitute(propty='TrigAcqCtrl-Sel'),
            pressValue=self._csorb.TrigAcqCtrl.Start)
        strt.setToolTip('Start Acquisition')
        strt.setIcon(qta.icon('fa5s.play'))
        strt.setObjectName('strt')
        strt.setStyleSheet(
            '#strt{min-width:25px; max-width:25px; icon-size:20px;}')
        stop = PyDMPushButton(
            grp_bx,
            label='',
            init_channel=self.devpref.substitute(propty='TrigAcqCtrl-Sel'),
            pressValue=self._csorb.TrigAcqCtrl.Stop)
        stop.setToolTip('Stop Acquisition')
        stop.setIcon(qta.icon('fa5s.stop'))
        stop.setObjectName('stop')
        stop.setStyleSheet(
            '#stop{min-width:25px; max-width:25px; icon-size:20px;}')
        abrt = PyDMPushButton(
            grp_bx,
            label='',
            init_channel=self.devpref.substitute(propty='TrigAcqCtrl-Sel'),
            pressValue=self._csorb.TrigAcqCtrl.Abort)
        abrt.setToolTip('Abort Acquisition')
        abrt.setIcon(qta.icon('fa5s.ban'))
        abrt.setObjectName('abrt')
        abrt.setStyleSheet(
            '#abrt{min-width:25px; max-width:25px; icon-size:20px;}')

        pdmlbl = PyDMLabel(grp_bx,
                           self.devpref.substitute(propty='TrigAcqCtrl-Sts'))
        pdmlbl.setObjectName('pdmlbl')
        pdmlbl.setStyleSheet('#pdmlbl{min-width:6em; max-width:6em;}')
        pdmlbl.setAlignment(Qt.AlignCenter)
        hbl = QHBoxLayout()
        fbl.addRow(hbl)
        hbl.addStretch()
        hbl.addWidget(lbl)
        hbl.addWidget(strt)
        hbl.addWidget(stop)
        hbl.addWidget(abrt)
        hbl.addWidget(pdmlbl)

        conf = PyDMPushButton(
            grp_bx,
            pressValue=1,
            init_channel=self.devpref.substitute(propty='TrigAcqConfig-Cmd'))
        conf.setToolTip('Resend Configurations')
        conf.setIcon(qta.icon('fa5s.sync'))
        conf.setObjectName('conf')
        conf.setStyleSheet(
            '#conf{min-width:25px; max-width:25px; icon-size:20px;}')

        sts = QPushButton('', grp_bx)
        sts.setIcon(qta.icon('fa5s.list-ul'))
        sts.setToolTip('Open Detailed Status View')
        sts.setObjectName('sts')
        sts.setStyleSheet(
            '#sts{min-width:25px; max-width:25px; icon-size:20px;}')
        Window = create_window_from_widget(StatusWidget, title='Orbit Status')
        connect_window(sts,
                       Window,
                       grp_bx,
                       device=self.device,
                       prefix=self.prefix,
                       acc=self.acc,
                       is_orb=True)

        pdm_led = SiriusLedAlert(
            grp_bx, self.devpref.substitute(propty='OrbStatus-Mon'))

        lbl = QLabel('Status:', grp_bx)
        hbl = QHBoxLayout()
        hbl.setSpacing(9)
        hbl.addStretch()
        hbl.addWidget(lbl)
        hbl.addWidget(pdm_led)
        hbl.addWidget(sts)
        hbl.addWidget(conf)
        fbl.addRow(hbl)

        return grp_bx