From 3aa2cbcbdbbd90cdbdd878bc23831069270a5925 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 21 Sep 2017 23:12:44 -0700 Subject: [PATCH] Fixes in wx.aui to properly transfer ownership of the menubar, and also some tweaks in the AUI_MDI sample in the demo. --- CHANGES.rst | 15 +++++++++++++++ demo/AUI_MDI.py | 19 ++++++++++--------- demo/AUI_Notebook.py | 5 +---- etg/auitabmdi.py | 5 ++++- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index eb9c9fda..526109cd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,21 @@ 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!" --------------------------------------------------------- diff --git a/demo/AUI_MDI.py b/demo/AUI_MDI.py index 908768fa..70bfc709 100644 --- a/demo/AUI_MDI.py +++ b/demo/AUI_MDI.py @@ -1,10 +1,8 @@ #!/usr/bin/env python import wx -try: - from agw import aui -except ImportError: # if it's not there locally, try the wxPython lib. - import wx.lib.agw.aui as aui +import wx.aui as aui + #---------------------------------------------------------------------- @@ -17,10 +15,10 @@ class ParentFrame(aui.AuiMDIParentFrame): size=(640,480), style=wx.DEFAULT_FRAME_STYLE) self.count = 0 - mb = self.MakeMenuBar() - self.SetMenuBar(mb) + self.mb = self.MakeMenuBar() + self.SetMenuBar(self.mb) self.CreateStatusBar() - self.Bind(wx.EVT_CLOSE, self.OnDoClose) + self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) def MakeMenuBar(self): mb = wx.MenuBar() @@ -35,13 +33,16 @@ class ParentFrame(aui.AuiMDIParentFrame): def OnNewChild(self, evt): self.count += 1 child = ChildFrame(self, self.count) - child.Show() + #child.Show() def OnDoClose(self, evt): + self.Close() + + def OnCloseWindow(self, evt): # Close all ChildFrames first else Python crashes for m in self.GetChildren(): if isinstance(m, aui.AuiMDIClientWindow): - for k in m.GetChildren(): + for k in list(m.GetChildren()): if isinstance(k, ChildFrame): k.Close() evt.Skip() diff --git a/demo/AUI_Notebook.py b/demo/AUI_Notebook.py index 374e7412..46193236 100644 --- a/demo/AUI_Notebook.py +++ b/demo/AUI_Notebook.py @@ -1,10 +1,7 @@ #!/usr/bin/env python import wx -try: - from agw import aui -except ImportError: # if it's not there locally, try the wxPython lib. - import wx.lib.agw.aui as aui +import wx.aui as aui text = """\ diff --git a/etg/auitabmdi.py b/etg/auitabmdi.py index ae2d2dbb..45065b2e 100644 --- a/etg/auitabmdi.py +++ b/etg/auitabmdi.py @@ -37,12 +37,15 @@ def run(): c = module.find('wxAuiMDIParentFrame') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) + c.find('SetMenuBar.menuBar').transfer = True + c.find('SetArtProvider.provider').transfer = True c = module.find('wxAuiMDIChildFrame') tools.fixTopLevelWindowClass(c) tools.fixSetStatusWidths(c.find('SetStatusWidths')) - + c.find('SetMenuBar.menuBar').transfer = True + c.find('Show').isVirtual = True c = module.find('wxAuiMDIClientWindow') tools.fixWindowClass(c)