コード例 #1
0
    def OnFrame(self, **kwargs):
        """Callback which should be called on every frame"""
        if not self.watchingFrames:
            #we have allready disconnected - ignore any new frames
            return

        t = time.time()

        self.imNum += 1
        if not self.guiUpdateCallback is None:
            if (t > (self._last_gui_update + .1)):
                self._last_gui_update = t
                self.guiUpdateCallback()

        try:
            import wx  #FIXME - shouldn't do this here
            wx.CallAfter(self.protocol.OnFrame, self.imNum)
            #FIXME - The GUI logic shouldn't be here (really needs to change at the level of the protocol and/or general structure of PYMEAcquire
        except (ImportError,
                AssertionError):  # handle if spooler doesn't have a GUI
            self.protocol.OnFrame(
                self.imNum
            )  #FIXME - This will most likely fail for anything but a NullProtocol

        if self.imNum == 2 and sampleInformation and sampleInformation.currentSlide[
                0]:  #have first frame and should thus have an imageID
            sampleInformation.createImage(self.md,
                                          sampleInformation.currentSlide[0])

        if self.imNum >= self.maxFrames:
            self.StopSpool()
コード例 #2
0
ファイル: Spooler.py プロジェクト: RuralCat/CLipPYME
   def Tick(self, caller):
        '''Called on every frame'''
        self.imNum += 1
        if not self.parent == None:
            self.parent.Tick()
        self.protocol.OnFrame(self.imNum)

        if self.imNum == 2 and sampleInformation and sampleInformation.currentSlide[0]: #have first frame and should thus have an imageID
            sampleInformation.createImage(self.md, sampleInformation.currentSlide[0])