def UpdatePulse(self, newmsg=""):
        """
        Updates the dialog, setting the progress bar to the new value and, if given
        changes the message above it. Returns ``True`` unless the ``Cancel`` button
        has been pressed.

        If ``False`` is returned, the application can either immediately destroy the
        dialog or ask the user for the confirmation.

        :param `newmsg`: The new messages for the progress dialog text, if it is
         empty (which is the default) the message is not changed.
        """
       
        self._gauge.Update()
        
        if newmsg and newmsg != self._msg.GetLabel():
            self._msg.SetLabel(newmsg)
            wx.YieldIfNeeded() 
        
        if self._elapsed:        
            elapsed = wx.GetCurrentTime() - self._timeStart
            if self._last_timeupdate < elapsed:
                self._last_timeupdate = elapsed
                
            self.SetTimeLabel(elapsed, self._elapsed)
            
        if self._remained:    
            remained = self._timeEnd-wx.GetCurrentTime()  
                                

        if self._state == Finished:

            if not self._agwStyle & wx.PD_AUTO_HIDE:
                
                self.EnableClose()
                
                if newmsg == "":
                    # also provide the finishing message if the application didn't
                    self._msg.SetLabel("Done.")
                
                wx.YieldIfNeeded()
                self.ShowModal()
                return False
            
            else:
                # reenable other windows before hiding this one because otherwise
                # Windows wouldn't give the focus back to the window which had
                # been previously focused because it would still be disabled
                self.ReenableOtherWindows()
                self.Hide()
            
        # we have to yield because not only we want to update the display but
        # also to process the clicks on the cancel and skip buttons
        wx.YieldIfNeeded()

        return self._state != Canceled
예제 #2
0
 def update(self, output):
     """
     Get and print the results from one completed task.
     """
     self.output_tc.AppendText('%s [%d] calculate(%d) = %.2f\n' % output)
     # Give the user an opportunity to interact
     wx.YieldIfNeeded()
예제 #3
0
 def f():
     t = SimpleThread(acallable)
     t.start()
     while t.is_alive():
         wx.YieldIfNeeded()
         time.sleep(0.01)
     return t.result()
예제 #4
0
파일: wxShell.py 프로젝트: ttrainor/_tdl
    def ReadInputLine(self):
        self.isreading = True
        while self.isreading:
            #time.sleep(.01)
            time.sleep(.025)
            wx.YieldIfNeeded()
            #wx.Yield()
        #print "here"
        input_text = str(self.input_text)
        self.input_text = ''
        #line = input_text.strip() + '\n'
        line = input_text

        #history
        if len(line) > 1:
            # element zero always blank line
            # element 1 most recent etc..
            if self.cmd_from_hist:
                del self.cmd_history[self.cmd_idx]
            else:
                self.cmd_count = self.cmd_count + 1
            self.cmd_history.insert(1, line[:-1])
        self.cmd_idx = 0
        self.cmd_from_hist = False
        return (line)
예제 #5
0
def take_screenshot(fullscreen=True):
    """Returns a wx.Bitmap screenshot taken of fullscreen or program window."""
    wx.YieldIfNeeded()
    if fullscreen:
        rect = wx.Rect(0, 0, *wx.DisplaySize())
    else:
        window = wx.GetApp().TopWindow
        rect = window.GetRect()

        # adjust widths for Linux (figured out by John Torres
        # http://article.gmane.org/gmane.comp.python.wxpython/67327)
        if "linux2" == sys.platform:
            client_x, client_y = window.ClientToScreen((0, 0))
            border_width = client_x - rect.x
            title_bar_height = client_y - rect.y
            rect.width += (border_width * 2)
            rect.height += title_bar_height + border_width

    dc = wx.ScreenDC()
    bmp = wx.Bitmap(rect.width, rect.height)
    dc_bmp = wx.MemoryDC()
    dc_bmp.SelectObject(bmp)
    dc_bmp.Blit(0, 0, rect.width, rect.height, dc, rect.x, rect.y)
    dc_bmp.SelectObject(wx.NullBitmap)
    del dc, dc_bmp
    if bmp.Depth > 24:
        try:  # Drop alpha channel
            img = bmp.ConvertToImage()
            img.ClearAlpha()
            bmp = img.ConvertToBitmap()
        except Exception:
            pass
    return bmp
