Exemple #1
0
    def on_but_show(self):
        logger.debug('on_but_show')

        if cp.cgwpartitiontable is None: self.w_show = None
        if self.w_show is None:
            _, list2d = get_platform(
            )  # [[[True,''], 'test/19670/daq-tst-dev02', 'testClient2b'], ...]

            list2d_active = list_active_procs(list2d)
            #logger.debug('list2d active processes:\n%s' % str(list2d_active))

            self.w_show = CGWPartitionTable(parent=None, tableio=list2d_active,\
                                            win_title='Display partitions',\
                                            title_h=self.TABTITLE_H,\
                                            is_visv=False)

            self.w_show.setToolTip(
                'Processes selection is only available\nin the "Select" window.'
            )
            self.w_show.move(QCursor.pos() + QPoint(50, 10))
            self.w_show.setWindowTitle('Partitions')
            self.w_show.show()

            #if cp.cgwmain is not None:
            # THIS DOES NOT WORK AT LEAST IN OUR WM ...
            #logger.debug('force to activate cgwmain window')
            #cp.cgwmain.setWindowTitle('Activate it')
            #cp.cgwmain.raise_()
            #cp.cgwmain.activateWindow()
            """
               # THIS WAS A FIGHT FOR ACTIVATION OF OTHER WINDOW, BUT
               # ALL THIS DOES NOT WORK AT LEAST IN OUR WM ...
               #cp.cgwmain.setWindowState(cp.cgwmain.windowState() & ~Qt.WindowMinimized | Qt.WindowActive)
               #cp.cgwmain.show()
               #cp.cgwmain.setFocus(Qt.PopupFocusReason)
               #cp.cgwmain.setFocus()
               #cp.cgwmain.update()

            if cp.qapplication is not None:
                for w in cp.qapplication.allWindows():
                    print('window in allWindows():', str(w), type(w), w.title(), ' isActive:', w.isActive(),' isModal:', w.isModal())
                    if str(w.title())=='DAQ Control':
                        print('window %s is found' % w.title())
                        #w.show()
                        w.requestActivate()

            from PyQt5.QtTest import QTest
            QTest.mouseClick(self, Qt.LeftButton)
            """

        else:
            self.w_show.close()
            self.w_show = None

        self.set_but_show_title()
Exemple #2
0
    def on_but_select(self):
        logger.debug('on_but_select')

        dict_platf, list2d = get_platform(
        )  # list2d = [[[True,''], 'test/19670/daq-tst-dev02', 'testClient2b'], ...]

        #logger.debug('List of processes:')
        #for rec in list2d :
        #    [[state,name],alias] = rec
        #    logger.debug('%s %s is %s selected' % (name.ljust(10), alias.ljust(10), {False:'not', True:'   '}[state]))

        #parent=self,
        w = QWPopupTableCheck(tableio=list2d, title_h=self.TABTITLE_H,\
                              do_ctrl=(self.state=='UNALLOCATED'),\
                              win_title='Select partition',\
                              do_edit=False, is_visv=False, do_frame=True)

        if self.state != 'UNALLOCATED':
            w.setToolTip(
                'Processes control is only available\nin the state UNALLOCATED'
            )

        #w.move(QCursor.pos()+QPoint(20,10))
        w.move(self.mapToGlobal(self.but_select.pos()) +
               QPoint(5, 22))  # (5,22) offset for frame
        resp = w.exec_()

        logger.debug('resp: %s' % {
            QDialog.Rejected: 'Rejected',
            QDialog.Accepted: 'Accepted'
        }[resp])

        if resp != QDialog.Accepted: return

        list2d = w.table_out()

        #if self.w_display is not None :
        #    self.w_display.fill_table_model(tableio=list2d,\
        #                                    title_h=self.TABTITLE_H,\
        #                                    do_edit=False, is_visv=False, do_ctrl=False, do_frame=True)

        set_platform(dict_platf, list2d)

        # 2019-03-13 caf: If Select->Apply is successful, an Allocate transition should be triggered.
        json_data = daq_control().getJsonConfig()
        retval = daq_control().storeJsonConfig(json_data)
        if 'err_info' in retval:
            logger.error('control.storeJsonConfig: %s' % retval['err_info'])

        list2d_active = list_active_procs(list2d)

        if len(list2d_active) == 0:
            logger.warning('NO PROCESS SELECTED!')

        daq_control().setState('allocated')
Exemple #3
0
    def onApply(self):
        logger.debug('onApply')
        self.list2d_out = self.wtab.fill_output_object()
        #self.accept()

        dict_platf, list2d = get_platform(
        )  # [[[True,''], 'test/19670/daq-tst-dev02', 'testClient2b'], ...]
        set_platform(dict_platf, self.list2d_out)

        ## 2019-03-13 caf: If Select->Apply is successful, an Allocate transition should be triggered.
        ## 2020-07-29 caf: The Allocate transition will update the active detectors file, if necessary.

        list2d_active = list_active_procs(self.list2d_out)

        if len(list2d_active) == 0:
            logger.warning('NO PROCESS SELECTED!')
        else:
            daq_control().setState('allocated')