Exemple #1
0
    def display_secData(self):
        '''Build the secondary data widget'''

        group = QGroupBox()
        sc_glay = QGridLayout()

        countx = 0
        for text, channel in self.bpm_sec_data.items():

            if text != "Orientation":

                text_lb = QLabel(text, self)
                sc_glay.addWidget(text_lb, countx, 0, 1, 1)

                channel_lb = self.dataItem(channel, 1)
                channel_lb.showUnits = True
                sc_glay.addWidget(channel_lb, countx, 1, 1, 1)
            else:
                text_lb = QLabel(text, self)
                text_lb.setAlignment(Qt.AlignCenter)
                sc_glay.addWidget(text_lb, countx, 0, 1, 2)
                selection = PyDMEnumComboBox(init_channel=self.prefix +
                                             self.device_name + ":" + channel)
                sc_glay.addWidget(selection, countx + 1, 0, 1, 2)
            countx += 1

        sc_glay.setAlignment(Qt.AlignTop)
        group.setLayout(sc_glay)

        return group
Exemple #2
0
    def display_data(self, title, info, pos_x, pos_y, style):
        '''Build a data widget'''
        glay = QGridLayout()
        group = QGroupBox()

        countx = 0
        county = 0

        if style == 0:
            for text, channel in info.items():

                text_lb = QLabel(text, self)
                glay.addWidget(text_lb, countx, county)

                channel_lb = self.dataItem(channel, pos_y)
                channel_lb.showUnits = True
                glay.addWidget(channel_lb, countx, county + 1)

                countx += 1
        else:
            channel_lb = self.dataItem(info, pos_y)
            channel_lb.showUnits = True
            glay.addWidget(channel_lb, pos_x, pos_y)

        glay.setAlignment(Qt.AlignCenter)

        group.setTitle(title)
        group.setLayout(glay)

        return group
Exemple #3
0
    def display_mainData(self):
        '''Display all main data widgets'''
        countx = 0
        county = 0

        md_glay = QGridLayout()

        for title, info in self.bpm_main_data.items():

            if title in ["Trigger Cnt", "Cycle"]:
                md_glay.addWidget(
                    self.display_data(title, info, countx, county, 1), countx,
                    county, 1, 1)
                countx += 1
            else:
                md_glay.addWidget(
                    self.display_data(title, info, countx, county, 0), countx,
                    county, 2, 1)
                countx += 2

            if countx > 7:
                countx = 0
                county += 2

        md_glay.setAlignment(Qt.AlignCenter)

        return md_glay
Exemple #4
0
 def __init__(self, item, parent_layout):
     super(TabGroupWidget, self).__init__(item, parent_layout)
     self.tabs = QTabWidget()
     items = item.item.group
     self.widgets = []
     for item in items:
         if item.get_prop_value("display", parent_layout.instance, "hide",
                                False):
             continue
         item.set_prop("display", embedded=True)
         widget = parent_layout.build_widget(item)
         frame = QFrame()
         label = widget.item.get_prop_value("display", "label")
         icon = widget.item.get_prop_value("display", "icon", None)
         if icon is not None:
             self.tabs.addTab(frame, get_icon(icon), label)
         else:
             self.tabs.addTab(frame, label)
         layout = QGridLayout()
         layout.setAlignment(Qt.AlignTop)
         frame.setLayout(layout)
         widget.place_on_grid(layout, 0, 0, 1)
         try:
             widget.get()
         except Exception:
             print("Error building item :", item.item._name)
             raise
         self.widgets.append(widget)
Exemple #5
0
    def __init__(self, parent=None, prefix='', is_main=False):
        """Init."""
        super().__init__(parent)
        self.setObjectName('ITApp')

        ld_tienbl = QLabel('Enable Pulses', self, alignment=Qt.AlignCenter)
        bt_tienblsel = PyDMStateButton(
            self, prefix + 'IT-EGH:TI-TrigGen:ChanOut-Sel')
        led_tienblsts = SiriusLedState(
            self, prefix + 'IT-EGH:TI-TrigGen:ChanOut-Sts')

        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignCenter)
        lay.setContentsMargins(0, 0, 0, 0)

        glay = QGridLayout()
        glay.addWidget(ld_tienbl, 0, 0, 1, 2)
        glay.addWidget(bt_tienblsel, 1, 0)
        glay.addWidget(led_tienblsts, 1, 1)
        if not is_main:
            gbox = QGroupBox('Timing', self)
            gbox.setLayout(glay)
            lay.addWidget(gbox)
        else:
            lb_title = QLabel('<h3>IT - Timing</h3>',
                              self,
                              alignment=Qt.AlignCenter)
            lay.setHorizontalSpacing(15)
            lay.setVerticalSpacing(15)
            lay.addWidget(lb_title, 0, 0)
            lay.addLayout(glay, 1, 0)
Exemple #6
0
    def _setupTimeHistory(self):
        self.label_currhist = QLabel('<h3>Current History</h3>',
                                     self,
                                     alignment=Qt.AlignCenter)

        self.timegraph = SiriusTimePlot(self)
        self.timegraph.timeSpan = 600
        channel = self.dcct_prefix.substitute(propty='Current-Mon')
        self.timegraph.addYChannel(y_channel=channel,
                                   name='Current History',
                                   color='blue',
                                   lineWidth=1,
                                   lineStyle=Qt.SolidLine)
        self.timegraph.autoRangeX = True
        self.timegraph.autoRangeY = True
        self.timegraph.backgroundColor = QColor(255, 255, 255)
        self.timegraph.showLegend = False
        self.timegraph.showXGrid = True
        self.timegraph.showYGrid = True
        self.timegraph.plotItem.showButtons()
        self.timecurve = self.timegraph.curveAtIndex(0)

        wid = QWidget()
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignTop)
        lay.setRowStretch(0, 1)
        lay.setRowStretch(1, 9)
        lay.addWidget(self.label_currhist, 0, 0)
        lay.addWidget(self.timegraph, 1, 0)
        return wid
Exemple #7
0
    def _setupDecayModeWidget(self):
        self._ld_autostop = QLabel('Auto Stop', self)
        self._cb_autostop = PyDMStateButton(
            self, self._inj_prefix.substitute(propty='AutoStop-Sel'))
        self._cb_autostop.shape = 1
        self._led_autostop = SiriusLedState(
            self, self._inj_prefix.substitute(propty='AutoStop-Sts'))

        wid = QWidget()
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignTop)
        lay.setContentsMargins(0, 6, 0, 0)
        lay.addWidget(self._ld_autostop, 0, 0)
        lay.addWidget(self._cb_autostop, 0, 1)
        lay.addWidget(self._led_autostop, 0, 2)
        lay.setColumnStretch(0, 3)
        lay.setColumnStretch(1, 2)
        lay.setColumnStretch(2, 2)

        wid.setStyleSheet("""
            .QLabel{
                min-width: 6.5em; max-width: 6.5em; min-height: 1.5em;
                qproperty-alignment: 'AlignRight | AlignVCenter';
            }
            PyDMLabel{
                qproperty-alignment: AlignCenter;
            }""")
        return wid
Exemple #8
0
    def _create_headerline(self, labels):
        """Create and return a headerline."""
        hl = QWidget()
        hl.setLayout(QHBoxLayout())
        hl.layout().setContentsMargins(0, 9, 0, 0)

        glay = None
        for text, width in labels:
            if not width:
                if glay:
                    hl.layout().addLayout(glay)
                hl.layout().addStretch()
                glay = QGridLayout()
                glay.setAlignment(Qt.AlignCenter)
                glay.setContentsMargins(0, 0, 0, 0)
                c = 0
            else:
                label = QLabel(text, self)
                label.setStyleSheet("""
                    min-width:valueem; min-height:1.29em; max-height:1.29em;
                    font-weight:bold; qproperty-alignment: AlignCenter;
                    """.replace('value', str(width)))
                glay.addWidget(label, 0, c)
                c += 1
        return hl
Exemple #9
0
    def display_header(self):
        '''Display the header of the interface'''
        hd_glay = QGridLayout()

        title_lb = QLabel(
            '<h2>' + self.device_name + ' - POSITION MONITOR </h2>', self)
        title_lb.setAlignment(Qt.AlignCenter)
        hd_glay.addWidget(title_lb, 0, 2, 2, 1)

        countx = 0

        for led_lb, led_channel in self.header.items():
            trig_led = SiriusLedState(init_channel=self.prefix +
                                      self.device_name + ':' + led_channel)
            trig_led.setFixedSize(30, 30)
            hd_glay.addWidget(trig_led, 0, countx, 1, 1)

            trig_lb = QLabel(led_lb)
            trig_lb.setAlignment(Qt.AlignCenter)
            hd_glay.addWidget(trig_lb, 1, countx, 1, 1)

            countx += 1

        hd_glay.setAlignment(Qt.AlignCenter)

        return hd_glay
Exemple #10
0
    def _setupUi(self):
        ''' Display the tabs of the graphic interface '''

        if_glay = QGridLayout()
        if_glay.addWidget(self.displayTabs(), 1, 0, 1, 1)
        if_glay.addWidget(self.displayHeader(), 0, 0, 1, 1)
        if_glay.setAlignment(Qt.AlignTop)

        self.setLayout(if_glay)
Exemple #11
0
    def _setupDelaySettingWidget(self):
        props = [
            ('Trigger', 'TRIGGER_DELAY'),
            ('Refer_' + self.dev.nickname, 'CH7_DELAY'),
            ('VM_' + self.dev.nickname, 'CH8_DELAY'),
            ('SSA_' + self.dev.nickname, 'CH2_DELAY'),
        ]
        if self.dev.nickname == 'SHB':
            props.append(('Pick-Up', 'CH1_DELAY'))
        elif self.dev.nickname == 'K1':
            props.extend([(self.dev.nickname + ' Fwd', 'CH1_DELAY'),
                          (self.dev.nickname + ' Reflec', 'CH9_DELAY'),
                          ('Buncher Input', 'CH3_DELAY'),
                          ('A1 Input', 'CH4_DELAY'), ('A2 Input', 'CH5_DELAY'),
                          ('Buncher Output', 'CH6_DELAY')])
        elif self.dev.nickname == 'K2':
            props.extend([(self.dev.nickname + ' Fwd', 'CH1_DELAY'),
                          (self.dev.nickname + ' Reflec', 'CH9_DELAY'),
                          ('A3 Input', 'CH3_DELAY'), ('A4 Input', 'CH4_DELAY'),
                          ('A3 Output', 'CH5_DELAY'),
                          ('A4 Output', 'CH6_DELAY')])

        wid = QGroupBox('Delay Setting')
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignTop)

        row = 0
        lb_sett = QLabel('<h4>Settings</h4>', self, alignment=Qt.AlignCenter)
        lb_actl = QLabel('<h4>Actual</h4>', self, alignment=Qt.AlignCenter)
        lay.addWidget(lb_sett, row, 1)
        lay.addWidget(lb_actl, row, 2)

        row += 1
        lim_label = '0~4095' if self.dev.nickname == 'SHB' else '0~1023'
        lb_lim1 = QLabel(lim_label, self, alignment=Qt.AlignCenter)
        lb_unit = QLabel('clk', self, alignment=Qt.AlignCenter)
        lay.addWidget(lb_lim1, row, 1)
        lay.addWidget(lb_unit, row, 2)

        for name, prop in props:
            row += 1
            laba = QLabel(name, self)
            sppv = self.devpref + ':SET_' + prop
            rbpv = self.devpref + ':GET_' + prop
            spa = SiriusSpinbox(self, init_channel=sppv)
            spa.showStepExponent = False
            rba = SiriusLabel(self, init_channel=rbpv)
            lay.addWidget(laba, row, 0)
            lay.addWidget(spa, row, 1)
            lay.addWidget(rba, row, 2)

            if name == 'Trigger' and self.dev.nickname == 'SHB':
                row += 1
                lb_lim2 = QLabel('0~1023', self, alignment=Qt.AlignCenter)
                lay.addWidget(lb_lim2, row, 1)

        return wid
Exemple #12
0
    def _setupUi(self):
        '''Build the graphic interface'''
        wid = QWidget(self)
        if_glay = QGridLayout()

        if_glay.addLayout(self.display_header(), 0, 0, 1, 3)
        if_glay.addLayout(self.display_graph(), 1, 0, 2, 1)
        if_glay.addLayout(self.display_mainData(), 1, 1, 1, 1)
        if_glay.addLayout(self.display_selectors(), 1, 2, 1, 1)
        if_glay.setAlignment(Qt.AlignTop)
        if_glay.setColumnStretch(0, 10)

        wid.setLayout(if_glay)
        self.setCentralWidget(wid)
Exemple #13
0
    def _setupUi(self):
        self.title = QLabel('<h2>' + self._device.device_name + '</h2>',
                            self,
                            alignment=Qt.AlignCenter)

        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignTop)
        lay.addWidget(self.title, 0, 0, 1, 2)
        lay.addWidget(self._setupModSignalWidget(), 1, 0)
        lay.addWidget(self._setupExtIntlkSignalWidget(), 1, 1)

        self.setStyleSheet("""
            QLed{
                min-width: 1.29em; max-width: 1.29em;
            }""")
Exemple #14
0
    def displayControlMPS(self, tab_type):
        ''' Display the desired tab widget '''
        wid = QWidget(self)
        if_glay = QGridLayout()

        if tab_type != 0:
            if_glay.addLayout(self.displayTempGroups(), 0, 0, 1, 1)

        if_glay.setAlignment(Qt.AlignTop)
        wid.setLayout(if_glay)

        if tab_type == 0:
            self.mps_glay = if_glay
            self.changeWid(self.mps_glay)
        return wid
Exemple #15
0
    def _setupUi(self):
        monitor = QGroupBox('Monitor')
        glay = QGridLayout(monitor)
        glay.setAlignment(Qt.AlignTop)
        glay.addWidget(QLabel('', self), 0, 0)

        sec_lbls = get_status_labels()
        for col, sec in enumerate(sec_lbls):
            lbl = QLabel(sec, self, alignment=Qt.AlignCenter)
            glay.addWidget(lbl, 0, col + 1)
        sub_lbls = set()
        for sec in sec_lbls:
            sub_lbls.update(get_status_labels(sec))
        sub_lbls = sorted(sub_lbls)
        for row, sub in enumerate(sub_lbls):
            lbl = QLabel(sub, self, alignment=Qt.AlignCenter)
            glay.addWidget(lbl, row + 1, 0)

        line = QFrame(self)
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        glay.addWidget(line, row + 2, 0, 1, len(sec_lbls) + 1)

        glay.addWidget(QLabel('All', self, alignment=Qt.AlignCenter), row + 3,
                       0)

        for col, sec in enumerate(sec_lbls):
            lbls = get_status_labels(sec)
            for row, sub in enumerate(sub_lbls):
                if sub not in lbls:
                    continue
                bit = lbls.index(sub)
                led = SiriusLedAlert(self,
                                     self._inj_prefix.substitute(
                                         propty='DiagStatus' + sec + '-Mon'),
                                     bit=bit)
                glay.addWidget(led, row + 1, col + 1)

            bit = sec_lbls.index(sec)
            led = SiriusLedAlert(
                self,
                self._inj_prefix.substitute(propty='DiagStatus-Mon'),
                bit=bit)
            glay.addWidget(led, row + 3, col + 1)

        lay = QHBoxLayout(self)
        lay.setContentsMargins(0, 0, 0, 0)
        lay.addWidget(monitor)
Exemple #16
0
    def __init__(self, parent=None, allItems=(), selectedItems=()):
        QDialog.__init__(
            self, parent, flags=Qt.WindowSystemMenuHint | Qt.WindowTitleHint)

        self.allItems = allItems

        self.fromKeys = list(range(len(allItems)))
        self.selectedKeys = []
        for item in selectedItems:
            key = allItems.index(item)
            self.fromKeys.remove(key)
            self.selectedKeys.append(key)

        self.setAttribute(Qt.WA_DeleteOnClose)

        fromLabel = QLabel(_("Select from"))
        self.fromList = QListWidget(self)
        self.fromList.addItems(allItems[key] for key in self.fromKeys)

        selectedLabel = QLabel(_("Selected"))
        self.selectedList = QListWidget(self)
        self.selectedList.addItems(allItems[key] for key in self.selectedKeys)

        self.selectButton = QPushButton(_("Select"))
        self.deselectButton = QPushButton(_("Deselect"))
        self.selectBox = QDialogButtonBox(Qt.Vertical)
        self.selectBox.addButton(self.selectButton, QDialogButtonBox.ActionRole)
        self.selectBox.addButton(self.deselectButton, QDialogButtonBox.ActionRole)
        self.selectButton.clicked.connect(self.on_select)
        self.deselectButton.clicked.connect(self.on_deselect)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        mainLayout = QGridLayout(self)
        mainLayout.addWidget(fromLabel, 0, 0)
        mainLayout.addWidget(selectedLabel, 0, 2)
        mainLayout.addWidget(self.fromList, 1, 0)
        mainLayout.addWidget(self.selectBox, 1, 1)
        mainLayout.addWidget(self.selectedList, 1, 2)
        mainLayout.addWidget(self.buttonBox, 2, 0, 1, 3)
        mainLayout.setAlignment(self.selectBox, Qt.AlignCenter)
        self.setLayout(mainLayout)
Exemple #17
0
    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
Exemple #18
0
    def _setupUi(self):
        fbsett_wid = self._setupFeedbackSettings()
        status_wid = self._setupStatusWidget()

        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignTop | Qt.AlignCenter)
        if self._is_resumed:
            led_gensts = SiriusLedAlert(self, self.dev_pref+':ERRSUM')
            dev_label = QLabel(
                '<h3>'+self._label+'</h3>', self, alignment=Qt.AlignCenter)
            self.pb_detail = QPushButton(qta.icon('fa5s.ellipsis-v'), '', self)
            self.pb_detail.setObjectName('dtls')
            self.pb_detail.setStyleSheet(
                '#dtls{min-width:20px;max-width:20px;icon-size:15px;}')
            cmd = ['sirius-hla-si-di-bbb.py', '-dev', self.dev_pref]
            if self._prefix:
                cmd.extend(['-p', self._prefix])
            connect_newprocess(self.pb_detail, cmd, self)
            hbox_label = QHBoxLayout()
            hbox_label.setContentsMargins(0, 0, 0, 0)
            hbox_label.addWidget(led_gensts, alignment=Qt.AlignLeft)
            hbox_label.addWidget(dev_label)
            hbox_label.addWidget(self.pb_detail, alignment=Qt.AlignRight)
            hbox_label.setStretch(0, 1)
            hbox_label.setStretch(1, 10)
            hbox_label.setStretch(2, 1)

            wid = QWidget(self)
            wid.setObjectName('box')
            wid.setStyleSheet("""
                #box{border: 2px solid gray;}""")
            lay_box = QGridLayout(wid)
            lay_box.setVerticalSpacing(15)
            lay_box.addLayout(hbox_label, 0, 0)
            lay_box.addWidget(fbsett_wid, 1, 0)
            lay_box.addWidget(status_wid, 2, 0)

            lay.setContentsMargins(0, 0, 0, 0)
            lay.addWidget(wid)
        else:
            info_wid = BbBInfoWidget(self, self._prefix, self._device)
            lay.addWidget(fbsett_wid, 0, 1)
            lay.addWidget(status_wid, 0, 2)
            lay.addWidget(info_wid, 0, 3)
            lay.setColumnStretch(0, 3)
            lay.setColumnStretch(4, 3)
            lay.setRowStretch(1, 3)
Exemple #19
0
    def _create_corr_summwidget(self, corr):
        """Create and return a corrector detail widget."""
        wid = QWidget()
        wid.setSizePolicy(QSzPlcy.Preferred, QSzPlcy.Maximum)
        lay = QGridLayout(wid)
        lay.setContentsMargins(0, 0, 0, 0)
        lay.setAlignment(Qt.AlignCenter)

        propty_sp = 'Current-SP' if corr.sec == 'LI' else 'Kick-SP'
        propty_mon = propty_sp.replace('SP', 'Mon')

        led = SiriusLedState(
            self, corr.substitute(prefix=self.prefix, propty='PwrState-Sts'))
        led.setStyleSheet("max-width:1.29em;")
        lay.addWidget(led, 1, 1)

        nickname = corr.get_nickname(sec=corr.sec == 'LI', dev=True)
        pb = QPushButton(nickname, self)
        if corr.dis == 'PU':
            util.connect_window(pb, PUDetailWindow, parent=self, devname=corr)
        else:
            util.connect_window(pb, PSDetailWindow, parent=self, psname=corr)
        pb.setStyleSheet("""
            min-width:6em; max-width:6em; min-height:1.29em;""")
        lay.addWidget(pb, 1, 2)

        sp_kick = PyDMSpinboxScrollbar(
            self, corr.substitute(prefix=self.prefix, propty=propty_sp))
        sp_kick.setStyleSheet("QDoubleSpinBox{min-width:4em; max-width:4em; }"
                              "QScrollBar{max-width:4em;}")
        sp_kick.spinbox.precisionFromPV = False
        sp_kick.spinbox.precision = 1
        sp_kick.scrollbar.limitsFromPV = True
        lay.addWidget(sp_kick, 1, 3, 2, 1)

        lb_kick = PyDMLabel(
            self, corr.substitute(prefix=self.prefix, propty=propty_mon))
        lb_kick.setStyleSheet("""
            min-width:5em; max-width:5em; min-height:1.29em;""")
        lb_kick.showUnits = True
        lb_kick.precisionFromPV = False
        lb_kick.precision = 1
        lb_kick.setAlignment(Qt.AlignCenter)
        lay.addWidget(lb_kick, 1, 4)
        return wid
Exemple #20
0
    def _setupUi(self):
        gbox_feedback = self._setupFBSettingsWidget()
        gbox_coefview = self._setupCoefficientsViewWidget()
        gbox_coefedit = self._setupCoefficientsEditWidget()

        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignLeft | Qt.AlignTop)
        lay.setVerticalSpacing(9)
        lay.setHorizontalSpacing(15)
        lay.addWidget(gbox_coefedit, 0, 0, 1, 2)
        lay.addWidget(gbox_feedback, 1, 0)
        if not self.dev_pref.endswith('-L'):
            gbox_bun_clean = self._setupBCSettingsWidget()
            lay.addWidget(gbox_bun_clean, 1, 1)

        lay.addWidget(gbox_coefview, 0, 2, 2, 1)
        lay.setColumnStretch(0, 2)
        lay.setColumnStretch(2, 1)
Exemple #21
0
    def _setupAttenuationWidget(self):
        props = [
            ('VM', 'VM_ADT', 0.25),
            ('Refer_' + self.dev.nickname, 'CH7_ADT', 0.5),
            ('VM_' + self.dev.nickname, 'CH8_ADT', 0.5),
            ('SSA_' + self.dev.nickname, 'CH2_ADT', 0.5),
        ]
        if self.dev.nickname == 'SHB':
            props.append(('Pick-Up', 'CH1_ADT', 0.5))
        elif self.dev.nickname == 'K1':
            props.extend([(self.dev.nickname + ' Fwd', 'CH1_ADT', 0.5),
                          ('Buncher Input', 'CH3_ADT', 0.5),
                          ('A1 Input', 'CH4_ADT', 0.5),
                          ('A2 Input', 'CH5_ADT', 0.5),
                          ('Buncher Output', 'CH6_ADT', 0.5)])
        elif self.dev.nickname == 'K2':
            props.extend([(self.dev.nickname + ' Fwd', 'CH1_ADT', 0.5),
                          ('A3 Input', 'CH3_ADT', 0.5),
                          ('A4 Input', 'CH4_ADT', 0.5),
                          ('A3 Output', 'CH5_ADT', 0.5),
                          ('A4 Output', 'CH6_ADT', 0.5)])

        wid = QGroupBox('Attenuation')
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignTop)

        row = 0
        lb_lim = QLabel('0~63', self, alignment=Qt.AlignCenter)
        lb_unit = QLabel('dB', self, alignment=Qt.AlignCenter)
        lay.addWidget(lb_lim, row, 1)
        lay.addWidget(lb_unit, row, 2)

        for name, prop, factor in props:
            row += 1
            laba = QLabel(name, self)
            sppv = self.devpref + ':SET_' + prop
            spa = SiriusSpinbox(self, init_channel=sppv)
            spa.showStepExponent = False
            dsc = QLabel('*' + str(factor))
            lay.addWidget(laba, row, 0)
            lay.addWidget(spa, row, 1)
            lay.addWidget(dsc, row, 2)

        return wid
