예제 #1
0
    def updateDisplayInfo(self):
        # Update display info and status
        #
        try:
            self.lblDisplDevName.setText("{0}, screen #{1}".format(
                self.Stage.scrDevName, self.Stage.scrIndex))
            self.lblDisplDevRes.setText(
                "{0}x{1}, {2}bit, {3:.1f}({4:.1f}) Hz{5}".format(
                    self.Stage.dxScr, self.Stage.dyScr, self.Stage.depth,
                    self.Stage.scrDevFreq_Hz, self.Stage.scrReqFreq_Hz,
                    ", full" if self.Stage.isFullScr else ""))
            self.lblDisplDevInfo.setText(
                "{0:.2f}x{1:.2f} µm/pixel<br>offset: {2},{3}, angle: {4}°".
                format(self.Stage.scalX_umPerPix, self.Stage.scalY_umPerPix,
                       self.Stage.centX_pix, self.Stage.centY_pix,
                       self.Stage.rot_angle))

            if len(self.Stage.LEDs) == 0:
                self.lblDisplDevLEDs.setText("n/a")

            else:
                sTemp = ""
                pal = QPalette()
                LEDsEnabled = self.btnToggleLEDEnable.isChecked()

                for iLED, LED in enumerate(self.Stage.LEDs):
                    sTemp += "{0}={1} ".format(LED["name"], LED["current"])
                    pal.setColor(QPalette.Window, QColor(LED["Qt_color"]))
                    pal.setColor(QPalette.WindowText, QColor("white"))
                    [spinBoxLED, labelLED,
                     btnLED] = gsu.getLEDGUIObjects(self, LED)
                    spinBoxLED.setValue(LED["current"])
                    spinBoxLED.setEnabled(LEDsEnabled)
                    labelLED.setPalette(pal)
                    labelLED.setText(LED["name"])
                    btnLED.setEnabled(not LEDsEnabled)
                    btnLED.setText("")
                    gsu.updateToggleButton(btnLED)
                self.lblDisplDevLEDs.setText(sTemp)

            self.spinBoxStageCS_hOffs.setValue(self.Stage.centOffX_pix)
            self.spinBoxStageCS_vOffs.setValue(self.Stage.centOffY_pix)
            self.spinBoxStageCS_hScale.setValue(self.Stage.scalX_umPerPix)
            self.spinBoxStageCS_vScale.setValue(self.Stage.scalY_umPerPix)
            self.spinBoxStageCS_rot.setValue(self.Stage.rot_angle)

        except KeyError:
            pass
예제 #2
0
    def OnClick_btnSetLEDCurrents(self):
        if len(self.Stage.LEDs) == 0:
            return

        curr = []
        for iLED, LED in enumerate(self.Stage.LEDs):
            (spinBoxLED, labelLED, btnLED) = gsu.getLEDGUIObjects(self, LED)
            val = spinBoxLED.value()
            curr.append(val)
            self.Stage.setLEDCurrent(iLED, val)

        self.Sync.pipeCli.send([
            mpr.PipeValType.toSrv_changedLEDs,
            [self.Stage.LEDs, self.Stage.isLEDSeqEnabled]
        ])
        self.btnSetLEDCurrents.setEnabled(False)
        self.updateDisplayInfo()
예제 #3
0
    def handleLEDStateChanged(self):
        enabled = []
        LEDsEnabled = not (self.btnToggleLEDEnable.isChecked())

        for iLED, LED in enumerate(self.Stage.LEDs):
            (spinBoxLED, labelLED, btnLED) = gsu.getLEDGUIObjects(self, LED)
            btnLED.setEnabled(LEDsEnabled)
            val = btnLED.isChecked()
            enabled.append(val)
            spinBoxLED.setEnabled(LEDsEnabled and not (val))
            self.Stage.setLEDEnabled(iLED, val)

        self.Sync.pipeCli.send([
            mpr.PipeValType.toSrv_changedLEDs,
            [self.Stage.LEDs, self.Stage.isLEDSeqEnabled]
        ])
        self.updateDisplayInfo()
