diff --git a/TODO.rst b/TODO.rst index 38c195a7..fc5dd85f 100644 --- a/TODO.rst +++ b/TODO.rst @@ -143,8 +143,6 @@ Other Dev Stuff * [] New activex classes in wx/msw/ole/activex.h ? * Any others? - * Add _aui module ?? (or go with only agw aui?) - * Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py) to StyledTextCtrl * Reimplement the classes in the valgen, valnum and valtext headers as diff --git a/demo/AUI_DockingWindowMgr.py b/demo/AUI_DockingWindowMgr.py index c9b3461d..0a0dda4f 100644 --- a/demo/AUI_DockingWindowMgr.py +++ b/demo/AUI_DockingWindowMgr.py @@ -7,11 +7,7 @@ import wx import wx.grid import wx.html - -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 from six import BytesIO @@ -163,69 +159,69 @@ class PyAUIFrame(wx.Frame): tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER) tb1.SetToolBitmapSize(wx.Size(48,48)) - tb1.AddLabelTool(101, "Test", wx.ArtProvider.GetBitmap(wx.ART_ERROR)) + tb1.AddTool(101, "Test", wx.ArtProvider.GetBitmap(wx.ART_ERROR)) tb1.AddSeparator() - tb1.AddLabelTool(102, "Test", wx.ArtProvider.GetBitmap(wx.ART_QUESTION)) - tb1.AddLabelTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_INFORMATION)) - tb1.AddLabelTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_WARNING)) - tb1.AddLabelTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE)) + tb1.AddTool(102, "Test", wx.ArtProvider.GetBitmap(wx.ART_QUESTION)) + tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_INFORMATION)) + tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_WARNING)) + tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE)) tb1.Realize() tb2 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER) tb2.SetToolBitmapSize(wx.Size(16,16)) tb2_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(16, 16)) - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) tb2.AddSeparator() - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) tb2.AddSeparator() - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) - tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) + tb2.AddTool(101, "Test", tb2_bmp1) tb2.Realize() tb3 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER) tb3.SetToolBitmapSize(wx.Size(16,16)) tb3_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, wx.Size(16, 16)) - tb3.AddLabelTool(101, "Test", tb3_bmp1) - tb3.AddLabelTool(101, "Test", tb3_bmp1) - tb3.AddLabelTool(101, "Test", tb3_bmp1) - tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddTool(101, "Test", tb3_bmp1) + tb3.AddTool(101, "Test", tb3_bmp1) + tb3.AddTool(101, "Test", tb3_bmp1) + tb3.AddTool(101, "Test", tb3_bmp1) tb3.AddSeparator() - tb3.AddLabelTool(101, "Test", tb3_bmp1) - tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddTool(101, "Test", tb3_bmp1) + tb3.AddTool(101, "Test", tb3_bmp1) tb3.Realize() tb4 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_HORZ_TEXT) tb4.SetToolBitmapSize(wx.Size(16,16)) tb4_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16)) - tb4.AddLabelTool(101, "Item 1", tb4_bmp1) - tb4.AddLabelTool(101, "Item 2", tb4_bmp1) - tb4.AddLabelTool(101, "Item 3", tb4_bmp1) - tb4.AddLabelTool(101, "Item 4", tb4_bmp1) + tb4.AddTool(101, "Item 1", tb4_bmp1) + tb4.AddTool(101, "Item 2", tb4_bmp1) + tb4.AddTool(101, "Item 3", tb4_bmp1) + tb4.AddTool(101, "Item 4", tb4_bmp1) tb4.AddSeparator() - tb4.AddLabelTool(101, "Item 5", tb4_bmp1) - tb4.AddLabelTool(101, "Item 6", tb4_bmp1) - tb4.AddLabelTool(101, "Item 7", tb4_bmp1) - tb4.AddLabelTool(101, "Item 8", tb4_bmp1) + tb4.AddTool(101, "Item 5", tb4_bmp1) + tb4.AddTool(101, "Item 6", tb4_bmp1) + tb4.AddTool(101, "Item 7", tb4_bmp1) + tb4.AddTool(101, "Item 8", tb4_bmp1) tb4.Realize() tb5 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_VERTICAL) tb5.SetToolBitmapSize(wx.Size(48, 48)) - tb5.AddLabelTool(101, "Test", wx.ArtProvider.GetBitmap(wx.ART_ERROR)) + tb5.AddTool(101, "Test", wx.ArtProvider.GetBitmap(wx.ART_ERROR)) tb5.AddSeparator() - tb5.AddLabelTool(102, "Test", wx.ArtProvider.GetBitmap(wx.ART_QUESTION)) - tb5.AddLabelTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_INFORMATION)) - tb5.AddLabelTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_WARNING)) - tb5.AddLabelTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE)) + tb5.AddTool(102, "Test", wx.ArtProvider.GetBitmap(wx.ART_QUESTION)) + tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_INFORMATION)) + tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_WARNING)) + tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE)) tb5.Realize() # add a bunch of panes @@ -451,10 +447,10 @@ class PyAUIFrame(wx.Frame): def OnAbout(self, event): - msg = "aui Demo\n" + \ + msg = "wx.aui Demo\n" + \ "An advanced window management library for wxWidgets\n" + \ "(c) Copyright 2005-2006, Kirix Corporation" - dlg = wx.MessageDialog(self, msg, "About aui Demo", + dlg = wx.MessageDialog(self, msg, "About wx.aui Demo", wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() @@ -743,12 +739,12 @@ class PyAUIFrame(wx.Frame): # -- wx.SizeReportCtrl -- # (a utility control that always reports it's client size) -class SizeReportCtrl(wx.PyControl): +class SizeReportCtrl(wx.Control): def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, mgr=None): - wx.PyControl.__init__(self, parent, id, pos, size, wx.NO_BORDER) + wx.Control.__init__(self, parent, id, pos, size, wx.NO_BORDER) self._mgr = mgr diff --git a/docs/sphinx/_templates/main.html b/docs/sphinx/_templates/main.html index 9515dc8e..057af5a2 100644 --- a/docs/sphinx/_templates/main.html +++ b/docs/sphinx/_templates/main.html @@ -39,7 +39,7 @@ A generic, ground-up implementation of a text control capable of showing multiple text styles and images.

+ A set of classes for writing a ribbon-based UI, typically a combonation of tabs and toolbar, similar to the UI in MS Office and Windows 10.