Exemple #22
0
    def _setupMultiPulsePSWidget(self):
        self._ld_mpulspwrsp = QLabel('Power SP [V]', self)
        self._sb_mpulspwrsp = SiriusSpinbox(
            self, self.prefix + self.dev_pref + ':EG-PulsePS:poweroutsoft')
        self._sb_mpulspwrsp.limitsFromChannel = False
        self._sb_mpulspwrsp.setMinimum(0)
        self._sb_mpulspwrsp.setMaximum(300)
        self._sb_mpulspwrsp.showStepExponent = False
        self._ld_mpulspwrrb = QLabel('Power RB [V]', self)
        self._lb_mpulspwrrb = PyDMLabel(
            self, self.prefix + self.dev_pref + ':EG-PulsePS:powerinsoft')

        wid = QGroupBox('Multi Pulse Power Supply', self)
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignVCenter)
        lay.addWidget(self._ld_mpulspwrsp, 0, 0)
        lay.addWidget(self._sb_mpulspwrsp, 1, 0)
        lay.addWidget(self._ld_mpulspwrrb, 0, 1)
        lay.addWidget(self._lb_mpulspwrrb, 1, 1)
        return wid
Exemple #23
0
    def setup_layout(self):
        self.instantiated = False
        layout = QGridLayout()

        self.load_atlas_button = add_button(
            "Load atlas",
            layout,
            self.load_atlas,
            0,
            0,
            minimum_width=200,
        )
        self.load_reference_button = add_button(
            "Load reference image",
            layout,
            self.load_reference,
            1,
            0,
            visibility=False,
        )
        self.load_annotated_button = add_button(
            "Load annotated image",
            layout,
            self.load_annotated,
            2,
            0,
            visibility=False,
        )

        layout.setAlignment(QtCore.Qt.AlignTop)
        layout.setSpacing(4)
        self.status_label = QLabel()

        self.status_label.setText("Ready")

        layout.addWidget(self.status_label, 4, 0)

        self.info_box = QTextBrowser()
        self.info_box.setVisible(False)
        layout.addWidget(self.info_box)
        self.setLayout(layout)
Exemple #24
0
    def _setupSummary(self):
        self._pb_off = PyDMPushButton(self,
                                      label='',
                                      icon=self._icon_off,
                                      init_channel=self._inj_prefix.substitute(
                                          propty='InjSysTurnOff-Cmd'),
                                      pressValue=0)
        self._pb_off.setObjectName('bt')
        self._pb_off.setStyleSheet(
            '#bt{min-width:25px; max-width:25px; icon-size:20px;}')
        self._pb_on = PyDMPushButton(self,
                                     label='',
                                     icon=self._icon_on,
                                     init_channel=self._inj_prefix.substitute(
                                         propty='InjSysTurnOn-Cmd'),
                                     pressValue=0)
        self._pb_on.setObjectName('bt')
        self._pb_on.setStyleSheet(
            '#bt{min-width:25px; max-width:25px; icon-size:20px;}')

        self._led_sts = InjSysStbyLed(self)
        self._led_sts.setStyleSheet(
            'QLed{min-width:1.29em; max-width:1.29em;}')

        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignCenter)
        lay.addWidget(self._pb_off, 0, 0)
        lay.addWidget(self._pb_on, 0, 1)
        lay.addWidget(self._led_sts, 1, 0, 1, 2, alignment=Qt.AlignCenter)

        # menu
        for cmmtype in ['on', 'off']:
            order = getattr(self._handler, cmmtype + '_order')
            menu = QMenu('Select Turn ' + cmmtype.upper() + ' Commands', self)
            setattr(self, cmmtype + '_menu', menu)
            self.menu.addMenu(menu)
            for cmm in order:
                act = menu.addAction(self._handler.HANDLER_DESC[cmm])
                act.setObjectName(cmm)
                act.setCheckable(True)
