示例#1
0
文件: base.py 项目: lnls-sirius/hla
    def _create_scrn_summwidget(self, scrn_device, scrn_idx):
        """Create and return a screen detail widget."""
        cb_scrn = QCheckBox(scrn_device.get_nickname(dev=True), self)
        self._scrns_sel_bg.addButton(cb_scrn)
        self._scrns_sel_bg.setId(cb_scrn, scrn_idx)
        if scrn_idx == self._currScrn:
            cb_scrn.setChecked(True)
        cb_scrn.clicked.connect(self._setScrnWidget)
        cb_scrn.setStyleSheet("""
            min-width:6.5em; max-width:6.5em; font-weight:bold;""")

        led_camenbl = SiriusLedState(
            self,
            scrn_device.substitute(prefix=self.prefix, propty='CamEnbl-Sts'))
        led_camenbl.setStyleSheet("min-width:3.2em; max-width:3.2em;")

        cb_scrntype = PyDMEnumComboBox(
            self,
            scrn_device.substitute(prefix=self.prefix, propty='ScrnType-Sel'))
        cb_scrntype.setSizePolicy(QSzPlcy.Minimum, QSzPlcy.Fixed)
        cb_scrntype.setStyleSheet("min-width:4.5em;max-width:4.5em;")

        lb_scrntype = PyDMLabel(
            self,
            scrn_device.substitute(prefix=self.prefix, propty='ScrnType-Sts'))
        lb_scrntype.setStyleSheet("min-width:4.5em; max-width:4.5em;")
        lb_scrntype.setAlignment(Qt.AlignCenter)

        led_scrntype = PyDMLed(self,
                               scrn_device.substitute(prefix=self.prefix,
                                                      propty='ScrnType-Sts'),
                               color_list=[
                                   PyDMLed.LightGreen, PyDMLed.Red,
                                   PyDMLed.Red, PyDMLed.Yellow
                               ])
        led_scrntype.shape = 2
        led_scrntype.setStyleSheet("""min-width:4.5em; max-width:4.5em;""")

        wid = QWidget()
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignCenter)
        lay.addWidget(cb_scrn, 1, 1)
        lay.addWidget(led_camenbl, 1, 2)
        lay.addWidget(cb_scrntype, 1, 3)
        lay.addWidget(lb_scrntype, 1, 4)
        lay.addWidget(led_scrntype, 2, 4)
        return wid