예제 #6
0
 def run(self):
     if not self.isRunnable():
         print "Can't run thread '{}'".format(self.name)
         print self.target, self.EVT_ID, self.notifyWindow, self.process
         return
     try:
         parentPipe, childPipe = Pipe()
         #self.process = Process(target = self.target, args = (childPipe, self.args))
         self.process = threading.Thread(target = self.target,
            name = "Serial communication thread",
            kwargs = {"pipe": childPipe,
                      "args": self.args})
         self.process.name = self.name
         self.process.daemon = True
         self.process.start()
         while self.process.isAlive() or parentPipe.poll(0.001):
             if parentPipe.poll(0.001):
                 out = parentPipe.recv()
                 wx.PostEvent(self.notifyWindow, ResultEvent(out, self.EVT_ID))
             if self.stop:
                 if self.stopSignalTime == 0:
                     self.stopSignalTime = time() + 0.5
                     parentPipe.send([False])
                 if time() > self.stopSignalTime:
                     self.process._Thread__stop()
             wx.YieldIfNeeded()
             #sleep(0.01)
     except OSError, e:
             wx.PostEvent(self.notifyWindow, ResultEvent(\
             "Execution failed in thread '{}', message: {}".format(\
                                             self.name, e), self.EVT_ID))
예제 #7
0
 def run(self):
     url = self.info["updater_url"]
     file_name = "update_file.zip"
     response = requests.get(url, stream=True)
     total_size = int(response.headers["Content-Length"])
     wx.CallAfter(self.dialog.gauge.SetRange, (total_size))
     now_size = 0
     broken = False
     with open(file_name, mode="wb") as f:
         for chunk in response.iter_content(chunk_size=1024):
             if self.needStop:
                 broken = True
                 print("broken!")
                 break
             f.write(chunk)
             now_size += len(chunk)
             wx.CallAfter(self.dialog.gauge.SetValue, (now_size))
             wx.YieldIfNeeded()
     if broken:
         print("canceled!")
         os.remove(file_name)
         wx.CallAfter(self.dialog.end)
         return
     print("downloaded!")
     if os.path.exists("updater.exe"):
         pid = os.getpid()
         subprocess.Popen(
             ("updater.exe", sys.argv[0], constants.UPDATER_WAKE_WORD,
              file_name, self.info["updater_hash"], str(pid)))
         wx.CallAfter(sys.exit)
     else:
         os.remove(file_name)
         wx.CallAfter(self.dialog.updater_notFound)
         return
예제 #8
0
def take_screenshot(fullscreen=True):
    """Returns a wx.Bitmap screenshot taken of fullscreen or program window."""
    wx.YieldIfNeeded()
    if fullscreen:
        rect = wx.Rect(0, 0, *wx.DisplaySize())
    else:
        window = wx.GetApp().TopWindow
        rect   = window.GetRect()

        # adjust widths for Linux (figured out by John Torres 
        # http://article.gmane.org/gmane.comp.python.wxpython/67327)
        if "linux2" == sys.platform:
            client_x, client_y = window.ClientToScreen((0, 0))
            border_width       = client_x - rect.x
            title_bar_height   = client_y - rect.y
            rect.width        += (border_width * 2)
            rect.height       += title_bar_height + border_width

    dc = wx.ScreenDC()
    bmp = wx.EmptyBitmap(rect.width, rect.height)
    dc_bmp = wx.MemoryDC()
    dc_bmp.SelectObject(bmp)
    dc_bmp.Blit(0, 0, rect.width, rect.height, dc, rect.x, rect.y)
    dc_bmp.SelectObject(wx.NullBitmap)
    # Hack to drop screen transparency, wx issue when blitting from screen
    bmp = wx.BitmapFromIcon(wx.IconFromBitmap(bmp))
    return bmp
예제 #9
0
 def write(self,txt):
     orig = self.contents.GetValue()
     if orig:
         self.contents.SetValue(orig+"\n"+txt)
     else:
         self.contents.SetValue(txt)
     wx.YieldIfNeeded()
예제 #10
0
def DoClick(click, panel):

    wx.PostEvent(panel, click)

    wx.YieldIfNeeded()

    time.sleep(0.1)