Exemple #25
0
    def _setupAttCompensationWidget(self):
        props = [
            ('Refer_' + self.dev.nickname, 'CH7_ATT'),
            ('VM_' + self.dev.nickname, 'CH8_ATT'),
            ('SSA_' + self.dev.nickname, 'CH2_ATT'),
        ]
        if self.dev.nickname == 'SHB':
            props.append(('Pick-Up', 'CH1_ATT'))
        elif self.dev.nickname == 'K1':
            props.extend([(self.dev.nickname + ' Fwd', 'CH1_ATT'),
                          (self.dev.nickname + ' Reflec', 'CH9_ATT'),
                          ('Buncher Input', 'CH3_ATT'),
                          ('A1 Input', 'CH4_ATT'), ('A2 Input', 'CH5_ATT'),
                          ('Buncher Output', 'CH6_ATT')])
        elif self.dev.nickname == 'K2':
            props.extend([(self.dev.nickname + ' Fwd', 'CH1_ATT'),
                          (self.dev.nickname + ' Reflec', 'CH9_ATT'),
                          ('A3 Input', 'CH3_ATT'), ('A4 Input', 'CH4_ATT'),
                          ('A3 Output', 'CH5_ATT'), ('A4 Output', 'CH6_ATT')])

        wid = QGroupBox('Att. Compensation')
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignTop)

        row = 0
        lb_lim = QLabel('(0.00~200.00)', self, alignment=Qt.AlignCenter)
        lay.addWidget(lb_lim, row, 1)

        for name, prop in props:
            row += 1
            laba = QLabel(name, self)
            sppv = self.devpref + ':SET_' + prop
            spa = SiriusSpinbox(self, init_channel=sppv)
            spa.showStepExponent = False
            spa.precisionFromPV = False
            spa.precision = 2
            lay.addWidget(laba, row, 0)
            lay.addWidget(spa, row, 1)

        return wid
Exemple #26
0
    def _setupTopUpModeWidget(self):
        self._ld_tuperd = QLabel('Period', self)
        self._sb_tuperd = SiriusSpinbox(
            self, self._inj_prefix.substitute(propty='TopUpPeriod-SP'))
        self._sb_tuperd.showStepExponent = False
        self._lb_tuperd = PyDMLabel(
            self, self._inj_prefix.substitute(propty='TopUpPeriod-RB'))
        self._lb_tuperd.showUnits = True

        self._ld_tumaxpu = QLabel('Max.Nr.Pulses', self)
        self._sb_tumaxpu = SiriusSpinbox(
            self, self._inj_prefix.substitute(propty='TopUpMaxNrPulses-SP'))
        self._sb_tumaxpu.showStepExponent = False
        self._lb_tumaxpu = PyDMLabel(
            self, self._inj_prefix.substitute(propty='TopUpMaxNrPulses-RB'))
        self._lb_tumaxpu.showUnits = True

        wid = QWidget()
        lay = QGridLayout(wid)
        lay.setContentsMargins(0, 6, 0, 0)
        lay.setAlignment(Qt.AlignTop)
        lay.addWidget(self._ld_tuperd, 0, 0)
        lay.addWidget(self._sb_tuperd, 0, 1)
        lay.addWidget(self._lb_tuperd, 0, 2)
        lay.addWidget(self._ld_tumaxpu, 1, 0)
        lay.addWidget(self._sb_tumaxpu, 1, 1)
        lay.addWidget(self._lb_tumaxpu, 1, 2)
        lay.setColumnStretch(0, 3)
        lay.setColumnStretch(1, 2)
        lay.setColumnStretch(2, 2)

        wid.setStyleSheet("""
            .QLabel{
                min-width: 6.5em; max-width: 6.5em; min-height: 1.5em;
                qproperty-alignment: 'AlignRight | AlignVCenter';
            }
            PyDMLabel{
                qproperty-alignment: AlignCenter;
            }""")
        return wid
Exemple #27
0
    def setup_layout(self):
        self.instantiated = False
        layout = QGridLayout()

        self.load_button = add_button(
            "Load project",
            layout,
            self.load_amap_directory,
            0,
            0,
            minimum_width=200,
        )

        self.load_atlas_button = add_button("Load atlas",
                                            layout,
                                            self.load_atlas,
                                            0,
                                            1,
                                            visibility=False)
        self.save_button = add_button("Save",
                                      layout,
                                      self.save,
                                      7,
                                      1,
                                      visibility=False)

        self.status_label = QLabel()
        self.status_label.setText("Ready")

        layout.addWidget(self.status_label, 8, 0)
        layout.setAlignment(QtCore.Qt.AlignTop)
        layout.setSpacing(4)
        self.setLayout(layout)

        self.add_track_panel(layout)
        self.add_region_panel(layout)
        self.add_brainrender_panel(layout)

        self.setLayout(layout)
