From f73396c47956cf1798656b49b2c5a01fb7463cc8 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 23 Feb 2015 16:44:06 -0800 Subject: [PATCH] Starting work on wrapping propgrid --- etg/_propgrid.py | 70 +++++++++++++++++++++++++++++ etg/property.py | 50 +++++++++++++++++++++ etg/propgrid.py | 55 +++++++++++++++++++++++ etg/propgrideditors.py | 47 +++++++++++++++++++ etg/propgridiface.py | 47 +++++++++++++++++++ etg/propgridpagestate.py | 56 +++++++++++++++++++++++ unittests/test_property.py | 16 +++++++ unittests/test_propgrid.py | 63 ++++++++++++++++++++++++++ unittests/test_propgrideditors.py | 16 +++++++ unittests/test_propgridiface.py | 16 +++++++ unittests/test_propgridpagestate.py | 16 +++++++ wscript | 8 ++++ 12 files changed, 460 insertions(+) create mode 100644 etg/_propgrid.py create mode 100644 etg/property.py create mode 100644 etg/propgrid.py create mode 100644 etg/propgrideditors.py create mode 100644 etg/propgridiface.py create mode 100644 etg/propgridpagestate.py create mode 100644 unittests/test_property.py create mode 100644 unittests/test_propgrid.py create mode 100644 unittests/test_propgrideditors.py create mode 100644 unittests/test_propgridiface.py create mode 100644 unittests/test_propgridpagestate.py diff --git a/etg/_propgrid.py b/etg/_propgrid.py new file mode 100644 index 00000000..57d6a2c4 --- /dev/null +++ b/etg/_propgrid.py @@ -0,0 +1,70 @@ +#--------------------------------------------------------------------------- +# Name: etg/_propgrid.py +# Author: Robin Dunn +# +# Created: 23-Feb-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools +from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef + +PACKAGE = "wx" +MODULE = "_propgrid" +NAME = "_propgrid" # 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 = [ ] + + +# 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 "propgrid" library in a multi-lib build. +INCLUDES = [ 'property', + 'propgrideditors', + 'propgridpagestate', + 'propgridiface', + 'propgrid', + ] + + +# 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.addInclude(INCLUDES) + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + run() diff --git a/etg/property.py b/etg/property.py new file mode 100644 index 00000000..8c1d9e30 --- /dev/null +++ b/etg/property.py @@ -0,0 +1,50 @@ +#--------------------------------------------------------------------------- +# Name: etg/property.py +# Author: Robin Dunn +# +# Created: 23-Feb-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_propgrid" +NAME = "property" # 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 = [ 'wxPGProperty', + 'wxPGCell', + 'wxPGChoices', + 'wxPGPaintData', + 'wxPGCellRenderer', + ] + +#--------------------------------------------------------------------------- + +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('wxPGProperty') + assert isinstance(c, etgtools.ClassDef) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/propgrid.py b/etg/propgrid.py new file mode 100644 index 00000000..fef89eaf --- /dev/null +++ b/etg/propgrid.py @@ -0,0 +1,55 @@ +#--------------------------------------------------------------------------- +# Name: etg/propgrid.py +# Author: Robin Dunn +# +# Created: 23-Feb-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_propgrid" +NAME = "propgrid" # 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 = [ 'interface_2wx_2propgrid_2propgrid_8h.xml', + 'wxPGValidationInfo', + 'wxPropertyGrid', + ] + +#--------------------------------------------------------------------------- + +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.find('wxPGSortCallback').ignore() + + c = module.find('wxPGValidationInfo') + assert isinstance(c, etgtools.ClassDef) + + + c = module.find('wxPropertyGrid') + assert isinstance(c, etgtools.ClassDef) + c.bases.remove('wxScrollHelper') + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/propgrideditors.py b/etg/propgrideditors.py new file mode 100644 index 00000000..914415db --- /dev/null +++ b/etg/propgrideditors.py @@ -0,0 +1,47 @@ +#--------------------------------------------------------------------------- +# Name: etg/propgrideditors.py +# Author: Robin Dunn +# +# Created: 23-Feb-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_propgrid" +NAME = "propgrideditors" # 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 = [ 'wxPGEditor', + 'wxPGMultiButton', + ] + +#--------------------------------------------------------------------------- + +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('') + #assert isinstance(c, etgtools.ClassDef) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/propgridiface.py b/etg/propgridiface.py new file mode 100644 index 00000000..c23f3c79 --- /dev/null +++ b/etg/propgridiface.py @@ -0,0 +1,47 @@ +#--------------------------------------------------------------------------- +# Name: etg/propgridiface.py +# Author: Robin Dunn +# +# Created: 23-Feb-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_propgrid" +NAME = "propgridiface" # 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 = [ 'wxPropertyGridInterface', + + ] + +#--------------------------------------------------------------------------- + +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('wxPropertyGridInterface') + assert isinstance(c, etgtools.ClassDef) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/etg/propgridpagestate.py b/etg/propgridpagestate.py new file mode 100644 index 00000000..8d5d8913 --- /dev/null +++ b/etg/propgridpagestate.py @@ -0,0 +1,56 @@ +#--------------------------------------------------------------------------- +# Name: etg/propgridpagestate.py +# Author: Robin Dunn +# +# Created: 23-Feb-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_propgrid" +NAME = "propgridpagestate" # 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 = [ 'wxPropertyGridHitTestResult', + 'wxPropertyGridIterator', + 'wxPGVIterator', + ] + +#--------------------------------------------------------------------------- + +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('wxPropertyGridHitTestResult') + assert isinstance(c, etgtools.ClassDef) + + + c = module.find('wxPropertyGridIterator') + # The base class is not documented, and it looks like it may not be + # needed, so just pretend this class has no base class. At least for + # now... + c.bases = [] + + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/unittests/test_property.py b/unittests/test_property.py new file mode 100644 index 00000000..f6c2f8a9 --- /dev/null +++ b/unittests/test_property.py @@ -0,0 +1,16 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class property_Tests(wtc.WidgetTestCase): + + # TODO: Remove this test and add real ones. + def test_property1(self): + self.fail("Unit tests for property not implemented yet.") + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_propgrid.py b/unittests/test_propgrid.py new file mode 100644 index 00000000..d7a0d20b --- /dev/null +++ b/unittests/test_propgrid.py @@ -0,0 +1,63 @@ +import imp_unittest, unittest +import wtc +import wx +import wx.propgrid as pg + +#--------------------------------------------------------------------------- + +class propgrid_Tests(wtc.WidgetTestCase): + + def test_propgrid1(self): + obj = pg.PGValidationInfo() + + + def test_propgrid0(self): + pg.PG_AUTO_SORT + pg.PG_HIDE_CATEGORIES + pg.PG_ALPHABETIC_MODE + pg.PG_BOLD_MODIFIED + pg.PG_SPLITTER_AUTO_CENTER + pg.PG_TOOLTIPS + pg.PG_HIDE_MARGIN + pg.PG_STATIC_SPLITTER + pg.PG_STATIC_LAYOUT + pg.PG_LIMITED_EDITING + pg.PG_TOOLBAR + pg.PG_DESCRIPTION + pg.PG_NO_INTERNAL_BORDER + pg.PG_EX_INIT_NOCAT + pg.PG_EX_NO_FLAT_TOOLBAR + pg.PG_EX_MODE_BUTTONS + pg.PG_EX_HELP_AS_TOOLTIPS + pg.PG_EX_NATIVE_DOUBLE_BUFFERING + pg.PG_EX_AUTO_UNSPECIFIED_VALUES + pg.PG_EX_WRITEONLY_BUILTIN_ATTRIBUTES + pg.PG_EX_HIDE_PAGE_BUTTONS + pg.PG_EX_MULTIPLE_SELECTION + pg.PG_EX_ENABLE_TLP_TRACKING + pg.PG_EX_NO_TOOLBAR_DIVIDER + pg.PG_EX_TOOLBAR_SEPARATOR + pg.PG_VFB_STAY_IN_PROPERTY + pg.PG_VFB_BEEP + pg.PG_VFB_MARK_CELL + pg.PG_VFB_SHOW_MESSAGE + pg.PG_VFB_SHOW_MESSAGEBOX + pg.PG_VFB_SHOW_MESSAGE_ON_STATUSBAR + pg.PG_VFB_DEFAULT + pg.PG_ACTION_INVALID + pg.PG_ACTION_NEXT_PROPERTY + pg.PG_ACTION_PREV_PROPERTY + pg.PG_ACTION_EXPAND_PROPERTY + pg.PG_ACTION_COLLAPSE_PROPERTY + pg.PG_ACTION_CANCEL_EDIT + pg.PG_ACTION_EDIT + pg.PG_ACTION_PRESS_BUTTON + pg.PG_ACTION_MAX + + pg.PG_DEFAULT_STYLE + pg.PGMAN_DEFAULT_STYLE + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_propgrideditors.py b/unittests/test_propgrideditors.py new file mode 100644 index 00000000..9b87aa50 --- /dev/null +++ b/unittests/test_propgrideditors.py @@ -0,0 +1,16 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class propgrideditors_Tests(wtc.WidgetTestCase): + + # TODO: Remove this test and add real ones. + def test_propgrideditors1(self): + self.fail("Unit tests for propgrideditors not implemented yet.") + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_propgridiface.py b/unittests/test_propgridiface.py new file mode 100644 index 00000000..122b4cbd --- /dev/null +++ b/unittests/test_propgridiface.py @@ -0,0 +1,16 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class propgridiface_Tests(wtc.WidgetTestCase): + + # TODO: Remove this test and add real ones. + def test_propgridiface1(self): + self.fail("Unit tests for propgridiface not implemented yet.") + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_propgridpagestate.py b/unittests/test_propgridpagestate.py new file mode 100644 index 00000000..a38dd6e9 --- /dev/null +++ b/unittests/test_propgridpagestate.py @@ -0,0 +1,16 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class propgridpagestate_Tests(wtc.WidgetTestCase): + + # TODO: Remove this test and add real ones. + def test_propgridpagestate1(self): + self.fail("Unit tests for propgridpagestate not implemented yet.") + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/wscript b/wscript index 5f3fff32..46153863 100644 --- a/wscript +++ b/wscript @@ -138,6 +138,9 @@ def configure(conf): _copyEnvGroup(conf.env, '_WX', '_WXRIBBON') conf.env.LIB_WXRIBBON += cfg.makeLibName('ribbon') + _copyEnvGroup(conf.env, '_WX', '_WXPROPGRID') + conf.env.LIB_WXPROPGRID += cfg.makeLibName('propgrid') + # ** Add code for new modules here (and below for non-MSW) # tweak the PYEXT compile and link flags if making a --debug build @@ -228,6 +231,10 @@ def configure(conf): args='--cxxflags --libs ribbon,core,net' + rpath, uselib_store='WXRIBBON', mandatory=True) + conf.check_cfg(path=conf.options.wx_config, package='', + args='--cxxflags --libs core' + rpath, + uselib_store='WXPROPGRID', mandatory=True) + # ** Add code for new modules here @@ -519,6 +526,7 @@ def build(bld): makeETGRule(bld, 'etg/_richtext.py', '_richtext', 'WXHTML WXRICHTEXT') makeETGRule(bld, 'etg/_media.py', '_media', 'WXMEDIA') makeETGRule(bld, 'etg/_ribbon.py', '_ribbon', 'WXRIBBON') + makeETGRule(bld, 'etg/_ribbon.py', '_propgrid', 'WXPROPGRID') if isDarwin: makeETGRule(bld, 'etg/_webkit.py', '_webkit', 'WXWEBKIT')