mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
support wx main loop in p3d system too
This commit is contained in:
parent
93d625845c
commit
279b3a8aeb
@ -2717,6 +2717,11 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.spawnWxLoop()
|
self.spawnWxLoop()
|
||||||
|
|
||||||
def spawnWxLoop(self):
|
def spawnWxLoop(self):
|
||||||
|
""" Call this method to hand the main loop over to wxPython.
|
||||||
|
This sets up a wxTimer callback so that Panda still gets
|
||||||
|
updated, but wxPython owns the main loop (which seems to make
|
||||||
|
it happier than the other way around). """
|
||||||
|
|
||||||
if self.wxApp:
|
if self.wxApp:
|
||||||
# Don't do this twice.
|
# Don't do this twice.
|
||||||
return
|
return
|
||||||
@ -2734,11 +2739,27 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.run = self.wxRun
|
self.run = self.wxRun
|
||||||
self.taskMgr.run = self.wxRun
|
self.taskMgr.run = self.wxRun
|
||||||
__builtin__.run = self.wxRun
|
__builtin__.run = self.wxRun
|
||||||
|
if self.appRunner:
|
||||||
|
self.appRunner.run = self.wxRun
|
||||||
|
|
||||||
def __wxTimerCallback(self, event):
|
def __wxTimerCallback(self, event):
|
||||||
|
if Thread.getCurrentThread().getCurrentTask():
|
||||||
|
# This happens when the wxTimer expires while igLoop is
|
||||||
|
# rendering. Ignore it.
|
||||||
|
return
|
||||||
|
|
||||||
self.taskMgr.step()
|
self.taskMgr.step()
|
||||||
|
|
||||||
def wxRun(self):
|
def wxRun(self):
|
||||||
|
""" This method replaces base.run() after we have called
|
||||||
|
spawnWxLoop(). Since at this point wxPython now owns the main
|
||||||
|
loop, this method is a call to wxApp.MainLoop(). """
|
||||||
|
|
||||||
|
if Thread.getCurrentThread().getCurrentTask():
|
||||||
|
# This happens in the p3d environment during startup.
|
||||||
|
# Ignore it.
|
||||||
|
return
|
||||||
|
|
||||||
self.wxApp.MainLoop()
|
self.wxApp.MainLoop()
|
||||||
|
|
||||||
def startTk(self, fWantTk = True):
|
def startTk(self, fWantTk = True):
|
||||||
|
@ -1269,11 +1269,9 @@ do_poll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_num_busy_threads != 0) {
|
if (_num_busy_threads != 0) {
|
||||||
// We are recursively nested within another task. Return quietly.
|
// We are recursively nested within another task. Return, with a warning.
|
||||||
if (task_cat.is_debug()) {
|
task_cat.warning()
|
||||||
task_cat.debug()
|
<< "Ignoring recursive poll() within another task.\n";
|
||||||
<< "Ignoring recursive poll() within another task.\n";
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user