Пример #1
0
 def _connect_buttons(self, widget):
     w = widget.findChild(QPushButton, 'dclink_button')
     if w:
         psname = self._psname[0]
         dclinks = PSSearch.conv_psname_2_dclink(psname)
         if dclinks:
             dclink_type = PSSearch.conv_psname_2_psmodel(dclinks[0])
             if dclink_type != 'REGATRON_DCLink':
                 connect_window(w, PSDetailWindow, self, psname=dclinks)
             else:
                 if len(dclinks) > 1:
                     menu = QMenu(w)
                     for dcl in dclinks:
                         act = QAction(dcl, menu)
                         connect_newprocess(act, [
                             'sirius-hla-as-ps-regatron-individual', '-dev',
                             dcl
                         ],
                                            parent=self,
                                            is_pydm=True)
                         menu.addAction(act)
                     w.setMenu(menu)
                 else:
                     connect_newprocess(w, [
                         'sirius-hla-as-ps-regatron-individual', '-dev',
                         dclinks[0]
                     ],
                                        parent=self,
                                        is_pydm=True)
         else:
             w.setHidden(True)
Пример #2
0
 def _setupUi(self):
     hlay = QHBoxLayout(self)
     hlay.addStretch()
     pbt = QPushButton(self._scrn)
     pbt.setStyleSheet("""min-width:10em;""")
     util.connect_newprocess(
         pbt, ['sirius-hla-as-di-scrn.py', '-p', self._prefix, self._scrn],
         parent=self)
     hlay.addWidget(pbt)
     hlay.addStretch()
Пример #3
0
    def get_selection_lists_widget(self, parent):
        """."""
        sel_wid = QWidget(parent)
        sel_lay = QHBoxLayout(sel_wid)

        icon = qta.icon('fa5s.hammer', color=get_appropriate_color(self.acc))
        Window = create_window_from_widget(
            SelectionMatrix, title='Corrs and BPMs selection', icon=icon)
        btn = QPushButton('', sel_wid)
        btn.setObjectName('btn')
        btn.setIcon(qta.icon('fa5s.tasks'))
        btn.setToolTip('Open window to select BPMs and correctors')
        btn.setStyleSheet(
            '#btn{min-width:3.8em; max-width:3.8em;\
            min-height:2em; max-height:2em; icon-size:25px;}')
        connect_window(
            btn, Window, None, device=self.device,
            prefix=self.prefix, acc=self.acc)
        sel_lay.addWidget(btn)

        lay = QVBoxLayout()
        sel_lay.addStretch()
        sel_lay.addLayout(lay)

        hlay = QHBoxLayout()
        lay.addLayout(hlay)
        hlay.addWidget(SiriusEnumComboBox(
            sel_wid, self.devpref.substitute(propty='RespMatMode-Sel')))
        hlay.addWidget(SiriusLabel(
            sel_wid, self.devpref.substitute(propty='RespMatMode-Sts')))

        if self.acc in {'SI', 'BO'}:
            hlay = QHBoxLayout()
            lay.addLayout(hlay)
            pdm_chbx = PyDMCheckbox(
                sel_wid, self.devpref.substitute(propty='RFEnbl-Sel'))
            pdm_chbx.setText('use RF')
            pdm_led = SiriusLedState(
                sel_wid, self.devpref.substitute(propty='RFEnbl-Sts'))
            hlay.addWidget(pdm_chbx)
            hlay.addWidget(pdm_led)

        btn = QPushButton('', sel_wid)
        btn.setToolTip('Visualize RespMat')
        btn.setIcon(qta.icon('mdi.chart-line'))
        btn.setObjectName('btn')
        btn.setStyleSheet('#btn{max-width:40px; icon-size:40px;}')
        connect_newprocess(
            btn, [f'sirius-hla-{self.acc.lower():s}-ap-sofb.py', '--matrix'])
        sel_lay.addWidget(btn)

        return sel_wid