示例#2
0
    def _setupUi(self):
        ld_maindev = QLabel('<h3>General Settings</h3>',
                            self,
                            alignment=Qt.AlignCenter)

        # # Delay Lines
        ld_adcclock = QLabel('ADC Clock', self)
        sb_adcclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL0')
        sb_adcclock.showStepExponent = False
        fr_adcclock = SiriusFrame(self, self.dev_pref + ':ECLDEL0_SUBWR')
        fr_adcclock.add_widget(sb_adcclock)

        ld_fidclock = QLabel('Fiducial Clock', self)
        sb_fidclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL1')
        sb_fidclock.showStepExponent = False
        fr_fidclock = SiriusFrame(self, self.dev_pref + ':ECLDEL1_SUBWR')
        fr_fidclock.add_widget(sb_fidclock)

        ld_fiducial = QLabel('Fiducial', self)
        sb_fiducial = PyDMSpinbox(self, self.dev_pref + ':ECLDEL2')
        sb_fiducial.showStepExponent = False
        fr_fiducial = SiriusFrame(self, self.dev_pref + ':ECLDEL2_SUBWR')
        fr_fiducial.add_widget(sb_fiducial)

        ld_dacclock = QLabel('DAC Clock', self)
        sb_dacclock = PyDMSpinbox(self, self.dev_pref + ':ECLDEL3')
        sb_dacclock.showStepExponent = False
        fr_dacclock = SiriusFrame(self, self.dev_pref + ':ECLDEL3_SUBWR')
        fr_dacclock.add_widget(sb_dacclock)

        gbox_delaylines = QGroupBox('Delay lines', self)
        lay_delaylines = QGridLayout(gbox_delaylines)
        lay_delaylines.addWidget(ld_adcclock, 0, 0)
        lay_delaylines.addWidget(fr_adcclock, 0, 1)
        lay_delaylines.addWidget(ld_fidclock, 1, 0)
        lay_delaylines.addWidget(fr_fidclock, 1, 1)
        lay_delaylines.addWidget(ld_fiducial, 2, 0)
        lay_delaylines.addWidget(fr_fiducial, 2, 1)
        lay_delaylines.addWidget(ld_dacclock, 3, 0)
        lay_delaylines.addWidget(fr_dacclock, 3, 1)

        # # Thresholds and offsets
        ld_lvl = QLabel('<h4>Level</h4>', self, alignment=Qt.AlignCenter)
        ld_enbl = QLabel('<h4>Enbl</h4>', self, alignment=Qt.AlignCenter)
        ld_v = QLabel('<h4>V</h4>', self, alignment=Qt.AlignCenter)
        ld_edge = QLabel('<h4>Edge</h4>', self, alignment=Qt.AlignCenter)

        ld_fid = QLabel('Fiducial', self)
        cb_fidlvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_FID')
        cb_fidlvlenbl = PyDMEnumComboBox(self,
                                         self.dev_pref + ':LEVEL_FID_ENABLE')
        cb_fidlvlenbl.setStyleSheet('max-width:3em;')
        sb_fidv = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH9')
        sb_fidv.showStepExponent = False
        sb_fidv.showUnits = True
        fr_fidv = SiriusFrame(self, self.dev_pref + ':AD5644CH9_SUBWR')
        fr_fidv.add_widget(sb_fidv)

        ld_trg1 = QLabel('Trigger 1', self)
        cb_trg1lvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_TRIG1')
        cb_trg1lvlenbl = PyDMEnumComboBox(
            self, self.dev_pref + ':LEVEL_TRIG1_ENABLE')
        cb_trg1lvlenbl.setStyleSheet('max-width:3em;')
        sb_trg1lvlv = PyDMSpinbox(self, self.dev_pref + ':LEVEL_VTRIG1')
        sb_trg1lvlv.showStepExponent = False
        sb_trg1lvlv.showUnits = True
        fr_trg1lvlv = SiriusFrame(self, self.dev_pref + ':AD5644CH10_SUBWR')
        fr_trg1lvlv.add_widget(sb_trg1lvlv)
        cb_trg1edge = PyDMEnumComboBox(self, self.dev_pref + ':TRIG1INV')
        cb_trg1edge.setStyleSheet('max-width:3.2em;')

        ld_trg2 = QLabel('Trigger 2', self)
        cb_trg2lvl = PyDMEnumComboBox(self, self.dev_pref + ':LEVEL_TRIG2')
        cb_trg2lvlenbl = PyDMEnumComboBox(
            self, self.dev_pref + ':LEVEL_TRIG2_ENABLE')
        cb_trg2lvlenbl.setStyleSheet('max-width:3em;')
        sb_trg2lvlv = PyDMSpinbox(self, self.dev_pref + ':LEVEL_VTRIG2')
        sb_trg2lvlv.showStepExponent = False
        sb_trg2lvlv.showUnits = True
        fr_trg2lvlv = SiriusFrame(self, self.dev_pref + ':AD5644CH8_SUBWR')
        fr_trg2lvlv.add_widget(sb_trg2lvlv)
        cb_trg2edge = PyDMEnumComboBox(self, self.dev_pref + ':TRIG2INV')
        cb_trg2edge.setStyleSheet('max-width:3.2em;')

        ld_dacoff = QLabel('DAC Offset', self)
        sb_dacoff = PyDMSpinbox(self, self.dev_pref + ':AD5644_V_CH11')
        sb_dacoff.showStepExponent = False
        sb_dacoff.showUnits = True
        fr_dacoff = SiriusFrame(self, self.dev_pref + ':AD5644CH11_SUBWR')
        fr_dacoff.add_widget(sb_dacoff)

        gbox_thoff = QGroupBox('Thresholds and Offsets', self)
        lay_thoff = QGridLayout(gbox_thoff)
        lay_thoff.addWidget(ld_lvl, 0, 1)
        lay_thoff.addWidget(ld_enbl, 0, 2)
        lay_thoff.addWidget(ld_v, 0, 3)
        lay_thoff.addWidget(ld_edge, 0, 4)
        lay_thoff.addWidget(ld_fid, 1, 0)
        lay_thoff.addWidget(cb_fidlvl, 1, 1)
        lay_thoff.addWidget(cb_fidlvlenbl, 1, 2)
        lay_thoff.addWidget(fr_fidv, 1, 3)
        lay_thoff.addWidget(ld_trg1, 2, 0)
        lay_thoff.addWidget(cb_trg1lvl, 2, 1)
        lay_thoff.addWidget(cb_trg1lvlenbl, 2, 2)
        lay_thoff.addWidget(fr_trg1lvlv, 2, 3)
        lay_thoff.addWidget(cb_trg1edge, 2, 4)
        lay_thoff.addWidget(ld_trg2, 3, 0)
        lay_thoff.addWidget(cb_trg2lvl, 3, 1)
        lay_thoff.addWidget(cb_trg2lvlenbl, 3, 2)
        lay_thoff.addWidget(fr_trg2lvlv, 3, 3)
        lay_thoff.addWidget(cb_trg2edge, 3, 4)
        lay_thoff.addWidget(ld_dacoff, 4, 0)
        lay_thoff.addWidget(fr_dacoff, 4, 3)
        lay_thoff.setColumnStretch(0, 3)
        lay_thoff.setColumnStretch(1, 2)
        lay_thoff.setColumnStretch(2, 1)
        lay_thoff.setColumnStretch(3, 5)
        lay_thoff.setColumnStretch(4, 1)

        # # FIR
        ld_sfir = QLabel('Shaper FIR ([C0 2^17 C2])', self)

        ld_firc0 = QLabel('C0', self)
        sb_firc0 = PyDMSpinbox(self, self.dev_pref + ':SHAPE_C0')
        sb_firc0.showStepExponent = False
        fr_firc0 = SiriusFrame(self, self.dev_pref + ':SHAPE_C0_SUBWR')
        fr_firc0.add_widget(sb_firc0)

        ld_firc2 = QLabel('C2', self)
        sb_firc2 = PyDMSpinbox(self, self.dev_pref + ':SHAPE_C2')
        sb_firc2.showStepExponent = False
        fr_firc2 = SiriusFrame(self, self.dev_pref + ':SHAPE_C2_SUBWR')
        fr_firc2.add_widget(sb_firc2)

        lay_fir = QHBoxLayout()
        lay_fir.addStretch()
        lay_fir.addWidget(ld_sfir)
        lay_fir.addStretch()
        lay_fir.addWidget(ld_firc0)
        lay_fir.addWidget(fr_firc0)
        lay_fir.addStretch()
        lay_fir.addWidget(ld_firc2)
        lay_fir.addWidget(fr_firc2)
        lay_fir.addStretch()

        lay = QGridLayout(self)
        lay.addWidget(ld_maindev, 0, 1, 1, 2)
        lay.addWidget(gbox_delaylines, 1, 1)
        lay.addWidget(gbox_thoff, 1, 2)
        lay.addLayout(lay_fir, 2, 1, 1, 2)
        lay.setColumnStretch(0, 3)
        lay.setColumnStretch(3, 3)
        lay.setRowStretch(3, 3)

        self.setStyleSheet("""SiriusFrame{max-height: 1.8em;}""")