From 03c47b50df46ee3a39ac9f00ad3308520d3a65f5 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 30 Sep 2016 13:45:41 -0700 Subject: [PATCH] Add wx.adv.PropertySheetDialog --- TODO.rst | 4 -- docs/sphinx/itemToModuleMap.json | 10 +++++ etg/_adv.py | 1 + etg/propdlg.py | 50 ++++++++++++++++++++++ ext/wxWidgets | 2 +- unittests/test_propdlg.py | 71 ++++++++++++++++++++++++++++++++ 6 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 etg/propdlg.py create mode 100644 unittests/test_propdlg.py diff --git a/TODO.rst b/TODO.rst index ca54cf46..3ba0ac06 100644 --- a/TODO.rst +++ b/TODO.rst @@ -136,12 +136,8 @@ Other Dev Stuff * [] New activex classes in wx/msw/ole/activex.h ? * Any others? - * Add _propdlg module - * Add _aui module ?? (or go with only agw aui?) - * Add _propgrid (in progress) - * 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/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index bda3bd1b..93d03f96 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -2623,6 +2623,14 @@ "PRINT_QUALITY_HIGH":"wx.", "PRINT_QUALITY_LOW":"wx.", "PRINT_QUALITY_MEDIUM":"wx.", +"PROPSHEET_BUTTONTOOLBOOK":"wx.adv.", +"PROPSHEET_CHOICEBOOK":"wx.adv.", +"PROPSHEET_DEFAULT":"wx.adv.", +"PROPSHEET_LISTBOOK":"wx.adv.", +"PROPSHEET_NOTEBOOK":"wx.adv.", +"PROPSHEET_SHRINKTOFIT":"wx.adv.", +"PROPSHEET_TOOLBOOK":"wx.adv.", +"PROPSHEET_TREEBOOK":"wx.adv.", "PageSetupDialog":"wx.", "PageSetupDialogData":"wx.", "PaintDC":"wx.", @@ -2693,6 +2701,8 @@ "PropertyGridManagerNameStr":"wx.propgrid.", "PropertyGridPage":"wx.propgrid.", "PropertyGridPageState":"wx.propgrid.", +"PropertySheetDialog":"wx.adv.", +"PropertySheetDialogFlags":"wx.adv.", "PseudoDC":"wx.adv.", "PyApp":"wx.", "PyAxBaseWindow":"wx.msw.", diff --git a/etg/_adv.py b/etg/_adv.py index 6104ab25..eca9c537 100644 --- a/etg/_adv.py +++ b/etg/_adv.py @@ -53,6 +53,7 @@ INCLUDES = [ 'timectrl', 'wizard', 'pseudodc', + 'propdlg', ] diff --git a/etg/propdlg.py b/etg/propdlg.py new file mode 100644 index 00000000..1114cbd1 --- /dev/null +++ b/etg/propdlg.py @@ -0,0 +1,50 @@ +#--------------------------------------------------------------------------- +# Name: etg/propdlg.py +# Author: Robin Dunn +# +# Created: 30-Sep-2016 +# Copyright: (c) 2016 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_adv" +NAME = "propdlg" # 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 = [ 'wxPropertySheetDialog', + ] + +#--------------------------------------------------------------------------- + +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. + + module.addHeaderCode('#include ') + + c = module.find('wxPropertySheetDialog') + assert isinstance(c, etgtools.ClassDef) + tools.fixTopLevelWindowClass(c, hideVirtuals=False) + + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/ext/wxWidgets b/ext/wxWidgets index 9164090b..c9e56dd3 160000 --- a/ext/wxWidgets +++ b/ext/wxWidgets @@ -1 +1 @@ -Subproject commit 9164090b461f24a4628cdbee951ff8dec11af4da +Subproject commit c9e56dd3e598586f88bb15c29cf1bc5131cc6d20 diff --git a/unittests/test_propdlg.py b/unittests/test_propdlg.py new file mode 100644 index 00000000..2d021672 --- /dev/null +++ b/unittests/test_propdlg.py @@ -0,0 +1,71 @@ +import unittest +from unittests import wtc +import wx +import wx.adv + +#--------------------------------------------------------------------------- + +class propdlg_Tests(wtc.WidgetTestCase): + + def test_propdlg1(self): + # Constants + wx.adv.PROPSHEET_DEFAULT + wx.adv.PROPSHEET_NOTEBOOK + wx.adv.PROPSHEET_TOOLBOOK + wx.adv.PROPSHEET_CHOICEBOOK + wx.adv.PROPSHEET_LISTBOOK + wx.adv.PROPSHEET_BUTTONTOOLBOOK + wx.adv.PROPSHEET_TREEBOOK + wx.adv.PROPSHEET_SHRINKTOFIT + + + def test_propgrid2(self): + # Normal, simple usage + dlg = wx.adv.PropertySheetDialog(self.frame, title="Property Sheet") + dlg.SetSheetStyle(wx.adv.PROPSHEET_NOTEBOOK) + dlg.Destroy() + + + def test_propgrid3(self): + # 2-Phase create + dlg = wx.adv.PropertySheetDialog() + dlg.Create(self.frame, title="Property Sheet") + dlg.SetSheetStyle(wx.adv.PROPSHEET_NOTEBOOK) + dlg.Destroy() + + + def test_propgrid4(self): + # Derived class + class MyPropSheetDlg(wx.adv.PropertySheetDialog): + def __init__(self, parent, title): + wx.adv.PropertySheetDialog.__init__(self) # 1st phase + + # Setup + self.SetSheetStyle(wx.adv.PROPSHEET_NOTEBOOK) + self.SetSheetInnerBorder(10) + self.SetSheetOuterBorder(15) + + self.Create(parent, title=title) # 2nd phase create + + # Create the stock buttons + self.CreateButtons(wx.OK|wx.CANCEL) + + # Add some pages + notebook = self.GetBookCtrl() + notebook.AddPage(wx.Panel(notebook), "Page1") + notebook.AddPage(wx.Panel(notebook), "Page2") + + # Do the layout + self.LayoutDialog() + + + dlg = MyPropSheetDlg(self.frame, "Property Sheet Dlg") + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() + dlg.Destroy() + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main()