Пример #4
0
 def _setupMenu(self):
     # LatticeAndTwiss = QAction("Show Lattice and Twiss", self)
     # util.connect_window(LatticeAndTwiss, ShowLatticeAndTwiss,
     #                         parent=self, tl=self.tl)
     # self.menu.addAction(LatticeAndTwiss)
     PS = QAction("PS", self)
     util.connect_newprocess(PS,
                             'sirius-hla-' + self.tl + '-ps-control.py',
                             parent=self)
     self.menu.addAction(PS)
     PU = QAction("PU", self)
     util.connect_newprocess(PU,
                             'sirius-hla-' + self.tl + '-pu-control.py',
                             parent=self)
     self.menu.addAction(PU)
     SOFB = QAction("SOFB", self)
     util.connect_newprocess(SOFB,
                             'sirius-hla-' + self.tl + '-ap-sofb.py',
                             parent=self)
     self.menu.addAction(SOFB)
     ICTs = QAction("ICTs", self)
     util.connect_newprocess(ICTs,
                             'sirius-hla-' + self.tl + '-di-icts.py',
                             parent=self)
     self.menu.addAction(ICTs)
Пример #5
0
 def setupui(self):
     hbl = QHBoxLayout(self)
     hbl.setContentsMargins(0, 0, 0, 0)
     chan2vals = {
         'asyn.CNCT': 1,
         'asyn.ENBL': 1,
         'RFFEasyn.CNCT': 1,
         'RFFEasyn.ENBL': 1,
         'ADCAD9510PllStatus-Mon': 1
     }
     chan2vals = {self.get_pvname(k): v for k, v in chan2vals.items()}
     led = PyDMLedMultiChannel(self, channels2values=chan2vals)
     led.setToolTip(self.bpm)
     hbl.addWidget(led)
     connect_newprocess(
         led, ['sirius-hla-as-di-bpm.py', '-p', self.prefix, self.bpm],
         parent=self,
         signal=led.clicked)
Пример #6
0
 def _fill_dclink_container(self):
     self._dclink_is_filled = True
     self._dclink_container.layout().addWidget(
         SummaryHeader(self.dclinks[0], self.visible_props, self))
     for dclink_name in self.dclinks:
         w = SummaryWidget(dclink_name, self.visible_props, self)
         if self.dclinks_type == 'REGATRON_DCLink':
             connect_newprocess(w.detail_bt, [
                 'sirius-hla-as-ps-regatron-individual', '-dev', dclink_name
             ],
                                parent=self,
                                is_pydm=True)
         else:
             connect_window(w.detail_bt,
                            PSDetailWindow,
                            self,
                            psname=dclink_name)
         self._dclink_container.layout().addWidget(w)
         self.dclink_widgets.append(w)
Пример #7
0
    def _connect_buttons(self, widget):
        for w in widget.get_summary_widgets():
            detail_bt = w.get_detail_button()
            psname = detail_bt.text()
            if not psname:
                psname = detail_bt.toolTip()
            psname = _PVName(psname)
            if PSSearch.conv_psname_2_psmodel(psname) == 'REGATRON_DCLink':
                connect_newprocess(
                    w,
                    ['sirius-hla-as-ps-regatron-individual', '-dev', psname],
                    parent=self,
                    is_pydm=True)
            else:
                connect_window(detail_bt, PSDetailWindow, self, psname=psname)

            trim_bt = w.get_trim_button()
            if trim_bt is not None:
                connect_window(trim_bt, PSTrimWindow, self, device=psname)
