Пример #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 _get_related_dclinks(self, psnames, include_regatrons=False):
     if isinstance(psnames, str):
         psnames = [
             psnames,
         ]
     alldclinks = set()
     for name in psnames:
         if 'LI' in name:
             continue
         dclinks = PSSearch.conv_psname_2_dclink(name)
         if dclinks:
             dclink_model = PSSearch.conv_psname_2_psmodel(dclinks[0])
             if dclink_model != 'REGATRON_DCLink':
                 alldclinks.update(dclinks)
             elif include_regatrons:
                 for dcl in dclinks:
                     dcl_typ = PSSearch.conv_psname_2_pstype(dcl)
                     if dcl_typ == 'as-dclink-regatron-master':
                         alldclinks.add(dcl)
     alldclinks = [PVName(dev) for dev in alldclinks]
     return alldclinks
Пример #3
0
    def _handle_checked_items_changed(self, item):
        devname = PVName(item.data(0, Qt.DisplayRole))
        if not _re.match('.*-.*:.*-.*', devname):
            return
        state2set = item.checkState(0)

        # ensure power supplies that share dclinks are checked together
        if devname in self._si_fam_psnames and not self._is_adv_mode:
            dclinks = PSSearch.conv_psname_2_dclink(devname)
            if dclinks:
                psname2check = set()
                for dcl in dclinks:
                    relps = PSSearch.conv_dclink_2_psname(dcl)
                    relps.remove(devname)
                    psname2check.update(relps)
                self.ps_tree.tree.blockSignals(True)
                for psn in psname2check:
                    item2check = self.ps_tree._item_map[psn]
                    if item2check.checkState(0) != state2set:
                        item2check.setData(0, Qt.CheckStateRole, state2set)
                self.ps_tree.tree.blockSignals(False)

        self._needs_update_setup = True
def create_tree():
    """."""
    dev2ip = get_device_2_ioc_ip()
    bbbnames = PSSearch.get_bbbnames()
    tree = ['BeagleBones', []]
    for bbbname in bbbnames:
        # PSSearch.con
        bbbip = dev2ip[bbbname] if bbbname in dev2ip else ''
        bbblist = (bbbname + '  [' + bbbip + ']', [])
        udcnames = PSSearch.conv_bbbname_2_udc(bbbname)
        for udcname in udcnames:
            udclist = [udcname, []]
            devices = PSSearch.conv_udc_2_bsmps(udcname)
            for device in devices:
                psname, bsmp_id = device
                psmodel = PSSearch.conv_psname_2_psmodel(psname)
                if device == devices[0]:
                    udclist[0] += '  (' + psmodel + ')'
                pslist = [psname + '  (' + str(bsmp_id) + ')', []]

                try:
                    dclinks = PSSearch.conv_psname_2_dclink(psname)
                except KeyError:
                    dclinks = []
                if dclinks is None:
                    dclinks = []
                if len(dclinks) > 0:
                    for dclink in dclinks:
                        dclinklist = [dclink, []]
                        pslist[-1].append(dclinklist)

                # print(dclinks)
                udclist[-1].append(pslist)
                # print(psname, bsmp_id)
            bbblist[-1].append(udclist)
        tree[-1].append(bbblist)
    return tree
Пример #5
0
    def __init__(self, widget, parent=None):
        super().__init__(parent)
        self._widget = widget
        self.name = widget.devname
        self.bbbname = widget.bbbname
        self.udcname = widget.udcname

        self.dclinks = list()
        self.dclinks_type = ''
        self.dclink_widgets = list()
        self.dclinksbbbname = set()
        self.dclinksudcname = set()
        dclinks = PSSearch.conv_psname_2_dclink(self.name)
        if dclinks:
            self.dclinks = dclinks
            self.dclinks_type = PSSearch.conv_psname_2_psmodel(dclinks[0])
            if self.dclinks_type != 'REGATRON_DCLink':
                for dc in dclinks:
                    self.dclinksbbbname.add(PSSearch.conv_psname_2_bbbname(dc))
                    self.dclinksudcname.add(PSSearch.conv_psname_2_udc(dc))
            self.all_props = get_prop2label(PVName(dclinks[0]))

        self.visible_props = sort_propties(
            ['detail', 'state', 'intlk', 'setpoint', 'monitor'])
        self._setup_ui()
        self._create_actions()
        self._enable_actions()
        self.setStyleSheet("""
            #HideButton {
                min-width: 10px;
                max-width: 10px;
            }
            #DCLinkContainer {
                background-color: lightgrey;
            }
        """)