예제 #11
0
파일: tester.py 프로젝트: tazjel/rad2py
def unittestfile(filename):
    # unit test using pytong: http://code.google.com/p/pytong
    import pytong
    pytong.filename = filename
    frame = pytong.Frame("PyTong: %s" % filename)
    if frame.Load():
        # show and start all tests (get root)
        frame.Show()
        item = frame.tree.GetRootItem()
        frame.RunItem(item)
        while frame.running:
            wx.YieldIfNeeded()
        for result in frame.results:
            if not result.wasSuccessful():
                for error in result.errors:
                    defect = dict(summary="ERROR IN " + error[0].__str__(),
                                  description=error[1],
                                  type=60,
                                  filename=filename,
                                  lineno=None,
                                  offset=1)
                    yield defect
                for error in result.failures:
                    defect = dict(summary="FAILURE IN " + error[0].__str__(),
                                  description=error[1],
                                  type=60,
                                  filename=filename,
                                  lineno=None,
                                  offset=1)
                    yield defect
    else:
        frame.Destroy()
예제 #12
0
    def OnProgressNotification(self, event):
        try:
            # Detect Play State Change and notify the VideoWindow.
            # See if the playState has changed.
            if (self.movie != None) and (self.playState != self.movie.GetState()):
                # If it has, communicate that to the VideoWindow.  The Mac doesn't seem to differentiate between
                # Stop and Pause the say Windows does, so pass "Stopped" for either Stop or Pause.
                if self.movie.GetState() != wx.media.MEDIASTATE_PLAYING:
                    if self.parent != None:
                        self.parent.UpdatePlayState(wx.media.MEDIASTATE_STOPPED)
                # Pass "Play" for play.
                else:
                    if self.parent != None:
                        self.parent.UpdatePlayState(wx.media.MEDIASTATE_PLAYING)
                # Update the local playState variable
                self.playState = self.movie.GetState()

            # Take this opportunity to see if there are any waiting events.  Leaving this out has the unfortunate side effect
            # of diabling the media player's control bar.
            # There is sometimes a problem with recursive calls to Yield; trap the exception ...
            wx.YieldIfNeeded()

            # The timer that calls this routine runs whether the video is playing or not.  We only need to think
            # about updating the rest of Transana if the video is playing.
            if self.IsPlaying():
                self.PostPos()
        # Trap the PyDeadObjectError, mostly during Play All Clips on PPC Mac
        except wx._core.PyDeadObjectError, e:
            pass
예제 #13
0
파일: update.py 프로젝트: riku22/TCV
 def run(self):
     self.log.info("downloading update file...")
     url = self.info["updater_url"]
     self._file_name = "update_file.zip"
     response = requests.get(url, stream=True)
     total_size = int(response.headers["Content-Length"])
     wx.CallAfter(self.dialog.gauge.SetRange, (total_size))
     now_size = 0
     broken = False
     with open(self._file_name, mode="wb") as f:
         for chunk in response.iter_content(chunk_size=1024):
             if self.needStop:
                 broken = True
                 print("broken!")
                 break
             f.write(chunk)
             now_size += len(chunk)
             wx.CallAfter(self.dialog.gauge.SetValue, (now_size))
             wx.YieldIfNeeded()
     if broken:
         self.log.info("downloading update file has canceled by user")
         os.remove(self._file_name)
         wx.CallAfter(self.dialog.end)
         return
     self.log.info("update file downloaded")
     wx.CallAfter(self.dialog.end)
     self.reserve = True
     simpleDialog.winDialog(_("アップデート"),
                            _("ダウンロードが完了しました。\nソフトウェア終了時に、自動でアップデートされます。"))
     return
예제 #14
0
def getToken():
	manager = twitterAuthorization.TwitterAuthorization(constants.TWITTER_CONSUMER_KEY, constants.TWITTER_CONSUMER_SECRET, constants.TWITTER_PORT)
	l="ja"
	try:
		l=globalVars.app.config["general"]["language"].split("_")[0].lower()
	except:
		pass#end うまく読めなかったら ja を採用
	#end except
	manager.setMessage(
		lang=l,
		success=_("認証に成功しました。このウィンドウを閉じて、アプリケーションに戻ってください。"),
		failed=_("認証に失敗しました。もう一度お試しください。"),
		transfer=_("しばらくしても画面が切り替わらない場合は、別のブラウザでお試しください。")
	)
	webbrowser.open(manager.getUrl())
	d = views.auth.waitingDialog()
	d.Initialize(_("Twitterアカウント認証"))
	d.Show(False)
	while True:
		time.sleep(0.01)
		wx.YieldIfNeeded()
		if manager.getToken():
			d.Destroy()
			break
		if d.canceled == 1 or manager.getToken() == "":
			simpleDialog.dialog(_("処理結果"), _("キャンセルされました。"))
			manager.shutdown()
			d.Destroy()
			return
	return manager.getToken()
예제 #15
0
    def poll(self,t,row,processname,outfile,wxObject,max_mem):
        # Poll thread to update progress bar
        ctr = 0
        increment = 5
        tcount = 90
        while t.is_alive():
            time.sleep(increment)

            # Check CPU usage
            percent = psutil.virtual_memory().percent
            msg = "Controller:RunProcess (t.alive): [%s] %s (%s)" % (
            processname, outfile, "{0}% memory".format(percent))
            print(msg)
            logger.debug(msg)
            if percent > max_mem:
                msg = 'Low memory - stop processing: %d' % percent
                logging.warning(msg)
                print(msg)
                self._stopevent.set()
                raise OSError(msg)

            ctr += increment
            # reset ??
            if ctr == tcount:
                ctr = increment
            # count, row, process, filename
            wx.PostEvent(wxObject, ResultEvent((ctr, row, processname, outfile, "{0}% memory".format(percent))))
            wx.YieldIfNeeded()
예제 #16
0
 def OnEndProcess(self, event):
     """ End of wx.Process event handler """
     # Stop the Progress Timer
     self.timer.Stop()
     # If the process exists ...
     if self.process is not None:
         # Get the Process Error Stream
         errStream = self.process.GetErrorStream()
         # If the stream exists and can be read ...
         if errStream and errStream.CanRead():
             # ... read the stream
             text = errStream.read()
             # If the newlines are in the form of \r\n, we need to replace them with \n only for Python.
             text = text.replace('\r\n', '\n')
             # Split the stream into individual lines
             text = text.split('\n')
             # For each line ...
             for line in text:
                 # ... if the line is not blank, and is not is not a buffer line ...
                 if (line != ''):  # and (not '[buffer @' in line):
                     # ... add the line to the error messages list
                     self.errorMessages.append(line)
         # Destroy the now-completed process
         if self.process is not None:
             self.process.Detach()
             self.process.CloseOutput()
         # De-reference the process
         self.process = None
         wx.YieldIfNeeded()
         # If we're allowing multiple threads ...
         if not self.showModally:
             # ... inform the PARENT that this thread is complete for cleanup
             self.parent.OnConvertComplete(self)
         # Close the Progress Dialog
         self.Close()
예제 #17
0
    def GetObsUnfiltered(self, *args):

        # do we need to recompute?
        mustcompute = False
        if hasattr(self, 'obs_unfiltered') and self.obs_unfiltered.issame(
                self.show_frame):
            for arg in args:
                if self.obs_unfiltered.__dict__[arg] is None:
                    mustcompute = True
                    break
        else:
            mustcompute = True

        if DEBUG_TRACKINGSETTINGS: print 'mustcompute = ' + str(mustcompute)
        if DEBUG_TRACKINGSETTINGS and not mustcompute:
            print 'stored obs_unfiltered = ' + str(self.obs_unfiltered)

        # if we are only interested in the unfiltered observation
        if len(args) == 0:
            # if it has not yet been computed for this frame, compute
            if mustcompute:
                obs_unfiltered = ell.find_ellipses(self.bg_imgs.dfore.copy(),
                                                   self.bg_imgs.cc.copy(),
                                                   self.bg_imgs.ncc, False)
                self.obs_unfiltered = StoredObservations(
                    obs_unfiltered, self.show_frame)
            return self.obs_unfiltered.obs

        # compute if necessary
        if mustcompute:
            wx.BeginBusyCursor()
            wx.YieldIfNeeded()
            (obs_unfiltered,ellsmall,elllarge,didlowerthresh,didmerge,diddelete,didsplit) = \
                                         ell.find_ellipses_display(self.bg_imgs.dfore.copy(),self.bg_imgs.cc.copy(),self.bg_imgs.ncc)
            if DEBUG_TRACKINGSETTINGS:
                print 'computed obs_unfiltered = ' + str(
                    obs_unfiltered) + ', len = ' + str(len(obs_unfiltered))
            if DEBUG_TRACKINGSETTINGS: print 'ellsmall = ' + str(ellsmall)
            if DEBUG_TRACKINGSETTINGS: print 'elllarge = ' + str(elllarge)
            if DEBUG_TRACKINGSETTINGS:
                print 'didlowerthresh = ' + str(didlowerthresh)
            if DEBUG_TRACKINGSETTINGS: print 'didmerge = ' + str(didmerge)
            if DEBUG_TRACKINGSETTINGS: print 'diddelete = ' + str(diddelete)
            if DEBUG_TRACKINGSETTINGS: print 'didsplit = ' + str(didsplit)
            wx.EndBusyCursor()
            self.obs_unfiltered = StoredObservations(obs_unfiltered,
                                                     self.show_frame, ellsmall,
                                                     elllarge, didlowerthresh,
                                                     didmerge, diddelete,
                                                     didsplit)
            if DEBUG_TRACKINGSETTINGS: print 'stored obs_unfiltered: '
            if DEBUG_TRACKINGSETTINGS: print str(self.obs_unfiltered)

        # create return list
        ret = (self.obs_unfiltered.obs, )
        for arg in args:
            ret += (self.obs_unfiltered.__dict__[arg], )

        return ret