Пример #8
0
    def _setupUi(self):
        self.setStyleSheet("""QMenuBar::item {\npadding: 0 1em 0 0.17em;\n}""")
        self.config_menu = self.addMenu('Booster Ramp Configuration')
        self.act_new = self.config_menu.addAction('New from template')
        self.act_new.setIcon(qta.icon('mdi.file'))
        self.act_new.setShortcut(QKeySequence.New)
        self.act_new.triggered.connect(self.createNewConfigFromTemplate)
        self.act_load = self.config_menu.addAction('Load existing config...')
        self.act_load.setIcon(qta.icon('mdi.folder-open'))
        self.act_load.setShortcut(QKeySequence.Open)
        self.act_load.triggered.connect(self.showLoadExistingConfigPopup)
        self.act_save = self.config_menu.addAction('Save')
        self.act_save.setIcon(qta.icon('mdi.content-save'))
        self.act_save.setShortcut(QKeySequence.Save)
        self.act_save.triggered.connect(self._saveAndEmitConfigName)
        self.act_save_as = self.config_menu.addAction('Save As...')
        self.act_save_as.setIcon(qta.icon('mdi.content-save-settings'))
        self.act_save_as.setShortcut(
            QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_S))
        self.act_save_as.triggered.connect(self.showSaveAsPopup)
        self.config_menu.addSeparator()
        self.act_reconst_normconf_fromwfm = self.config_menu.addAction(
            'Reconstruct norm. configurations from waveforms...')
        self.act_reconst_normconf_fromwfm.setIcon(qta.icon('mdi.laravel'))
        self.act_reconst_normconf_fromwfm.triggered.connect(
            _part(self._handleReconstructConfig, 'normconfigs'))
        self.act_reconst_rfparams_frompvs = self.config_menu.addAction(
            'Reconstruct RF parameters from PVs...')
        self.act_reconst_rfparams_frompvs.setIcon(qta.icon('mdi.laravel'))
        self.act_reconst_rfparams_frompvs.triggered.connect(
            _part(self._handleReconstructConfig, 'rf'))
        self.act_reconst_tiparams_frompvs = self.config_menu.addAction(
            'Reconstruct TI parameters from PVs...')
        self.act_reconst_tiparams_frompvs.setIcon(qta.icon('mdi.laravel'))
        self.act_reconst_tiparams_frompvs.triggered.connect(
            _part(self._handleReconstructConfig, 'ti'))
        self.config_menu.addSeparator()

        self.ramp_params_menu = self.addMenu('Ramping Parameters')
        self.menu_plotunits = self.ramp_params_menu.addMenu(
            'Plot waveforms in...')
        self.menu_plotunits.setIcon(qta.icon('mdi.chart-line'))
        self.act_plotcurrents = self.menu_plotunits.addAction('Currents')
        self.act_plotcurrents.triggered.connect(
            _part(self.plotUnitSignal.emit, 'Currents'))
        self.act_plotstrengths = self.menu_plotunits.addAction('Strengths')
        self.act_plotstrengths.triggered.connect(
            _part(self.plotUnitSignal.emit, 'Strengths'))

        self.act_optics = self.addAction('Optics Adjustments Settings')
        self.act_optics.triggered.connect(self._showOpticsSettingsPopup)

        self.open_menu = self.addMenu('Open...')
        self.act_ps = self.open_menu.addAction('PS')
        self.act_ps.setIcon(qta.icon('mdi.car-battery'))
        util.connect_newprocess(self.act_ps,
                                'sirius-hla-bo-ps-control.py',
                                parent=self)
        self.act_pm = self.open_menu.addAction('PU')
        self.act_pm.setIcon(qta.icon('mdi.current-ac'))
        util.connect_newprocess(self.act_pm,
                                'sirius-hla-bo-pu-control.py',
                                parent=self)
        self.act_sofb = self.open_menu.addAction('SOFB')
        self.act_sofb.setIcon(qta.icon('fa5s.hammer'))
        util.connect_newprocess(self.act_sofb,
                                'sirius-hla-bo-ap-sofb.py',
                                parent=self)
        self.act_ti = self.open_menu.addAction('Timing')
        self.act_ti.setIcon(qta.icon('mdi.timer'))
        util.connect_newprocess(self.act_ti,
                                'sirius-hla-as-ti-control.py',
                                parent=self)
        self.act_dcct = self.open_menu.addAction('DCCT')
        self.act_dcct.setIcon(qta.icon('mdi.current-dc'))
        util.connect_newprocess(self.act_dcct,
                                ['sirius-hla-as-di-dcct.py', 'BO-35D:DI-DCCT'],
                                parent=self)
        self.act_tune = self.open_menu.addAction('Tune')
        self.act_tune.setIcon(qta.icon('mdi.pulse'))
        util.connect_newprocess(self.act_tune,
                                'sirius-hla-bo-di-tune.py',
                                parent=self)
