Esempio n. 1
0
    def closeEvent(self, e):
        logger.debug('%s.closeEvent' % self._name)

        resp = confirm_or_cancel_dialog_box(parent=None,
                                            text='Close window?',\
                                            title='Confirm or cancel')
        if not resp:
            logger.warning('Closing window is cancelled')
            e.ignore()
            return

        logger.debug('Closing window is confirmed')

        # save app-configuration parameters
        #try:
        #    self.on_save()
        #except Exception as ex:
        #    print('Exception: %s' % ex)

        try:
            self.wtabs.close()
            self.wconf.close()
            self.wlogr.close()
        except Exception as ex:
            print('Exception: %s' % ex)

        QWZMQListener.closeEvent(self, e)

        #print('Exit CGWMain.closeEvent')

        cp.cgwmain = None
Esempio n. 2
0
    def __init__(self, parser=None):

        self.proc_parser(parser)

        if __name__ != "__main__":
            daq_control.set_daq_control(
                DaqControl(host=self.host,
                           platform=self.platform,
                           timeout=self.timeout))
            QWZMQListener.__init__(self,
                                   host=self.host,
                                   platform=self.platform,
                                   timeout=self.timeout)
        else:  # emulator mode for TEST ONLY
            QWZMQListener.__init__(self, is_normal=False)

        self.init_daq_control_parameters()  # cach parameters in cp

        self.wlogr = QWLoggerStd(log_level=self.loglevel, instrument=cp.instr,\
                                 log_prefix=self.logdir, show_buttons=False)

        logger.debug('logger started with log_level:%s instrument:%s' %
                     (self.loglevel, cp.instr))

        cp.cgwmain = self

        self.main_win_width = cp.main_win_width
        self.main_win_height = cp.main_win_height
        self.main_win_pos_x = cp.main_win_pos_x
        self.main_win_pos_y = cp.main_win_pos_y

        #icon.set_icons()

        self.wconf = CGWMainConfiguration()
        #self.wtabs = CGWMainTabs()
        self.wtabs = CGWMainTabExpert()
        self.winfo = CGWMainInfo()

        self.vspl = QSplitter(Qt.Vertical)
        self.vspl.addWidget(self.wconf)
        self.vspl.addWidget(self.wtabs)
        self.vspl.addWidget(self.winfo)
        self.vspl.addWidget(self.wlogr)

        self.mbox = QHBoxLayout()
        self.mbox.addWidget(self.vspl)
        self.setLayout(self.mbox)

        self.set_style()
        #self.set_tool_tips()
        #self.connect_signals_to_slots()
        #self.move(self.pos()) # + QPoint(self.width()+5, 0))
        self.set_buts_enabled()
Esempio n. 3
0
    def __init__(self, parser=None):

        self.proc_parser(parser)

        if __name__ != "__main__":
            daq_control.set_daq_control(
                DaqControl(host=self.host,
                           platform=self.platform,
                           timeout=self.timeout))
            QWZMQListener.__init__(self,
                                   host=self.host,
                                   platform=self.platform,
                                   timeout=self.timeout)
        else:  # emulator mode for TEST ONLY
            QWZMQListener.__init__(self, is_normal=False)

        self.wlogr = QWLoggerStd(log_level=self.loglevel,
                                 show_buttons=False,
                                 log_prefix=self.logdir)

        #instrument = self.expname[:3].upper()
        instrument = daq_control().getInstrument()
        logger.debug('daq_control().getInstrument(): %s' % instrument)
        self.inst = 'TMO' if instrument in ('TST', None) else instrument

        cp.cgwmain = self

        self.main_win_width = cp.main_win_width
        self.main_win_height = cp.main_win_height
        self.main_win_pos_x = cp.main_win_pos_x
        self.main_win_pos_y = cp.main_win_pos_y

        #icon.set_icons()

        self.wconf = CGWMainConfiguration(parent_ctrl=self)
        self.wtabs = CGWMainTabs(parent_ctrl=self)

        self.vspl = QSplitter(Qt.Vertical)
        self.vspl.addWidget(self.wconf)
        self.vspl.addWidget(self.wtabs)
        self.vspl.addWidget(self.wlogr)

        self.mbox = QHBoxLayout()
        self.mbox.addWidget(self.vspl)
        self.setLayout(self.mbox)

        self.set_style()