mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
call closeWindow on exit
This commit is contained in:
parent
a160e795dc
commit
53415bb679
@ -86,6 +86,11 @@ class ShowBase:
|
|||||||
self.renderTop.node(),
|
self.renderTop.node(),
|
||||||
self.initialState)
|
self.initialState)
|
||||||
self.win = chanConfig.getWin()
|
self.win = chanConfig.getWin()
|
||||||
|
|
||||||
|
# Now that we've assigned a window, assign an exitfunc.
|
||||||
|
self.oldexitfunc = getattr(sys, 'exitfunc', None)
|
||||||
|
sys.exitfunc = self.exitfunc
|
||||||
|
|
||||||
self.cameraList = []
|
self.cameraList = []
|
||||||
for i in range(chanConfig.getNumGroups()):
|
for i in range(chanConfig.getNumGroups()):
|
||||||
self.cameraList.append(self.render.attachNewNode(
|
self.cameraList.append(self.render.attachNewNode(
|
||||||
@ -227,6 +232,25 @@ class ShowBase:
|
|||||||
|
|
||||||
self.restart()
|
self.restart()
|
||||||
|
|
||||||
|
def exitfunc(self):
|
||||||
|
"""exitfunc(self)
|
||||||
|
|
||||||
|
This should be assigned to sys.exitfunc to be called just
|
||||||
|
before Python shutdown. It guarantees that the Panda window
|
||||||
|
is closed cleanly, so that we free system resources, restore
|
||||||
|
the desktop and keyboard functionality, etc.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# temporary try..except for old pandas.
|
||||||
|
try:
|
||||||
|
self.win.closeWindow()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if self.oldexitfunc:
|
||||||
|
self.oldexitfunc()
|
||||||
|
|
||||||
|
|
||||||
def addAngularIntegrator(self):
|
def addAngularIntegrator(self):
|
||||||
"""addAngularIntegrator(self)"""
|
"""addAngularIntegrator(self)"""
|
||||||
if (self.physicsMgrAngular == 0):
|
if (self.physicsMgrAngular == 0):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user