Пример #9
0
    def _setupUi(self):
        self._lb_bl = QLabel('<h4>' + self._beamline + '</h4>',
                             self,
                             alignment=Qt.AlignCenter)

        self._pb_dev = QPushButton(self._device, self)
        connect_newprocess(
            self._pb_dev,
            ['sirius-hla-si-id-control.py', '-dev', self._device])

        self._sb_phs = PyDMSpinbox(self,
                                   self.dev_pref.substitute(propty='Phase-SP'))
        self._sb_phs.showStepExponent = False
        self._lb_phs = PyDMLabel(self,
                                 self.dev_pref.substitute(propty='Phase-Mon'))

        self._sb_kx = PyDMSpinbox(self,
                                  self.dev_pref.substitute(propty='Kx-SP'))
        self._sb_kx.showStepExponent = False
        self._lb_kx = PyDMLabel(self,
                                self.dev_pref.substitute(propty='Kx-Mon'))

        self._sb_phsspd = PyDMSpinbox(
            self, self.dev_pref.substitute(propty='PhaseSpeed-SP'))
        self._sb_phsspd.showStepExponent = False
        self._lb_phsspd = PyDMLabel(
            self, self.dev_pref.substitute(propty='PhaseSpeed-Mon'))

        self._pb_start = PyDMPushButton(self,
                                        label='',
                                        icon=qta.icon('fa5s.play'))
        self._pb_start.setToolTip(
            'Start automatic motion towards previously entered setpoint.')
        self._pb_start.channel = self.dev_pref.substitute(propty='DevCtrl-Cmd')
        self._pb_start.pressValue = 3  # Start
        self._pb_start.setObjectName('Start')
        self._pb_start.setStyleSheet(
            '#Start{min-width:30px; max-width:30px; icon-size:25px;}')

        self._pb_stop = PyDMPushButton(self,
                                       label='',
                                       icon=qta.icon('fa5s.stop'))
        self._pb_stop.setToolTip('Stop all motion, lock all brakes.')
        self._pb_stop.channel = self.dev_pref.substitute(propty='DevCtrl-Cmd')
        self._pb_stop.pressValue = 1  # Stop
        self._pb_stop.setObjectName('Stop')
        self._pb_stop.setStyleSheet(
            '#Stop{min-width:30px; max-width:30px; icon-size:25px;}')

        self._led_ismov = SiriusLedState(
            self, self.dev_pref.substitute(propty='Moving-Mon'))

        self._led_status = PyDMLedMultiChannel(
            self, {
                self.dev_pref.substitute(propty='Alarm-Mon'): 0,
                self.dev_pref.substitute(propty='IntlkInStop-Mon'): 0,
                self.dev_pref.substitute(propty='IntlkInEOpnGap-Mon'): 0,
                self.dev_pref.substitute(propty='IntlkOutPwrEnbld-Mon'): 1,
                self.dev_pref.substitute(propty='IsOperational-Mon'): 1
            })

        self._sb_blenbl = PyDMStateButton(
            self, self.dev_pref.substitute(propty='BeamLineCtrlEnbl-Sel'))
        self._led_blenbl = SiriusLedState(
            self, self.dev_pref.substitute(propty='BeamLineCtrlEnbl-Sts'))

        self._led_blmon = SiriusLedState(
            self, self.dev_pref.substitute(propty='BeamLineCtrl-Mon'))

        self.widgets = {
            'Beamline': ([
                self._lb_bl,
            ], 'v'),
            'Device': ([
                self._pb_dev,
            ], 'v'),
            'Alarms': ([
                self._led_status,
            ], 'v'),
            'Phase': ([self._sb_phs, self._lb_phs], 'v'),
            'Kx': ([self._sb_kx, self._lb_kx], 'v'),
            'Phase Speed': ([self._sb_phsspd, self._lb_phsspd], 'v'),
            'Start': ([
                self._pb_start,
            ], 'v'),
            'Stop': ([
                self._pb_stop,
            ], 'v'),
            'Moving': ([
                self._led_ismov,
            ], 'v'),
            'BeamLine Enable': ([self._sb_blenbl, self._led_blenbl], 'h'),
            'Beamline Control': ([
                self._led_blmon,
            ], 'v'),
        }

        layout = QHBoxLayout(self)
        for name, size in self.widgets_widths:
            objname = name.replace(' ', '')
            group = self.widgets[name]
            items, ori = group

            widget = QWidget(self)
            lay = QVBoxLayout() if ori == 'v' else QHBoxLayout()
            lay.setContentsMargins(0, 0, 0, 0)
            lay.setAlignment(Qt.AlignCenter)
            lay.setSpacing(0)
            widget.setLayout(lay)

            for item in items:
                lay.addWidget(item)

            widget.setObjectName(objname)
            widget.setStyleSheet(
                '#' + objname +
                '{{min-width:{0}em; max-width:{0}em;}}'.format(str(size)))
            layout.addWidget(widget)
