mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
remove-callback-window
This commit is contained in:
parent
19a0d3bdb9
commit
38de5011e1
@ -792,12 +792,14 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
|
|
||||||
return win
|
return win
|
||||||
|
|
||||||
def closeWindow(self, win, keepCamera = 0):
|
def closeWindow(self, win, keepCamera = False, removeWindow = True):
|
||||||
"""
|
"""
|
||||||
Closes the indicated window and removes it from the list of
|
Closes the indicated window and removes it from the list of
|
||||||
windows. If it is the main window, clears the main window
|
windows. If it is the main window, clears the main window
|
||||||
pointer to None.
|
pointer to None.
|
||||||
"""
|
"""
|
||||||
|
win.setActive(False)
|
||||||
|
|
||||||
# First, remove all of the cameras associated with display
|
# First, remove all of the cameras associated with display
|
||||||
# regions on the window.
|
# regions on the window.
|
||||||
numRegions = win.getNumDisplayRegions()
|
numRegions = win.getNumDisplayRegions()
|
||||||
@ -838,7 +840,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.winControls.remove(winCtrl)
|
self.winControls.remove(winCtrl)
|
||||||
break
|
break
|
||||||
# Now we can actually close the window.
|
# Now we can actually close the window.
|
||||||
self.graphicsEngine.removeWindow(win)
|
if removeWindow:
|
||||||
|
self.graphicsEngine.removeWindow(win)
|
||||||
self.winList.remove(win)
|
self.winList.remove(win)
|
||||||
|
|
||||||
mainWindow = False
|
mainWindow = False
|
||||||
@ -896,7 +899,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
which case base.win may be either None, or the previous,
|
which case base.win may be either None, or the previous,
|
||||||
closed window).
|
closed window).
|
||||||
"""
|
"""
|
||||||
keepCamera = kw.get('keepCamera', 0)
|
keepCamera = kw.get('keepCamera', False)
|
||||||
|
|
||||||
success = 1
|
success = 1
|
||||||
oldWin = self.win
|
oldWin = self.win
|
||||||
|
@ -54,13 +54,12 @@ class EmbeddedPandaWindow(wx.Window):
|
|||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
""" Parent windows should call cleanp() to clean up the
|
""" Parent windows should call cleanup() to clean up the
|
||||||
wxPandaWindow explicitly (since we can't catch EVT_CLOSE
|
wxPandaWindow explicitly (since we can't catch EVT_CLOSE
|
||||||
directly). """
|
directly). """
|
||||||
if self.win:
|
if self.win:
|
||||||
base.closeWindow(self.win)
|
base.closeWindow(self.win)
|
||||||
self.win = None
|
self.win = None
|
||||||
self.Destroy()
|
|
||||||
|
|
||||||
def onSize(self, event):
|
def onSize(self, event):
|
||||||
wp = WindowProperties()
|
wp = WindowProperties()
|
||||||
@ -77,6 +76,8 @@ else:
|
|||||||
within the wx GLCanvas object. It is supported whenever OpenGL is
|
within the wx GLCanvas object. It is supported whenever OpenGL is
|
||||||
Panda's rendering engine, and GLCanvas is available in wx. """
|
Panda's rendering engine, and GLCanvas is available in wx. """
|
||||||
|
|
||||||
|
removeCallbackWindow = ConfigVariableBool('remove-callback-window', True)
|
||||||
|
|
||||||
Keymap = {
|
Keymap = {
|
||||||
wx.WXK_BACK : KeyboardButton.backspace(),
|
wx.WXK_BACK : KeyboardButton.backspace(),
|
||||||
wx.WXK_TAB : KeyboardButton.tab(),
|
wx.WXK_TAB : KeyboardButton.tab(),
|
||||||
@ -204,13 +205,15 @@ else:
|
|||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
""" Parent windows should call cleanp() to clean up the
|
""" Parent windows should call cleanup() to clean up the
|
||||||
wxPandaWindow explicitly (since we can't catch EVT_CLOSE
|
wxPandaWindow explicitly (since we can't catch EVT_CLOSE
|
||||||
directly). """
|
directly). """
|
||||||
if self.win:
|
if self.win:
|
||||||
base.closeWindow(self.win)
|
self.win.clearEventsCallback()
|
||||||
|
self.win.clearPropertiesCallback()
|
||||||
|
self.win.clearRenderCallback()
|
||||||
|
base.closeWindow(self.win, removeWindow = self.removeCallbackWindow)
|
||||||
self.win = None
|
self.win = None
|
||||||
self.Destroy()
|
|
||||||
|
|
||||||
def __buttonDown(self, button):
|
def __buttonDown(self, button):
|
||||||
self.inputDevice.buttonDown(button)
|
self.inputDevice.buttonDown(button)
|
||||||
@ -304,7 +307,7 @@ else:
|
|||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
def onPaint(self, event):
|
def onPaint(self, event):
|
||||||
""" This is called whenever we get the fisrt paint event,
|
""" This is called whenever we get the first paint event,
|
||||||
at which point we can conclude that the window has
|
at which point we can conclude that the window has
|
||||||
actually been manifested onscreen. (In X11, there appears
|
actually been manifested onscreen. (In X11, there appears
|
||||||
to be no way to know this otherwise.) """
|
to be no way to know this otherwise.) """
|
||||||
@ -315,17 +318,18 @@ else:
|
|||||||
#event.Skip()
|
#event.Skip()
|
||||||
|
|
||||||
def onIdle(self, event):
|
def onIdle(self, event):
|
||||||
size = None
|
if self.win:
|
||||||
properties = self.win.getProperties()
|
size = None
|
||||||
if properties.hasSize():
|
properties = self.win.getProperties()
|
||||||
size = (properties.getXSize(), properties.getYSize())
|
if properties.hasSize():
|
||||||
|
size = (properties.getXSize(), properties.getYSize())
|
||||||
|
|
||||||
if tuple(self.GetClientSize()) != size:
|
if tuple(self.GetClientSize()) != size:
|
||||||
# The window has changed size during the idle call.
|
# The window has changed size during the idle call.
|
||||||
# This seems to be possible in Linux.
|
# This seems to be possible in Linux.
|
||||||
wp = WindowProperties()
|
wp = WindowProperties()
|
||||||
wp.setSize(*self.GetClientSize())
|
wp.setSize(*self.GetClientSize())
|
||||||
self.win.requestProperties(wp)
|
self.win.requestProperties(wp)
|
||||||
|
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user