From: Robin Dunn Date: Wed, 1 Nov 2006 23:32:50 +0000 (+0000) Subject: AUI updates X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2a783b2daaae6f06928e7095ebbc4fc039583907 AUI updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/demo/AUI_DockingWindowMgr.py b/wxPython/demo/AUI_DockingWindowMgr.py index cbaddcaa2d..8ab30e3dc2 100644 --- a/wxPython/demo/AUI_DockingWindowMgr.py +++ b/wxPython/demo/AUI_DockingWindowMgr.py @@ -17,20 +17,26 @@ ID_HTMLContent = wx.NewId() ID_SizeReportContent = wx.NewId() ID_CreatePerspective = wx.NewId() ID_CopyPerspective = wx.NewId() -ID_AllowFloating = wx.NewId() -ID_AllowActivePane = wx.NewId() + ID_TransparentHint = wx.NewId() -ID_TransparentHintFade = wx.NewId() +ID_VenetianBlindsHint = wx.NewId() +ID_RectangleHint = wx.NewId() +ID_NoHint = wx.NewId() +ID_HintFade = wx.NewId() +ID_AllowFloating = wx.NewId() +ID_NoVenetianFade = wx.NewId() ID_TransparentDrag = wx.NewId() -ID_DisableVenetianBlinds = wx.NewId() -ID_DisableVenetianBlindsFade = wx.NewId() +ID_AllowActivePane = wx.NewId() ID_NoGradient = wx.NewId() ID_VerticalGradient = wx.NewId() ID_HorizontalGradient = wx.NewId() + ID_Settings = wx.NewId() ID_About = wx.NewId() ID_FirstPerspective = ID_CreatePerspective+1000 + + #---------------------------------------------------------------------- def GetMondrianData(): return \ @@ -68,7 +74,7 @@ class PyAUIFrame(wx.Frame): wx.Frame.__init__(self, parent, id, title, pos, size, style) # tell FrameManager to manage this frame - self._mgr = wx.aui.FrameManager() + self._mgr = wx.aui.AuiManager() self._mgr.SetManagedWindow(self) self._perspectives = [] @@ -97,20 +103,23 @@ class PyAUIFrame(wx.Frame): view_menu.Append(ID_SizeReportContent, "Use a Size Reporter for the Content Pane") options_menu = wx.Menu() + options_menu.AppendRadioItem(ID_TransparentHint, "Transparent Hint") + options_menu.AppendRadioItem(ID_VenetianBlindsHint, "Venetian Blinds Hint") + options_menu.AppendRadioItem(ID_RectangleHint, "Rectangle Hint") + options_menu.AppendRadioItem(ID_NoHint, "No Hint") + options_menu.AppendSeparator(); + options_menu.AppendCheckItem(ID_HintFade, "Hint Fade-in") options_menu.AppendCheckItem(ID_AllowFloating, "Allow Floating") - options_menu.AppendCheckItem(ID_TransparentHint, "Transparent Hint") - options_menu.AppendCheckItem(ID_TransparentHintFade, "Transparent Hint Fade-in") + options_menu.AppendCheckItem(ID_NoVenetianFade, "Disable Venetian Blinds Hint Fade-in") options_menu.AppendCheckItem(ID_TransparentDrag, "Transparent Drag") - options_menu.AppendCheckItem(ID_DisableVenetianBlinds, "Disable Venetian Blinds Effect") - options_menu.AppendCheckItem(ID_DisableVenetianBlindsFade, "Disable Venetian Blinds Fade-in") options_menu.AppendCheckItem(ID_AllowActivePane, "Allow Active Pane") - options_menu.AppendSeparator() + options_menu.AppendSeparator(); options_menu.AppendRadioItem(ID_NoGradient, "No Caption Gradient") options_menu.AppendRadioItem(ID_VerticalGradient, "Vertical Caption Gradient") options_menu.AppendRadioItem(ID_HorizontalGradient, "Horizontal Caption Gradient") - options_menu.AppendSeparator() + options_menu.AppendSeparator(); options_menu.Append(ID_Settings, "Settings Pane") - + self._perspectives_menu = wx.Menu() self._perspectives_menu.Append(ID_CreatePerspective, "Create Perspective") self._perspectives_menu.Append(ID_CopyPerspective, "Copy Perspective Data To Clipboard") @@ -210,100 +219,100 @@ class PyAUIFrame(wx.Frame): tb5.Realize() # add a bunch of panes - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test1").Caption("Pane Caption").Top()) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test2").Caption("Client Size Reporter"). Bottom().Position(1)) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test3").Caption("Client Size Reporter"). Bottom()) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test4").Caption("Pane Caption"). Left()) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test5").Caption("Pane Caption"). Right()) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test6").Caption("Client Size Reporter"). Right().Row(1)) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test7").Caption("Client Size Reporter"). Left().Layer(1)) - self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.AuiPaneInfo(). Name("test8").Caption("Tree Pane"). Left().Layer(1).Position(1)) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test9").Caption("Min Size 200x100"). BestSize(wx.Size(200,100)).MinSize(wx.Size(200,100)). Bottom().Layer(1)) - self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.AuiPaneInfo(). Name("test10").Caption("Text Pane"). Bottom().Layer(1).Position(1)) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("test11").Caption("Fixed Pane"). Bottom().Layer(1).Position(2).Fixed()) - self._mgr.AddPane(SettingsPanel(self, self), wx.aui.PaneInfo(). + self._mgr.AddPane(SettingsPanel(self, self), wx.aui.AuiPaneInfo(). Name("settings").Caption("Dock Manager Settings"). Dockable(False).Float().Hide()) # create some center panes - self._mgr.AddPane(self.CreateGrid(), wx.aui.PaneInfo().Name("grid_content"). + self._mgr.AddPane(self.CreateGrid(), wx.aui.AuiPaneInfo().Name("grid_content"). CenterPane().Hide()) - self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.PaneInfo().Name("tree_content"). + self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.AuiPaneInfo().Name("tree_content"). CenterPane().Hide()) - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo().Name("sizereport_content"). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo().Name("sizereport_content"). CenterPane().Hide()) - self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.PaneInfo().Name("text_content"). + self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.AuiPaneInfo().Name("text_content"). CenterPane().Hide()) - self._mgr.AddPane(self.CreateHTMLCtrl(), wx.aui.PaneInfo().Name("html_content"). + self._mgr.AddPane(self.CreateHTMLCtrl(), wx.aui.AuiPaneInfo().Name("html_content"). CenterPane()) # add the toolbars to the manager - self._mgr.AddPane(tb1, wx.aui.PaneInfo(). + self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo(). Name("tb1").Caption("Big Toolbar"). ToolbarPane().Top(). LeftDockable(False).RightDockable(False)) - self._mgr.AddPane(tb2, wx.aui.PaneInfo(). + self._mgr.AddPane(tb2, wx.aui.AuiPaneInfo(). Name("tb2").Caption("Toolbar 2"). ToolbarPane().Top().Row(1). LeftDockable(False).RightDockable(False)) - self._mgr.AddPane(tb3, wx.aui.PaneInfo(). + self._mgr.AddPane(tb3, wx.aui.AuiPaneInfo(). Name("tb3").Caption("Toolbar 3"). ToolbarPane().Top().Row(1).Position(1). LeftDockable(False).RightDockable(False)) - self._mgr.AddPane(tb4, wx.aui.PaneInfo(). + self._mgr.AddPane(tb4, wx.aui.AuiPaneInfo(). Name("tb4").Caption("Sample Bookmark Toolbar"). ToolbarPane().Top().Row(2). LeftDockable(False).RightDockable(False)) - self._mgr.AddPane(tb5, wx.aui.PaneInfo(). + self._mgr.AddPane(tb5, wx.aui.AuiPaneInfo(). Name("tbvert").Caption("Sample Vertical Toolbar"). ToolbarPane().Left().GripperTop(). TopDockable(False).BottomDockable(False)) self._mgr.AddPane(wx.Button(self, -1, "Test Button"), - wx.aui.PaneInfo().Name("tb5"). + wx.aui.AuiPaneInfo().Name("tb5"). ToolbarPane().Top().Row(2).Position(1). LeftDockable(False).RightDockable(False)) @@ -365,13 +374,17 @@ class PyAUIFrame(wx.Frame): self.Bind(wx.EVT_MENU, self.OnCreateSizeReport, id=ID_CreateSizeReport) self.Bind(wx.EVT_MENU, self.OnCreatePerspective, id=ID_CreatePerspective) self.Bind(wx.EVT_MENU, self.OnCopyPerspective, id=ID_CopyPerspective) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_AllowFloating) self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_TransparentHint) - self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_TransparentHintFade) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_VenetianBlindsHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_RectangleHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_NoHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_HintFade) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_NoVenetianFade) self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_TransparentDrag) - self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_DisableVenetianBlinds) - self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_DisableVenetianBlindsFade) self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_AllowActivePane) + self.Bind(wx.EVT_MENU, self.OnGradient, id=ID_NoGradient) self.Bind(wx.EVT_MENU, self.OnGradient, id=ID_VerticalGradient) self.Bind(wx.EVT_MENU, self.OnGradient, id=ID_HorizontalGradient) @@ -384,15 +397,19 @@ class PyAUIFrame(wx.Frame): self.Bind(wx.EVT_MENU, self.OnClose, id=wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_About) - self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_AllowFloating) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_TransparentHint) - self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_TransparentHintFade) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_VenetianBlindsHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_RectangleHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_NoHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_HintFade) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_AllowFloating) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_NoVenetianFade) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_TransparentDrag) - self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_DisableVenetianBlinds) - self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_DisableVenetianBlindsFade) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_AllowActivePane) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_NoGradient) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_VerticalGradient) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_HorizontalGradient) + self.Bind(wx.EVT_MENU_RANGE, self.OnRestorePerspective, id=ID_FirstPerspective, id2=ID_FirstPerspective+1000) @@ -404,7 +421,7 @@ class PyAUIFrame(wx.Frame): if caption in ["Tree Pane", "Dock Manager Settings", "Fixed Pane"]: msg = "Are You Sure You Want To Close This Pane?" - dlg = wx.MessageDialog(self, msg, "PyAUI Question", + dlg = wx.MessageDialog(self, msg, "AUI Question", wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_QUESTION) if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]: @@ -484,61 +501,75 @@ class PyAUIFrame(wx.Frame): def OnManagerFlag(self, event): flag = 0 - - if event.GetId() == ID_AllowFloating: - flag = wx.aui.AUI_MGR_ALLOW_FLOATING + eid = event.GetId() - elif event.GetId() == ID_TransparentDrag: - flag = wx.aui.AUI_MGR_TRANSPARENT_DRAG - - elif event.GetId() == ID_TransparentHint: - flag = wx.aui.AUI_MGR_TRANSPARENT_HINT + if eid in [ ID_TransparentHint, ID_VenetianBlindsHint, ID_RectangleHint, ID_NoHint ]: + flags = self._mgr.GetFlags() + flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT + flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT + flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT + self._mgr.SetFlags(flags) - elif event.GetId() == ID_TransparentHintFade: - flag = wx.aui.AUI_MGR_TRANSPARENT_HINT_FADE - - elif event.GetId() == ID_AllowActivePane: + if eid == ID_AllowFloating: + flag = wx.aui.AUI_MGR_ALLOW_FLOATING + elif eid == ID_TransparentDrag: + flag = wx.aui.AUI_MGR_TRANSPARENT_DRAG + elif eid == ID_HintFade: + flag = wx.aui.AUI_MGR_HINT_FADE + elif eid == ID_NoVenetianFade: + flag = wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE + elif eid == ID_AllowActivePane: flag = wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE - - elif event.GetId() == ID_DisableVenetianBlinds: - flag = wx.aui.AUI_MGR_DISABLE_VENETIAN_BLINDS - - elif event.GetId() == ID_DisableVenetianBlindsFade: - flag = wx.aui.AUI_MGR_DISABLE_VENETIAN_BLINDS_FADE - + elif eid == ID_TransparentHint: + flag = wx.aui.AUI_MGR_TRANSPARENT_HINT + elif eid == ID_VenetianBlindsHint: + flag = wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT + elif eid == ID_RectangleHint: + flag = wx.aui.AUI_MGR_RECTANGLE_HINT + self._mgr.SetFlags(self._mgr.GetFlags() ^ flag) def OnUpdateUI(self, event): flags = self._mgr.GetFlags() - - if event.GetId() == ID_NoGradient: + eid = event.GetId() + + if eid == ID_NoGradient: event.Check(self._mgr.GetArtProvider().GetMetric(wx.aui.AUI_ART_GRADIENT_TYPE) == wx.aui.AUI_GRADIENT_NONE) - - elif event.GetId() == ID_VerticalGradient: + + elif eid == ID_VerticalGradient: event.Check(self._mgr.GetArtProvider().GetMetric(wx.aui.AUI_ART_GRADIENT_TYPE) == wx.aui.AUI_GRADIENT_VERTICAL) - - elif event.GetId() == ID_HorizontalGradient: + + elif eid == ID_HorizontalGradient: event.Check(self._mgr.GetArtProvider().GetMetric(wx.aui.AUI_ART_GRADIENT_TYPE) == wx.aui.AUI_GRADIENT_HORIZONTAL) - - elif event.GetId() == ID_AllowFloating: + + elif eid == ID_AllowFloating: event.Check((flags & wx.aui.AUI_MGR_ALLOW_FLOATING) != 0) - elif event.GetId() == ID_TransparentDrag: + elif eid == ID_TransparentDrag: event.Check((flags & wx.aui.AUI_MGR_TRANSPARENT_DRAG) != 0) - elif event.GetId() == ID_TransparentHint: + elif eid == ID_TransparentHint: event.Check((flags & wx.aui.AUI_MGR_TRANSPARENT_HINT) != 0) - elif event.GetId() == ID_TransparentHintFade: - event.Check((flags & wx.aui.AUI_MGR_TRANSPARENT_HINT_FADE) != 0) - - elif event.GetId() == ID_DisableVenetianBlinds: - event.Check((flags & wx.aui.AUI_MGR_DISABLE_VENETIAN_BLINDS) != 0) - - elif event.GetId() == ID_DisableVenetianBlindsFade: - event.Check((flags & wx.aui.AUI_MGR_DISABLE_VENETIAN_BLINDS_FADE) != 0) + elif eid == ID_VenetianBlindsHint: + event.Check((flags & wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT) != 0) + + elif eid == ID_RectangleHint: + event.Check((flags & wx.aui.AUI_MGR_RECTANGLE_HINT) != 0) + + elif eid == ID_NoHint: + event.Check(((wx.aui.AUI_MGR_TRANSPARENT_HINT | + wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT | + wx.aui.AUI_MGR_RECTANGLE_HINT) & flags) == 0) + + elif eid == ID_HintFade: + event.Check((flags & wx.aui.AUI_MGR_HINT_FADE) != 0); + + elif eid == ID_NoVenetianFade: + event.Check((flags & wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE) != 0); + @@ -582,7 +613,7 @@ class PyAUIFrame(wx.Frame): def OnCreateTree(self, event): - self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.AuiPaneInfo(). Name("Test").Caption("Tree Control"). Float().FloatingPosition(self.GetStartPosition()). FloatingSize(wx.Size(150, 300))) @@ -591,7 +622,7 @@ class PyAUIFrame(wx.Frame): def OnCreateGrid(self, event): - self._mgr.AddPane(self.CreateGrid(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateGrid(), wx.aui.AuiPaneInfo(). Name("Test").Caption("Grid"). Float().FloatingPosition(self.GetStartPosition()). FloatingSize(wx.Size(300, 200))) @@ -600,7 +631,7 @@ class PyAUIFrame(wx.Frame): def OnCreateHTML(self, event): - self._mgr.AddPane(self.CreateHTMLCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateHTMLCtrl(), wx.aui.AuiPaneInfo(). Name("Test").Caption("HTML Content"). Float().FloatingPosition(self.GetStartPosition()). FloatingSize(wx.Size(300, 200))) @@ -609,7 +640,7 @@ class PyAUIFrame(wx.Frame): def OnCreateText(self, event): - self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.AuiPaneInfo(). Name("Test").Caption("Text Control"). Float().FloatingPosition(self.GetStartPosition())) self._mgr.Update() @@ -617,7 +648,7 @@ class PyAUIFrame(wx.Frame): def OnCreateSizeReport(self, event): - self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.PaneInfo(). + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). Name("Test").Caption("Client Size Reporter"). Float().FloatingPosition(self.GetStartPosition())) self._mgr.Update() @@ -657,7 +688,7 @@ class PyAUIFrame(wx.Frame): tree = wx.TreeCtrl(self, -1, wx.Point(0, 0), wx.Size(160, 250), wx.TR_DEFAULT_STYLE | wx.NO_BORDER) - root = tree.AddRoot("PyAUI Project") + root = tree.AddRoot("AUI Project") items = [] imglist = wx.ImageList(16, 16, True, 2) diff --git a/wxPython/demo/AUI_Notebook.py b/wxPython/demo/AUI_Notebook.py index febe83dff7..3a5d7dcd3d 100644 --- a/wxPython/demo/AUI_Notebook.py +++ b/wxPython/demo/AUI_Notebook.py @@ -18,7 +18,7 @@ class TestPanel(wx.Panel): self.log = log wx.Panel.__init__(self, parent, -1) - self.nb = wx.aui.AuiMultiNotebook(self) + self.nb = wx.aui.AuiNotebook(self) page = wx.TextCtrl(self.nb, -1, text, style=wx.TE_MULTILINE) self.nb.AddPage(page, "Welcome") diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index ffb55803ff..698ff6c054 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -19,6 +19,19 @@ scenario GetBestFitting size is probably what you want to use instead. wx.Image: Gained support for TGA image file format. +wx.aui: The classes in the wx.aui module have been renamed to be more +consistent with each other, and make it easier to recognize in the +docs and etc. that they belong together. + + FrameManager --> AuiManager + FrameManagerEvent --> AuiManagerEvent + PaneInfo --> AuiPaneInfo + FloatingPane --> AuiFloatingPane + DockArt --> AuiDockArt + TabArt --> AuiTabArt + AuiMultiNotebook --> AuiNotebook + AuiNotebookEvent --> AuiNotebookEvent + @@ -136,20 +149,20 @@ base_Whatever that is marked as deprecated. So now instead of writing your overridden methods like this:: def OnBeginDocument(self, start, end): - # do something here - return self.base_OnBeginDocument(start, end) + # do something here + return self.base_OnBeginDocument(start, end) You can now call the base class method the normal way, like this:: def OnBeginDocument(self, start, end): - # do something here - return Printout.OnBeginDocument(self, start, end) + # do something here + return Printout.OnBeginDocument(self, start, end) Or like this with super():: def OnBeginDocument(self, start, end): - # do something here - return super(MyPrintout, self).OnBeginDocument(start, end) + # do something here + return super(MyPrintout, self).OnBeginDocument(start, end) Note that the old way with the "base_*" function still works, but you will get a DeprecationWarning from calling base_OnBeginDocument. The @@ -483,7 +496,7 @@ data types (wx.Point, wx.Size, wx.Colour, etc.) to no longer raise a TypeError if the compared object is not compatible, but to just return a boolean as expected. For example:: - wx.Colour(64,0,64) == 123 ==> False + wx.Colour(64,0,64) == 123 ==> False wxMSW: Fixed (again) sizing/positioning issues of calling Realize on a wx.ToolBar that is not manaaged directly by a frame and that is @@ -912,9 +925,9 @@ as it considered close enough since the version numbers match. If you want to force the options to be required then you can just add a True parameter, like this:: - import wxversion - wxversion.select("2.6-unicode", True) - import wx + import wxversion + wxversion.select("2.6-unicode", True) + import wx Tweaked wx.lib.buttons such that flat buttons (e.g. have no bevel and a wx.BORDER_NONE style flag) paint themed backgrounds if there are @@ -1785,11 +1798,11 @@ good way to explore and play with the objects in the currently running sample. For example, load the Button sample and then do the following in the PyShell:: - >>> b = frame.demoPage.GetChildren()[0] - >>> for x in range(0, 500, 10): - ... b.Move((x, 50)) - ... app.Yield(True) - ... wx.MilliSleep(10) + >>> b = frame.demoPage.GetChildren()[0] + >>> for x in range(0, 500, 10): + ... b.Move((x, 50)) + ... app.Yield(True) + ... wx.MilliSleep(10) wxGTK: Applied wxNO_BORDER patch (#1098374) for text control and combo diff --git a/wxPython/src/aui.i b/wxPython/src/aui.i index 53baa1d170..254ed49fe5 100755 --- a/wxPython/src/aui.i +++ b/wxPython/src/aui.i @@ -44,7 +44,7 @@ interface: effects\" such as transparent window dragging as well as frame animation. -**PyAUI adheres to the following principles** +**wx.aui adheres to the following principles** - Use native floating frames to obtain a native look and feel for all platforms; @@ -69,7 +69,7 @@ The following example shows a simple implementation that utilizes size=(800, 600), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) - self._mgr = wx.aui.FrameManager(self) + self._mgr = wx.aui.AuiManager(self) # create several text controls text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text', @@ -141,30 +141,30 @@ The following example shows a simple implementation that utilizes // We'll skip making wrappers for these, they have overloads that take a // wxSize or wxPoint -%ignore wxPaneInfo::MaxSize(int x, int y); -%ignore wxPaneInfo::MinSize(int x, int y); -%ignore wxPaneInfo::BestSize(int x, int y); -%ignore wxPaneInfo::FloatingPosition(int x, int y); -%ignore wxPaneInfo::FloatingSize(int x, int y); +%ignore wxAuiPaneInfo::MaxSize(int x, int y); +%ignore wxAuiPaneInfo::MinSize(int x, int y); +%ignore wxAuiPaneInfo::BestSize(int x, int y); +%ignore wxAuiPaneInfo::FloatingPosition(int x, int y); +%ignore wxAuiPaneInfo::FloatingSize(int x, int y); // But for these we will do the overloading (see %pythoncode below) so let's // rename the C++ versions -%rename(_GetPaneByWidget) wxFrameManager::GetPane(wxWindow* window); -%rename(_GetPaneByName) wxFrameManager::GetPane(const wxString& name); +%rename(_GetPaneByWidget) wxAuiManager::GetPane(wxWindow* window); +%rename(_GetPaneByName) wxAuiManager::GetPane(const wxString& name); -%rename(_AddPane1) wxFrameManager::AddPane(wxWindow* window, const wxPaneInfo& pane_info); -%rename(_AddPane2) wxFrameManager::AddPane(wxWindow* window, int direction = wxLEFT, - const wxString& caption = wxEmptyString); +%rename(_AddPane1) wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info); +%rename(_AddPane2) wxAuiManager::AddPane(wxWindow* window, int direction = wxLEFT, + const wxString& caption = wxEmptyString); -%rename(AddPaneAtPos) wxFrameManager::AddPane(wxWindow* window, - const wxPaneInfo& pane_info, - const wxPoint& drop_pos); +%rename(AddPaneAtPos) wxAuiManager::AddPane(wxWindow* window, + const wxPaneInfo& pane_info, + const wxPoint& drop_pos); // A typemap for the return value of wxFrameManager::GetAllPanes -%typemap(out) wxPaneInfoArray& { +%typemap(out) wxAuiPaneInfoArray& { $result = PyList_New(0); for (size_t i=0; i < $1->GetCount(); i++) { - PyObject* pane_obj = SWIG_NewPointerObj((void*)(&$1->Item(i)), SWIGTYPE_p_wxPaneInfo, 0); + PyObject* pane_obj = SWIG_NewPointerObj((void*)(&$1->Item(i)), SWIGTYPE_p_wxAuiPaneInfo, 0); PyList_Append($result, pane_obj); } } @@ -174,10 +174,10 @@ The following example shows a simple implementation that utilizes %pythonAppend wxAuiTabCtrl::wxAuiTabCtrl "self._setOORInfo(self)"; -%pythonAppend wxAuiMultiNotebook::wxAuiMultiNotebook "self._setOORInfo(self)"; -%pythonAppend wxAuiMultiNotebook::wxAuiMultiNotebook() "self._setOORInfo(self)"; -%ignore wxAuiMultiNotebook::~wxAuiMultiNotebook; -%rename(PreAuiMultiNotebook) wxAuiMultiNotebook::wxAuiMultiNotebook(); +%pythonAppend wxAuiNotebook::wxAuiNotebook "self._setOORInfo(self)"; +%pythonAppend wxAuiNotebook::wxAuiNotebook() "self._setOORInfo(self)"; +%ignore wxAuiiNotebook::~wxAuiNotebook; +%rename(PreAuiNotebook) wxAuiNotebook::wxAuiNotebook(); //--------------------------------------------------------------------------- // Get all our defs from the REAL header files. @@ -190,7 +190,7 @@ The following example shows a simple implementation that utilizes // Methods to inject into the FrameManager class that will sort out calls to // the overloaded versions of GetPane and AddPane -%extend wxFrameManager { +%extend wxAuiManager { %pythoncode { def GetPane(self, item): """ @@ -228,7 +228,7 @@ The following example shows a simple implementation that utilizes pane info, and defaults to ``wx.LEFT``. The pane caption may also be specified as an extra parameter in this form. """ - if type(info) == PaneInfo: + if type(info) == AuiPaneInfo: return self._AddPane1(window, info) else: # This Is AddPane2 @@ -248,25 +248,25 @@ The following example shows a simple implementation that utilizes } } -%extend wxDockInfo { - ~wxDockInfo() {} +%extend wxAuiDockInfo { + ~wxAuiDockInfo() {} } -%extend wxDockUIPart { - ~wxDockUIPart() {} +%extend wxAuiDockUIPart { + ~wxAuiDockUIPart() {} } -%extend wxPaneButton { - ~wxPaneButton() {} +%extend wxAuiPaneButton { + ~wxAuiPaneButton() {} } //--------------------------------------------------------------------------- %{ // A wxDocArt class that knows how to forward virtuals to Python methods -class wxPyDockArt : public wxDefaultDockArt +class wxPyAuiDockArt : public wxAuiDefaultDockArt { - wxPyDockArt() : wxDefaultDockArt() {} + wxPyAuiDockArt() : wxAuiDefaultDockArt() {} DEC_PYCALLBACK_INT_INT(GetMetric); DEC_PYCALLBACK_VOID_INTINT(SetMetric); @@ -294,7 +294,7 @@ class wxPyDockArt : public wxDefaultDockArt } wxPyEndBlockThreads(blocked); if (! found) - wxDefaultDockArt::DrawSash(dc, window, orientation, rect); + wxAuiDefaultDockArt::DrawSash(dc, window, orientation, rect); } virtual void DrawBackground(wxDC& dc, @@ -316,14 +316,14 @@ class wxPyDockArt : public wxDefaultDockArt } wxPyEndBlockThreads(blocked); if (! found) - wxDefaultDockArt::DrawBackground(dc, window, orientation, rect); + wxAuiDefaultDockArt::DrawBackground(dc, window, orientation, rect); } virtual void DrawCaption(wxDC& dc, wxWindow* window, const wxString& text, const wxRect& rect, - wxPaneInfo& pane) + wxAuiPaneInfo& pane) { bool found; wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -332,7 +332,7 @@ class wxPyDockArt : public wxDefaultDockArt PyObject* owin = wxPyMake_wxObject(window, false); PyObject* otext = wx2PyString(text); PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0); - PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0); + PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOO)", odc, owin, otext, orect, opane)); Py_DECREF(odc); @@ -343,13 +343,13 @@ class wxPyDockArt : public wxDefaultDockArt } wxPyEndBlockThreads(blocked); if (! found) - wxDefaultDockArt::DrawCaption(dc, window, text, rect, pane); + wxAuiDefaultDockArt::DrawCaption(dc, window, text, rect, pane); } virtual void DrawGripper(wxDC& dc, wxWindow* window, const wxRect& rect, - wxPaneInfo& pane) + wxAuiPaneInfo& pane) { bool found; wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -357,7 +357,7 @@ class wxPyDockArt : public wxDefaultDockArt PyObject* odc = wxPyMake_wxObject(&dc, false); PyObject* owin = wxPyMake_wxObject(window, false); PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0); - PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0); + PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOO)", odc, owin, orect, opane)); Py_DECREF(odc); Py_DECREF(orect); @@ -365,13 +365,13 @@ class wxPyDockArt : public wxDefaultDockArt } wxPyEndBlockThreads(blocked); if (! found) - wxDefaultDockArt::DrawGripper(dc, window, rect, pane); + wxAuiDefaultDockArt::DrawGripper(dc, window, rect, pane); } virtual void DrawBorder(wxDC& dc, wxWindow* window, const wxRect& rect, - wxPaneInfo& pane) + wxAuiPaneInfo& pane) { bool found; wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -379,7 +379,7 @@ class wxPyDockArt : public wxDefaultDockArt PyObject* odc = wxPyMake_wxObject(&dc, false); PyObject* owin = wxPyMake_wxObject(window, false); PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0); - PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0); + PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, orect, opane)); Py_DECREF(odc); Py_DECREF(owin); @@ -388,7 +388,7 @@ class wxPyDockArt : public wxDefaultDockArt } wxPyEndBlockThreads(blocked); if (! found) - wxDefaultDockArt::DrawBorder(dc, window, rect, pane); + wxAuiDefaultDockArt::DrawBorder(dc, window, rect, pane); } virtual void DrawPaneButton(wxDC& dc, @@ -396,7 +396,7 @@ class wxPyDockArt : public wxDefaultDockArt int button, int button_state, const wxRect& rect, - wxPaneInfo& pane) + wxAuiPaneInfo& pane) { bool found; wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -404,7 +404,7 @@ class wxPyDockArt : public wxDefaultDockArt PyObject* odc = wxPyMake_wxObject(&dc, false); PyObject* owin = wxPyMake_wxObject(window, false); PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0); - PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0); + PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiIOO)", odc, owin, button, button_state, orect, opane)); @@ -415,39 +415,39 @@ class wxPyDockArt : public wxDefaultDockArt } wxPyEndBlockThreads(blocked); if (! found) - wxDefaultDockArt::DrawPaneButton(dc, window, button, button_state, rect, pane); + wxAuiDefaultDockArt::DrawPaneButton(dc, window, button, button_state, rect, pane); } PYPRIVATE; }; -IMP_PYCALLBACK_INT_INT(wxPyDockArt, wxDefaultDockArt, GetMetric); -IMP_PYCALLBACK_VOID_INTINT(wxPyDockArt, wxDefaultDockArt, SetMetric); -IMP_PYCALLBACK__INTFONT(wxPyDockArt, wxDefaultDockArt, SetFont); -IMP_PYCALLBACK_FONT_INT(wxPyDockArt, wxDefaultDockArt, GetFont); -IMP_PYCALLBACK_COLOUR_INT(wxPyDockArt, wxDefaultDockArt, GetColour); -IMP_PYCALLBACK__INTCOLOUR(wxPyDockArt, wxDefaultDockArt, SetColour); +IMP_PYCALLBACK_INT_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetMetric); +IMP_PYCALLBACK_VOID_INTINT(wxPyAuiDockArt, wxAuiDefaultDockArt, SetMetric); +IMP_PYCALLBACK__INTFONT(wxPyAuiDockArt, wxAuiDefaultDockArt, SetFont); +IMP_PYCALLBACK_FONT_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetFont); +IMP_PYCALLBACK_COLOUR_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetColour); +IMP_PYCALLBACK__INTCOLOUR(wxPyAuiDockArt, wxAuiDefaultDockArt, SetColour); %} -DocStr(wxPyDockArt, -"This version of the `DockArt` class has been instrumented to be +DocStr(wxPyAuiDockArt, +"This version of the `AuiDockArt` class has been instrumented to be subclassable in Python and to reflect all calls to the C++ base class methods to the Python methods implemented in the derived class.", ""); -class wxPyDockArt : public wxDefaultDockArt +class wxPyAuiDockArt : public wxAuiDefaultDockArt { - %pythonAppend wxPyDockArt "self._setCallbackInfo(self, PyDockArt)" - wxPyDocArt(); + %pythonAppend wxPyAuiDockArt "self._setCallbackInfo(self, PyAuiDockArt)" + wxPyAuiDocArt(); }; //--------------------------------------------------------------------------- -%extend wxAuiMultiNotebook { +%extend wxAuiNotebook { %property(PageCount, GetPageCount, doc="See `GetPageCount`"); %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`"); } @@ -466,7 +466,7 @@ class wxPyDockArt : public wxDefaultDockArt } -%extend wxFrameManager { +%extend wxAuiManager { %property(AllPanes, GetAllPanes, doc="See `GetAllPanes`"); %property(ArtProvider, GetArtProvider, SetArtProvider, doc="See `GetArtProvider` and `SetArtProvider`"); %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`"); @@ -474,7 +474,7 @@ class wxPyDockArt : public wxDefaultDockArt } -%extend wxFrameManagerEvent { +%extend wxAuiManagerEvent { %property(Button, GetButton, SetButton, doc="See `GetButton` and `SetButton`"); %property(DC, GetDC, SetDC, doc="See `GetDC` and `SetDC`"); %property(Pane, GetPane, SetPane, doc="See `GetPane` and `SetPane`"); @@ -485,9 +485,9 @@ class wxPyDockArt : public wxDefaultDockArt %{ // A wxTabArt class that knows how to forward virtuals to Python methods -class wxPyTabArt : public wxDefaultTabArt +class wxPyAuiTabArt : public wxAuiDefaultTabArt { - wxPyTabArt() : wxDefaultTabArt() {} + wxPyAuiTabArt() : wxAuiDefaultTabArt() {} virtual void DrawBackground( wxDC* dc, @@ -504,13 +504,14 @@ class wxPyTabArt : public wxDefaultTabArt } wxPyEndBlockThreads(blocked); if (!found) - wxDefaultTabArt::DrawBackground(dc, rect); + wxAuiDefaultTabArt::DrawBackground(dc, rect); } virtual void DrawTab( wxDC* dc, const wxRect& in_rect, const wxString& caption, bool active, + bool with_close_button, wxRect* out_rect, int* x_extent) { @@ -522,7 +523,10 @@ class wxPyTabArt : public wxDefaultTabArt PyObject* orect = wxPyConstructObject((void*)&in_rect, wxT("wxRect"), 0); PyObject* otext = wx2PyString(caption); PyObject* ro; - ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOi)", odc, orect, otext, (int)active)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue( + "(OOOii)", + odc, orect, otext, + (int)active, (int)with_close_button)); if (ro) { if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { PyObject* o1 = PySequence_GetItem(ro, 0); @@ -549,7 +553,7 @@ class wxPyTabArt : public wxDefaultTabArt } wxPyEndBlockThreads(blocked); if (!found) - wxDefaultTabArt::DrawTab(dc, in_rect, caption, active, out_rect, x_extent); + wxAuiDefaultTabArt::DrawTab(dc, in_rect, caption, active, with_close_button, out_rect, x_extent); } @@ -584,13 +588,14 @@ class wxPyTabArt : public wxDefaultTabArt } wxPyEndBlockThreads(blocked); if (!found) - wxDefaultTabArt::DrawButton(dc, in_rect, bitmap_id, button_state, orientation, bitmap_override, out_rect); + wxAuiDefaultTabArt::DrawButton(dc, in_rect, bitmap_id, button_state, orientation, bitmap_override, out_rect); } virtual wxSize GetTabSize( wxDC* dc, const wxString& caption, bool active, + bool with_close_button, int* x_extent) { bool found; @@ -601,7 +606,8 @@ class wxPyTabArt : public wxDefaultTabArt PyObject* odc = wxPyMake_wxObject(dc, false); PyObject* otext = wx2PyString(caption); PyObject* ro; - ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOi)", odc, otext, (int)active)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue( + "(OOi)", odc, otext, (int)active, (int)with_close_button)); if (ro) { if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { PyObject* o1 = PySequence_GetItem(ro, 0); @@ -627,7 +633,7 @@ class wxPyTabArt : public wxDefaultTabArt } wxPyEndBlockThreads(blocked); if (!found) - rv = wxDefaultTabArt::GetTabSize(dc, caption, active, x_extent); + rv = wxAuiDefaultTabArt::GetTabSize(dc, caption, active, with_close_button, x_extent); return rv; } @@ -642,22 +648,22 @@ class wxPyTabArt : public wxDefaultTabArt }; -IMP_PYCALLBACK__FONT(wxPyTabArt, wxDefaultTabArt, SetNormalFont); -IMP_PYCALLBACK__FONT(wxPyTabArt, wxDefaultTabArt, SetSelectedFont); -IMP_PYCALLBACK__FONT(wxPyTabArt, wxDefaultTabArt, SetMeasuringFont); -IMP_PYCALLBACK_INT_WIN(wxPyTabArt, wxDefaultTabArt, GetBestTabCtrlSize); +IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetNormalFont); +IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetSelectedFont); +IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetMeasuringFont); +IMP_PYCALLBACK_INT_WIN(wxPyAuiTabArt, wxAuiDefaultTabArt, GetBestTabCtrlSize); %} -DocStr(wxPyTabArt, +DocStr(wxPyAuiTabArt, "This version of the `TabArt` class has been instrumented to be subclassable in Python and to reflect all calls to the C++ base class methods to the Python methods implemented in the derived class.", ""); -class wxPyTabArt : public wxDefaultTabArt +class wxPyAuiTabArt : public wxAuiDefaultTabArt { - %pythonAppend wxPyTabArt "self._setCallbackInfo(self, PyTabArt)" - wxPyTabArt(); + %pythonAppend wxPyAuiTabArt "self._setCallbackInfo(self, PyAuiTabArt)" + wxPyAuiTabArt(); };