Пример #10
0
 def _setupMenu(self):
     PosAng = QAction("PosAng CH-Sept", self)
     util.connect_newprocess(PosAng,
                             'sirius-hla-tb-ap-posang.py',
                             parent=self)
     self.menu.addAction(PosAng)
Пример #11
0
 def connect_newprocess(self, button, cmd, is_pydm=False):
     util.connect_newprocess(button, cmd, parent=self, is_pydm=is_pydm)
Пример #12
0
        def _create_li_menu(self):
            menu = LEVEL1('LI', self)
            menu.setObjectName('LIApp')
            launcher = LEVEL2A('Launcher', menu)
            util.connect_newprocess(launcher,
                                    'sirius-hla-li-ap-launcher.sh',
                                    is_window=False)

            PS = self._set_ps_menu('li')
            PS.setIcon(qta.icon('mdi.car-battery'))

            DIG = LEVEL2M('DI', self)
            DIG.setObjectName('LIApp')

            bpms_menu = DIG.addMenu('BPMs')
            bpms_menu.setIcon(qta.icon('mdi.currency-sign'))
            bpms_menu.setObjectName('LIApp')

            bpm2 = QAction('BPM2', bpms_menu)
            self.connect_newprocess(bpm2,
                                    ["sirius-hla-li-di-bpms.py", 'LA-BI:BPM2'])
            bpms_menu.addAction(bpm2)
            bpm3 = QAction('BPM3', bpms_menu)
            self.connect_newprocess(bpm3,
                                    ["sirius-hla-li-di-bpms.py", 'LA-BI:BPM3'])
            bpms_menu.addAction(bpm3)

            mps = LEVEL2M('MPS', menu)
            mps.setObjectName('LIApp')
            mpsmon = QAction('Monitor', mps)
            mpsmon.setIcon(qta.icon('mdi.monitor-dashboard'))
            self.connect_newprocess(mpsmon, 'sirius-hla-li-ap-mpsmon.py')
            mps.addAction(mpsmon)

            mpscon = QAction('Control', mps)
            self.connect_newprocess(mpscon, 'sirius-hla-li-ap-mpscon.py')
            mps.addAction(mpscon)

            egun = LEVEL2A('Egun', menu)
            egun.setIcon(qta.icon('mdi.spotlight-beam'))
            self.connect_newprocess(egun, 'sirius-hla-li-eg-control.py')

            mod = LEVEL2A('Modltrs', menu)
            mod.setIcon(qta.icon('mdi.current-ac'))
            self.connect_newprocess(mod, 'sirius-hla-li-pu-modltr.py')

            llrf = LEVEL2M('LLRF', menu)
            llrf.setObjectName('LIApp')
            llrf.setIcon(qta.icon('mdi.waves'))
            llrfa = QAction('Main', llrf)
            llrfa.setIcon(qta.icon('mdi.waves'))
            self.connect_newprocess(llrfa, 'sirius-hla-li-rf-llrf.py')
            llrf.addAction(llrfa)

            optics = LEVEL2M('Optics', menu)
            optics.setObjectName('LIApp')
            energy = QAction('Energy Meas', optics)
            energy.setIcon(qta.icon('mdi.gauge'))
            self.connect_newprocess(energy, 'sirius-hla-li-ap-energy.py')
            emit = QAction('Emittance Meas', optics)
            self.connect_newprocess(emit, 'sirius-hla-li-ap-emittance.py')
            optics.addAction(energy)
            optics.addAction(emit)

            self.add_object_to_level1(menu, PS)
            self.add_object_to_level1(menu, DIG)
            self.add_object_to_level1(menu, mps)
            self.add_object_to_level1(menu, egun)
            self.add_object_to_level1(menu, mod)
            self.add_object_to_level1(menu, llrf)
            self.add_object_to_level1(menu, launcher)
            self.add_object_to_level1(menu, optics)
            return menu
