Python wx.CallLater() Examples

The following are 23 code examples of wx.CallLater(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: url_handler.py    From NVDARemote with GNU General Public License v2.0 6 votes vote down vote up
def windowProc(self, hwnd, msg, wParam, lParam):
		if msg != WM_COPYDATA:
			return
		hwnd = wParam
		struct_pointer = lParam
		message_data = ctypes.cast(struct_pointer, PCOPYDATASTRUCT)
		url = ctypes.wstring_at(message_data.contents.lpData)
		log.info("Received url: %s" % url)
		try:
			con_info = connection_info.ConnectionInfo.from_url(url)
		except connection_info.URLParsingError:
			wx.CallLater(50, gui.messageBox, parent=gui.mainFrame, caption=_("Invalid URL"),
			# Translators: Message shown when an invalid URL has been provided.
			message=_("Unable to parse url \"%s\"")%url, style=wx.OK | wx.ICON_ERROR)
			log.exception("unable to parse nvdaremote:// url %s" % url)
			raise
		log.info("Connection info: %r" % con_info)
		if callable(self.callback):
			wx.CallLater(50, self.callback, con_info) 
Example #2
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 6 votes vote down vote up
def Calibrate(self, startTask):
        self._loadConfiguration(None)
        if 'base' in self.tasks[self.current]:
            self.settings['scan']['elevation'] = self.tasks[self.current]['base']
        elif 'base_region' in self.tasks[self.current]:
            self.settings['scan']['region'] = self.tasks[self.current]['base_region']
        self.settings['output']['scan'] = 'scan_saved'
        self.settings['analyses']['file'] = ''
        self._loadScanningParams(key='scanning_params')
        # just update whatever was not set with 'scanning_params'
        self._loadScanningParams(key='calibration_scanning_params')

        # resume scanning
        self.buttonCalibrate.SetLabel("Calibrating...")
        self.scaniface.filter['filter'] = False
        self._startScanning()

        wx.CallLater(2000, lambda: self.CalibrationDone(startTask)) 
Example #3
Source File: main.py    From wxGlade with MIT License 6 votes vote down vote up
def edit_properties(self, edit_widget):
        # this will be called with a delay
        if edit_widget is not self.next_widget:
            # wait for another call...
            return
        if self._notebook_decoration_size is None:
            # try again later
            wx.CallLater( 150, self.edit_properties, edit_widget )
            return

        self.current_widget = None
        self.create_editor(edit_widget)
        self.current_widget = edit_widget
        if edit_widget:
            # XXX set status bar
            klass = edit_widget.get_prop_value("class", edit_widget.WX_CLASS)
            self.heading.SetValue( _('Properties - %s - <%s>:') % (klass, edit_widget.name) )
        else:
            self.heading.SetValue( _('Properties') ) 
Example #4
Source File: color_interaction.py    From grass-tangible-landscape with GNU General Public License v2.0 6 votes vote down vote up
def Run(self, func):
        ll = self.giface.GetLayerList()
        checked = []
        for l in ll:
            if ll.IsLayerChecked(l):
                checked.append(l.cmd)
                ll.CheckLayer(l, False)
        wx.Yield()

        if not self.scaniface.IsScanning():
            self.scaniface.Scan(continuous=False)
            self.scaniface.process.wait()
            self.scaniface.process = None
            self.scaniface.status.SetLabel("Done.")
            self.Done(func, checked)
        elif self.scaniface.pause:
            pass
        else:
            wx.CallLater(3000, self.Done, func, checked) 
Example #5
Source File: tydesk.py    From tydesk with GNU General Public License v3.0 6 votes vote down vote up
def Notify(self):      
    if hasattr(self, 'TotalMsgs') and self.TotalMsgs > 0:
      toaster = TB.ToasterBox(self, tbstyle=TB.TB_COMPLEX)
      toaster.SetPopupSize((200, 120))
      toaster.SetPopupPauseTime(4000)
      toaster.SetPopupPositionByInt(3)
      toaster.SetPopupBackgroundColour('#F2F5A9')
      
      tbpanel = toaster.GetToasterBoxWindow()
      panel = wx.Panel(tbpanel, -1)
      sizer = wx.BoxSizer(wx.VERTICAL)

      sizer.AddSpacer(10)
      st = wx.StaticText(panel, wx.ID_ANY, label= u'有新消息!')
      sizer.Add(st, 0, wx.ALIGN_CENTER|wx.ALL, 10)

      button = wx.Button(panel, wx.ID_ANY, u"点击查看")
      self.Bind(wx.EVT_BUTTON, self.OnMessages, button)
      sizer.Add(button, 0, wx.ALIGN_CENTER|wx.ALL, 10)

      panel.SetSizer(sizer)
      toaster.AddPanel(panel)
      wx.CallLater(1000, toaster.Play) 
Example #6
Source File: easyshell.py    From Zulu with GNU Affero General Public License v3.0 5 votes vote down vote up
def autoSave(self):
        """auto save callback function for saving the serial output and input
        """
        data = self.text_ctrl_output.GetValue()
        if data != self.preData:
            path = self.outputwin.workingdir + "/../logs/serial_log" + time.strftime("_%Y-%m-%d_%H-%M-%S", time.localtime()) + ".log"
            self.f = open(path, 'w')
            self.f.write('recent saved at : %s\n' % time.asctime())
            self.f.write(data)
            self.f.close()
            self.preData = data
        wx.CallLater(AUTOSAVE_PERIOD, self.autoSave) 
Example #7
Source File: gui.py    From RF-Monitor with GNU General Public License v2.0 5 votes vote down vote up
def __restart_gps(self):
        self.__stop_gps()
        wx.CallLater(GPS_RETRY * 1000, self.__start_gps) 
Example #8
Source File: easyshell.py    From Zulu with GNU Affero General Public License v3.0 5 votes vote down vote up
def printStatusbar(self, data):
        """information stay at statusbar for 1.8 seconds
        """
	try:
        	#wx.CallLater(1800, lambda x: x.SetStatusText(''), self.frame_statusbar)
        	self.frame_statusbar.SetStatusText(data)
	except:
		pass 
Example #9
Source File: easyshell.py    From Zulu with GNU Affero General Public License v3.0 5 votes vote down vote up
def printTitle(self, data):
        """information stay as title for 1.8 seconds
        """
	#try:
        #	wx.CallLater(1800, lambda x: x.SetTitle(self.title), self)
	#except:
	#	return
        #self.SetTitle(data)
        pass 
Example #10
Source File: ListCtrlPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
            kwds["style"] = wx.DEFAULT_FRAME_STYLE
            wx.Frame.__init__(self, *args, **kwds)

            self.panel = wx.Panel(self, -1)
            #self.lv = ObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            self.lv = GroupListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            #self.lv = FastObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)

            sizer_2 = wx.BoxSizer(wx.VERTICAL)
            sizer_2.Add(self.lv, 1, wx.ALL|wx.EXPAND, 4)
            self.panel.SetSizer(sizer_2)
            self.panel.Layout()

            sizer_1 = wx.BoxSizer(wx.VERTICAL)
            sizer_1.Add(self.panel, 1, wx.EXPAND)
            self.SetSizer(sizer_1)
            self.Layout()

            musicImage = self.lv.AddImages(ExampleImages.getMusic16Bitmap(), ExampleImages.getMusic32Bitmap())
            artistImage = self.lv.AddImages(ExampleImages.getUser16Bitmap(), ExampleImages.getUser32Bitmap())

            self.lv.SetColumns([
                ColumnDefn("Title", "left", 200, "title", imageGetter=musicImage),
                ColumnDefn("Artist", "left", 150, "artist", imageGetter=artistImage),
                ColumnDefn("Last Played", "left", 100, "lastPlayed"),
                ColumnDefn("Size", "center", 100, "sizeInBytes"),
                ColumnDefn("Rating", "center", 100, "rating"),
             ])

            #self.lv.CreateCheckStateColumn()
            self.lv.SetSortColumn(self.lv.columns[2])
            self.lv.SetObjects(ExampleModel.GetTracks())

            wx.CallLater(50, self.run) 
Example #11
Source File: OLVPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
            kwds["style"] = wx.DEFAULT_FRAME_STYLE
            wx.Frame.__init__(self, *args, **kwds)

            self.panel = wx.Panel(self, -1)
            self.olv = ObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            self.olv = GroupListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            #self.olv = FastObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            #self.olv = VirtualObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)

            sizer_2 = wx.BoxSizer(wx.VERTICAL)
            sizer_2.Add(self.olv, 1, wx.ALL|wx.EXPAND, 4)
            self.panel.SetSizer(sizer_2)
            self.panel.Layout()

            sizer_1 = wx.BoxSizer(wx.VERTICAL)
            sizer_1.Add(self.panel, 1, wx.EXPAND)
            self.SetSizer(sizer_1)
            self.Layout()

            groupImage = self.olv.AddImages(ExampleImages.getGroup16Bitmap(), ExampleImages.getGroup32Bitmap())
            userImage = self.olv.AddImages(ExampleImages.getUser16Bitmap(), ExampleImages.getUser32Bitmap())
            musicImage = self.olv.AddImages(ExampleImages.getMusic16Bitmap(), ExampleImages.getMusic32Bitmap())

            self.olv.SetColumns([
                ColumnDefn("Title", "left", 120, "title", imageGetter=musicImage),
                ColumnDefn("Artist", "left", 120, "artist", imageGetter=groupImage),
                ColumnDefn("Last Played", "left", 100, "lastPlayed"),
                ColumnDefn("Size", "center", 100, "sizeInBytes"),
                ColumnDefn("Rating", "center", 100, "rating")
            ])
            #self.olv.CreateCheckStateColumn()
            self.olv.SetSortColumn(self.olv.columns[2])
            self.olv.SetObjects(ExampleModel.GetTracks())

            wx.CallLater(50, self.run) 
Example #12
Source File: Document.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def HideFrame(self):
        # NOTICE:
        # If the program is started through a shortcut with "minimize" option
        # set, we get an iconize event while ShowFrame() is executing.
        # Therefore we have to use this CallLater workaround.
        # TODO: Find a better way. Preferable detect the minimize option
        #       before we create the MainFrame.
        if self.reentrantLock.acquire(False):
            if self.frame is not None:
                if len(self.frame.openDialogs) == 0:
                    logCtrl = self.frame.logCtrl
                    if logCtrl.IsAutoscroll():
                        self.visibleLogItem = 0
                    else:
                        self.visibleLogItem = (
                            logCtrl.GetTopItem() + logCtrl.GetCountPerPage()
                        )

                        if self.visibleLogItem:
                            self.visibleLogItem -= 1

                    self.frame.Destroy()
                    self.frame = eg.mainFrame = None
            self.reentrantLock.release()
        else:
            wx.CallLater(100, self.HideFrame) 
Example #13
Source File: TreeCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def OnLeftDoubleClickEvent(self, event):
        """
        Handles wx.EVT_LEFT_DCLICK
        """
        itemId = self.HitTest(event.GetPosition())[0]
        if itemId.IsOk():
            node = self.GetPyData(itemId)
            if node.isConfigurable:
                while wx.GetMouseState().LeftIsDown():
                    wx.GetApp().Yield()
                wx.CallLater(1, self.document.OnCmdConfigure, node)
        event.Skip() 
Example #14
Source File: main.py    From wxGlade with MIT License 5 votes vote down vote up
def set_widget(self, widget, force=False):
        if widget is self.current_widget and not force:
            # just update
            return
        self.next_widget = widget
        if self.current_widget:
            for editor in self.current_widget.properties.values():
                editor.destroy_editor()
            self.current_widget = None   # delete the reference
        wx.CallLater( 150, self.edit_properties, widget ) 
Example #15
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def _showSolutions(self):
        ll = self.giface.GetLayerList()
        if self.handsoff:
            ll.DeleteLayer(self.handsoff)

        cmd = self.tasks[self.current]['solutions'][self.currentSubtask]
        if cmd[0] == 'd.rast':
            ll.AddLayer('raster', name=cmd[1].split('=')[1], checked=True,
                        opacity=1.0, cmd=cmd)
        elif cmd[0] == 'd.vect':
            ll.AddLayer('vector', name=cmd[1].split('=')[1], checked=True,
                        opacity=1.0, cmd=cmd)
        wx.CallLater(6000, self._subtaskDone) 
Example #16
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def _subtaskStop(self):
        # pause scanning
        self._stopScanning()
        if 'duration_handsoff_after' in self.configuration:
            t = self.configuration['duration_handsoff_after']
        else:
            t = 0
        if 'solutions' in self.tasks[self.current]:
            wx.CallLater(t, self.PostProcessing, onDone=self._showSolutions)
        else:
            wx.CallLater(t, self.PostProcessing, onDone=self._subtaskDone) 
Example #17
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def OnSubtask(self, event):
        self._processingSubTask = True
        self.LoadHandsOff()
        # keep scanning without hands
        if 'duration_handsoff' in self.configuration:
            t = self.configuration['duration_handsoff']
        else:
            t = 0
        wx.CallLater(t, self._subtaskStop) 
Example #18
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def _stop(self):
        # pause scanning
        self._stopScanning()
        if 'duration_handsoff_after' in self.configuration:
            t = self.configuration['duration_handsoff_after']
            wx.CallLater(t, self.PostProcessing)
        else:
            self.PostProcessing()
        self._setFocus() 
Example #19
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def _startTask(self):
        if self.timer.IsRunning():
            return

        self._hideToolbarStatusbar()
        self.currentSubtask = 0
        self._processingSubTask = False
        self.scaniface.additionalParams4Analyses = {'subTask': self.currentSubtask}
        self.LoadLayers()
        if 'base' in self.tasks[self.current]:
            self.settings['scan']['elevation'] = self.tasks[self.current]['base']
        elif 'base_region' in self.tasks[self.current]:
            self.settings['scan']['region'] = self.tasks[self.current]['base_region']
        self.settings['analyses']['file'] = os.path.join(self._getTaskDir(), self.tasks[self.current]['analyses'])
        self.settings['output']['scan'] = 'scan'
        self._loadScanningParams(key='scanning_params')

        # resume scanning
        if 'filter' in self.tasks[self.current]:
            self.scaniface.filter['filter'] = True
            self.scaniface.filter['counter'] = 0
            self.scaniface.filter['threshold'] = self.tasks[self.current]['filter']['threshold']
            self.scaniface.filter['debug'] = self.tasks[self.current]['filter']['debug']
        if 'single_scan' in self.tasks[self.current] and self.tasks[self.current]['single_scan']:
            self._stopScanning()
        else:
            self._startScanning()

        # profile
        if 'profile' in self.tasks[self.current]:
            self.StartProfile()
        # display
        if 'display' in self.tasks[self.current]:
            self.StartDisplay()

        wx.CallLater(1000, self._setFocus)

        self.startTime = datetime.datetime.now()
        self.endTime = 0
        self.timer.Start(100) 
Example #20
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def _hideToolbarStatusbar(self):
        """Hide toolbar and statusbar of active Map Display"""
        self.giface.ShowAllToolbars(False)
        self.giface.ShowStatusbar(False)
        wx.CallLater(1000, self.giface.GetMapDisplay().PostSizeEvent) 
Example #21
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def _startSlides(self):
        # lazy import
        from activities_slides import Slides

        self.slides = Slides(self)
        self.slides.SetPosition(self.configuration['slides']['position'])
        self.slides.LoadURL('file://' + os.path.join(self.configuration['slides']['dir'], self.tasks[self.current]['slides']['file']))
        self.slides.Maximize(True)
        self.slides.Show()
        slidenum = 1
        self.slidesStatus.SetLabel("Slide {}".format(slidenum))
        for t in self.tasks[self.current]['slides']['switch']:
            slidenum += 1
            wx.CallLater(t * 1000, self._switchSlide, slidenum)
        wx.CallLater(self.tasks[self.current]['slides']['switch'][-1] * 1000, self._startTask) 
Example #22
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def CalibrationDone(self, startTask):
        self._stopScanning()
        wx.CallLater(4000, lambda: self.buttonCalibrate.SetLabel("Calibrate"))
        if startTask:
            wx.CallLater(4000, lambda: self.OnStart(None)) 
Example #23
Source File: Main.py    From nodemcu-pyflasher with MIT License 5 votes vote down vote up
def __init__(self):
        wx.adv.SplashScreen.__init__(self, images.Splash.GetBitmap(),
                                     wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT, 2500, None, -1)
        self.Bind(wx.EVT_CLOSE, self._on_close)
        self.__fc = wx.CallLater(2000, self._show_main)