Python wx 模块,CallLater() 实例源码

我们从Python开源项目中,提取了以下43个代码示例,用于说明如何使用wx.CallLater()

项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClassify(self):
        cap = self.src.getEEGSecs(time.time() - self.testTime)
        self.testTime = time.time()

        cap = self.bandpass(cap)
        seg = cap.segment(start=self.windowStart, end=self.windowEnd)
        seg = self.downsample(seg)

        # if verbose XXX - idfah
        #wx.LogMessage('nSeg: %d' % seg.getNSeg())
        assert seg.getNSeg() == len(self.choices)

        stim = [self.markToStim(m) for m in seg.getMarkers()]

        x = self.standardizer.apply(seg.chanEmbed())

        dv = self.classifier.discrim(x)
        choice = stim[np.argmax(dv, axis=0)[0]]

        if self.pieMenu.growBar(choice, amount=1.0/self.nTestTrial):
            wx.CallAfter(self.controlPlayer, choice)
        else:
            wx.CallLater(1000.0*self.isi, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testDecision(self, probs):
        for i,choice in enumerate(self.choices):
            self.pieMenu.growBar(choice, self.gain*(probs[i]-self.loss), refresh=False)
        self.pieMenu.refresh()

        self.curDecision += 1

        finalSelection = self.pieMenu.getSelection()

        if finalSelection is None:
            wx.CallAfter(self.runTestEpoch)

        else:
            self.pieMenu.clearAllHighlights(refresh=False)
            self.pieMenu.highlight(finalSelection, style='jump', secs=self.pauseSecs)
            finalLabel = self.choices.index(finalSelection)
            self.src.incrementMarker(finalLabel+1)
            self.confusion[finalLabel, self.choices.index(self.curChoice)] += 1.0

            wx.CallLater(1000.0*self.pauseSecs, self.testClearTrial)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClassify(self):
        cap = self.src.getEEGSecs(time.time() - self.testTime)
        self.testTime = time.time()

        cap = self.decimate(cap)
        seg = cap.segment(start=self.windowStart, end=self.windowEnd)

        assert seg.getNSeg() == len(self.choices)

        stim = [self.markToStim(m) for m in seg.getMarkers()]

        x = self.standardizer.apply(seg.chanEmbed())

        dv = self.classifier.discrim(x)
        choice = stim[np.argmax(dv, axis=0)[0]]

        if self.pieMenu.growBar(choice, amount=1.0/self.nTestTrial):
            wx.CallAfter(self.moveRobot, choice)
        else:
            wx.CallLater(1000.0*self.isi, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def toggleTest(self, event=None):
        if self.isRunning():
            self.earlyStopFlag = True
            self.testButton.Disable()

            wx.LogMessage('%s: Testing stopped early.' % self.name)
        else:
            try:
                self.earlyStopFlag = False
                self.trainButton.Disable()
                self.retrainButton.Disable()
                self.testButton.SetLabel('Stop')
                self.start()

                self.startTime = time.time()
                self.beforeTest()

                wx.CallLater(1000.0*2.0, self.runTestEpoch)

            except Exception:
                self.earlyStopFlag = True
                self.trainButton.Enable()
                self.retrainButton.Enable()
                self.testButton.SetLabel('Test')
                raise
项目:dictationbridge-nvda    作者:dictationbridge    | 项目源码 | 文件源码
def textInserted(hwnd, start, text):
    global currentEntry, autoFlushTimer
    log.debug("textInserted %r" % text)
    if currentEntry is not None:
        prevStart, prevText = currentEntry
        if (not (start == -1 and prevStart == -1)) and (start < prevStart or start > (prevStart + len(prevText))):
            flushCurrentEntry()
    if currentEntry is not None:
        prevStart, prevText = currentEntry
        if prevStart == -1 and start == -1:
            currentEntry = (-1, prevText + text)
        else:
            currentEntry = (prevStart, prevText[:start - prevStart] + text)
    else:
        currentEntry = (start, text)
    if autoFlushTimer is not None:
        autoFlushTimer.Stop()
        autoFlushTimer = None
    def autoFlush(*args, **kwargs):
        global autoFlushTimer
        autoFlushTimer = None
        flushCurrentEntry()
    autoFlushTimer = wx.CallLater(100, autoFlush)
项目:SpatialTool    作者:JRcard    | 项目源码 | 文件源码
def _whenPlaying(self):
        if self.isPlaying:
            self.elapsedTime = time.time() - self.initTime
            total = self.elapsedTime + self.sndOffset
            try:
                pos = total / self.sndDurSecs
            except:
                pos = 0
            if pos < 1:
                self.chrono.SetLabel(self.secs2Time(total))
                self.timeLeft.SetLabel("- "+ self.secs2Time(self.sndDurSecs-total))
                self.sndView.refreshPos(pos)
                wx.CallLater(5, self._whenPlaying)
            elif pos >= 1:
                self.sndEnd()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainEpoch(self):
        if len(self.curChoices) == 0:
            self.curChoices = copy.copy(self.choices)
            np.random.shuffle(self.curChoices)
            self.curTrial += 1

        choice = self.curChoices.pop()
        self.pieMenu.highlight(choice, style='pop')

        self.src.setMarker(self.choices.index(choice)+1.0)

        wx.CallLater(1000.0*self.trainTrialSecs, self.trainClearTrial)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainClearTrial(self, event=None):
        self.pieMenu.clearAllHighlights()

        self.src.setMarker(0.0)

        if self.curTrial == self.nTrainTrial and len(self.curChoices) == 0:
            wx.CallLater(1000.0*self.pauseSecs, self.endTrain)
        else:
            wx.CallLater(1000.0*self.pauseSecs, self.runTrainEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testEpoch(self):
        if self.curDecision == -1:
            self.src.setMarker(0.0)
            self.highlightTestTarget()
            self.curDecision += 1
            wx.CallLater(1000.0*self.width*1.1, self.runTestEpoch)

        else:
            # a little extra at the end to make sure we get the last segment
            wx.CallLater(1000.0*self.decisionSecs*1.1, self.testClassify)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClassify(self):
        # a little extra (0.9*self.pauseSecs) for edge effects in filter XXX - idfah
        cap = self.src.getEEGSecs(self.width+0.9*self.pauseSecs).copy(dtype=np.float32) # get rid of copy and dtype after implementing in source XXX - idfah
        cap = cap.trim(start=0.9*self.pauseSecs)

        seg = cap.segmentSingle()

        if self.method == 'Welch Power':
            freqs, testData = self.powerize((seg,))

        else:
            testData = (seg.data,)

        testDataStd = self.stand.apply(testData)[0]
        label = self.classifier.label(testDataStd)[0]
        selection = self.choices[label]
        self.pieMenu.growBar(selection, self.gain, refresh=True)

        self.curDecision += 1

        finalSelection = self.pieMenu.getSelection()
        if finalSelection is None:
            wx.CallAfter(self.runTestEpoch)
        else:
            self.pieMenu.clearAllHighlights(refresh=False)
            self.pieMenu.highlight(finalSelection, style='jump', secs=self.pauseSecs)
            finalLabel = self.choices.index(finalSelection)
            self.src.incrementMarker(finalLabel+1)
            self.confusion[finalLabel, self.choices.index(self.curChoice)] += 1.0

            wx.CallLater(1000.0*self.pauseSecs, self.testClearTrial)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClearTrial(self):
        self.pieMenu.zeroBars(refresh=False)
        self.pieMenu.clearAllHighlights()
        self.curDecision = -1

        if self.curTrial == self.nTestTrial and len(self.curChoices) == 0:
            wx.CallLater(1000.0*self.pauseSecs, self.endTest)
        else:
            wx.CallLater(1000.0*self.pauseSecs, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainClearStim(self, event=None):
        self.pieMenu.clearAllHighlights()

        self.src.setMarker(0.0)

        wx.CallLater(1000.0*self.isi, self.runTrainEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testEpoch(self):
        curStim = self.curStimList.pop()

        self.src.setMarker(self.stimToMark(curStim))
        self.pieMenu.highlight(curStim, style='jump')

        wx.CallLater(1000.0*self.si, self.testClearStim)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClearStim(self, event=None):
        self.pieMenu.clearAllHighlights()
        self.src.setMarker(0.0)

        if len(self.curStimList) == 0:
            self.initCurStimList()
            wx.CallLater(1000.0*self.windowEnd*1.05, self.testClassify)
        else:
            wx.CallLater(1000.0*self.isi, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def controlPlayer(self, choice):
        self.pieMenu.highlight(choice, style='pop')

        def moveOn():
            wx.CallLater(1000.0*1.0, self.clearPieMenu)
            wx.CallLater(1000.0*2.0, self.runTestEpoch)

        if choice == 'Play':
            self.mplayer.play()
            wx.CallLater(1000.0*2.0, self.pieMenu.zeroBars)
        elif choice == 'Album ' + rightArrow:
            self.mplayer.forAlbum()
            moveOn()
        elif choice == leftArrow + ' Album':
            self.mplayer.rewAlbum()
            moveOn()
        elif choice == 'Song ' + rightArrow:
            self.mplayer.forSong()
            moveOn()
        elif choice == leftArrow + ' Song':
            self.mplayer.rewSong()
            moveOn()
        elif choice == 'Preview':
            self.mplayer.preview()
            wx.CallLater(1000.0*2.0, self.pieMenu.zeroBars)
        else:
            raise Exception('Invalid choice: %s.' % str(choice))
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def showTrainSymbol(self):
        # random, no bottom row
        #self.curRow = np.random.randint(0,5)
        #self.curCol = np.random.randint(0,6)

        trainSyms = [sym if sym != ' ' else grid.space for sym in self.trainText]
        sym = trainSyms[(self.curRep-1) % len(trainSyms)]
        self.curRow, self.curCol = self.gridSpeller.getGridLocation(sym)

        self.gridSpeller.selectSymbol(self.curRow, self.curCol)

        wx.CallLater(1000.0*self.pause, self.gridSpeller.removeHighlight)
        wx.CallLater(1000.0*(self.pause+self.windowEnd), self.trainClearStim)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainEpoch(self):
        # if the stim list is empty
        if len(self.curStimList) == 0:
            # increment current repetition
            self.curRep += 1

            # if we have done all reps, then quit
            if self.curRep > len(self.trainText):
                 self.gridSpeller.removeHighlight()
                 ##wx.CallLater(1000.0*self.windowEnd*1.1-1000.0*self.si, self.endTrain)
                 wx.CallLater(1000.0*self.windowEnd*1.1, self.endTrain)

            # otherwise, reset stim list and show another training symbol
            else:
                self.initCurStimList()
                #self.showTrainSymbol()
                ##wx.CallLater(1000.0*self.windowEnd*1.1-1000.0*self.si, self.showTrainSymbol)
                wx.CallLater(1000.0*self.windowEnd*1.1, self.showTrainSymbol)

        # if stim list still had elements to show
        else:
            # grab next symbol index and set marker
            curStim = self.curStimList.pop()
            self.src.setMarker(self.stimToMark(curStim))

            # highlight row or column
            if curStim <= self.nRows:
                self.gridSpeller.highlightRow(curStim - 1)
            else:
                self.gridSpeller.highlightCol(curStim - self.nRows - 1)

            # clear after si seconds
            wx.CallLater(1000.0*self.si, self.trainClearStim)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainClearStim(self, event=None):
        self.gridSpeller.removeHighlight()
        self.src.setMarker(0.0)

        wx.CallLater(1000.0*self.isi, self.runTrainEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testEpoch(self):
        curStim = self.curStimList.pop()
        self.src.setMarker(self.stimToMark(curStim))

        if curStim <= self.nRows:
            self.gridSpeller.highlightRow(curStim - 1)
        else:
            self.gridSpeller.highlightCol(curStim - self.nRows - 1)

        wx.CallLater(1000.0*self.si, self.testClearStim)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClearStim(self, event=None):
        self.gridSpeller.removeHighlight()
        self.src.setMarker(0.0)

        if len(self.curStimList) == 0:
            self.initCurStimList()

            wx.CallLater(1000.0*self.windowEnd*1.1, self.testClassify)
        else:
            wx.CallLater(1000.0*self.isi, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainEpoch(self):
        if len(self.curChoices) == 0:
            self.curChoices = copy.copy(self.choices)
            np.random.shuffle(self.curChoices)
            self.curTrial += 1

        choice = self.curChoices.pop()
        self.pieMenu.highlight(choice, style='pop')

        self.src.setMarker(self.choices.index(choice)+1.0)

        wx.CallLater(1000.0*self.trainTrialSecs, self.trainClearTrial)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainClearTrial(self, event=None):
        self.pieMenu.clearAllHighlights()

        self.src.setMarker(0.0)

        if self.curTrial == self.nTrainTrial and len(self.curChoices) == 0:
            wx.CallLater(1000.0*self.pauseSecs, self.endTrain)
        else:
            wx.CallLater(1000.0*self.pauseSecs, self.runTrainEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testEpoch(self):
        if not self.gameActive and self.curDecision == -1:
            self.src.setMarker(0.0)
            self.highlightTestTarget()
            self.curDecision += 1
            wx.CallLater(1000.0*self.pauseSecs*1.1, self.runTestEpoch)

        else:
            wx.CallLater(1000.0*self.decisionSecs*1.1, self.testClassify)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClearTrial(self):
        self.pieMenu.zeroBars(refresh=False)
        self.pieMenu.clearAllHighlights()
        self.curDecision = -1

        if self.curTrial == self.nTestTrial and len(self.curChoices) == 0:
            wx.CallLater(1000.0*self.pauseSecs, self.endTest)
        else:
            wx.CallLater(1000.0*self.pauseSecs, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainEpoch(self):
        if len(self.curStimList) == 0:
            self.curTrainTrial += 1
            self.initCurStimList()

        if self.curTrainTrial >= self.nTrainTrial:
            wx.CallLater(1000.0*self.windowEnd*1.05, self.endTrain)
            return

        curStim = self.curStimList.pop()

        self.src.setMarker(self.stimToMark(curStim))
        self.pieMenu.highlight(curStim, style='jump')

        wx.CallLater(1000.0*self.si, self.trainClearStim)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainClearStim(self, event=None):
        self.pieMenu.clearAllHighlights()

        self.src.setMarker(0.0)

        wx.CallLater(1000.0*self.isi, self.runTrainEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testEpoch(self):
        curStim = self.curStimList.pop()

        self.src.setMarker(self.stimToMark(curStim))
        self.pieMenu.highlight(curStim, style='jump')

        wx.CallLater(1000.0*self.si, self.testClearStim)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClearStim(self, event=None):
        self.pieMenu.clearAllHighlights()
        self.src.setMarker(0.0)

        if len(self.curStimList) == 0:
            self.initCurStimList()
            wx.CallLater(1000.0*self.windowEnd*1.05, self.testClassify)
        else:
            wx.CallLater(1000.0*self.isi, self.runTestEpoch)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainEpoch(self):
        choice = self.curChoices.pop()
        self.pieMenu.highlight(choice, style='pop')

        self.src.setMarker(self.choices.index(choice)+1.0)

        wx.CallLater(1000.0*self.trialSecs, self.trainClearTrial)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainClearTrial(self, event=None):
        self.pieMenu.clearAllHighlights()

        self.src.setMarker(0.0)

        if len(self.curChoices) > 0:
            wx.CallLater(1000.0*self.iti, self.runTrainEpoch)
        else:
            wx.CallLater(1000.0*self.iti, self.endTrain)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testEpoch(self):
        self.curChoice = self.curChoices.pop()
        self.pieMenu.highlight(self.curChoice, style='pop')

        self.src.setMarker(10.0*(self.choices.index(self.curChoice)+1.0))

        # a little extra at the end to make sure we get the last segment
        wx.CallLater(1000.0*self.trialSecs*1.1, self.testClassify)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClassify(self):
        testCap = self.getCap(np.min((self.getSessionTime(), 2.0*self.trialSecs)))

        segs = testCap.segment(start=0.0, end=self.trialSecs)

        # select the last segment only
        segs = (segs.setMarkers(None)
            .select(lambda mark: np.isclose(mark, np.max(segs.markers))))

        assert segs.getNSeg() == 1

        ##print 'test nSeg: ', segs.nSeg
        ##print segs.data.shape
        ##print ''

        freqs, testData = self.powerize((segs,))

        testData = self.stand.apply(testData)[0]

        label = self.classifier.label(testData)
        selection = self.choices[label]

        self.src.incrementMarker(label+1)
        self.pieMenu.growBar(selection, 1.0)

        self.confusion[label, self.choices.index(self.curChoice)] += 1.0

        wx.CallLater(1000.0*self.iti, self.testClearTrial)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def testClearTrial(self, event=None):
        self.pieMenu.zeroBars()
        self.pieMenu.clearAllHighlights()

        self.src.setMarker(0.0)

        if len(self.curChoices) > 0:
            wx.CallLater(1000.0*self.iti, self.runTestEpoch)
        else:
            wx.CallLater(1000.0*self.iti, self.endTest)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def play(self, event=None):
        self.loadAndPlay()
        wx.CallLater(1000.0*3.0*self.previewSecs, self.stop)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def preview(self, event=None):
        self.loadAndPlay()
        wx.CallLater(1000.0*self.previewSecs, self.stop)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def highlight(self, choice, style='pop', secs=None, refresh=True):
        """Turn on a highlight for a given cell.

        Args:
            choice: Name of cell where highlight should be
                    turned on.

            style:  String describing the type of highlight.
                    Current possible values are 'jump' or
                    'pop'.

            secs:   Floating point seconds until the
                    highlight should be turned off.  If
                    None, highlight will be left on until
                    manually cleared.
        """
        if style.lower() == 'pop':
            self.highlightPop.add(choice)
        elif style.lower() == 'jump':
            self.highlightJump.add(choice)
        else:
            raise Exception('Unknown highlight style %s.' % style)

        if refresh:
            self.refresh()

        if secs != None:
            wx.CallLater(1000.0*secs, self.clearHighlight, choice=choice, refresh=refresh)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def OnMouseDoubleClick(self, event):
        if self._zoomEnabled:
            # Give a little time for the click to be totally finished
            # before (possibly) removing the scrollbars and trigering
            # size events, etc.
            wx.CallLater(200, self.Reset)
项目:AppAutoViewer    作者:RealLau    | 项目源码 | 文件源码
def DoSwipeOrInput(self, msg):
        global recordStatus
        global treeDic
        global recordTimeDelay
        if treeDic!=None:
            if recordStatus=="?":
                if "??" in msg:
                    d = msg.replace("??\n", "").split("\n")
                    print("?????,", "???: ",d)
                    os.system("adb shell input swipe %d %d %d %d" % (int(d[0]), int(d[1]),int(d[2]),int(d[3])))

                    dlg = MessageDialog('??????????(?????%d?)' % recordTimeDelay, '??')        
                    wx.CallLater(recordTimeDelay*1000, dlg.Destroy)
                    dlg.ShowModal()
                    getNewScreenShotAndDomFileThread()  
                else:
                    c = msg.split("\n")[0]
                    kT = msg.split("\n")[1]
                    print("?????,", "???",c)
                    if c!='':
                        if kT == "ADB":
                            os.system("adb shell am broadcast -a ADB_INPUT_TEXT --es msg '%s'" %c)
                        else:
                            os.system("adb shell input text '%s'" %c)

                        dlg = MessageDialog('??????????(?????%d?)' % recordTimeDelay, '??')        
                        wx.CallLater(recordTimeDelay*1000, dlg.Destroy)
                        dlg.ShowModal()
                        getNewScreenShotAndDomFileThread()
                    else:
                        dlg = wx.MessageDialog(self, u"???????", u"????????", wx.OK | wx.ICON_ERROR)
                        if dlg.ShowModal() == wx.ID_OK:
                            dlg.Destroy()
            else:
                msg = "????????????????"
                print(msg)
                wx.CallAfter(pub.sendMessage, "update", msg=msg)
        else:
            msg = "?????????????"
            print(msg)
            wx.CallAfter(pub.sendMessage, "update", msg=msg)
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def delayExit(self, e=None):
        wx.CallLater(5000, self.onExit)
项目:Janet    作者:nosmokingbandit    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
                          title='Janet', size=(WIDTH, HEIGHT))
        self.SetMinSize((WIDTH, HEIGHT))

        self.browser = None

        global g_count_windows
        g_count_windows += 1

        self.setup_icon()
        # self.create_menu()
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Set wx.WANTS_CHARS style for the keyboard to work.
        # This style also needs to be set for all parent controls.
        self.browser_panel = wx.Panel(self, style=wx.WANTS_CHARS)
        self.browser_panel.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.browser_panel.Bind(wx.EVT_SIZE, self.OnSize)

        # On Linux must show before embedding browser, so that handle
        # is available.
        if LINUX:
            self.Show()
            self.embed_browser()
        else:
            self.embed_browser()
            self.Show()

        wx.CallLater(500, self.setup_gamepad)  # this has to be delayed to make sure the DOM has loaded the list of games
项目:dictationbridge-nvda    作者:dictationbridge    | 项目源码 | 文件源码
def schedulePoll(self):
        self.cancelPoll()
        self.pollTimer = wx.CallLater(100, self.poll)
项目:SpatialTool    作者:JRcard    | 项目源码 | 文件源码
def on_timer(self):
        w,h = self.size[0], self.size[1]
        oldPosBlue = [self.blueCircle.x, self.blueCircle.y]
        oldPosRed = [self.redCircle.x, self.redCircle.y]
        changed = False

        if self.mode2:
            rate = 30
            self.blueCircle.x = floatmap(self.absPos[0], 0, w)
            self.blueCircle.y = floatmap(self.absPos[1], 0, h)
            self.redCircle.x = floatmap(self.absPos[2], 0, w)
            self.redCircle.y = floatmap(self.absPos[3], 0, h)
        else:
            rate = 40
            self.blueCircle.x += self.incs[0]
            self.blueCircle.y += self.incs[1]
            self.redCircle.x += self.incs[2]
            self.redCircle.y += self.incs[3]

            if self.blueCircle.x < 0:
                self.blueCircle.x = 0
            elif self.blueCircle.x > w:
                self.blueCircle.x = w

            if self.blueCircle.y < 0:
                self.blueCircle.y = 0
            elif self.blueCircle.y > h:
                self.blueCircle.y = h

            if self.redCircle.x < 0:
                self.redCircle.x = 0
            elif self.redCircle.x > w:
                self.redCircle.x = w

            if self.redCircle.y < 0:
                self.redCircle.y = 0
            elif self.redCircle.y > h:
                self.redCircle.y = h

        if oldPosBlue[0] != self.blueCircle.x or oldPosBlue[1] != self.blueCircle.y:
            self.currentCircle = self.blueCircle
            newPos = [self.blueCircle.x, self.blueCircle.y]
            self.distance(newPos)
            changed = True

        if oldPosRed[0] != self.redCircle.x or oldPosRed[1] != self.redCircle.y:        
            self.currentCircle = self.redCircle
            newPos = [self.redCircle.x, self.redCircle.y]
            self.distance(newPos)
            changed = True

        if changed:
            self.Refresh()
        wx.CallLater(rate, self.on_timer)
        # FL END 23/05/2017

    # FL START 29/05/17
    # Fonction qui ajuste les volumes quand on change les radius des speakers
项目:wintenApps    作者:josephsl    | 项目源码 | 文件源码
def _downloadSuccess(self):
            self._stopped()
            # Emulate add-on update (don't prompt to install).
            from gui import addonGui
            closeAfter = addonGui.AddonsDialog._instance is None
            try:
                try:
                    bundle=addonHandler.AddonBundle(self.destPath.decode("mbcs"))
                except:
                    log.error("Error opening addon bundle from %s"%self.destPath,exc_info=True)
                    # Translators: The message displayed when an error occurs when opening an add-on package for adding. 
                    gui.messageBox(_("Failed to open add-on package file at %s - missing file or invalid file format")%self.destPath,
                        # Translators: The title of a dialog presented when an error occurs.
                        _("Error"),
                        wx.OK | wx.ICON_ERROR)
                    return
                bundleName=bundle.manifest['name']
                for addon in addonHandler.getAvailableAddons():
                    if not addon.isPendingRemove and bundleName==addon.manifest['name']:
                        addon.requestRemove()
                        break
                progressDialog = gui.IndeterminateProgressDialog(gui.mainFrame,
                # Translators: The title of the dialog presented while an Addon is being updated.
                _("Updating Add-on"),
                # Translators: The message displayed while an addon is being updated.
                _("Please wait while the add-on is being updated."))
                try:
                    gui.ExecAndPump(addonHandler.installAddonBundle,bundle)
                except:
                    log.error("Error installing  addon bundle from %s"%self.destPath,exc_info=True)
                    if not closeAfter: addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList()
                    progressDialog.done()
                    del progressDialog
                    # Translators: The message displayed when an error occurs when installing an add-on package.
                    gui.messageBox(_("Failed to update add-on  from %s")%self.destPath,
                        # Translators: The title of a dialog presented when an error occurs.
                        _("Error"),
                        wx.OK | wx.ICON_ERROR)
                    return
                else:
                    if not closeAfter: addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList(activeIndex=-1)
                    progressDialog.done()
                    del progressDialog
            finally:
                try:
                    os.remove(self.destPath)
                except OSError:
                    pass
                if closeAfter:
                    wx.CallLater(1, addonGui.AddonsDialog(gui.mainFrame).Close)