예제 #18
0
def download_and_install(url):
    """
    Downloads and launches the specified file.
    """
    global update_window, url_opener
    try:
        is_cancelled = False
        parent = wx.GetApp().TopWindow
        filename, tmp_dir = os.path.split(url)[-1], tempfile.mkdtemp()
        dlg_progress = \
            controls.ProgressWindow(parent, "Downloading %s" % filename)
        dlg_progress.SetGaugeForegroundColour(conf.GaugeColour)
        dlg_progress.Position = (parent.Position.x + parent.Size.width -
                                 dlg_progress.Size.width, parent.Position.y +
                                 parent.Size.height - dlg_progress.Size.height)
        update_window = dlg_progress
        urlfile = url_opener.open(url)
        filepath = os.path.join(tmp_dir, filename)
        main.log("Downloading %s to %s.", url, filepath)
        filesize = int(urlfile.headers.get("content-length", sys.maxint))
        with open(filepath, "wb") as f:
            BLOCKSIZE = 65536
            bytes_downloaded = 0
            buf = urlfile.read(BLOCKSIZE)
            while len(buf):
                f.write(buf)
                bytes_downloaded += len(buf)
                percent = 100 * bytes_downloaded / filesize
                msg = "%d%% of %s" % (percent, util.format_bytes(filesize))
                is_cancelled = not dlg_progress.Update(percent, msg)
                if is_cancelled:
                    break  # break while len(buf)
                wx.YieldIfNeeded()
                buf = urlfile.read(BLOCKSIZE)
        dlg_progress.Destroy()
        update_window = None
        if is_cancelled:
            main.log("Upgrade cancelled, erasing temporary file %s.", filepath)
            util.try_until(lambda: os.unlink(filepath))
            util.try_until(lambda: os.rmdir(tmp_dir))
        else:
            main.log("Successfully downloaded %s of %s.",
                     util.format_bytes(filesize), filename)
            dlg_proceed = controls.NonModalOKDialog(
                parent, "Update information",
                "Ready to open %s. You should close %s before upgrading." %
                (filename, conf.Title))

            def proceed_handler(event):
                global update_window
                update_window = None
                dlg_proceed.Destroy()
                util.start_file(filepath)

            update_window = dlg_proceed
            dlg_proceed.Bind(wx.EVT_CLOSE, proceed_handler)
    except Exception:
        main.log("Failed to download new version from %s.\n\n%s", url,
                 traceback.format_exc())
예제 #19
0
    def OnTimer(self, event):
        """ Give the pourcentage of simulation progress
		"""

        ### if no time limit, gauge pulse
        if self.ntl:
            self._gauge.Pulse()
        else:
            if not isinstance(self.thread.model.timeLast, tuple):
                timeLast = self.thread.model.timeLast
            else:
                timeLast = self.thread.model.timeLast[0]

            self.count = (timeLast / self.thread.model.FINAL_TIME) * 100

            self._gauge.SetValue(self.count)

        ### if simulation is over
        if self.thread.end_flag:

            ### update the status of buttons
            self._btn1.Enable(True)
            self._btn2.Disable()
            self._btn3.Disable()
            self._value.Enable(not self.ntl)
            self._cp.Enable()

            ### check if gauge is full (can appear if timer is too slow)
            if self.count != 100:
                self.count = 100
                self._gauge.SetValue(self.count)

            ### update the status bar
            self.statusbar.SetBackgroundColour('')
            self.statusbar.SetStatusText(_("Completed!"), 0)
            self.statusbar.SetStatusText("%0.4f s" % (self.thread.cpu_time), 1)

            ### is no time limit add some informations in status bar
            if not self.ntl:
                if self.statusbar.GetFieldsCount() > 2:
                    self.statusbar.SetStatusText(str(100) + "%", 2)

            ### stop the timer
            self.timer.Stop()

        ### if the simulation is suspended
        elif not self.thread.thread_suspend:
            ### udpate the status bar
            self.statusbar.SetBackgroundColour('GREY')
            self.statusbar.SetStatusText(_("Processing..."), 0)
            self.statusbar.SetStatusText("%0.4f s" % (self.thread.cpu_time), 1)

            ### is no time limit, add some information in status bar
            if not self.ntl:
                if self.statusbar.GetFieldsCount() > 2:
                    self.statusbar.SetStatusText(str(self.count)[:4] + "%", 2)

            #wx.Yield()
            wx.YieldIfNeeded()