예제 #4
0
    def updateAll(self):
        # Update the complete GUI
        #
        txt = gsu.getShortText(self, self.currStimPath, self.lblCurrStimFolder)
        self.lblCurrStimFolder.setText(txt)

        stateWorker = self.Sync.State.value
        if stateWorker == mpr.PRESENTING:
            self.state = State.playing
        elif stateWorker == mpr.COMPILING:
            self.state = State.compiling
        elif stateWorker == mpr.PROBING:
            self.state = State.probing
        elif stateWorker in [mpr.CANCELING, mpr.TERMINATING]:
            self.state = State.canceling
        elif stateWorker == mpr.IDLE:
            self.state = State.ready

        isStimSelPerm = self.state in {
            State.undefined, State.idle, State.ready
        }

        self.listStim.setEnabled(isStimSelPerm)
        self.btnRefreshStimList.setEnabled(isStimSelPerm)
        self.btnChangeStimFolder.setEnabled(isStimSelPerm)

        self.btnStimPlay.setText("Play")
        self.btnStimPlay.setEnabled(self.isStimReady)
        self.btnStimCompile.setText("Compile")
        self.btnStimCompile.setEnabled(not (self.isStimCurr))
        self.btnStimAbort.setText("Abort")
        self.btnStimAbort.setEnabled((self.state == State.playing)
                                     or (self.state == State.probing))
        self.btnProbeStart.setText("Start probing\ncenter")
        self.btnProbeStart.setEnabled(True)

        if self.state == State.loading:
            self.btnStimPlay.setText("Loading\n...")
            self.btnStimPlay.setEnabled(False)
            self.btnStimCompile.setEnabled(False)
            self.listStim.setEnabled(False)

        elif self.state == State.compiling:
            self.btnStimCompile.setText("Compi-\nling ...")
            self.btnStimCompile.setEnabled(False)
            self.btnStimPlay.setEnabled(False)
            self.listStim.setEnabled(False)

        elif self.state == State.canceling:
            self.btnStimAbort.setText("Aborting ...")
            self.btnStimPlay.setEnabled(False)
            self.listStim.setEnabled(False)

        elif self.state == State.playing:
            self.btnStimPlay.setText("Playing\n...")
            self.btnStimPlay.setEnabled(False)
            self.btnStimCompile.setEnabled(False)

        elif self.state == State.probing:
            self.btnProbeStart.setText("Probing\ncenter ...")
            self.btnProbeStart.setEnabled(False)
            self.btnStimPlay.setEnabled(False)
            self.btnStimCompile.setEnabled(False)

        if not (self.winCam is None):
            self.checkBoxCamEnable.setCheckState(self.winCam.isHidden())

        if not (self.Stage is None):
            enabledSeq = self.Stage.isLEDSeqEnabled[0]
        else:
            enabledSeq = True
        self.btnSetLEDCurrents.setEnabled(self.isLCrUsed)
        self.btnToggleLEDEnable.setEnabled(self.isLCrUsed)
        self.btnToggleSeqControl0.setEnabled(False)
        self.btnToggleSeqControl1.setEnabled(False)
        '''
    enabledLEDs = self.btnToggleLEDEnable.isChecked()
    self.btnToggleSeqControl.setEnabled(self.isLCrUsed and not(enabledLEDs))
    '''
        self.btnToggleSeqControl0.setChecked(enabledSeq)
        gsu.updateToggleButton(self.btnToggleSeqControl0)
        self.btnToggleSeqControl1.setChecked(enabledSeq)
        gsu.updateToggleButton(self.btnToggleSeqControl1)

        self.btnRefreshDisplayInfo.setEnabled(self.isLCrUsed)
        if self.Stage:
            for iLED, LED in enumerate(self.Stage.LEDs):
                [spinBoxLED, labelLED,
                 btnLED] = gsu.getLEDGUIObjects(self, LED)
                spinBoxLED.setEnabled(self.isLCrUsed)
                spinBoxLED.setMaximum(LED["max_current"])
                btnLED.setEnabled(self.isLCrUsed and not (enabledSeq))
                if not (self.Stage is None):
                    btnLED.setChecked(LED["enabled"])
                else:
                    btnLED.setChecked(True)
                gsu.updateToggleButton(btnLED)

        self.processPipe()
        self.updateStatusBar(mpr.StateStr[stateWorker])
        QApplication.processEvents()