@@ -47,6 +47,9 @@ + + diff --git a/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index b51765b2..2d8b0f4f 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -106,6 +106,96 @@ "ART_TOOLBAR":"wx.", "ART_UNDO":"wx.", "ART_WARNING":"wx.", +"AUI_BUTTON_CLOSE":"wx.aui.", +"AUI_BUTTON_CUSTOM1":"wx.aui.", +"AUI_BUTTON_CUSTOM2":"wx.aui.", +"AUI_BUTTON_CUSTOM3":"wx.aui.", +"AUI_BUTTON_DOWN":"wx.aui.", +"AUI_BUTTON_LEFT":"wx.aui.", +"AUI_BUTTON_MAXIMIZE_RESTORE":"wx.aui.", +"AUI_BUTTON_MINIMIZE":"wx.aui.", +"AUI_BUTTON_OPTIONS":"wx.aui.", +"AUI_BUTTON_PIN":"wx.aui.", +"AUI_BUTTON_RIGHT":"wx.aui.", +"AUI_BUTTON_STATE_CHECKED":"wx.aui.", +"AUI_BUTTON_STATE_DISABLED":"wx.aui.", +"AUI_BUTTON_STATE_HIDDEN":"wx.aui.", +"AUI_BUTTON_STATE_HOVER":"wx.aui.", +"AUI_BUTTON_STATE_NORMAL":"wx.aui.", +"AUI_BUTTON_STATE_PRESSED":"wx.aui.", +"AUI_BUTTON_UP":"wx.aui.", +"AUI_BUTTON_WINDOWLIST":"wx.aui.", +"AUI_DOCKART_ACTIVE_CAPTION_COLOUR":"wx.aui.", +"AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR":"wx.aui.", +"AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR":"wx.aui.", +"AUI_DOCKART_BACKGROUND_COLOUR":"wx.aui.", +"AUI_DOCKART_BORDER_COLOUR":"wx.aui.", +"AUI_DOCKART_CAPTION_FONT":"wx.aui.", +"AUI_DOCKART_CAPTION_SIZE":"wx.aui.", +"AUI_DOCKART_GRADIENT_TYPE":"wx.aui.", +"AUI_DOCKART_GRIPPER_COLOUR":"wx.aui.", +"AUI_DOCKART_GRIPPER_SIZE":"wx.aui.", +"AUI_DOCKART_INACTIVE_CAPTION_COLOUR":"wx.aui.", +"AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR":"wx.aui.", +"AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR":"wx.aui.", +"AUI_DOCKART_PANE_BORDER_SIZE":"wx.aui.", +"AUI_DOCKART_PANE_BUTTON_SIZE":"wx.aui.", +"AUI_DOCKART_SASH_COLOUR":"wx.aui.", +"AUI_DOCKART_SASH_SIZE":"wx.aui.", +"AUI_DOCK_BOTTOM":"wx.aui.", +"AUI_DOCK_CENTER":"wx.aui.", +"AUI_DOCK_CENTRE":"wx.aui.", +"AUI_DOCK_LEFT":"wx.aui.", +"AUI_DOCK_NONE":"wx.aui.", +"AUI_DOCK_RIGHT":"wx.aui.", +"AUI_DOCK_TOP":"wx.aui.", +"AUI_GRADIENT_HORIZONTAL":"wx.aui.", +"AUI_GRADIENT_NONE":"wx.aui.", +"AUI_GRADIENT_VERTICAL":"wx.aui.", +"AUI_MGR_ALLOW_ACTIVE_PANE":"wx.aui.", +"AUI_MGR_ALLOW_FLOATING":"wx.aui.", +"AUI_MGR_DEFAULT":"wx.aui.", +"AUI_MGR_HINT_FADE":"wx.aui.", +"AUI_MGR_LIVE_RESIZE":"wx.aui.", +"AUI_MGR_NO_VENETIAN_BLINDS_FADE":"wx.aui.", +"AUI_MGR_RECTANGLE_HINT":"wx.aui.", +"AUI_MGR_TRANSPARENT_DRAG":"wx.aui.", +"AUI_MGR_TRANSPARENT_HINT":"wx.aui.", +"AUI_MGR_VENETIAN_BLINDS_HINT":"wx.aui.", +"AUI_NB_BOTTOM":"wx.aui.", +"AUI_NB_CLOSE_BUTTON":"wx.aui.", +"AUI_NB_CLOSE_ON_ACTIVE_TAB":"wx.aui.", +"AUI_NB_CLOSE_ON_ALL_TABS":"wx.aui.", +"AUI_NB_DEFAULT_STYLE":"wx.aui.", +"AUI_NB_LEFT":"wx.aui.", +"AUI_NB_MIDDLE_CLICK_CLOSE":"wx.aui.", +"AUI_NB_RIGHT":"wx.aui.", +"AUI_NB_SCROLL_BUTTONS":"wx.aui.", +"AUI_NB_TAB_EXTERNAL_MOVE":"wx.aui.", +"AUI_NB_TAB_FIXED_WIDTH":"wx.aui.", +"AUI_NB_TAB_MOVE":"wx.aui.", +"AUI_NB_TAB_SPLIT":"wx.aui.", +"AUI_NB_TOP":"wx.aui.", +"AUI_NB_WINDOWLIST_BUTTON":"wx.aui.", +"AUI_ORIENTATION_MASK":"wx.aui.", +"AUI_TBART_GRIPPER_SIZE":"wx.aui.", +"AUI_TBART_OVERFLOW_SIZE":"wx.aui.", +"AUI_TBART_SEPARATOR_SIZE":"wx.aui.", +"AUI_TBTOOL_TEXT_BOTTOM":"wx.aui.", +"AUI_TBTOOL_TEXT_LEFT":"wx.aui.", +"AUI_TBTOOL_TEXT_RIGHT":"wx.aui.", +"AUI_TBTOOL_TEXT_TOP":"wx.aui.", +"AUI_TB_DEFAULT_STYLE":"wx.aui.", +"AUI_TB_GRIPPER":"wx.aui.", +"AUI_TB_HORIZONTAL":"wx.aui.", +"AUI_TB_HORZ_LAYOUT":"wx.aui.", +"AUI_TB_HORZ_TEXT":"wx.aui.", +"AUI_TB_NO_AUTORESIZE":"wx.aui.", +"AUI_TB_NO_TOOLTIPS":"wx.aui.", +"AUI_TB_OVERFLOW":"wx.aui.", +"AUI_TB_PLAIN_BACKGROUND":"wx.aui.", +"AUI_TB_TEXT":"wx.aui.", +"AUI_TB_VERTICAL":"wx.aui.", "Abort":"wx.", "AboutBox":"wx.adv.", "AboutDialogInfo":"wx.adv.", @@ -139,6 +229,40 @@ "AsIs":"wx.", "AssertHandler_t":"wx.", "AttrKind":"wx.grid.GridCellAttr.", +"AuiButtonId":"wx.aui.", +"AuiDefaultDockArt":"wx.aui.", +"AuiDefaultTabArt":"wx.aui.", +"AuiDefaultToolBarArt":"wx.aui.", +"AuiDockArt":"wx.aui.", +"AuiDockInfo":"wx.aui.", +"AuiDockUIPart":"wx.aui.", +"AuiMDIChildFrame":"wx.aui.", +"AuiMDIClientWindow":"wx.aui.", +"AuiMDIParentFrame":"wx.aui.", +"AuiManager":"wx.aui.", +"AuiManagerDock":"wx.aui.", +"AuiManagerEvent":"wx.aui.", +"AuiManagerOption":"wx.aui.", +"AuiNotebook":"wx.aui.", +"AuiNotebookEvent":"wx.aui.", +"AuiNotebookOption":"wx.aui.", +"AuiNotebookPage":"wx.aui.", +"AuiPaneButton":"wx.aui.", +"AuiPaneButtonState":"wx.aui.", +"AuiPaneDockArtGradients":"wx.aui.", +"AuiPaneDockArtSetting":"wx.aui.", +"AuiPaneInfo":"wx.aui.", +"AuiSimpleTabArt":"wx.aui.", +"AuiTabArt":"wx.aui.", +"AuiTabContainer":"wx.aui.", +"AuiTabContainerButton":"wx.aui.", +"AuiToolBar":"wx.aui.", +"AuiToolBarArt":"wx.aui.", +"AuiToolBarArtSetting":"wx.aui.", +"AuiToolBarEvent":"wx.aui.", +"AuiToolBarItem":"wx.aui.", +"AuiToolBarStyle":"wx.aui.", +"AuiToolBarToolTextOrientation":"wx.aui.", "AutoBufferedPaintDC":"wx.", "AutoBufferedPaintDCFactory":"wx.", "BACKINGSTORE":"wx.", @@ -1125,6 +1249,7 @@ "GetSingleChoice":"wx.", "GetSingleChoiceData":"wx.", "GetSingleChoiceIndex":"wx.", +"GetStockLabel":"wx.", "GetTextFromUser":"wx.", "GetTextFromUserPromptStr":"wx.", "GetTopLevelParent":"wx.", @@ -5179,6 +5304,11 @@ "STC_YAML_OPERATOR":"wx.stc.", "STC_YAML_REFERENCE":"wx.stc.", "STC_YAML_TEXT":"wx.stc.", +"STOCK_FOR_BUTTON":"wx.", +"STOCK_NOFLAGS":"wx.", +"STOCK_WITHOUT_ELLIPSIS":"wx.", +"STOCK_WITH_ACCELERATOR":"wx.", +"STOCK_WITH_MNEMONIC":"wx.", "STREAM_EOF":"wx.", "STREAM_NO_ERROR":"wx.", "STREAM_READ_ERROR":"wx.", @@ -5367,6 +5497,7 @@ "StatusBarPane":"wx.", "StdDialogButtonSizer":"wx.", "StockCursor":"wx.", +"StockLabelQueryFlag":"wx.", "StockPreferencesPage":"wx.", "StopWatch":"wx.", "StreamBase":"wx.", @@ -6121,6 +6252,33 @@ "wxEVT_ACTIVATE":"wx.", "wxEVT_ACTIVATE_APP":"wx.", "wxEVT_ANY":"wx.", +"wxEVT_AUINOTEBOOK_ALLOW_DND":"wx.aui.", +"wxEVT_AUINOTEBOOK_BEGIN_DRAG":"wx.aui.", +"wxEVT_AUINOTEBOOK_BG_DCLICK":"wx.aui.", +"wxEVT_AUINOTEBOOK_BUTTON":"wx.aui.", +"wxEVT_AUINOTEBOOK_DRAG_DONE":"wx.aui.", +"wxEVT_AUINOTEBOOK_DRAG_MOTION":"wx.aui.", +"wxEVT_AUINOTEBOOK_END_DRAG":"wx.aui.", +"wxEVT_AUINOTEBOOK_PAGE_CHANGED":"wx.aui.", +"wxEVT_AUINOTEBOOK_PAGE_CHANGING":"wx.aui.", +"wxEVT_AUINOTEBOOK_PAGE_CLOSE":"wx.aui.", +"wxEVT_AUINOTEBOOK_PAGE_CLOSED":"wx.aui.", +"wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN":"wx.aui.", +"wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP":"wx.aui.", +"wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN":"wx.aui.", +"wxEVT_AUINOTEBOOK_TAB_RIGHT_UP":"wx.aui.", +"wxEVT_AUITOOLBAR_BEGIN_DRAG":"wx.aui.", +"wxEVT_AUITOOLBAR_MIDDLE_CLICK":"wx.aui.", +"wxEVT_AUITOOLBAR_OVERFLOW_CLICK":"wx.aui.", +"wxEVT_AUITOOLBAR_RIGHT_CLICK":"wx.aui.", +"wxEVT_AUITOOLBAR_TOOL_DROPDOWN":"wx.aui.", +"wxEVT_AUI_FIND_MANAGER":"wx.aui.", +"wxEVT_AUI_PANE_ACTIVATED":"wx.aui.", +"wxEVT_AUI_PANE_BUTTON":"wx.aui.", +"wxEVT_AUI_PANE_CLOSE":"wx.aui.", +"wxEVT_AUI_PANE_MAXIMIZE":"wx.aui.", +"wxEVT_AUI_PANE_RESTORE":"wx.aui.", +"wxEVT_AUI_RENDER":"wx.aui.", "wxEVT_AUX1_DCLICK":"wx.", "wxEVT_AUX1_DOWN":"wx.", "wxEVT_AUX1_UP":"wx.", diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.aui.AuiManager.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.aui.AuiManager.1.py new file mode 100644 index 00000000..f03094b9 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.aui.AuiManager.1.py @@ -0,0 +1,6 @@ + + text1 = wx.TextCtrl(self) + text2 = wx.TextCtrl(self) + self.mgr.AddPane(text1, wx.LEFT, "Pane Caption") + self.mgr.AddPane(text2, wx.BOTTOM, "Pane Caption") + self.mgr.Update() diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.aui.AuiManager.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.aui.AuiManager.2.py new file mode 100644 index 00000000..d2d8bfdd --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.aui.AuiManager.2.py @@ -0,0 +1,2 @@ + + self.mgr.GetPane(text1).Float() diff --git a/etg/_aui.py b/etg/_aui.py new file mode 100644 index 00000000..f7e9e3cb --- /dev/null +++ b/etg/_aui.py @@ -0,0 +1,78 @@ +#--------------------------------------------------------------------------- +# Name: etg/_aui.py +# Author: Robin Dunn +# +# Created: 25-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_aui" +NAME = "_aui" # Base name of the file to generate to for this script +DOCSTRING = """\ +`wx.aui` provides a set of classes for implementing an "Advanced User Interface". +More specifically, these classes enable to you present some of your application in +floating or dockable panels, notebooks with floatable tabs, etc. + +There is also a pure-python implementation of these classes available in the +`wx.lib.agw.aui` package. +""" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ ] + + +# The list of other ETG scripts and back-end generator modules that are +# included as part of this module. These should all be items that are put in +# the wxWidgets "aui" library in a multi-lib build. +INCLUDES = [ 'auiframemanager', + 'auidockart', + 'auibar', + 'auibook', + 'auitabmdi', + ] + + +# Separate the list into those that are generated from ETG scripts and the +# rest. These lists can be used from the build scripts to get a list of +# sources and/or additional dependencies when building this extension module. +ETGFILES = ['etg/%s.py' % NAME] + tools.getEtgFiles(INCLUDES) +DEPENDS = tools.getNonEtgFiles(INCLUDES) +OTHERDEPS = [ ] + + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + module.check4unittest = False + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + module.addHeaderCode('#include ') + module.addImport('_core') + module.addPyCode("import wx", order=10) + + module.addHeaderCode('#include ') + + module.addInclude(INCLUDES) + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + run() diff --git a/etg/_core.py b/etg/_core.py index 00845fff..db6c6f14 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -228,6 +228,7 @@ INCLUDES = [ # base and core stuff 'preferences', 'modalhook', 'unichar', + 'stockitem', ] diff --git a/etg/auibar.py b/etg/auibar.py new file mode 100644 index 00000000..c8ebb655 --- /dev/null +++ b/etg/auibar.py @@ -0,0 +1,67 @@ +#--------------------------------------------------------------------------- +# Name: etg/auibar.py +# Author: Robin Dunn +# +# Created: 26-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_aui" +NAME = "auibar" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'wxAuiToolBarItem', + 'wxAuiToolBarArt', + 'wxAuiDefaultToolBarArt', + 'wxAuiToolBar', + 'wxAuiToolBarEvent', + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + c = module.find('wxAuiToolBar') + assert isinstance(c, etgtools.ClassDef) + tools.fixWindowClass(c) + + + c = module.find('wxAuiToolBarEvent') + tools.fixEventClass(c) + + c.addPyCode("""\ + EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 ) + EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 ) + EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 ) + EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 ) + EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 ) + """) + + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiToolBarItemArray', 'wxAuiToolBarItem', module)) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/auibook.py b/etg/auibook.py new file mode 100644 index 00000000..16b97b0a --- /dev/null +++ b/etg/auibook.py @@ -0,0 +1,89 @@ +#--------------------------------------------------------------------------- +# Name: etg/auibook.py +# Author: Robin Dunn +# +# Created: 26-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_aui" +NAME = "auibook" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'wxAuiNotebook', + 'wxAuiNotebookPage', + 'wxAuiTabContainerButton', + 'wxAuiTabContainer', + 'wxAuiTabArt', + 'wxAuiDefaultTabArt', + 'wxAuiSimpleTabArt', + 'wxAuiNotebookEvent', + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + + c = module.find('wxAuiNotebook') + assert isinstance(c, etgtools.ClassDef) + tools.fixWindowClass(c) + + c = module.find('wxAuiTabContainer') + tools.ignoreConstOverloads(c) + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiNotebookPageArray', 'wxAuiNotebookPage', module)) + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiTabContainerButtonArray', 'wxAuiTabContainerButton', module)) + + c = module.find('wxAuiTabArt') + c.abstract = True + + c = module.find('wxAuiNotebookEvent') + tools.fixEventClass(c) + c.addPyCode("""\ + EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSE, 1 ) + EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSED, 1 ) + EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGED, 1 ) + EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGING, 1 ) + EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BUTTON, 1 ) + EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BEGIN_DRAG, 1 ) + EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_END_DRAG, 1 ) + EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_MOTION, 1 ) + EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_AUINOTEBOOK_ALLOW_DND, 1 ) + EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_DONE, 1 ) + EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 ) + EVT_AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, 1 ) + EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 ) + EVT_AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, 1 ) + EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BG_DCLICK, 1 ) + """) + + + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/auidockart.py b/etg/auidockart.py new file mode 100644 index 00000000..37a0bb23 --- /dev/null +++ b/etg/auidockart.py @@ -0,0 +1,48 @@ +#--------------------------------------------------------------------------- +# Name: etg/auidockart.py +# Author: Robin Dunn +# +# Created: 26-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_aui" +NAME = "auidockart" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'wxAuiDockArt', + 'wxAuiDefaultDockArt', + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + + c = module.find('wxAuiDockArt') + assert isinstance(c, etgtools.ClassDef) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/auiframemanager.py b/etg/auiframemanager.py new file mode 100644 index 00000000..80a02a8e --- /dev/null +++ b/etg/auiframemanager.py @@ -0,0 +1,88 @@ +#--------------------------------------------------------------------------- +# Name: etg/auiframemanager.py +# Author: Robin Dunn +# +# Created: 25-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_aui" +NAME = "auiframemanager" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'wxAuiManager', + 'wxAuiPaneInfo', + 'wxAuiManagerEvent', + 'wxAuiDockInfo', + 'wxAuiDockUIPart', + 'wxAuiPaneButton', + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + + c = module.find('wxAuiManager') + assert isinstance(c, etgtools.ClassDef) + c.find('ProcessDockResult').ignore(False) + + c = module.find('wxAuiPaneInfo') + module.addItem( + tools.wxArrayWrapperTemplate( + 'wxAuiPaneInfoArray', 'wxAuiPaneInfo', module)) + + + c = module.find('wxAuiManagerEvent') + tools.fixEventClass(c) + + c.addPyCode("""\ + EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON ) + EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) + EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) + EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) + EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED ) + EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) + EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) + """) + + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiDockInfoArray', 'wxAuiDockInfo', module)) + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiDockUIPartArray', 'wxAuiDockUIPart', module)) + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiPaneButtonArray', 'wxAuiPaneButton', module)) + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiPaneInfoPtrArray', 'wxAuiPaneInfo', module, itemIsPtr=True)) + + module.addItem(tools.wxArrayWrapperTemplate( + 'wxAuiDockInfoPtrArray', 'wxAuiDockInfo', module, itemIsPtr=True)) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/auitabmdi.py b/etg/auitabmdi.py new file mode 100644 index 00000000..ced4cf2c --- /dev/null +++ b/etg/auitabmdi.py @@ -0,0 +1,59 @@ +#--------------------------------------------------------------------------- +# Name: etg/auitabmdi.py +# Author: Robin Dunn +# +# Created: 27-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_aui" +NAME = "auitabmdi" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'wxAuiMDIParentFrame', + 'wxAuiMDIChildFrame', + 'wxAuiMDIClientWindow', + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + + c = module.find('wxAuiMDIParentFrame') + assert isinstance(c, etgtools.ClassDef) + tools.fixTopLevelWindowClass(c) + + + c = module.find('wxAuiMDIChildFrame') + tools.fixTopLevelWindowClass(c) + tools.fixSetStatusWidths(c.find('SetStatusWidths')) + + + c = module.find('wxAuiMDIClientWindow') + tools.fixWindowClass(c) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/frame.py b/etg/frame.py index 37378633..ce33fa01 100644 --- a/etg/frame.py +++ b/etg/frame.py @@ -40,16 +40,8 @@ def run(): # We already have a MappedType for wxArrayInt, so just tweak the # interface to use that instead of an array size and a const int pointer. - m = c.find('SetStatusWidths') - m.find('n').ignore() - m.find('widths_field').type = 'const wxArrayInt&' - m.find('widths_field').name = 'widths' - m.argsString = '(int n, const wxArrayInt& widths)' - m.setCppCode("""\ - const int* ptr = &widths->front(); - self->SetStatusWidths(widths->size(), ptr); - """) - + tools.fixSetStatusWidths(c.find('SetStatusWidths')) + c.addProperty('MenuBar GetMenuBar SetMenuBar') c.addProperty('StatusBar GetStatusBar SetStatusBar') c.addProperty('StatusBarPane GetStatusBarPane SetStatusBarPane') diff --git a/etg/statusbar.py b/etg/statusbar.py index d51db207..d94004ca 100644 --- a/etg/statusbar.py +++ b/etg/statusbar.py @@ -37,16 +37,8 @@ def run(): # We already have a MappedType for wxArrayInt, so just tweak the # interface to use that instead of an array size and a const int pointer. - m = c.find('SetStatusWidths') - m.find('n').ignore() - m.find('widths_field').type = 'const wxArrayInt&' - m.find('widths_field').name = 'widths' - m.argsString = '(int n, const wxArrayInt& widths)' - m.setCppCode("""\ - const int* ptr = &widths->front(); - self->SetStatusWidths(widths->size(), ptr); - """) - + tools.fixSetStatusWidths(c.find('SetStatusWidths')) + # Same thing for SetStatusStyles m = c.find('SetStatusStyles') m.find('n').ignore() diff --git a/etg/stockitem.py b/etg/stockitem.py new file mode 100644 index 00000000..c66bee80 --- /dev/null +++ b/etg/stockitem.py @@ -0,0 +1,44 @@ +#--------------------------------------------------------------------------- +# Name: etg/stockitem.py +# Author: Robin Dunn +# +# Created: 28-Oct-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_core" +NAME = "stockitem" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'stockitem_8h.xml', + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py index d2369000..855ac9d2 100644 --- a/etgtools/sphinx_generator.py +++ b/etgtools/sphinx_generator.py @@ -1150,6 +1150,9 @@ class Image(Node): image_path = os.path.normpath(os.path.join(DOXYROOT, 'images', value)) static_path = os.path.join(OVERVIEW_IMAGES_ROOT, os.path.split(image_path)[1]) + if not os.path.exists(image_path): + return '' + if not os.path.isfile(static_path): shutil.copyfile(image_path, static_path) diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index 8601a21b..9f226e74 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -262,9 +262,9 @@ def fixWindowClass(klass, hideVirtuals=True, ignoreProtected=True): for item in klass.allItems(): if isinstance(item, extractors.MethodDef) and item.protection == 'protected': item.ignore(False) - - - + + + def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True): """ Tweaks for TLWs @@ -275,11 +275,13 @@ def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True): item = klass.findItem('Create') if item: item.transferThis = True - + # give the id param a default value - for item in [klass.findItem('%s.id' % klass.name), klass.findItem('Create.id')]: - if item: - item.default = 'wxID_ANY' + for name in ['id', 'winid']: + for item in [klass.findItem('%s.%s' % (klass.name, name)), + klass.findItem('Create.%s' % name)]: + if item: + item.default = 'wxID_ANY' # give title param a default too if it needs it for item in [klass.findItem('%s.title' % klass.name), klass.findItem('Create.title')]: @@ -289,14 +291,14 @@ def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True): if hideVirtuals: removeVirtuals(klass) addWindowVirtuals(klass) - + if not ignoreProtected: for item in klass.allItems(): if isinstance(item, extractors.MethodDef) and item.protection == 'protected': item.ignore(False) - - - + + + def fixSizerClass(klass): """ Remove all virtuals except for CalcMin and RecalcSizes. @@ -344,7 +346,21 @@ def fixHtmlSetFonts(klass): } self->SetFonts(*normal_face, *fixed_face, &sizes->Item(0)); """) - + + +def fixSetStatusWidths(m): + # We already have a MappedType for wxArrayInt, so just tweak the + # interface to use that instead of an array size and a const int pointer. + m.find('n').ignore() + m.find('widths_field').type = 'const wxArrayInt&' + m.find('widths_field').name = 'widths' + m.argsString = '(int n, const wxArrayInt& widths)' + m.setCppCode("""\ + const int* ptr = &widths->front(); + self->SetStatusWidths(widths->size(), ptr); + """) + + def removeVirtuals(klass): """ @@ -360,7 +376,7 @@ def removeVirtuals(klass): def addWindowVirtuals(klass): """ - Either turn the virtual flag back on or add a delcaration for the subset of + Either turn the virtual flag back on or add a declaration for the subset of the C++ virtuals in wxWindow classes that we will be supporting. """ publicWindowVirtuals = [ @@ -954,10 +970,13 @@ del _{ListClass_pyName}___repr__ -def wxArrayWrapperTemplate(ArrayClass, ItemClass, module): +def wxArrayWrapperTemplate(ArrayClass, ItemClass, module, itemIsPtr=False): moduleName = module.module ArrayClass_pyName = removeWxPrefix(ArrayClass) - + itemRef = '*' if itemIsPtr else '&' + itemDeref = '' if itemIsPtr else '*' + addrOf = '' if itemIsPtr else '&' + # *** TODO: This can probably be done in a way that is not SIP-specfic. # Try creating extractor objects from scratch and attach cppMethods to # them as needed, etc.. @@ -971,10 +990,10 @@ public: sipRes = sipCpp->GetCount(); %End - {ItemClass}& __getitem__(ulong index); + {ItemClass}{itemRef} __getitem__(ulong index); %MethodCode if (index < sipCpp->GetCount()) {{ - sipRes = &sipCpp->Item(index); + sipRes = {addrOf}sipCpp->Item(index); }} else {{ wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); @@ -982,21 +1001,21 @@ public: }} %End - int __contains__(const {ItemClass}& obj); + int __contains__({ItemClass}{itemRef} obj); %MethodCode - int idx = sipCpp->Index(*obj, false); + int idx = sipCpp->Index({itemDeref}obj, false); sipRes = idx != wxNOT_FOUND; %End - void append(const {ItemClass}& obj); + void append({ItemClass}{itemRef} obj); %MethodCode - sipCpp->Add(*obj); + sipCpp->Add({itemDeref}obj); %End // TODO: add support for index(value, [start, [stop]]) - int index(const {ItemClass}& obj); + int index({ItemClass}{itemRef} obj); %MethodCode - int idx = sipCpp->Index(*obj, false); + int idx = sipCpp->Index({itemDeref}obj, false); if (idx == wxNOT_FOUND) {{ sipError = sipErrorFail; wxPyErr_SetString(PyExc_ValueError, diff --git a/ext/wxWidgets b/ext/wxWidgets index 80e2614b..1cdab48b 160000 --- a/ext/wxWidgets +++ b/ext/wxWidgets @@ -1 +1 @@ -Subproject commit 80e2614bacca94571716bcb0e2c35412425f67ce +Subproject commit 1cdab48bc3569dc7eb81f191d060b7dc7fecd5b3 diff --git a/sphinxtools/constants.py b/sphinxtools/constants.py index bf0e3a7b..27f59b11 100644 --- a/sphinxtools/constants.py +++ b/sphinxtools/constants.py @@ -85,6 +85,7 @@ MODULENAME_REPLACE = {'_core' : 'wx.', '_msw' : 'wx.msw.', '_ribbon' : 'wx.ribbon.', '_propgrid': 'wx.propgrid.', + '_aui' : 'wx.aui.', } diff --git a/unittests/test_auibar.py b/unittests/test_auibar.py new file mode 100644 index 00000000..2482a179 --- /dev/null +++ b/unittests/test_auibar.py @@ -0,0 +1,79 @@ +import unittest +from unittests import wtc +import wx +import wx.aui + +#--------------------------------------------------------------------------- + +class auibar_Tests(wtc.WidgetTestCase): + + def test_auibar01(self): + wx.aui.AUI_TB_TEXT + wx.aui.AUI_TB_NO_TOOLTIPS + wx.aui.AUI_TB_NO_AUTORESIZE + wx.aui.AUI_TB_GRIPPER + wx.aui.AUI_TB_OVERFLOW + wx.aui.AUI_TB_VERTICAL + wx.aui.AUI_TB_HORZ_LAYOUT + wx.aui.AUI_TB_HORIZONTAL + wx.aui.AUI_TB_PLAIN_BACKGROUND + wx.aui.AUI_TB_HORZ_TEXT + wx.aui.AUI_ORIENTATION_MASK + wx.aui.AUI_TB_DEFAULT_STYLE + wx.aui.AUI_TBART_SEPARATOR_SIZE + wx.aui.AUI_TBART_GRIPPER_SIZE + wx.aui.AUI_TBART_OVERFLOW_SIZE + wx.aui.AUI_TBTOOL_TEXT_LEFT + wx.aui.AUI_TBTOOL_TEXT_RIGHT + wx.aui.AUI_TBTOOL_TEXT_TOP + wx.aui.AUI_TBTOOL_TEXT_BOTTOM + + + + def test_auibar02(self): + evt = wx.aui.AuiToolBarEvent() + + + def test_auibar03(self): + wx.aui.wxEVT_AUITOOLBAR_TOOL_DROPDOWN + wx.aui.wxEVT_AUITOOLBAR_OVERFLOW_CLICK + wx.aui.wxEVT_AUITOOLBAR_RIGHT_CLICK + wx.aui.wxEVT_AUITOOLBAR_MIDDLE_CLICK + wx.aui.wxEVT_AUITOOLBAR_BEGIN_DRAG + + wx.aui.EVT_AUITOOLBAR_TOOL_DROPDOWN + wx.aui.EVT_AUITOOLBAR_OVERFLOW_CLICK + wx.aui.EVT_AUITOOLBAR_RIGHT_CLICK + wx.aui.EVT_AUITOOLBAR_MIDDLE_CLICK + wx.aui.EVT_AUITOOLBAR_BEGIN_DRAG + + + + def test_auibar04(self): + obj = wx.aui.AuiToolBarItem() + + + def test_auibar05(self): + with self.assertRaises(TypeError): + obj = wx.aui.AuiToolBarArt() + + + def test_auibar06(self): + obj = wx.aui.AuiDefaultToolBarArt() + + + + def test_auibar07(self): + tbar = wx.aui.AuiToolBar(self.frame) + + + def test_auibar08(self): + tbar = wx.aui.AuiToolBar() + tbar.Create(self.frame) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_auibook.py b/unittests/test_auibook.py new file mode 100644 index 00000000..d2908752 --- /dev/null +++ b/unittests/test_auibook.py @@ -0,0 +1,104 @@ +import unittest +from unittests import wtc +import wx +import wx.aui + +#--------------------------------------------------------------------------- + +class auibook_Tests(wtc.WidgetTestCase): + + def test_auibook01(self): + wx.aui.AUI_NB_TOP + wx.aui.AUI_NB_LEFT + wx.aui.AUI_NB_RIGHT + wx.aui.AUI_NB_BOTTOM + wx.aui.AUI_NB_TAB_SPLIT + wx.aui.AUI_NB_TAB_MOVE + wx.aui.AUI_NB_TAB_EXTERNAL_MOVE + wx.aui.AUI_NB_TAB_FIXED_WIDTH + wx.aui.AUI_NB_SCROLL_BUTTONS + wx.aui.AUI_NB_WINDOWLIST_BUTTON + wx.aui.AUI_NB_CLOSE_BUTTON + wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB + wx.aui.AUI_NB_CLOSE_ON_ALL_TABS + wx.aui.AUI_NB_MIDDLE_CLICK_CLOSE + wx.aui.AUI_NB_DEFAULT_STYLE + + + + def test_auibook02(self): + nb = wx.aui.AuiNotebook() + nb.Create(self.frame) + + + def test_auibook03(self): + nb = wx.aui.AuiNotebook(self.frame) + nb.AddPage(wx.Panel(nb), "Page") + + + def test_auibook04(self): + obj = wx.aui.AuiNotebookPage() + + + def test_auibook05(self): + obj = wx.aui.AuiTabContainerButton() + + + def test_auibook06(self): + obj = wx.aui.AuiTabContainer() + + + def test_auibook07(self): + with self.assertRaises(TypeError): + obj = wx.aui.AuiTabArt() + + + def test_auibook08(self): + obj = wx.aui.AuiDefaultTabArt() + + + def test_auibook09(self): + obj = wx.aui.AuiSimpleTabArt() + + + def test_auibook10(self): + evt = wx.aui.AuiNotebookEvent() + + wx.aui.wxEVT_AUINOTEBOOK_PAGE_CLOSE + wx.aui.wxEVT_AUINOTEBOOK_PAGE_CLOSED + wx.aui.wxEVT_AUINOTEBOOK_PAGE_CHANGED + wx.aui.wxEVT_AUINOTEBOOK_PAGE_CHANGING + wx.aui.wxEVT_AUINOTEBOOK_BUTTON + wx.aui.wxEVT_AUINOTEBOOK_BEGIN_DRAG + wx.aui.wxEVT_AUINOTEBOOK_END_DRAG + wx.aui.wxEVT_AUINOTEBOOK_DRAG_MOTION + wx.aui.wxEVT_AUINOTEBOOK_ALLOW_DND + wx.aui.wxEVT_AUINOTEBOOK_DRAG_DONE + wx.aui.wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN + wx.aui.wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP + wx.aui.wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN + wx.aui.wxEVT_AUINOTEBOOK_TAB_RIGHT_UP + wx.aui.wxEVT_AUINOTEBOOK_BG_DCLICK + + wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE + wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED + wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED + wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING + wx.aui.EVT_AUINOTEBOOK_BUTTON + wx.aui.EVT_AUINOTEBOOK_BEGIN_DRAG + wx.aui.EVT_AUINOTEBOOK_END_DRAG + wx.aui.EVT_AUINOTEBOOK_DRAG_MOTION + wx.aui.EVT_AUINOTEBOOK_ALLOW_DND + wx.aui.EVT_AUINOTEBOOK_DRAG_DONE + wx.aui.EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN + wx.aui.EVT_AUINOTEBOOK_TAB_MIDDLE_UP + wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN + wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_UP + wx.aui.EVT_AUINOTEBOOK_BG_DCLICK + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_auidockart.py b/unittests/test_auidockart.py new file mode 100644 index 00000000..dfec80a8 --- /dev/null +++ b/unittests/test_auidockart.py @@ -0,0 +1,66 @@ +import unittest +from unittests import wtc +import wx +import wx.aui + +#--------------------------------------------------------------------------- + +class auidockart_Tests(wtc.WidgetTestCase): + + def test_auidockart01(self): + wx.aui.AUI_DOCKART_SASH_SIZE + wx.aui.AUI_DOCKART_CAPTION_SIZE + wx.aui.AUI_DOCKART_GRIPPER_SIZE + wx.aui.AUI_DOCKART_PANE_BORDER_SIZE + wx.aui.AUI_DOCKART_PANE_BUTTON_SIZE + wx.aui.AUI_DOCKART_BACKGROUND_COLOUR + wx.aui.AUI_DOCKART_SASH_COLOUR + wx.aui.AUI_DOCKART_ACTIVE_CAPTION_COLOUR + wx.aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR + wx.aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR + wx.aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR + wx.aui.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR + wx.aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR + wx.aui.AUI_DOCKART_BORDER_COLOUR + wx.aui.AUI_DOCKART_GRIPPER_COLOUR + wx.aui.AUI_DOCKART_CAPTION_FONT + wx.aui.AUI_DOCKART_GRADIENT_TYPE + wx.aui.AUI_GRADIENT_NONE + wx.aui.AUI_GRADIENT_VERTICAL + wx.aui.AUI_GRADIENT_HORIZONTAL + wx.aui.AUI_BUTTON_STATE_NORMAL + wx.aui.AUI_BUTTON_STATE_HOVER + wx.aui.AUI_BUTTON_STATE_PRESSED + wx.aui.AUI_BUTTON_STATE_DISABLED + wx.aui.AUI_BUTTON_STATE_HIDDEN + wx.aui.AUI_BUTTON_STATE_CHECKED + wx.aui.AUI_BUTTON_CLOSE + wx.aui.AUI_BUTTON_MAXIMIZE_RESTORE + wx.aui.AUI_BUTTON_MINIMIZE + wx.aui.AUI_BUTTON_PIN + wx.aui.AUI_BUTTON_OPTIONS + wx.aui.AUI_BUTTON_WINDOWLIST + wx.aui.AUI_BUTTON_LEFT + wx.aui.AUI_BUTTON_RIGHT + wx.aui.AUI_BUTTON_UP + wx.aui.AUI_BUTTON_DOWN + wx.aui.AUI_BUTTON_CUSTOM1 + wx.aui.AUI_BUTTON_CUSTOM2 + wx.aui.AUI_BUTTON_CUSTOM3 + + + + def test_auidockart02(self): + with self.assertRaises(TypeError): + da = wx.aui.AuiDockArt() + + + def test_auidockart03(self): + da = wx.aui.AuiDefaultDockArt() + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_auiframemanager.py b/unittests/test_auiframemanager.py new file mode 100644 index 00000000..4993e6b4 --- /dev/null +++ b/unittests/test_auiframemanager.py @@ -0,0 +1,108 @@ +import unittest +from unittests import wtc +import wx +import wx.aui + +#--------------------------------------------------------------------------- + +class auiframemanager_Tests(wtc.WidgetTestCase): + + def test_auiframemanager01(self): + wx.aui.AUI_DOCK_NONE + wx.aui.AUI_DOCK_TOP + wx.aui.AUI_DOCK_RIGHT + wx.aui.AUI_DOCK_BOTTOM + wx.aui.AUI_DOCK_LEFT + wx.aui.AUI_DOCK_CENTER + wx.aui.AUI_DOCK_CENTRE + + wx.aui.AUI_MGR_ALLOW_FLOATING + wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE + wx.aui.AUI_MGR_TRANSPARENT_DRAG + wx.aui.AUI_MGR_TRANSPARENT_HINT + wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT + wx.aui.AUI_MGR_RECTANGLE_HINT + wx.aui.AUI_MGR_HINT_FADE + wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE + wx.aui.AUI_MGR_LIVE_RESIZE + wx.aui.AUI_MGR_DEFAULT + + + + def test_auiframemanager02(self): + wx.aui.EVT_AUI_PANE_BUTTON + wx.aui.EVT_AUI_PANE_CLOSE + wx.aui.EVT_AUI_PANE_MAXIMIZE + wx.aui.EVT_AUI_PANE_RESTORE + wx.aui.EVT_AUI_PANE_ACTIVATED + wx.aui.EVT_AUI_RENDER + wx.aui.EVT_AUI_FIND_MANAGER + + wx.aui.wxEVT_AUI_PANE_BUTTON + wx.aui.wxEVT_AUI_PANE_CLOSE + wx.aui.wxEVT_AUI_PANE_MAXIMIZE + wx.aui.wxEVT_AUI_PANE_RESTORE + wx.aui.wxEVT_AUI_PANE_ACTIVATED + wx.aui.wxEVT_AUI_RENDER + wx.aui.wxEVT_AUI_FIND_MANAGER + + + + def test_auiframemanager03(self): + mgr = wx.aui.AuiManager(self.frame) + mgr.AddPane( wx.Panel(self.frame), + wx.aui.AuiPaneInfo().Top().Caption('caption').Dock()) + mgr.Update() + self.myYield() + mgr.UnInit() + + + def test_auiframemanager04(self): + mgr = wx.aui.AuiManager() + mgr.SetManagedWindow(self.frame) + mgr.AddPane( wx.Panel(self.frame), + wx.aui.AuiPaneInfo().Top().Caption('caption').Dock()) + mgr.Update() + self.myYield() + mgr.UnInit() + + + + def test_auiframemanager05(self): + pi = wx.aui.AuiPaneInfo() + pi.BestSize((5,6)) + assert pi.best_size == (5,6) + pi.BestSize(wx.Size(7,8)) + assert pi.best_size == (7,8) + pi.BestSize(1, 2) + assert pi.best_size == (1,2) + + + + def test_auiframemanager06(self): + pi = wx.aui.AuiPaneInfo().Center().Caption("hello").DefaultPane().CloseButton().Floatable() + + + def test_auiframemanager07(self): + pi1 = wx.aui.AuiPaneInfo().BestSize(12,34) + pi2 = wx.aui.AuiPaneInfo(pi1) + assert pi1 is not pi2 + assert pi1.best_size == pi2.best_size + + + def test_auiframemanager08(self): + obj = wx.aui.AuiDockInfo() + + + def test_auiframemanager09(self): + obj = wx.aui.AuiDockUIPart() + + + def test_auiframemanager10(self): + obj = wx.aui.AuiPaneButton() + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_auitabmdi.py b/unittests/test_auitabmdi.py new file mode 100644 index 00000000..9568c768 --- /dev/null +++ b/unittests/test_auitabmdi.py @@ -0,0 +1,24 @@ +import unittest +from unittests import wtc +import wx +import wx.aui + +#--------------------------------------------------------------------------- + +class auitabmdi_Tests(wtc.WidgetTestCase): + + def test_auitabmdi01(self): + parent = wx.aui.AuiMDIParentFrame(self.frame, title='AUI MDI') + child = wx.aui.AuiMDIChildFrame(parent, title='Child') + + parent.Show() + self.myYield() + child.Close() + self.myYield() + parent.Close() + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_stockitem.py b/unittests/test_stockitem.py new file mode 100644 index 00000000..751eb41a --- /dev/null +++ b/unittests/test_stockitem.py @@ -0,0 +1,16 @@ +import unittest +from unittests import wtc +import wx + +#--------------------------------------------------------------------------- + +class stockitem_Tests(wtc.WidgetTestCase): + + # TODO: Remove this test and add real ones. + def test_stockitem1(self): + self.fail("Unit tests for stockitem not implemented yet.") + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/wscript b/wscript index ca588eee..35ee041e 100644 --- a/wscript +++ b/wscript @@ -142,6 +142,9 @@ def configure(conf): _copyEnvGroup(conf.env, '_WX', '_WXPROPGRID') conf.env.LIB_WXPROPGRID += cfg.makeLibName('propgrid') + _copyEnvGroup(conf.env, '_WX', '_WXAUI') + conf.env.LIB_WXPAUI += cfg.makeLibName('aui') + # ** Add code for new modules here (and below for non-MSW) # tweak the PYEXT compile and link flags if making a --debug build @@ -236,6 +239,10 @@ def configure(conf): args='--cxxflags --libs propgrid,core' + rpath, uselib_store='WXPROPGRID', mandatory=True) + conf.check_cfg(path=conf.options.wx_config, package='', + args='--cxxflags --libs aui,core' + rpath, + uselib_store='WXAUI', mandatory=True) + # ** Add code for new modules here @@ -528,7 +535,9 @@ def build(bld): makeETGRule(bld, 'etg/_media.py', '_media', 'WXMEDIA') makeETGRule(bld, 'etg/_ribbon.py', '_ribbon', 'WXRIBBON') makeETGRule(bld, 'etg/_propgrid.py', '_propgrid', 'WXPROPGRID') + makeETGRule(bld, 'etg/_aui.py', '_aui', 'WXAUI') + # Modules that are platform-specific if isDarwin: makeETGRule(bld, 'etg/_webkit.py', '_webkit', 'WXWEBKIT') if isWindows: