Exemple #1
0
    def finish(self):

        self.currentProgBar.setValue(self.currentProgBar.maximum())
        self.totalProgBar.setValue(self.totalProgBar.maximum())

        msg = Shared.MsgInfo(
            self, 'Job Finished!',
            'Congratulations! Now it is time to grab some coffee.')
        msg.exec_()
        self.stop_timers()
        self.accept()
Exemple #2
0
    def on_scan_jpl(self):

        # when invoke this dialog, pause live lockin monitor in the main panel
        self.liaMonitor.stop()

        # if it is test mode, or real-run mode with instrument correctly connected
        if self.testModeAction.isChecked() or (self.synHandle
                                               and self.liaHandle):
            dconfig = ScanLockin.JPLScanConfig(main=self)
            entry_settings = None
            dconfig_result = dconfig.exec_()
        else:
            # instrument handle is None, pop up error
            msg = Shared.MsgError(
                self, 'Instrument Offline!',
                'Connect to the synthesizer and lockin first before proceed.')
            msg.exec_()
            return None

        # this loop makes sure the config dialog does not disappear
        # unless the settings are all valid / or user hits cancel
        while dconfig_result:  # if dialog accepted
            entry_settings, filename = dconfig.get_settings()
            if entry_settings:
                total_time = Shared.jpl_scan_time(entry_settings)
                now = datetime.datetime.today()
                length = datetime.timedelta(seconds=total_time)
                then = now + length
                text = 'This batch job is estimated to take {:s}.\nIt is expected to finish at {:s}.'.format(
                    str(length), then.strftime('%I:%M %p, %m-%d-%Y (%a)'))
                q = Shared.MsgInfo(self, 'Time Estimation', text)
                q.addButton(QtGui.QMessageBox.Cancel)
                qres = q.exec_()
                if qres == QtGui.QMessageBox.Ok:
                    break
                else:
                    dconfig_result = dconfig.exec_()
            else:
                dconfig_result = dconfig.exec_()

        if entry_settings and dconfig_result:
            dscan = ScanLockin.JPLScanWindow(entry_settings,
                                             filename,
                                             main=self)
            dscan.exec_()
        else:
            pass