Exemple #28
0
    def _setupUi(self):
        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignTop)
        lay.setHorizontalSpacing(25)
        lay.setVerticalSpacing(15)

        self.title = QLabel(
            '<h4>LLRF Interlock Details</h4>', self,
            alignment=Qt.AlignCenter)
        lay.addWidget(self.title, 0, 0, 1, 3)

        # inputs
        col = 0
        for name, dic in self.chs['LLRF Intlk Details']['Inputs'].items():
            gbox = QGroupBox(name, self)
            lay_intlk = QGridLayout(gbox)
            lay_intlk.setAlignment(Qt.AlignTop)
            lay_intlk.setHorizontalSpacing(9)
            lay_intlk.setVerticalSpacing(0)

            icol = 0
            for key in dic['Status']:
                desc = QLabel(key, self, alignment=Qt.AlignCenter)
                desc.setStyleSheet('QLabel{min-width:1em; max-width:2.5em;}')
                lay_intlk.addWidget(desc, 0, icol)
                icol += 1

            labels = dic['Labels']
            for idx, label in enumerate(labels):
                irow, icol = idx+1, 0
                for key, pvn in dic['Status'].items():
                    led = SiriusLedAlert(self, self.prefix+pvn, bit=idx)
                    led.shape = led.Square
                    if key != 'Mon':
                        led.offColor = led.DarkRed
                    lay_intlk.addWidget(led, irow, icol)
                    icol += 1
                lbl = QLabel(label, self)
                lbl.setStyleSheet('QLabel{min-width:12em;}')
                lay_intlk.addWidget(lbl, irow, icol)

            lay.addWidget(gbox, 1, col)
            col += 1

        # timestamps
        gbox_time = QGroupBox('Timestamps', self)
        lay_time = QGridLayout(gbox_time)
        lay_time.setAlignment(Qt.AlignTop)
        lay_time.setHorizontalSpacing(9)
        lay_time.setVerticalSpacing(9)
        for idx, pvn in self.chs['LLRF Intlk Details']['Timestamps'].items():
            irow = int(idx)-1
            desc = QLabel('Interlock '+idx, self, alignment=Qt.AlignCenter)
            desc.setStyleSheet('QLabel{min-width:6em;}')
            lbl = PyDMLabel(self, self.prefix+pvn)
            lbl.showUnits = True
            lay_time.addWidget(desc, irow, 0)
            lay_time.addWidget(lbl, irow, 1)
        lay.addWidget(gbox_time, 1, col)
Exemple #29
0
    def _setupPISettingWidget(self):
        wid = QGroupBox('PI Setting')
        lay = QGridLayout(wid)
        lay.setAlignment(Qt.AlignTop)

        row = 0
        lb_sett = QLabel('<h4>Settings</h4>', self, alignment=Qt.AlignCenter)
        lb_actl = QLabel('<h4>Actual</h4>', self, alignment=Qt.AlignCenter)
        lay.addWidget(lb_sett, row, 1)
        lay.addWidget(lb_actl, row, 2)

        row += 1
        lb_lim = QLabel('0~1023', self, alignment=Qt.AlignCenter)
        lay.addWidget(lb_lim, row, 1)

        for prop in ['KP', 'KI']:
            row += 1
            laba = QLabel(prop, self)
            sppv = self.devpref + ':SET_' + prop
            rbpv = self.devpref + ':GET_' + prop
            spa = SiriusSpinbox(self, init_channel=sppv)
            spa.showStepExponent = False
            rba = SiriusLabel(self, init_channel=rbpv)
            lay.addWidget(laba, row, 0)
            lay.addWidget(spa, row, 1)
            lay.addWidget(rba, row, 2)

        row += 1
        lab1 = QLabel('Integral', self)
        sppv = self.devpref + ':SET_INTEGRAL_ENABLE'
        rbpv = self.devpref + ':GET_INTEGRAL_ENABLE'
        sp1 = PyDMStateButton(self, init_channel=sppv)
        rb1 = SiriusLedState(self, init_channel=rbpv)
        lay.addWidget(lab1, row, 0)
        lay.addWidget(sp1, row, 1)
        lay.addWidget(rb1, row, 2)

        return wid
Exemple #30
0
    def _setupUi(self):
        lay = QGridLayout(self)
        lay.setAlignment(Qt.AlignTop)
        lay.setHorizontalSpacing(25)
        lay.setVerticalSpacing(15)

        self.title = QLabel(
            '<h3>RF Temperature Monitor</h3>', self,
            alignment=Qt.AlignCenter)
        lay.addWidget(self.title, 0, 0)

        if len(self.chs['TempMon']) == 1:
            dettab = QTabWidget(self)
        else:
            dettab = DetachableTabWidget(self)
        dettab.setObjectName(self.section+'Tab')
        for dettabtitle, dtcontent in self.chs['TempMon'].items():
            if dettabtitle == 'Power':
                labels = list(dtcontent.keys())
                channels = [self.prefix+ch for ch in dtcontent.values()]
                wid = BarGraph(
                    channels=channels, xLabels=labels, yLabel='Power [kW]',
                    title=dettabtitle)
            else:
                wid = QTabWidget()
                for tabtitle, content in dtcontent.items():
                    labels = list(content.keys())
                    channels = [self.prefix+ch for ch in content.values()]
                    ylabel = 'Temperature [°C]' \
                        if 'temp' in dettabtitle.lower() \
                        else 'Diss. Power [kW]'
                    tabwid = BarGraph(
                        channels=channels, xLabels=labels,
                        yLabel=ylabel, title=dettabtitle)
                    wid.addTab(tabwid, tabtitle)
            dettab.addTab(wid, dettabtitle)
        lay.addWidget(dettab, 1, 0)