Пример #13
0
        def _create_tool_menu(self):
            menu = LEVEL1('Tools', self)
            menu.setObjectName('ToolMenu')

            servconf = LEVEL2A('ConfigDB', menu)
            self.connect_newprocess(servconf, 'sirius-hla-as-ap-configdb.py')
            self.add_object_to_level1(menu, servconf)

            procserv = LEVEL2A('ProcServ', menu)
            self.connect_newprocess(procserv,
                                    'sirius-hla-as-ap-pctrl',
                                    is_pydm=True)
            self.add_object_to_level1(menu, procserv)

            chart = LEVEL2A('TimeChart', menu)
            self.connect_newprocess(chart, 'timechart')
            self.add_object_to_level1(menu, chart)

            macreport = LEVEL2A('Mach.Rep', menu)
            self.connect_newprocess(macreport, 'sirius-hla-as-ap-macreport.py')
            self.add_object_to_level1(menu, macreport)

            osci = LEVEL2M('Osc.View', menu)
            asdifctdig = QAction('AS-DI-FCT', osci)
            util.connect_newprocess(asdifctdig, ['gvncviewer', 'as-di-fctdig'],
                                    is_window=False)
            asdifpmdig = QAction('AS-DI-FPM', osci)
            util.connect_newprocess(asdifpmdig, ['gvncviewer', 'as-di-fpmdig'],
                                    is_window=False)
            lidiict = QAction('LI-DI-ICT', osci)
            util.connect_newprocess(lidiict, ['gvncviewer', 'li-di-ictosc'],
                                    is_window=False)
            tbpuinjbo = QAction('TB-PU-InjBO', osci)
            util.connect_newprocess(tbpuinjbo,
                                    ['gvncviewer', 'TB-PU-Osc-InjBO'],
                                    is_window=False)
            tspuejebo = QAction('TS-PU-EjeBO', osci)
            util.connect_newprocess(tspuejebo,
                                    ['gvncviewer', 'TS-PU-Osc-EjeBO'],
                                    is_window=False)
            tspuinjsi = QAction('TS-PU-InjSI', osci)
            util.connect_newprocess(tspuinjsi,
                                    ['gvncviewer', 'TS-PU-Osc-InjSI'],
                                    is_window=False)
            sipuinjsi = QAction('SI-PU-InjSI', osci)
            util.connect_newprocess(sipuinjsi,
                                    ['gvncviewer', 'SI-PU-Osc-InjSI'],
                                    is_window=False)

            osci.addAction(asdifctdig)
            osci.addAction(asdifpmdig)
            osci.addAction(lidiict)
            osci.addAction(tbpuinjbo)
            osci.addAction(tspuejebo)
            osci.addAction(tspuinjsi)
            osci.addAction(sipuinjsi)
            self.add_object_to_level1(menu, osci)
            return menu