Fixes in wx.aui to properly transfer ownership of the menubar, and also some tweaks in the AUI_MDI sample in the demo.

This commit is contained in:
Robin Dunn
2017-09-21 23:12:44 -07:00
parent f04d103bea
commit 3aa2cbcbdb
4 changed files with 30 additions and 14 deletions

View File

@@ -8,6 +8,21 @@
wxPython Changelog wxPython Changelog
================== ==================
4.0.0rc1
--------
* (not yet released)
PyPI: https://pypi.python.org/pypi/wxPython/4.0.0rc1
Extras: https://extras.wxPython.org/wxPython4/extras/
Pip: ``pip install wxPython==4.0.0rc1``
Changes in this release include the following:
* Fixes in wx.aui to properly transfer ownership of the menubar, and also some
tweaks in the AUI_MDI sample in the demo. (#540)
4.0.0b2 -- "Hurricanes, Floods, and Forest Fires! Oh My!" 4.0.0b2 -- "Hurricanes, Floods, and Forest Fires! Oh My!"
--------------------------------------------------------- ---------------------------------------------------------

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
import wx import wx
try: import wx.aui as aui
from agw import aui
except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.agw.aui as aui
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@@ -17,10 +15,10 @@ class ParentFrame(aui.AuiMDIParentFrame):
size=(640,480), size=(640,480),
style=wx.DEFAULT_FRAME_STYLE) style=wx.DEFAULT_FRAME_STYLE)
self.count = 0 self.count = 0
mb = self.MakeMenuBar() self.mb = self.MakeMenuBar()
self.SetMenuBar(mb) self.SetMenuBar(self.mb)
self.CreateStatusBar() self.CreateStatusBar()
self.Bind(wx.EVT_CLOSE, self.OnDoClose) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
def MakeMenuBar(self): def MakeMenuBar(self):
mb = wx.MenuBar() mb = wx.MenuBar()
@@ -35,13 +33,16 @@ class ParentFrame(aui.AuiMDIParentFrame):
def OnNewChild(self, evt): def OnNewChild(self, evt):
self.count += 1 self.count += 1
child = ChildFrame(self, self.count) child = ChildFrame(self, self.count)
child.Show() #child.Show()
def OnDoClose(self, evt): def OnDoClose(self, evt):
self.Close()
def OnCloseWindow(self, evt):
# Close all ChildFrames first else Python crashes # Close all ChildFrames first else Python crashes
for m in self.GetChildren(): for m in self.GetChildren():
if isinstance(m, aui.AuiMDIClientWindow): if isinstance(m, aui.AuiMDIClientWindow):
for k in m.GetChildren(): for k in list(m.GetChildren()):
if isinstance(k, ChildFrame): if isinstance(k, ChildFrame):
k.Close() k.Close()
evt.Skip() evt.Skip()

View File

@@ -1,10 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import wx import wx
try: import wx.aui as aui
from agw import aui
except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.agw.aui as aui
text = """\ text = """\

View File

@@ -37,12 +37,15 @@ def run():
c = module.find('wxAuiMDIParentFrame') c = module.find('wxAuiMDIParentFrame')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
c.find('SetMenuBar.menuBar').transfer = True
c.find('SetArtProvider.provider').transfer = True
c = module.find('wxAuiMDIChildFrame') c = module.find('wxAuiMDIChildFrame')
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
tools.fixSetStatusWidths(c.find('SetStatusWidths')) tools.fixSetStatusWidths(c.find('SetStatusWidths'))
c.find('SetMenuBar.menuBar').transfer = True
c.find('Show').isVirtual = True
c = module.find('wxAuiMDIClientWindow') c = module.find('wxAuiMDIClientWindow')
tools.fixWindowClass(c) tools.fixWindowClass(c)