diff --git a/TODO.txt b/TODO.txt index dde8082c..de9b98f4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -188,19 +188,24 @@ other dev stuff * artprov * clipbrd, dnd, finish dataobj * power - * about * overlay * PseudoDC * Divide Phoenix core into multiple modules. Perhaps using the same - divisions that a wx multi-lib build uses would be a good idea. OTOH, doing - something like what Classic did will make the transition easier for anybody - who explicitly used the core extensions there. OTOOH, keeping it as one big - module might not be so bad... + divisions that a wx multi-lib build uses would be a good + idea. OTOH, doing something like what Classic did will make the + transition easier for anybody who explicitly used the core + extensions there. OTOOH, keeping it as one big module might not be + so bad... NOTE: I've attempted to do this split but because of all + the various interdependencies of the items currently in core I + wasn't able to make any divisions that had more than a few classes in + them. So let's go the route of following the wx multi-lib + divisions, except where it makes more sense for a group of classes + to have their own extension module like dataview or grid. We will likely need to have a way to export (like with a CObject) some of the helper functions in wxpy_api.sip from the core module so they can - be used in the other extension modules... + be used in the other extension modules... DONE. * Check wxDialog::CreateTextSizer, is it wrapped? diff --git a/etg/_adv.py b/etg/_adv.py new file mode 100644 index 00000000..c00fa482 --- /dev/null +++ b/etg/_adv.py @@ -0,0 +1,65 @@ +#--------------------------------------------------------------------------- +# Name: etg/_adv.py +# Author: Robin Dunn +# +# Created: 22-Mar-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools +from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef + +PACKAGE = "wx" +MODULE = "_adv" +NAME = "_adv" # 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 "adv" library in a multi-lib build. +INCLUDES = [ 'aboutdlg', + ] + + +# 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.addInclude(INCLUDES) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + run() diff --git a/etg/aboutdlg.py b/etg/aboutdlg.py new file mode 100644 index 00000000..22228835 --- /dev/null +++ b/etg/aboutdlg.py @@ -0,0 +1,47 @@ +#--------------------------------------------------------------------------- +# Name: etg/aboutdlg.py +# Author: Robin Dunn +# +# Created: 22-Mar-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_adv" +NAME = "aboutdlg" # 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 = [ "wxAboutDialogInfo", + ] + +#--------------------------------------------------------------------------- + +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) + + module.addHeaderCode('#include ') + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/setup.py b/setup.py index 09566b9c..d9599a35 100644 --- a/setup.py +++ b/setup.py @@ -153,9 +153,24 @@ extensions.append(ext) cfg.CLEANUP.append(opj(cfg.PKGDIR, 'core.py')) +etg = loadETG('etg/_adv.py') +etgDepends = etg.DEPENDS + etg.OTHERDEPS +ext = Extension('_adv', getEtgSipCppFiles(etg), + depends = getEtgSipHeaders(etg), + include_dirs = cfg.includes, + define_macros = cfg.defines, + library_dirs = cfg.libdirs, + libraries = cfg.libs, + extra_compile_args = cfg.cflags, + extra_link_args = cfg.lflags, + ) +extensions.append(ext) +cfg.CLEANUP.append(opj(cfg.PKGDIR, 'adv.py')) + + etg = loadETG('etg/_dataview.py') etgDepends = etg.DEPENDS + etg.OTHERDEPS -ext = Extension('_dataview', getEtgSipCppFiles(etg) + rc_file, +ext = Extension('_dataview', getEtgSipCppFiles(etg), depends = getEtgSipHeaders(etg), include_dirs = cfg.includes, define_macros = cfg.defines, diff --git a/unittests/test_aboutdlg.py b/unittests/test_aboutdlg.py new file mode 100644 index 00000000..e5e321f2 --- /dev/null +++ b/unittests/test_aboutdlg.py @@ -0,0 +1,31 @@ +import imp_unittest, unittest +import wtc +import wx +import wx.adv + +#--------------------------------------------------------------------------- + +class aboutdlg_Tests(wtc.WidgetTestCase): + + def _makeInfo(self): + info = wx.adv.AboutDialogInfo() + info.SetVersion('1.2.3') + info.SetName('My Goofy App') + info.SetDevelopers(['Goofy', 'Mickey', 'Donald']) + info.SetDescription('This is a very goofy application') + return info + + def test_aboutdlgNative(self): + info = self._makeInfo() + wx.adv.AboutBox(info, self.frame) + + def test_aboutdlgGeneric(self): + info = self._makeInfo() + wx.adv.GenericAboutBox(info, self.frame) + + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main() diff --git a/wscript b/wscript index 96ff4400..a5c99e87 100644 --- a/wscript +++ b/wscript @@ -1,8 +1,10 @@ #!/usr/bin/python #----------------------------------------------------------------------------- -# WAF build script for building the wxPython extension modules. -# +# WAF script for building and installing the wxPython extension modules. # +# Author: Robin Dunn +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License #----------------------------------------------------------------------------- import sys @@ -69,16 +71,20 @@ def configure(conf): conf.env.LIBFLAGS_WX = cfg.lflags - else: # Non-Windows, use wx-config - # Configuration stuff for ports using wx-config + else: + # Configuration stuff for non-windows ports using wx-config # Check wx-config exists and fetch some values from it conf.env.wx_config = conf.options.wx_config - conf.check_cfg(path=conf.options.wx_config, package='', args='--cxxflags --libs', + conf.check_cfg(path=conf.options.wx_config, package='', + args='--cxxflags --libs', uselib_store='WX', mandatory=True) - # TODO: Run it again with different libs options to get different - # sets of flags stored to use with different extension modules below. - # WXGL, WXHTML, etc. + # Run it again with different libs options to get different + # sets of flags stored to use with varous extension modules below. + conf.check_cfg(path=conf.options.wx_config, package='', + args='--cxxflags --libs adv,core', + uselib_store='WXADV', mandatory=True) + # NOTE: This assumes that if the platform is not win32 (from # the test above) and not darwin then we must be using the @@ -102,7 +108,7 @@ def configure(conf): conf.env.CFLAGS_WXPY.append('-g') conf.env.CXXFLAGS_WXPY.append('-g') - # And if --debug is set turn on more detailed info and turn off optimization + # And if --debug is set turn on more detailed debug info and turn off optimization if conf.env.debug: conf.env.CFLAGS_WXPY.extend(['-ggdb', '-O0']) conf.env.CXXFLAGS_WXPY.extend(['-ggdb', '-O0']) @@ -203,13 +209,23 @@ def build(bld): ) makeExtCopyRule(bld, '_core') - + + etg = loadETG('etg/_adv.py') + dataview = bld( + features = 'c cxx cxxshlib pyext', + target = '_adv', + source = getEtgSipCppFiles(etg) + rc, + uselib = 'WXADV WXPY', + ) + makeExtCopyRule(bld, '_adv') + + etg = loadETG('etg/_dataview.py') dataview = bld( features = 'c cxx cxxshlib pyext', target = '_dataview', source = getEtgSipCppFiles(etg) + rc, - uselib = 'WX WXPY', + uselib = 'WXADV WXPY', ) makeExtCopyRule(bld, '_dataview')