예제 #20
0
 def TableRecord(t, row):
     try:
         p = float(row) / t.RowsCount() * 100
     except ZeroDivisionError:
         p = 0
     wait._msg2 = 'Riga %d (%d%%)' % (row, p)
     wait._val2 = row
     wx.YieldIfNeeded()
예제 #21
0
 def TableRecord(tab_name, row):
     try:
         p = float(row) / wait._rows * 100
     except ZeroDivisionError:
         p = 0
     wait._msg2 = 'Riga %d (%d%%)' % (row, p)
     wait._val2 = row
     wx.YieldIfNeeded()
예제 #22
0
def playSound(wav_path):
	""" Play sound from wav_path
	"""

	if wav_path != os.devnull:
		sound = wx.Sound(wav_path)
		if sound.IsOk():
			sound.Play(wx.SOUND_ASYNC)
			wx.YieldIfNeeded()
예제 #23
0
 def wait(self, timeout=None):
     if timeout is not None:
         raise NotImplementedError('Timeout not implemented')
     while self._set is False:  #and (self._eng._stop is False):
         wx.YieldIfNeeded()
         # send the EVT_UPDATE_UI events so the UI status has a chance to
         # update (e.g., menubar, toolbar)
         wx.EventLoop.GetActive().ProcessIdle()
         time.sleep(0.05)
예제 #24
0
    def OnMotion(self, event=None):
        FG = self.GetForegroundColour()

        if self.IsHit() and FG != self.ColorHighlight:
            self.SetForegroundColour(self.ColorHighlight)

        elif not self.IsHit() and FG != self.ColorNormal:
            self.SetForegroundColour(self.ColorNormal)

        wx.YieldIfNeeded()
예제 #25
0
	def NextFrame(self, event):
		image = self.GetImage()

		height, width = image.shape[:2]
		
		image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
		image = wx.ImageFromData(width, height, image)
		
		self.image.SetBitmap(image.ConvertToBitmap())
		
		wx.YieldIfNeeded()
예제 #26
0
 def RestoreColors():
     try:
         if awu.GetParentFrame(b).IsShown():
             try:
                 b.SetForegroundColour(None)
                 b.SetBackgroundColour(None)
                 wx.YieldIfNeeded()
             except:
                 pass
     except:
         pass
예제 #27
0
def playSound(sound_path):
	""" Play sound from sound_path
	"""

	if sound_path != os.devnull:
		sound = wx.Sound(sound_path)
		if sound.IsOk():
			sound.Play(wx.SOUND_ASYNC)
			wx.YieldIfNeeded()
		else:
			sys.stderr.write(_("No sound\n"))
예제 #28
0
파일: gui.py 프로젝트: ColinK88/baxter_3d
	def NextFrame(self, evt):
		img = getImage(self.cams)
		h,w = img.shape[:2]

		img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

		if self.bmp.GetWidth() != w:
			self.bmp = wx.BitmapFromBuffer(w,h,img)

		self.bmp.CopyFromBuffer(img)
		wx.YieldIfNeeded()
		self.Refresh()
예제 #29
0
    def OnClose(self, evt):
        """Handles the window closer event
        @param evt: event that called this handler

        """
        self.LOG("[updater][evt] DownloadDialog: Closing Download Dialog")
        self._progress.Abort()
        # Wait till thread has halted before exiting
        while self._progress.IsDownloading():
            wx.YieldIfNeeded()
        wx.GetApp().UnRegisterWindow(repr(self))
        evt.Skip()
예제 #30
0
def DoClick(click, panel, do_delayed_ok_afterwards=False):

    wx.QueueEvent(panel, click)

    if do_delayed_ok_afterwards:

        HG.test_controller.CallLaterWXSafe(panel, 1, PressKeyOnFocusedWindow,
                                           wx.WXK_RETURN)

    wx.YieldIfNeeded()

    time.sleep(0.1)