trim trailing space etg directory

This commit is contained in:
Metallicow
2016-11-10 12:08:36 -06:00
parent b4e9d89f1a
commit ebc8d0d971
248 changed files with 4074 additions and 4075 deletions

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "_adv" # Base name of the file to generate to for this script NAME = "_adv" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -21,14 +21,14 @@ applications which do not need any of these classes.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
# the wxWidgets "adv" library in a multi-lib build. # the wxWidgets "adv" library in a multi-lib build.
INCLUDES = [ INCLUDES = [
'aboutdlg', 'aboutdlg',
'helpext', 'helpext',
'commandlinkbutton', 'commandlinkbutton',
@@ -66,7 +66,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -76,19 +76,19 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode("import wx", order=10) module.addPyCode("import wx", order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -11,7 +11,7 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "_core" # Base name of the file to generate to for this script NAME = "_core" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -21,8 +21,8 @@ Everything you need for building typical GUI applications is here.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
@@ -47,20 +47,20 @@ INCLUDES = [ # base and core stuff
'clntdata', 'clntdata',
'clntdatactnr', 'clntdatactnr',
'userdata', 'userdata',
'wxpybuffer', 'wxpybuffer',
'stockgdi', 'stockgdi',
'longlong', 'longlong',
'wxdatetime', 'wxdatetime',
'stopwatch', 'stopwatch',
'windowid', 'windowid',
'platinfo', 'platinfo',
'vidmode', 'vidmode',
'display', 'display',
'intl', 'intl',
'translation', 'translation',
'cmndata', 'cmndata',
'gdicmn', 'gdicmn',
'geometry', 'geometry',
@@ -97,7 +97,7 @@ INCLUDES = [ # base and core stuff
'palette', 'palette',
'renderer', 'renderer',
'rawbmp', 'rawbmp',
# more core # more core
'accel', 'accel',
'log', 'log',
@@ -115,7 +115,7 @@ INCLUDES = [ # base and core stuff
'pyevent', 'pyevent',
'sizer', 'gbsizer', 'wrapsizer', 'sizer', 'gbsizer', 'wrapsizer',
'stdpaths', 'stdpaths',
'eventfilter', 'eventfilter',
'evtloop', 'evtloop',
'apptrait', 'apptrait',
@@ -126,11 +126,11 @@ INCLUDES = [ # base and core stuff
'window', 'window',
'validate', 'validate',
'panel', 'panel',
'menuitem', 'menuitem',
'menu', 'menu',
'scrolwin', 'scrolwin',
'vscroll', 'vscroll',
# controls # controls
'control', 'control',
'ctrlsub', 'ctrlsub',
@@ -159,7 +159,7 @@ INCLUDES = [ # base and core stuff
'headercol', 'headercol',
'headerctrl', 'headerctrl',
'srchctrl', 'srchctrl',
'radiobox', 'radiobox',
'radiobut', 'radiobut',
'slider', 'slider',
'spinbutt', 'spinbutt',
@@ -179,7 +179,7 @@ INCLUDES = [ # base and core stuff
'toolbook', 'toolbook',
'treebook', 'treebook',
'vlbox', 'vlbox',
# toplevel and dialogs # toplevel and dialogs
'nonownedwnd', 'nonownedwnd',
'toplevel', 'toplevel',
@@ -206,7 +206,7 @@ INCLUDES = [ # base and core stuff
'power', 'power',
'utils', 'utils',
'process', 'process',
'uiaction', 'uiaction',
'snglinst', 'snglinst',
'help', 'help',
'cshelp', 'cshelp',
@@ -241,7 +241,7 @@ OTHERDEPS = [ 'src/core_ex.py',
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -251,9 +251,9 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
module.includePyCode('src/core_ex.py', order=10) module.includePyCode('src/core_ex.py', order=10)
@@ -284,20 +284,20 @@ def run():
handlers have been completed. This is also good for making GUI handlers have been completed. This is also good for making GUI
method calls from non-GUI threads. Any extra positional or method calls from non-GUI threads. Any extra positional or
keyword args are passed on to the callable when it is called. keyword args are passed on to the callable when it is called.
:param PyObject callableObj: the callable object :param PyObject callableObj: the callable object
:param args: arguments to be passed to the callable object :param args: arguments to be passed to the callable object
:param kw: keywords to be passed to the callable object :param kw: keywords to be passed to the callable object
.. seealso:: .. seealso::
:ref:`wx.CallLater` :ref:`wx.CallLater`
""", """,
body="""\ body="""\
assert callable(callableObj), "callableObj is not callable" assert callable(callableObj), "callableObj is not callable"
app = wx.GetApp() app = wx.GetApp()
assert app is not None, 'No wx.App created yet' assert app is not None, 'No wx.App created yet'
if not hasattr(app, "_CallAfterId"): if not hasattr(app, "_CallAfterId"):
app._CallAfterId = wx.NewEventType() app._CallAfterId = wx.NewEventType()
app.Connect(-1, -1, app._CallAfterId, app.Connect(-1, -1, app._CallAfterId,
@@ -310,24 +310,24 @@ def run():
wx.PostEvent(app, evt)""") wx.PostEvent(app, evt)""")
module.addPyClass('CallLater', ['object'], module.addPyClass('CallLater', ['object'],
doc="""\ doc="""\
A convenience class for :class:`wx.Timer`, that calls the given callable A convenience class for :class:`wx.Timer`, that calls the given callable
object once after the given amount of milliseconds, passing any object once after the given amount of milliseconds, passing any
positional or keyword args. The return value of the callable is positional or keyword args. The return value of the callable is
available after it has been run with the :meth:`~wx.CallLater.GetResult` available after it has been run with the :meth:`~wx.CallLater.GetResult`
method. method.
If you don't need to get the return value or restart the timer If you don't need to get the return value or restart the timer
then there is no need to hold a reference to this object. It will then there is no need to hold a reference to this object. It will
hold a reference to itself while the timer is running (the timer hold a reference to itself while the timer is running (the timer
has a reference to :meth:`~wx.CallLater.Notify`) but the cycle will be has a reference to :meth:`~wx.CallLater.Notify`) but the cycle will be
broken when the timer completes, automatically cleaning up the broken when the timer completes, automatically cleaning up the
:class:`wx.CallLater` object. :class:`wx.CallLater` object.
.. seealso:: .. seealso::
:func:`wx.CallAfter` :func:`wx.CallAfter`
""", """,
items = [ items = [
PyFunctionDef('__init__', '(self, millis, callableObj, *args, **kwargs)', PyFunctionDef('__init__', '(self, millis, callableObj, *args, **kwargs)',
@@ -339,7 +339,7 @@ def run():
:param args: arguments to be passed to the callable object :param args: arguments to be passed to the callable object
:param kw: keywords to be passed to the callable object :param kw: keywords to be passed to the callable object
""", """,
body="""\ body="""\
assert callable(callableObj), "callableObj is not callable" assert callable(callableObj), "callableObj is not callable"
self.millis = millis self.millis = millis
@@ -351,10 +351,10 @@ def run():
self.result = None self.result = None
self.timer = None self.timer = None
self.Start()"""), self.Start()"""),
PyFunctionDef('__del__', '(self)', 'self.Stop()'), PyFunctionDef('__del__', '(self)', 'self.Stop()'),
PyFunctionDef('Start', '(self, millis=None, *args, **kwargs)', PyFunctionDef('Start', '(self, millis=None, *args, **kwargs)',
doc="""\ doc="""\
(Re)start the timer (Re)start the timer
@@ -374,24 +374,24 @@ def run():
self.timer.Start(self.millis, wx.TIMER_ONE_SHOT) self.timer.Start(self.millis, wx.TIMER_ONE_SHOT)
self.running = True"""), self.running = True"""),
PyCodeDef('Restart = Start'), PyCodeDef('Restart = Start'),
PyFunctionDef('Stop', '(self)', PyFunctionDef('Stop', '(self)',
doc="Stop and destroy the timer.", doc="Stop and destroy the timer.",
body="""\ body="""\
if self.timer is not None: if self.timer is not None:
self.timer.Stop() self.timer.Stop()
self.timer = None"""), self.timer = None"""),
PyFunctionDef('GetInterval', '(self)', """\ PyFunctionDef('GetInterval', '(self)', """\
if self.timer is not None: if self.timer is not None:
return self.timer.GetInterval() return self.timer.GetInterval()
else: else:
return 0"""), return 0"""),
PyFunctionDef('IsRunning', '(self)', PyFunctionDef('IsRunning', '(self)',
"""return self.timer is not None and self.timer.IsRunning()"""), """return self.timer is not None and self.timer.IsRunning()"""),
PyFunctionDef('SetArgs', '(self, *args, **kwargs)', PyFunctionDef('SetArgs', '(self, *args, **kwargs)',
doc="""\ doc="""\
(Re)set the args passed to the callable object. This is (Re)set the args passed to the callable object. This is
useful in conjunction with :meth:`Start` if useful in conjunction with :meth:`Start` if
@@ -400,29 +400,29 @@ def run():
:param args: arguments to be passed to the callable object :param args: arguments to be passed to the callable object
:param kw: keywords to be passed to the callable object :param kw: keywords to be passed to the callable object
""", """,
body="""\ body="""\
self.args = args self.args = args
self.kwargs = kwargs"""), self.kwargs = kwargs"""),
PyFunctionDef('HasRun', '(self)', 'return self.hasRun', PyFunctionDef('HasRun', '(self)', 'return self.hasRun',
doc="""\ doc="""\
Returns whether or not the callable has run. Returns whether or not the callable has run.
:rtype: bool :rtype: bool
"""), """),
PyFunctionDef('GetResult', '(self)', 'return self.result', PyFunctionDef('GetResult', '(self)', 'return self.result',
doc="""\ doc="""\
Returns the value of the callable. Returns the value of the callable.
:rtype: a Python object :rtype: a Python object
:return: result from callable :return: result from callable
"""), """),
PyFunctionDef('Notify', '(self)', PyFunctionDef('Notify', '(self)',
doc="The timer has expired so call the callable.", doc="The timer has expired so call the callable.",
body="""\ body="""\
if self.callable and getattr(self.callable, 'im_self', True): if self.callable and getattr(self.callable, 'im_self', True):
@@ -433,9 +433,9 @@ def run():
if not self.running: if not self.running:
# if it wasn't restarted, then cleanup # if it wasn't restarted, then cleanup
wx.CallAfter(self.Stop)"""), wx.CallAfter(self.Stop)"""),
PyPropertyDef('Interval', 'GetInterval'), PyPropertyDef('Interval', 'GetInterval'),
PyPropertyDef('Result', 'GetResult'), PyPropertyDef('Result', 'GetResult'),
]) ])
module.addPyCode("FutureCall = deprecated(CallLater, 'Use CallLater instead.')") module.addPyCode("FutureCall = deprecated(CallLater, 'Use CallLater instead.')")
@@ -449,7 +449,7 @@ def run():
module.addCppFunction('bool', 'IsMainThread', '()', module.addCppFunction('bool', 'IsMainThread', '()',
doc="Returns ``True`` if the current thread is what wx considers the GUI thread.", doc="Returns ``True`` if the current thread is what wx considers the GUI thread.",
body="return wxThread::IsMain();") body="return wxThread::IsMain();")
module.addInitializerCode("""\ module.addInitializerCode("""\
wxPyPreInit(sipModuleDict); wxPyPreInit(sipModuleDict);
@@ -462,14 +462,14 @@ def run():
# Here is the function it calls # Here is the function it calls
module.includeCppCode('src/core_ex.cpp') module.includeCppCode('src/core_ex.cpp')
module.addItem(etgtools.WigCode("void _wxPyCleanup();")) module.addItem(etgtools.WigCode("void _wxPyCleanup();"))
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_dataview" MODULE = "_dataview"
NAME = "_dataview" # Base name of the file to generate to for this script NAME = "_dataview" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -20,9 +20,9 @@ such as :ref:`wx.ListCtrl`, :ref:`wx.TreeCtrl`, etc.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # The list of other ETG scripts and back-end generator modules that are
# included as part of this module. These items are in their own etg scripts # included as part of this module. These items are in their own etg scripts
@@ -46,7 +46,7 @@ OTHERDEPS = []
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False)
@@ -55,20 +55,20 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode("import wx", order=10) module.addPyCode("import wx", order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_glcanvas" MODULE = "_glcanvas"
NAME = "_glcanvas" # Base name of the file to generate to for this script NAME = "_glcanvas" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -18,11 +18,11 @@ These classes enable viewing and interacting with an OpenGL context in a wx.Wind
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxGLContext', ITEMS = [ 'wxGLContext',
'wxGLCanvas', 'wxGLCanvas',
] ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -39,7 +39,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -49,23 +49,23 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode('import wx', order=10) module.addPyCode('import wx', order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
module.addHeaderCode('#include <wx/glcanvas.h>') module.addHeaderCode('#include <wx/glcanvas.h>')
c = module.find('wxGLContext') c = module.find('wxGLContext')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c = module.find('wxGLCanvas') c = module.find('wxGLCanvas')
tools.fixWindowClass(c) tools.fixWindowClass(c)
@@ -93,8 +93,8 @@ def run():
""", """,
noDerivedCtor=False, noDerivedCtor=False,
) )
m = c.find('IsDisplaySupported') m = c.find('IsDisplaySupported')
m.find('attribList').type = 'wxArrayInt*' m.find('attribList').type = 'wxArrayInt*'
m.setCppCode_sip("""\ m.setCppCode_sip("""\
@@ -103,13 +103,13 @@ def run():
attribPtr = &attribList->front(); attribPtr = &attribList->front();
sipRes = wxGLCanvas::IsDisplaySupported(attribPtr); sipRes = wxGLCanvas::IsDisplaySupported(attribPtr);
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_grid" MODULE = "_grid"
NAME = "_grid" # Base name of the file to generate to for this script NAME = "_grid" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -20,9 +20,9 @@ various types, which the user can edit and otherwise interact with.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # The list of other ETG scripts and back-end generator modules that are
# included as part of this module. These items are in their own etg scripts # included as part of this module. These items are in their own etg scripts
@@ -44,7 +44,7 @@ OTHERDEPS = []
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False)
@@ -53,20 +53,20 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode("import wx", order=10) module.addPyCode("import wx", order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_html" MODULE = "_html"
NAME = "_html" # Base name of the file to generate to for this script NAME = "_html" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -26,14 +26,14 @@ documentation or built-in help pages.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
# the wxWidgets "html" library in a multi-lib build. # the wxWidgets "html" library in a multi-lib build.
INCLUDES = [ INCLUDES = [
'htmldefs', 'htmldefs',
'htmlcell', 'htmlcell',
'htmlfilt', 'htmlfilt',
@@ -42,13 +42,13 @@ INCLUDES = [
'htmlwin', 'htmlwin',
'htmlprint', 'htmlprint',
'htmlwinpars', 'htmlwinpars',
'helpdata', 'helpdata',
'helpfrm', 'helpfrm',
'helpdlg', 'helpdlg',
'helpwnd', 'helpwnd',
'helpctrl', 'helpctrl',
'htmllbox', 'htmllbox',
] ]
@@ -62,7 +62,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -72,12 +72,12 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode("import wx", order=10) module.addPyCode("import wx", order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
module.addCppCode("""\ module.addCppCode("""\
#include <wx/html/htmlwin.h> #include <wx/html/htmlwin.h>
#include <wx/html/htmprint.h> #include <wx/html/htmprint.h>
@@ -86,13 +86,13 @@ def run():
#include <wx/html/helpfrm.h> #include <wx/html/helpfrm.h>
#include <wx/html/helpdlg.h> #include <wx/html/helpdlg.h>
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -11,7 +11,7 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_html2" MODULE = "_html2"
NAME = "_html2" # Base name of the file to generate to for this script NAME = "_html2" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -24,9 +24,9 @@ but these classes will minimize those differences as much as possible.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -44,7 +44,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -54,20 +54,20 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode('import wx', order=10) module.addPyCode('import wx', order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -11,7 +11,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_media" MODULE = "_media"
NAME = "_media" # Base name of the file to generate to for this script NAME = "_media" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -22,8 +22,8 @@ build so it may not always be available on your build of wxPython.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
@@ -48,7 +48,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -58,21 +58,21 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode('import wx', order=10) module.addPyCode('import wx', order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,15 +10,15 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_propgrid" MODULE = "_propgrid"
NAME = "_propgrid" # Base name of the file to generate to for this script NAME = "_propgrid" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -43,7 +43,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -65,9 +65,9 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_ribbon" MODULE = "_ribbon"
NAME = "_ribbon" # Base name of the file to generate to for this script NAME = "_ribbon" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -22,7 +22,7 @@ present in recent versions of Microsoft Office and in Windows 10.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # The list of other ETG scripts and back-end generator modules that are
@@ -54,7 +54,7 @@ def run():
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
check4unittest = False) check4unittest = False)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
@@ -69,8 +69,8 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_richtext" MODULE = "_richtext"
NAME = "_richtext" # Base name of the file to generate to for this script NAME = "_richtext" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -25,9 +25,9 @@ of the :class:`RichTextCtrl`.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -53,7 +53,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
@@ -63,7 +63,7 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode("import wx", order=10) module.addPyCode("import wx", order=10)
@@ -75,13 +75,13 @@ def run():
module.addPyCode("import wx.adv", order=10) module.addPyCode("import wx.adv", order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_stc" MODULE = "_stc"
NAME = "_stc" # Base name of the file to generate to for this script NAME = "_stc" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -20,11 +20,11 @@ based on the popular Scintilla widget.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxStyledTextCtrl', ITEMS = [ 'wxStyledTextCtrl',
'wxStyledTextEvent', 'wxStyledTextEvent',
] ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -41,7 +41,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -51,7 +51,7 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode('''\ module.addPyCode('''\
@@ -59,20 +59,20 @@ def run():
ID_ANY = wx.ID_ANY # Needed for some parameter defaults in this module ID_ANY = wx.ID_ANY # Needed for some parameter defaults in this module
''', order=10) ''', order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
module.addHeaderCode('#include <wx/stc/stc.h>') module.addHeaderCode('#include <wx/stc/stc.h>')
c = module.find('wxStyledTextCtrl') c = module.find('wxStyledTextCtrl')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.bases = ['wxControl'] # wxTextCtrlIface is also a base... c.bases = ['wxControl'] # wxTextCtrlIface is also a base...
c.piBases = ['wx.Control', 'wx.TextEntry'] c.piBases = ['wx.Control', 'wx.TextEntry']
tools.fixWindowClass(c, False) tools.fixWindowClass(c, False)
module.addGlobalStr('wxSTCNameStr', c) module.addGlobalStr('wxSTCNameStr', c)
c.find('GetCurLine.linePos').out = True c.find('GetCurLine.linePos').out = True
c.find('GetCurLineRaw.linePos').out = True c.find('GetCurLineRaw.linePos').out = True
@@ -80,12 +80,12 @@ def run():
m = c.find(name) m = c.find(name)
m.find('from').name = 'from_' m.find('from').name = 'from_'
m.find('to').name = 'to_' m.find('to').name = 'to_'
c.find('GetSelection.from_').out = True c.find('GetSelection.from_').out = True
c.find('GetSelection.to_').out = True c.find('GetSelection.to_').out = True
c.find('PositionToXY.x').out = True c.find('PositionToXY.x').out = True
c.find('PositionToXY.y').out = True c.find('PositionToXY.y').out = True
# Split the HitTest overloads into separately named methods since once # Split the HitTest overloads into separately named methods since once
# the output parameters are applied they will have the same function # the output parameters are applied they will have the same function
# signature. # signature.
@@ -98,12 +98,12 @@ def run():
ht2.find('row').out = True ht2.find('row').out = True
ht2.find('col').out = True ht2.find('col').out = True
# Replace the *Pointer methods with ones that return a memoryview object instead. # Replace the *Pointer methods with ones that return a memoryview object instead.
c.find('GetCharacterPointer').ignore() c.find('GetCharacterPointer').ignore()
c.addCppMethod('PyObject*', 'GetCharacterPointer', '()', c.addCppMethod('PyObject*', 'GetCharacterPointer', '()',
doc="""\ doc="""\
Compact the document buffer and return a read-only memoryview Compact the document buffer and return a read-only memoryview
object of the characters in the document.""", object of the characters in the document.""",
body=""" body="""
const char* ptr = self->GetCharacterPointer(); const char* ptr = self->GetCharacterPointer();
@@ -112,12 +112,12 @@ def run():
wxPyBLOCK_THREADS( rv = wxPyMakeBuffer((void*)ptr, len, true) ); wxPyBLOCK_THREADS( rv = wxPyMakeBuffer((void*)ptr, len, true) );
return rv; return rv;
""") """)
c.find('GetRangePointer').ignore() c.find('GetRangePointer').ignore()
c.addCppMethod('PyObject*', 'GetRangePointer', '(int position, int rangeLength)', c.addCppMethod('PyObject*', 'GetRangePointer', '(int position, int rangeLength)',
doc="""\ doc="""\
Return a read-only pointer to a range of characters in the Return a read-only pointer to a range of characters in the
document. May move the gap so that the range is contiguous, document. May move the gap so that the range is contiguous,
but will only move up to rangeLength bytes.""", but will only move up to rangeLength bytes.""",
body=""" body="""
const char* ptr = self->GetRangePointer(position, rangeLength); const char* ptr = self->GetRangePointer(position, rangeLength);
@@ -164,12 +164,12 @@ def run():
# TODO: Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py) # TODO: Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py)
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxStyledTextEvent') c = module.find('wxStyledTextEvent')
tools.fixEventClass(c) tools.fixEventClass(c)
c.addPyCode("""\ c.addPyCode("""\
EVT_STC_CHANGE = wx.PyEventBinder( wxEVT_STC_CHANGE, 1 ) EVT_STC_CHANGE = wx.PyEventBinder( wxEVT_STC_CHANGE, 1 )
EVT_STC_STYLENEEDED = wx.PyEventBinder( wxEVT_STC_STYLENEEDED, 1 ) EVT_STC_STYLENEEDED = wx.PyEventBinder( wxEVT_STC_STYLENEEDED, 1 )
@@ -201,18 +201,18 @@ def run():
EVT_STC_INDICATOR_CLICK = wx.PyEventBinder( wxEVT_STC_INDICATOR_CLICK, 1 ) EVT_STC_INDICATOR_CLICK = wx.PyEventBinder( wxEVT_STC_INDICATOR_CLICK, 1 )
EVT_STC_INDICATOR_RELEASE = wx.PyEventBinder( wxEVT_STC_INDICATOR_RELEASE, 1 ) EVT_STC_INDICATOR_RELEASE = wx.PyEventBinder( wxEVT_STC_INDICATOR_RELEASE, 1 )
EVT_STC_AUTOCOMP_CANCELLED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CANCELLED, 1 ) EVT_STC_AUTOCOMP_CANCELLED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CANCELLED, 1 )
EVT_STC_AUTOCOMP_CHAR_DELETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CHAR_DELETED, 1 ) EVT_STC_AUTOCOMP_CHAR_DELETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CHAR_DELETED, 1 )
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_webkit" MODULE = "_webkit"
NAME = "_webkit" # Base name of the file to generate to for this script NAME = "_webkit" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -21,9 +21,9 @@ the OSX WebKit control and is not implemented on any other platform.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -41,7 +41,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -51,20 +51,20 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode('import wx', order=10) module.addPyCode('import wx', order=10)
module.addInclude(INCLUDES) module.addInclude(INCLUDES)
#----------------------------------------------------------------- #-----------------------------------------------------------------
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,7 +10,7 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_xml" MODULE = "_xml"
NAME = "_xml" # Base name of the file to generate to for this script NAME = "_xml" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -21,12 +21,12 @@ provided by Python.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxXmlNode', ITEMS = [ 'wxXmlNode',
'wxXmlAttribute', 'wxXmlAttribute',
'wxXmlDocument', 'wxXmlDocument',
] ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -43,7 +43,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -53,7 +53,7 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addPyCode('import wx', order=10) module.addPyCode('import wx', order=10)
@@ -61,31 +61,31 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
module.addPyCode("""\ module.addPyCode("""\
XmlProperty = wx.deprecated(XmlAttribute, 'Use XmlProperty instead.') XmlProperty = wx.deprecated(XmlAttribute, 'Use XmlProperty instead.')
""") """)
c = module.find('wxXmlNode') c = module.find('wxXmlNode')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('wxXmlNode.parent').transferThis = True c.find('wxXmlNode.parent').transferThis = True
c.find('AddAttribute.attr').transfer = True c.find('AddAttribute.attr').transfer = True
c.find('AddChild.child').transfer = True c.find('AddChild.child').transfer = True
c.find('InsertChild.child').transfer = True c.find('InsertChild.child').transfer = True
c.find('InsertChildAfter.child').transfer = True c.find('InsertChildAfter.child').transfer = True
c.find('RemoveChild.child').transferBack = True c.find('RemoveChild.child').transferBack = True
# we like the other overload better # we like the other overload better
c.find('GetAttribute').findOverload('value').ignore() c.find('GetAttribute').findOverload('value').ignore()
c.find('SetAttributes').ignore() c.find('SetAttributes').ignore()
c.find('SetChildren').ignore() c.find('SetChildren').ignore()
c = module.find('wxXmlDocument') c = module.find('wxXmlDocument')
c.piBases = ['wx.Object'] c.piBases = ['wx.Object']
c.find('GetEncoding').ignore() c.find('GetEncoding').ignore()
@@ -96,14 +96,14 @@ def run():
c.find('DetachRoot').transferBack = True c.find('DetachRoot').transferBack = True
c.find('SetDocumentNode.node').transfer = True c.find('SetDocumentNode.node').transfer = True
c.find('SetRoot.node').transfer = True c.find('SetRoot.node').transfer = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -11,7 +11,7 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
from etgtools import ClassDef, MethodDef, ParamDef from etgtools import ClassDef, MethodDef, ParamDef
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_xrc" MODULE = "_xrc"
NAME = "_xrc" # Base name of the file to generate to for this script NAME = "_xrc" # Base name of the file to generate to for this script
DOCSTRING = """\ DOCSTRING = """\
@@ -19,11 +19,11 @@ The classes in this module enable loading widgets and layout from XML.
""" """
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxXmlResource', ITEMS = [ 'wxXmlResource',
'wxXmlResourceHandler', 'wxXmlResourceHandler',
] ]
# The list of other ETG scripts and back-end generator modules that are # 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 # included as part of this module. These should all be items that are put in
@@ -40,7 +40,7 @@ OTHERDEPS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
@@ -50,10 +50,10 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>') module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core') module.addImport('_core')
module.addImport('_xml') module.addImport('_xml')
module.addPyCode('''\ module.addPyCode('''\
import wx import wx
ID_NONE = wx.ID_NONE # Needed for some parameter defaults in this module ID_NONE = wx.ID_NONE # Needed for some parameter defaults in this module
@@ -73,9 +73,9 @@ def run():
// forward declarations // forward declarations
class wxAnimation; class wxAnimation;
""")) """))
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxXmlResource') c = module.find('wxXmlResource')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.piBases = ['wx.Object'] c.piBases = ['wx.Object']
@@ -88,19 +88,19 @@ def run():
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
sipCpp = new sipwxXmlResource({args}); sipCpp = new sipwxXmlResource({args});
sipCpp->InitAllHandlers(); sipCpp->InitAllHandlers();
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
""" """
if 'filemask' in ctor.argsString: if 'filemask' in ctor.argsString:
args = '*filemask,flags,*domain' args = '*filemask,flags,*domain'
else: else:
args = 'flags,*domain' args = 'flags,*domain'
ctor.setCppCode_sip(template.format(args=args)) ctor.setCppCode_sip(template.format(args=args))
c.addPublic() c.addPublic()
c.addCppMethod('bool', 'LoadFromBuffer', '(wxPyBuffer* data)', c.addCppMethod('bool', 'LoadFromBuffer', '(wxPyBuffer* data)',
doc="Load the resource from a bytes string or other data buffer compatible object.", doc="Load the resource from a bytes string or other data buffer compatible object.",
#protection='public', #protection='public',
body="""\ body="""\
static int s_memFileIdx = 0; static int s_memFileIdx = 0;
@@ -126,31 +126,31 @@ def run():
return retval; return retval;
""") """)
c.addPyCode("XmlResource.LoadFromString = wx.deprecated(XmlResource.LoadFromBuffer, 'Use LoadFromBuffer instead')") c.addPyCode("XmlResource.LoadFromString = wx.deprecated(XmlResource.LoadFromBuffer, 'Use LoadFromBuffer instead')")
c.find('AddHandler.handler').transfer = True c.find('AddHandler.handler').transfer = True
c.find('InsertHandler.handler').transfer = True c.find('InsertHandler.handler').transfer = True
c.find('Set.res').transfer = True c.find('Set.res').transfer = True
c.find('Set').transferBack = True c.find('Set').transferBack = True
c.find('AddSubclassFactory.factory').transfer = True c.find('AddSubclassFactory.factory').transfer = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxXmlResourceHandler') c = module.find('wxXmlResourceHandler')
# un-ignore all the protected methods # un-ignore all the protected methods
for item in c.allItems(): for item in c.allItems():
if isinstance(item, etgtools.MethodDef): if isinstance(item, etgtools.MethodDef):
item.ignore(False) item.ignore(False)
c.find('DoCreateResource').factory = True c.find('DoCreateResource').factory = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
module.addPyFunction('EmptyXmlResource', '(flags=XRC_USE_LOCALE, domain="")', module.addPyFunction('EmptyXmlResource', '(flags=XRC_USE_LOCALE, domain="")',
deprecated="Use :class:`xrc.XmlResource` instead", deprecated="Use :class:`xrc.XmlResource` instead",
doc='A compatibility wrapper for the XmlResource(flags, domain) constructor', doc='A compatibility wrapper for the XmlResource(flags, domain) constructor',
body='return XmlResource(flags, domain)') body='return XmlResource(flags, domain)')
module.addPyFunction('XRCID', '(str_id, value_if_not_found=wx.ID_NONE)', module.addPyFunction('XRCID', '(str_id, value_if_not_found=wx.ID_NONE)',
doc='Returns a numeric ID that is equivalent to the string ID used in an XML resource.', doc='Returns a numeric ID that is equivalent to the string ID used in an XML resource.',
body='return XmlResource.GetXRCID(str_id, value_if_not_found)') body='return XmlResource.GetXRCID(str_id, value_if_not_found)')
@@ -161,24 +161,24 @@ def run():
cls = ClassDef(name='wxXmlSubclassFactory', cls = ClassDef(name='wxXmlSubclassFactory',
briefDoc="", briefDoc="",
items=[ items=[
MethodDef(name='wxXmlSubclassFactory', isCtor=True), MethodDef(name='wxXmlSubclassFactory', isCtor=True),
MethodDef(name='~wxXmlSubclassFactory', isDtor=True), MethodDef(name='~wxXmlSubclassFactory', isDtor=True),
MethodDef(name='Create', type='wxObject*', MethodDef(name='Create', type='wxObject*',
isVirtual=True, isPureVirtual=True, isVirtual=True, isPureVirtual=True,
items=[ParamDef(type='const wxString&', name='className')]) items=[ParamDef(type='const wxString&', name='className')])
]) ])
module.addItem(cls) module.addItem(cls)
module.addPyCode("""\ module.addPyCode("""\
# Create a factory for handling the subclass property of XRC's # Create a factory for handling the subclass property of XRC's
# object tag. This factory will search for the specified # object tag. This factory will search for the specified
# package.module.class and will try to instantiate it for XRC's # package.module.class and will try to instantiate it for XRC's
# use. The class must support instantiation with no parameters and # use. The class must support instantiation with no parameters and
# delayed creation of the UI widget (aka 2-phase create). # delayed creation of the UI widget (aka 2-phase create).
def _my_import(name): def _my_import(name):
@@ -192,11 +192,11 @@ def run():
for comp in components[1:]: for comp in components[1:]:
mod = getattr(mod, comp) mod = getattr(mod, comp)
return mod return mod
class XmlSubclassFactory_Python(XmlSubclassFactory): class XmlSubclassFactory_Python(XmlSubclassFactory):
def __init__(self): def __init__(self):
XmlSubclassFactory.__init__(self) XmlSubclassFactory.__init__(self)
def Create(self, className): def Create(self, className):
assert className.find('.') != -1, "Module name must be specified!" assert className.find('.') != -1, "Module name must be specified!"
mname = className[:className.rfind('.')] mname = className[:className.rfind('.')]
@@ -204,17 +204,17 @@ def run():
module = _my_import(mname) module = _my_import(mname)
klass = getattr(module, cname) klass = getattr(module, cname)
inst = klass() inst = klass()
return inst return inst
XmlResource.AddSubclassFactory(XmlSubclassFactory_Python()) XmlResource.AddSubclassFactory(XmlSubclassFactory_Python())
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -10,27 +10,27 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "aboutdlg" # Base name of the file to generate to for this script NAME = "aboutdlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxAboutDialogInfo", ITEMS = [ "wxAboutDialogInfo",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/generic/aboutdlgg.h>') module.addHeaderCode('#include <wx/generic/aboutdlgg.h>')
c = module.find('wxAboutDialogInfo') c = module.find('wxAboutDialogInfo')
@@ -48,8 +48,8 @@ def run():
AboutDialogInfo.License = AboutDialogInfo.Licence AboutDialogInfo.License = AboutDialogInfo.Licence
""") """)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,16 +17,16 @@ NAME = "accel" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxAcceleratorEntry', 'wxAcceleratorTable', ] ITEMS = [ 'wxAcceleratorEntry', 'wxAcceleratorTable', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
@@ -37,8 +37,8 @@ def run():
c = module.find('wxAcceleratorTable') c = module.find('wxAcceleratorTable')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.removeVirtuals(c) tools.removeVirtuals(c)
# Replace the implementation of the AcceleratorTable ctor so it can # Replace the implementation of the AcceleratorTable ctor so it can
# accept a Python sequence of tuples or AcceleratorEntry objects like # accept a Python sequence of tuples or AcceleratorEntry objects like
# Classic does. Using the arraySize and array annotations does let us # Classic does. Using the arraySize and array annotations does let us
@@ -49,11 +49,11 @@ def run():
# Ignore the current constructor # Ignore the current constructor
c.find('wxAcceleratorTable').findOverload('entries').ignore() c.find('wxAcceleratorTable').findOverload('entries').ignore()
# and add the code for the new constructor # and add the code for the new constructor
c.addCppCtor( c.addCppCtor(
briefDoc="TODO", briefDoc="TODO",
argsString='(PyObject* entries)', argsString='(PyObject* entries)',
body="""\ body="""\
const char* errmsg = "Expected a sequence of 3-tuples or wx.AcceleratorEntry objects."; const char* errmsg = "Expected a sequence of 3-tuples or wx.AcceleratorEntry objects.";
if (!PySequence_Check(entries)) { if (!PySequence_Check(entries)) {
@@ -82,7 +82,7 @@ def run():
tmpEntries[idx].Set(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3)); tmpEntries[idx].Set(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3));
Py_DECREF(o1); Py_DECREF(o1);
Py_DECREF(o2); Py_DECREF(o2);
Py_DECREF(o3); Py_DECREF(o3);
} }
else { else {
PyErr_SetString(PyExc_TypeError, errmsg); PyErr_SetString(PyExc_TypeError, errmsg);
@@ -90,7 +90,7 @@ def run():
} }
Py_DECREF(obj); Py_DECREF(obj);
} }
wxAcceleratorTable* table = new wxAcceleratorTable(count, tmpEntries); wxAcceleratorTable* table = new wxAcceleratorTable(count, tmpEntries);
delete tmpEntries; delete tmpEntries;
return table; return table;
@@ -99,8 +99,8 @@ def run():
# Mac doesn't have this, and we don't real with resource files from # Mac doesn't have this, and we don't real with resource files from
# wxPython anyway. # wxPython anyway.
c.find('wxAcceleratorTable').findOverload('resource').ignore() c.find('wxAcceleratorTable').findOverload('resource').ignore()
module.addPyFunction('GetAccelFromString', '(label)', module.addPyFunction('GetAccelFromString', '(label)',
deprecated=True, deprecated=True,
body="""\ body="""\
@@ -108,12 +108,12 @@ def run():
accel.FromString(label) accel.FromString(label)
return accel return accel
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "affinematrix2d" # Base name of the file to generate to for this script NAME = "affinematrix2d" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxMatrix2D", ITEMS = [ "wxMatrix2D",
"wxAffineMatrix2DBase", "wxAffineMatrix2DBase",
"wxAffineMatrix2D", "wxAffineMatrix2D",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxAffineMatrix2DBase') c = module.find('wxAffineMatrix2DBase')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
for c in [module.find('wxAffineMatrix2DBase'), for c in [module.find('wxAffineMatrix2DBase'),
module.find('wxAffineMatrix2D')]: module.find('wxAffineMatrix2D')]:
c.find('Get.mat2D').out = True c.find('Get.mat2D').out = True
c.find('Get.tr').out = True c.find('Get.tr').out = True
@@ -48,12 +48,12 @@ def run():
c.find('TransformDistance.dx').inOut = True c.find('TransformDistance.dx').inOut = True
c.find('TransformDistance.dy').inOut = True c.find('TransformDistance.dy').inOut = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,49 +10,49 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "animate" # Base name of the file to generate to for this script NAME = "animate" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxAnimation", ITEMS = [ "wxAnimation",
"wxAnimationCtrl", "wxAnimationCtrl",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxAnimation') c = module.find('wxAnimation')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c = module.find('wxAnimationCtrl') c = module.find('wxAnimationCtrl')
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.addGlobalStr('wxAnimationCtrlNameStr', c) module.addGlobalStr('wxAnimationCtrlNameStr', c)
# move this before wxAnimationCtrl so it can be used for default arg values # move this before wxAnimationCtrl so it can be used for default arg values
item = module.find('wxNullAnimation') item = module.find('wxNullAnimation')
module.items.remove(item) module.items.remove(item)
module.insertItemBefore(c, item) module.insertItemBefore(c, item)
# TODO: It would be nice to be able to use the generic verison on all # TODO: It would be nice to be able to use the generic verison on all
# platforms since the native GTK version has some limitations... # platforms since the native GTK version has some limitations...
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,35 +10,35 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "anybutton" # Base name of the file to generate to for this script NAME = "anybutton" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxAnyButton", ] ITEMS = [ "wxAnyButton", ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxAnyButton') c = module.find('wxAnyButton')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -11,16 +11,16 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "app" # Base name of the file to generate to for this script NAME = "app" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxAppConsole', ITEMS = [ 'wxAppConsole',
'wxApp', 'wxApp',
] ]
OTHERDEPS = [ 'src/app_ex.cpp', # and some C++ code too OTHERDEPS = [ 'src/app_ex.cpp', # and some C++ code too
] ]
@@ -31,36 +31,36 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.find('wxDISABLE_DEBUG_SUPPORT').ignore() module.find('wxDISABLE_DEBUG_SUPPORT').ignore()
c = module.find('wxAppConsole') c = module.find('wxAppConsole')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
etgtools.prependText(c.detailedDoc, etgtools.prependText(c.detailedDoc,
"Note that it is not intended for this class to be used directly from " "Note that it is not intended for this class to be used directly from "
"Python. It is wrapped just for inheriting its methods from :class:`App`.") "Python. It is wrapped just for inheriting its methods from :class:`App`.")
# There's no need for the command line stuff as Python has its own ways to # There's no need for the command line stuff as Python has its own ways to
# deal with that # deal with that
c.find('argc').ignore() c.find('argc').ignore()
c.find('argv').ignore() c.find('argv').ignore()
c.find('OnCmdLineError').ignore() c.find('OnCmdLineError').ignore()
c.find('OnCmdLineHelp').ignore() c.find('OnCmdLineHelp').ignore()
c.find('OnCmdLineParsed').ignore() c.find('OnCmdLineParsed').ignore()
c.find('OnInitCmdLine').ignore() c.find('OnInitCmdLine').ignore()
c.find('HandleEvent').ignore() c.find('HandleEvent').ignore()
c.find('UsesEventLoop').ignore() c.find('UsesEventLoop').ignore()
# We will use OnAssertFailure, but I don't think we should let it be # We will use OnAssertFailure, but I don't think we should let it be
# overridden in Python. # overridden in Python.
c.find('OnAssertFailure').ignore() c.find('OnAssertFailure').ignore()
# TODO: Decide if these should be visible from Python. They are for # TODO: Decide if these should be visible from Python. They are for
# dealing with C/C++ exceptions, but perhaps we could also add the ability # dealing with C/C++ exceptions, but perhaps we could also add the ability
# to deal with unhandled Python exceptions using these (overridable) # to deal with unhandled Python exceptions using these (overridable)
@@ -68,37 +68,37 @@ def run():
c.find('OnExceptionInMainLoop').ignore() c.find('OnExceptionInMainLoop').ignore()
c.find('OnFatalException').ignore() c.find('OnFatalException').ignore()
c.find('OnUnhandledException').ignore() c.find('OnUnhandledException').ignore()
# Release the GIL for potentially blocking or long-running functions # Release the GIL for potentially blocking or long-running functions
c.find('MainLoop').releaseGIL() c.find('MainLoop').releaseGIL()
c.find('ProcessPendingEvents').releaseGIL() c.find('ProcessPendingEvents').releaseGIL()
c.find('Yield').releaseGIL() c.find('Yield').releaseGIL()
c.addProperty('AppDisplayName GetAppDisplayName SetAppDisplayName') c.addProperty('AppDisplayName GetAppDisplayName SetAppDisplayName')
c.addProperty('AppName GetAppName SetAppName') c.addProperty('AppName GetAppName SetAppName')
c.addProperty('ClassName GetClassName SetClassName') c.addProperty('ClassName GetClassName SetClassName')
c.addProperty('VendorDisplayName GetVendorDisplayName SetVendorDisplayName') c.addProperty('VendorDisplayName GetVendorDisplayName SetVendorDisplayName')
c.addProperty('VendorName GetVendorName SetVendorName') c.addProperty('VendorName GetVendorName SetVendorName')
c.addProperty('Traits GetTraits') c.addProperty('Traits GetTraits')
#------------------------------------------------------- #-------------------------------------------------------
c = module.find('wxApp') c = module.find('wxApp')
# Add a new C++ wxPyApp class that adds empty Mac* methods for other # Add a new C++ wxPyApp class that adds empty Mac* methods for other
# platforms, and other goodies, then change the name so SIP will # platforms, and other goodies, then change the name so SIP will
# generate code wrapping this class as if it was the wxApp class seen in # generate code wrapping this class as if it was the wxApp class seen in
# the DoxyXML. # the DoxyXML.
c.includeCppCode('src/app_ex.cpp') c.includeCppCode('src/app_ex.cpp')
# Now change the class name, ctors and dtor names from wxApp to wxPyApp # Now change the class name, ctors and dtor names from wxApp to wxPyApp
for item in c.allItems(): for item in c.allItems():
if item.name == 'wxApp': if item.name == 'wxApp':
item.name = 'wxPyApp' item.name = 'wxPyApp'
if item.name == '~wxApp': if item.name == '~wxApp':
item.name = '~wxPyApp' item.name = '~wxPyApp'
c.find('ProcessMessage').ignore() c.find('ProcessMessage').ignore()
c.addCppMethod('void', 'MacHideApp', '()', c.addCppMethod('void', 'MacHideApp', '()',
doc="""\ doc="""\
Hide all application windows just as the user can do with the Hide all application windows just as the user can do with the
@@ -137,12 +137,12 @@ def run():
""") """)
# Remove the virtualness from these methods # Remove the virtualness from these methods
for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive', for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive',
'SafeYield', 'SafeYieldFor', 'SetDisplayMode', 'SafeYield', 'SafeYieldFor', 'SetDisplayMode',
'SetNativeTheme', ]: 'SetNativeTheme', ]:
c.find(m).isVirtual = False c.find(m).isVirtual = False
# Methods we implement in wxPyApp beyond what are in wxApp, plus some # Methods we implement in wxPyApp beyond what are in wxApp, plus some
# overridden virtuals (or at least some that we want the wrapper # overridden virtuals (or at least some that we want the wrapper
# generator to treat as if they are overridden.) # generator to treat as if they are overridden.)
@@ -181,29 +181,29 @@ def run():
protection='public', type='wxAppAssertMode', name='GetAssertMode', argsString='()', protection='public', type='wxAppAssertMode', name='GetAssertMode', argsString='()',
briefDoc="Returns the current mode for how the application responds to wx asserts.", briefDoc="Returns the current mode for how the application responds to wx asserts.",
className=c.name)) className=c.name))
m = etgtools.MethodDef( m = etgtools.MethodDef(
protection='public', type='void', name='SetAssertMode', argsString='(wxAppAssertMode mode)', protection='public', type='void', name='SetAssertMode', argsString='(wxAppAssertMode mode)',
briefDoc="""\ briefDoc="""\
Set the mode indicating how the application responds to wx assertion Set the mode indicating how the application responds to wx assertion
statements. Valid settings are a combination of these flags: statements. Valid settings are a combination of these flags:
- wx.APP_ASSERT_SUPPRESS - wx.APP_ASSERT_SUPPRESS
- wx.APP_ASSERT_EXCEPTION - wx.APP_ASSERT_EXCEPTION
- wx.APP_ASSERT_DIALOG - wx.APP_ASSERT_DIALOG
- wx.APP_ASSERT_LOG - wx.APP_ASSERT_LOG
The default behavior is to raise a wx.wxAssertionError exception. The default behavior is to raise a wx.wxAssertionError exception.
""", """,
className=c.name) className=c.name)
m.addItem(etgtools.ParamDef(type='wxAppAssertMode', name='wxAppAssertMode')) m.addItem(etgtools.ParamDef(type='wxAppAssertMode', name='wxAppAssertMode'))
c.addItem(m) c.addItem(m)
c.addItem(etgtools.MethodDef( c.addItem(etgtools.MethodDef(
protection='public', isStatic=True, type='bool', name='IsDisplayAvailable', argsString='()', protection='public', isStatic=True, type='bool', name='IsDisplayAvailable', argsString='()',
briefDoc="""\ briefDoc="""\
Returns True if the application is able to connect to the system's Returns True if the application is able to connect to the system's
display, or whatever the equivallent is for the platform.""", display, or whatever the equivallent is for the platform.""",
className=c.name)) className=c.name))
@@ -217,11 +217,11 @@ def run():
c.addProperty('LayoutDirection GetLayoutDirection') c.addProperty('LayoutDirection GetLayoutDirection')
c.addProperty('UseBestVisual GetUseBestVisual SetUseBestVisual') c.addProperty('UseBestVisual GetUseBestVisual SetUseBestVisual')
c.addProperty('TopWindow GetTopWindow SetTopWindow') c.addProperty('TopWindow GetTopWindow SetTopWindow')
#------------------------------------------------------- #-------------------------------------------------------
module.addHeaderCode("""\ module.addHeaderCode("""\
enum wxAppAssertMode { enum wxAppAssertMode {
wxAPP_ASSERT_SUPPRESS = 1, wxAPP_ASSERT_SUPPRESS = 1,
@@ -234,7 +234,7 @@ def run():
for eitem in "wxAPP_ASSERT_SUPPRESS wxAPP_ASSERT_EXCEPTION wxAPP_ASSERT_DIALOG wxAPP_ASSERT_LOG".split(): for eitem in "wxAPP_ASSERT_SUPPRESS wxAPP_ASSERT_EXCEPTION wxAPP_ASSERT_DIALOG wxAPP_ASSERT_LOG".split():
enum.addItem(etgtools.EnumValueDef(name=eitem)) enum.addItem(etgtools.EnumValueDef(name=eitem))
module.insertItemBefore(c, enum) module.insertItemBefore(c, enum)
module.addHeaderCode("""\ module.addHeaderCode("""\
class wxPyApp; class wxPyApp;
wxPyApp* wxGetApp(); wxPyApp* wxGetApp();
@@ -248,14 +248,14 @@ def run():
module.find('wxYield').releaseGIL() module.find('wxYield').releaseGIL()
module.find('wxSafeYield').releaseGIL() module.find('wxSafeYield').releaseGIL()
#------------------------------------------------------- #-------------------------------------------------------
# Now add extractor objects for the main App class as a Python class, # Now add extractor objects for the main App class as a Python class,
# deriving from the wx.PyApp class that we created above. Also define the # deriving from the wx.PyApp class that we created above. Also define the
# stdio helper class too. # stdio helper class too.
module.addPyClass('PyOnDemandOutputWindow', ['object'], module.addPyClass('PyOnDemandOutputWindow', ['object'],
doc="""\ doc="""\
A class that can be used for redirecting Python's stdout and A class that can be used for redirecting Python's stdout and
@@ -272,11 +272,11 @@ def run():
self.size = (450, 300) self.size = (450, 300)
self.parent = None self.parent = None
"""), """),
PyFunctionDef('SetParent', '(self, parent)', PyFunctionDef('SetParent', '(self, parent)',
doc="""Set the window to be used as the popup Frame's parent.""", doc="""Set the window to be used as the popup Frame's parent.""",
body="""self.parent = parent"""), body="""self.parent = parent"""),
PyFunctionDef('CreateOutputWindow', '(self, txt)', PyFunctionDef('CreateOutputWindow', '(self, txt)',
doc="", doc="",
body="""\ body="""\
@@ -288,7 +288,7 @@ def run():
self.frame.Show(True) self.frame.Show(True)
self.frame.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.frame.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
"""), """),
PyFunctionDef('OnCloseWindow', '(self, event)', PyFunctionDef('OnCloseWindow', '(self, event)',
doc="", doc="",
body="""\ body="""\
@@ -298,12 +298,12 @@ def run():
self.text = None self.text = None
self.parent = None self.parent = None
"""), """),
# These methods provide the file-like output behaviour. # These methods provide the file-like output behaviour.
PyFunctionDef('write', '(self, text)', PyFunctionDef('write', '(self, text)',
doc="""\ doc="""\
Create the output window if needed and write the string to it. Create the output window if needed and write the string to it.
If not called in the context of the gui thread then CallAfter is If not called in the context of the gui thread then CallAfter is
used to do the work there. used to do the work there.
""", """,
body="""\ body="""\
@@ -318,94 +318,94 @@ def run():
else: else:
self.text.AppendText(text) self.text.AppendText(text)
"""), """),
PyFunctionDef('close', '(self)', PyFunctionDef('close', '(self)',
doc="", doc="",
body="""\ body="""\
if self.frame is not None: if self.frame is not None:
wx.CallAfter(self.frame.Close) wx.CallAfter(self.frame.Close)
"""), """),
PyFunctionDef('flush', '(self)', 'pass'), PyFunctionDef('flush', '(self)', 'pass'),
]) ])
module.addPyClass('App', ['PyApp'], module.addPyClass('App', ['PyApp'],
doc="""\ doc="""\
The ``wx.App`` class represents the application and is used to: The ``wx.App`` class represents the application and is used to:
* bootstrap the wxPython system and initialize the underlying * bootstrap the wxPython system and initialize the underlying
gui toolkit gui toolkit
* set and get application-wide properties * set and get application-wide properties
* implement the native windowing system main message or event loop, * implement the native windowing system main message or event loop,
and to dispatch events to window instances and to dispatch events to window instances
* etc. * etc.
Every wx application must have a single ``wx.App`` instance, and all Every wx application must have a single ``wx.App`` instance, and all
creation of UI objects should be delayed until after the ``wx.App`` object creation of UI objects should be delayed until after the ``wx.App`` object
has been created in order to ensure that the gui platform and wxWidgets has been created in order to ensure that the gui platform and wxWidgets
have been fully initialized. have been fully initialized.
Normally you would derive from this class and implement an ``OnInit`` Normally you would derive from this class and implement an ``OnInit``
method that creates a frame and then calls ``self.SetTopWindow(frame)``, method that creates a frame and then calls ``self.SetTopWindow(frame)``,
however ``wx.App`` is also usable on it's own without derivation. however ``wx.App`` is also usable on it's own without derivation.
""", """,
items=[ items=[
PyCodeDef('outputWindowClass = PyOnDemandOutputWindow'), PyCodeDef('outputWindowClass = PyOnDemandOutputWindow'),
PyFunctionDef('__init__', '(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True)', PyFunctionDef('__init__', '(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True)',
doc="""\ doc="""\
Construct a ``wx.App`` object. Construct a ``wx.App`` object.
:param redirect: Should ``sys.stdout`` and ``sys.stderr`` be :param redirect: Should ``sys.stdout`` and ``sys.stderr`` be
redirected? Defaults to False. If ``filename`` is None redirected? Defaults to False. If ``filename`` is None
then output will be redirected to a window that pops up then output will be redirected to a window that pops up
as needed. (You can control what kind of window is created as needed. (You can control what kind of window is created
for the output by resetting the class variable for the output by resetting the class variable
``outputWindowClass`` to a class of your choosing.) ``outputWindowClass`` to a class of your choosing.)
:param filename: The name of a file to redirect output to, if :param filename: The name of a file to redirect output to, if
redirect is True. redirect is True.
:param useBestVisual: Should the app try to use the best :param useBestVisual: Should the app try to use the best
available visual provided by the system (only relevant on available visual provided by the system (only relevant on
systems that have more than one visual.) This parameter systems that have more than one visual.) This parameter
must be used instead of calling `SetUseBestVisual` later must be used instead of calling `SetUseBestVisual` later
on because it must be set before the underlying GUI on because it must be set before the underlying GUI
toolkit is initialized. toolkit is initialized.
:param clearSigInt: Should SIGINT be cleared? This allows the :param clearSigInt: Should SIGINT be cleared? This allows the
app to terminate upon a Ctrl-C in the console like other app to terminate upon a Ctrl-C in the console like other
GUI apps will. GUI apps will.
:note: You should override OnInit to do application :note: You should override OnInit to do application
initialization to ensure that the system, toolkit and initialization to ensure that the system, toolkit and
wxWidgets are fully initialized. wxWidgets are fully initialized.
""", """,
body="""\ body="""\
PyApp.__init__(self) PyApp.__init__(self)
# make sure we can create a GUI # make sure we can create a GUI
if not self.IsDisplayAvailable(): if not self.IsDisplayAvailable():
if wx.Port == "__WXMAC__": if wx.Port == "__WXMAC__":
msg = "This program needs access to the screen. Please run with a\\n" \\ msg = "This program needs access to the screen. Please run with a\\n" \\
"Framework build of python, and only when you are logged in\\n" \\ "Framework build of python, and only when you are logged in\\n" \\
"on the main display of your Mac." "on the main display of your Mac."
elif wx.Port == "__WXGTK__": elif wx.Port == "__WXGTK__":
msg ="Unable to access the X Display, is $DISPLAY set properly?" msg ="Unable to access the X Display, is $DISPLAY set properly?"
else: else:
msg = "Unable to create GUI" msg = "Unable to create GUI"
# TODO: more description is needed for wxMSW... # TODO: more description is needed for wxMSW...
raise SystemExit(msg) raise SystemExit(msg)
# This has to be done before OnInit # This has to be done before OnInit
self.SetUseBestVisual(useBestVisual) self.SetUseBestVisual(useBestVisual)
# Set the default handler for SIGINT. This fixes a problem # Set the default handler for SIGINT. This fixes a problem
# where if Ctrl-C is pressed in the console that started this # where if Ctrl-C is pressed in the console that started this
# app then it will not appear to do anything, (not even send # app then it will not appear to do anything, (not even send
@@ -418,24 +418,24 @@ def run():
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
except: except:
pass pass
# Save and redirect the stdio to a window? # Save and redirect the stdio to a window?
self.stdioWin = None self.stdioWin = None
self.saveStdio = (_sys.stdout, _sys.stderr) self.saveStdio = (_sys.stdout, _sys.stderr)
if redirect: if redirect:
self.RedirectStdio(filename) self.RedirectStdio(filename)
# Use Python's install prefix as the default # Use Python's install prefix as the default
wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix) wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix)
# Until the new native control for wxMac is up to par, still use the generic one. # Until the new native control for wxMac is up to par, still use the generic one.
wx.SystemOptions.SetOption("mac.listctrl.always_use_generic", 1) wx.SystemOptions.SetOption("mac.listctrl.always_use_generic", 1)
# This finishes the initialization of wxWindows and then calls # This finishes the initialization of wxWindows and then calls
# the OnInit that should be present in the derived class # the OnInit that should be present in the derived class
self._BootstrapApp() self._BootstrapApp()
"""), """),
PyFunctionDef('OnPreInit', '(self)', PyFunctionDef('OnPreInit', '(self)',
doc="""\ doc="""\
Things that must be done after _BootstrapApp has done its thing, but Things that must be done after _BootstrapApp has done its thing, but
@@ -444,17 +444,17 @@ def run():
this method from there. this method from there.
""", """,
body="wx.StockGDI._initStockObjects()"), body="wx.StockGDI._initStockObjects()"),
PyFunctionDef('__del__', '(self)', PyFunctionDef('__del__', '(self)',
doc="", doc="",
body="""\ body="""\
# Just in case the MainLoop was overridden without calling RestoreStio # Just in case the MainLoop was overridden without calling RestoreStio
self.RestoreStdio() self.RestoreStdio()
"""), """),
PyFunctionDef('SetTopWindow', '(self, frame)', PyFunctionDef('SetTopWindow', '(self, frame)',
doc="""\ doc="""\
Set the \"main\" top level window, which will be used for the parent of Set the \"main\" top level window, which will be used for the parent of
the on-demand output window as well as for dialogs that do not have the on-demand output window as well as for dialogs that do not have
an explicit parent set. an explicit parent set.
""", """,
@@ -463,7 +463,7 @@ def run():
self.stdioWin.SetParent(frame) self.stdioWin.SetParent(frame)
wx.PyApp.SetTopWindow(self, frame) wx.PyApp.SetTopWindow(self, frame)
"""), """),
PyFunctionDef('MainLoop', '(self)', PyFunctionDef('MainLoop', '(self)',
doc="""Execute the main GUI event loop""", doc="""Execute the main GUI event loop""",
body="""\ body="""\
@@ -471,7 +471,7 @@ def run():
self.RestoreStdio() self.RestoreStdio()
return rv return rv
"""), """),
PyFunctionDef('RedirectStdio', '(self, filename=None)', PyFunctionDef('RedirectStdio', '(self, filename=None)',
doc="""Redirect sys.stdout and sys.stderr to a file or a popup window.""", doc="""Redirect sys.stdout and sys.stderr to a file or a popup window.""",
body="""\ body="""\
@@ -481,7 +481,7 @@ def run():
self.stdioWin = self.outputWindowClass() self.stdioWin = self.outputWindowClass()
_sys.stdout = _sys.stderr = self.stdioWin _sys.stdout = _sys.stderr = self.stdioWin
"""), """),
PyFunctionDef('RestoreStdio', '(self)', PyFunctionDef('RestoreStdio', '(self)',
doc="", doc="",
body="""\ body="""\
@@ -490,7 +490,7 @@ def run():
except: except:
pass pass
"""), """),
PyFunctionDef('SetOutputWindowAttributes', '(self, title=None, pos=None, size=None)', PyFunctionDef('SetOutputWindowAttributes', '(self, title=None, pos=None, size=None)',
doc="""\ doc="""\
Set the title, position and/or size of the output window if the stdio Set the title, position and/or size of the output window if the stdio
@@ -506,10 +506,10 @@ def run():
if size is not None: if size is not None:
self.stdioWin.size = size self.stdioWin.size = size
"""), """),
PyFunctionDef('Get', '()', isStatic=True, PyFunctionDef('Get', '()', isStatic=True,
doc="""\ doc="""\
A staticmethod returning the currently active application object. A staticmethod returning the currently active application object.
Essentially just a more pythonic version of :meth:`GetApp`.""", Essentially just a more pythonic version of :meth:`GetApp`.""",
body="return GetApp()" body="return GetApp()"
) )
@@ -533,14 +533,14 @@ def run():
for item in module.allItems(): for item in module.allItems():
if item.name == 'wxEntry': if item.name == 'wxEntry':
item.ignore() item.ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@@ -10,51 +10,51 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "apptrait" # Base name of the file to generate to for this script NAME = "apptrait" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxAppTraits' ] ITEMS = [ 'wxAppTraits' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxAppTraits') c = module.find('wxAppTraits')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
# TODO: Enable these as etg scripts for their return types are added # TODO: Enable these as etg scripts for their return types are added
for name in [ 'CreateFontMapper', for name in [ 'CreateFontMapper',
'CreateMessageOutput', 'CreateMessageOutput',
'CreateRenderer', 'CreateRenderer',
]: ]:
c.find(name).ignore() c.find(name).ignore()
for name in [ 'CreateConfig', for name in [ 'CreateConfig',
'CreateEventLoop', 'CreateEventLoop',
'CreateLogTarget', 'CreateLogTarget',
#'GetStandardPaths', #'GetStandardPaths',
]: ]:
c.find(name).factory = True c.find(name).factory = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,35 +10,35 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "artprov" # Base name of the file to generate to for this script NAME = "artprov" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxArtProvider", ITEMS = [ "wxArtProvider",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxArtProvider') c = module.find('wxArtProvider')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
# These are protrected and so they are ignored by default. Unignore them. # These are protrected and so they are ignored by default. Unignore them.
c.find('CreateBitmap').ignore(False) c.find('CreateBitmap').ignore(False)
c.find('CreateIconBundle').ignore(False) c.find('CreateIconBundle').ignore(False)
# deal with ownership transfers # deal with ownership transfers
c.find('Push.provider').transfer = True c.find('Push.provider').transfer = True
c.find('PushBack.provider').transfer = True c.find('PushBack.provider').transfer = True
@@ -58,13 +58,13 @@ def run():
for item in artConsts: for item in artConsts:
module.items.remove(item) module.items.remove(item)
module.items.insert(0, item) module.items.insert(0, item)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -11,22 +11,22 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
from etgtools import (ClassDef, MethodDef, ParamDef, TypedefDef) from etgtools import (ClassDef, MethodDef, ParamDef, TypedefDef)
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_msw" MODULE = "_msw"
NAME = "axbase" # Base name of the file to generate to for this script NAME = "axbase" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ] ITEMS = [ ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# The wxPyAxBaseWindow class does not come from the parsed Doxygen xml, # The wxPyAxBaseWindow class does not come from the parsed Doxygen xml,
# instead it is manufactured entirely in this ETG script. We're doing it # instead it is manufactured entirely in this ETG script. We're doing it
@@ -93,8 +93,8 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,27 +10,27 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "bannerwindow" # Base name of the file to generate to for this script NAME = "bannerwindow" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxBannerWindow", ITEMS = [ "wxBannerWindow",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxBannerWindow') c = module.find('wxBannerWindow')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
@@ -40,13 +40,13 @@ def run():
# We can already do with keyword args what this ctor does for C++ people, # We can already do with keyword args what this ctor does for C++ people,
# so ignore it to avoid signature conflicts. # so ignore it to avoid signature conflicts.
c.find('wxBannerWindow').findOverload('parent, wxDirection').ignore() c.find('wxBannerWindow').findOverload('parent, wxDirection').ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,11 +17,11 @@ NAME = "bitmap" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxBitmap', ITEMS = [ 'wxBitmap',
'wxBitmapHandler', 'wxBitmapHandler',
'wxMask' ] 'wxMask' ]
OTHERDEPS = [ 'src/bitmap_ex.h', OTHERDEPS = [ 'src/bitmap_ex.h',
'src/bitmap_ex.cpp', ] 'src/bitmap_ex.cpp', ]
@@ -32,14 +32,14 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxBitmap') c = module.find('wxBitmap')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.removeVirtuals(c) tools.removeVirtuals(c)
c.find('wxBitmap.bits').type = 'const char*' c.find('wxBitmap.bits').type = 'const char*'
@@ -55,7 +55,7 @@ def run():
char** cArray = NULL; char** cArray = NULL;
int count; int count;
char errMsg[] = "Expected a list of bytes objects."; char errMsg[] = "Expected a list of bytes objects.";
if (!PyList_Check(listOfBytes)) { if (!PyList_Check(listOfBytes)) {
PyErr_SetString(PyExc_TypeError, errMsg); PyErr_SetString(PyExc_TypeError, errMsg);
return NULL; return NULL;
@@ -88,7 +88,7 @@ def run():
c.addCppMethod('int', '__nonzero__', '()', """\ c.addCppMethod('int', '__nonzero__', '()', """\
return self->IsOk(); return self->IsOk();
""") """)
c.addCppMethod('long', 'GetHandle', '()', c.addCppMethod('long', 'GetHandle', '()',
doc='MSW-only method to fetch the windows handle for the bitmap.', doc='MSW-only method to fetch the windows handle for the bitmap.',
body="""\ body="""\
@@ -98,7 +98,7 @@ def run():
return 0; return 0;
#endif #endif
""") """)
c.addCppMethod('void', 'SetHandle', '(long handle)', c.addCppMethod('void', 'SetHandle', '(long handle)',
doc='MSW-only method to set the windows handle for the bitmap.', doc='MSW-only method to set the windows handle for the bitmap.',
body="""\ body="""\
@@ -126,11 +126,11 @@ def run():
c.find('GetHandlers').ignore() c.find('GetHandlers').ignore()
c.find('InsertHandler').ignore() c.find('InsertHandler').ignore()
c.find('RemoveHandler').ignore() c.find('RemoveHandler').ignore()
# This one is called from the wx startup code, it's not needed in Python # This one is called from the wx startup code, it's not needed in Python
# so nuke it too since we're nuking all the others. # so nuke it too since we're nuking all the others.
c.find('InitStandardHandlers').ignore() c.find('InitStandardHandlers').ignore()
module.find('wxBitmapHandler').ignore() module.find('wxBitmapHandler').ignore()
#module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler', module)) #module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler', module))
@@ -152,14 +152,14 @@ def run():
module.addHeaderCode('#include "bitmap_ex.h"') module.addHeaderCode('#include "bitmap_ex.h"')
c.addCppMethod('void', 'CopyFromBuffer', c.addCppMethod('void', 'CopyFromBuffer',
'(wxPyBuffer* data, wxBitmapBufferFormat format=wxBitmapBufferFormat_RGB, int stride=-1)', '(wxPyBuffer* data, wxBitmapBufferFormat format=wxBitmapBufferFormat_RGB, int stride=-1)',
doc="""\ doc="""\
Copy data from a buffer object to replace the bitmap pixel data. Copy data from a buffer object to replace the bitmap pixel data.
Default format is plain RGB, but other formats are now supported as Default format is plain RGB, but other formats are now supported as
well. The following symbols are used to specify the format of the well. The following symbols are used to specify the format of the
bytes in the buffer: bytes in the buffer:
============================= ================================ ============================= ================================
wx.BitmapBufferFormat_RGB A simple sequence of RGB bytes wx.BitmapBufferFormat_RGB A simple sequence of RGB bytes
wx.BitmapBufferFormat_RGBA A simple sequence of RGBA bytes wx.BitmapBufferFormat_RGBA A simple sequence of RGBA bytes
@@ -182,43 +182,43 @@ def run():
# Some bitmap factories added as static methods # Some bitmap factories added as static methods
c.addCppMethod('wxBitmap*', 'FromBufferAndAlpha', c.addCppMethod('wxBitmap*', 'FromBufferAndAlpha',
'(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)', '(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)',
isStatic=True, isStatic=True,
factory=True, factory=True,
doc="""\ doc="""\
Creates a :class:`wx.Bitmap` from in-memory data. The data and alpha Creates a :class:`wx.Bitmap` from in-memory data. The data and alpha
parameters must be a Python object that implements the buffer parameters must be a Python object that implements the buffer
interface, such as a string, bytearray, etc. The data object interface, such as a string, bytearray, etc. The data object
is expected to contain a series of RGB bytes and be at least is expected to contain a series of RGB bytes and be at least
width*height*3 bytes long, while the alpha object is expected width*height*3 bytes long, while the alpha object is expected
to be width*height bytes long and represents the image's alpha to be width*height bytes long and represents the image's alpha
channel. On Windows and Mac the RGB values will be channel. On Windows and Mac the RGB values will be
'premultiplied' by the alpha values. (The other platforms do 'premultiplied' by the alpha values. (The other platforms do
the multiplication themselves.) the multiplication themselves.)
Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function
does not share the memory block with the buffer object. This is does not share the memory block with the buffer object. This is
because the native pixel buffer format varies on different because the native pixel buffer format varies on different
platforms, and so instead an efficient as possible copy of the platforms, and so instead an efficient as possible copy of the
data is made from the buffer object to the bitmap's native pixel data is made from the buffer object to the bitmap's native pixel
buffer. buffer.
""", """,
body="""\ body="""\
if (!data->checkSize(width*height*3) || !alpha->checkSize(width*height)) if (!data->checkSize(width*height*3) || !alpha->checkSize(width*height))
return NULL; return NULL;
byte* ddata = (byte*)data->m_ptr; byte* ddata = (byte*)data->m_ptr;
byte* adata = (byte*)alpha->m_ptr; byte* adata = (byte*)alpha->m_ptr;
wxBitmap* bmp = new wxBitmap(width, height, 32); wxBitmap* bmp = new wxBitmap(width, height, 32);
wxAlphaPixelData pixData(*bmp, wxPoint(0,0), wxSize(width,height)); wxAlphaPixelData pixData(*bmp, wxPoint(0,0), wxSize(width,height));
if (! pixData) { if (! pixData) {
wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data."); wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data.");
return NULL; return NULL;
} }
wxAlphaPixelData::Iterator p(pixData); wxAlphaPixelData::Iterator p(pixData);
for (int y=0; y<height; y++) { for (int y=0; y<height; y++) {
wxAlphaPixelData::Iterator rowStart = p; wxAlphaPixelData::Iterator rowStart = p;
@@ -228,12 +228,12 @@ def run():
p.Green() = wxPy_premultiply(*(ddata++), a); p.Green() = wxPy_premultiply(*(ddata++), a);
p.Blue() = wxPy_premultiply(*(ddata++), a); p.Blue() = wxPy_premultiply(*(ddata++), a);
p.Alpha() = a; p.Alpha() = a;
++p; ++p;
} }
p = rowStart; p = rowStart;
p.OffsetY(pixData, 1); p.OffsetY(pixData, 1);
} }
return bmp; return bmp;
""") """)
c.addCppMethod('wxBitmap*', 'FromBuffer', '(int width, int height, wxPyBuffer* data)', c.addCppMethod('wxBitmap*', 'FromBuffer', '(int width, int height, wxPyBuffer* data)',
@@ -241,16 +241,16 @@ def run():
factory=True, factory=True,
doc="""\ doc="""\
Creates a :class:`wx.Bitmap` from in-memory data. The data parameter Creates a :class:`wx.Bitmap` from in-memory data. The data parameter
must be a Python object that implements the buffer interface, such must be a Python object that implements the buffer interface, such
as a string, bytearray, etc. The data object is expected to contain as a string, bytearray, etc. The data object is expected to contain
a series of RGB bytes and be at least width*height*3 bytes long. a series of RGB bytes and be at least width*height*3 bytes long.
Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function
does not share the memory block with the buffer object. This is does not share the memory block with the buffer object. This is
because the native pixel buffer format varies on different because the native pixel buffer format varies on different
platforms, and so instead an efficient as possible copy of the platforms, and so instead an efficient as possible copy of the
data is made from the buffer object to the bitmap's native pixel data is made from the buffer object to the bitmap's native pixel
buffer. buffer.
""", """,
body="""\ body="""\
wxBitmap* bmp = new wxBitmap(width, height, 24); wxBitmap* bmp = new wxBitmap(width, height, 24);
@@ -281,18 +281,18 @@ def run():
factory=True, factory=True,
doc="""\ doc="""\
Creates a :class:`wx.Bitmap` from in-memory data. The data parameter Creates a :class:`wx.Bitmap` from in-memory data. The data parameter
must be a Python object that implements the buffer interface, such must be a Python object that implements the buffer interface, such
as a string, bytearray, etc. The data object is expected to contain as a string, bytearray, etc. The data object is expected to contain
a series of RGBA bytes and be at least width*height*4 bytes long. a series of RGBA bytes and be at least width*height*4 bytes long.
On Windows and Mac the RGB values will be 'premultiplied' by the On Windows and Mac the RGB values will be 'premultiplied' by the
alpha values. (The other platforms do the multiplication themselves.) alpha values. (The other platforms do the multiplication themselves.)
Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function
does not share the memory block with the buffer object. This is does not share the memory block with the buffer object. This is
because the native pixel buffer format varies on different because the native pixel buffer format varies on different
platforms, and so instead an efficient as possible copy of the platforms, and so instead an efficient as possible copy of the
data is made from the buffer object to the bitmap's native pixel data is made from the buffer object to the bitmap's native pixel
buffer. buffer.
""", """,
body="""\ body="""\
wxBitmap* bmp = new wxBitmap(width, height, 32); wxBitmap* bmp = new wxBitmap(width, height, 32);
@@ -313,7 +313,7 @@ def run():
c.addCppMethod('wxBitmap*', 'FromRGBA', c.addCppMethod('wxBitmap*', 'FromRGBA',
'(int width, int height, byte red=0, byte green=0, byte blue=0, byte alpha=0)', '(int width, int height, byte red=0, byte green=0, byte blue=0, byte alpha=0)',
isStatic=True, isStatic=True,
factory=True, factory=True,
@@ -333,7 +333,7 @@ def run():
wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data."); wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data.");
return NULL; return NULL;
} }
wxAlphaPixelData::Iterator p(pixData); wxAlphaPixelData::Iterator p(pixData);
for (int y=0; y<height; y++) { for (int y=0; y<height; y++) {
wxAlphaPixelData::Iterator rowStart = p; wxAlphaPixelData::Iterator rowStart = p;
@@ -342,12 +342,12 @@ def run():
p.Green() = wxPy_premultiply(green, alpha); p.Green() = wxPy_premultiply(green, alpha);
p.Blue() = wxPy_premultiply(blue, alpha); p.Blue() = wxPy_premultiply(blue, alpha);
p.Alpha() = alpha; p.Alpha() = alpha;
++p; ++p;
} }
p = rowStart; p = rowStart;
p.OffsetY(pixData, 1); p.OffsetY(pixData, 1);
} }
return bmp; return bmp;
""") """)
module.addPyFunction('EmptyBitmapRGBA', '(width, height, red=0, green=0, blue=0, alpha=0)', module.addPyFunction('EmptyBitmapRGBA', '(width, height, red=0, green=0, blue=0, alpha=0)',
@@ -371,8 +371,8 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,40 +10,40 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "bmpbuttn" # Base name of the file to generate to for this script NAME = "bmpbuttn" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxBitmapButton' ] ITEMS = [ 'wxBitmapButton' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxBitmapButton') c = module.find('wxBitmapButton')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('wxBitmapButton.bitmap').default = 'wxNullBitmap' c.find('wxBitmapButton.bitmap').default = 'wxNullBitmap'
c.find('Create.bitmap').default = 'wxNullBitmap' c.find('Create.bitmap').default = 'wxNullBitmap'
tools.fixWindowClass(c) tools.fixWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,41 +10,41 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "bmpcbox" # Base name of the file to generate to for this script NAME = "bmpcbox" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxBitmapComboBox", ITEMS = [ "wxBitmapComboBox",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/bmpcbox.h>") module.addHeaderCode("#include <wx/bmpcbox.h>")
c = module.find('wxBitmapComboBox') c = module.find('wxBitmapComboBox')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
module.addGlobalStr('wxBitmapComboBoxNameStr', c) module.addGlobalStr('wxBitmapComboBoxNameStr', c)
tools.fixWindowClass(c) tools.fixWindowClass(c)
# The MSW and GTK version of this class derive from wxComboBox, but the # The MSW and GTK version of this class derive from wxComboBox, but the
# OSX version derives from wxOwnerDrawnCombo. To make all platforms happy # OSX version derives from wxOwnerDrawnCombo. To make all platforms happy
# with the generated wrapper code switch the declared base with the bases # with the generated wrapper code switch the declared base with the bases
# that both of those classes have in common. # that both of those classes have in common.
c.bases = ['wxControl', 'wxTextEntry', 'wxItemContainer'] c.bases = ['wxControl', 'wxTextEntry', 'wxItemContainer']
# Ignore the old C array verison of the ctor and Create methods, and # Ignore the old C array verison of the ctor and Create methods, and
# fixup the remaining ctor and Create with the typical default values for # fixup the remaining ctor and Create with the typical default values for
# the args # the args
@@ -58,16 +58,16 @@ def run():
m = c.find('Create').findOverload('wxArrayString') m = c.find('Create').findOverload('wxArrayString')
m.find('value').default = 'wxEmptyString' m.find('value').default = 'wxEmptyString'
m.find('choices').default = 'wxArrayString()' m.find('choices').default = 'wxArrayString()'
# Ignore the Append and Insert taking a void* for clientData # Ignore the Append and Insert taking a void* for clientData
c.find('Append').findOverload('void *').ignore() c.find('Append').findOverload('void *').ignore()
c.find('Insert').findOverload('void *').ignore() c.find('Insert').findOverload('void *').ignore()
# And set the ownership transfer for the other one # And set the ownership transfer for the other one
c.find('Append').findOverload('wxClientData *').find('clientData').transfer = True c.find('Append').findOverload('wxClientData *').find('clientData').transfer = True
c.find('Insert').findOverload('wxClientData *').find('clientData').transfer = True c.find('Insert').findOverload('wxClientData *').find('clientData').transfer = True
# wxItemContainer pure virtuals that have an implementation in this class # wxItemContainer pure virtuals that have an implementation in this class
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
virtual unsigned int GetCount() const; virtual unsigned int GetCount() const;
@@ -75,7 +75,7 @@ def run():
virtual void SetString(unsigned int n, const wxString& s); virtual void SetString(unsigned int n, const wxString& s);
virtual int GetSelection() const; virtual int GetSelection() const;
virtual void SetSelection(int n); virtual void SetSelection(int n);
virtual wxString GetStringSelection() const; virtual wxString GetStringSelection() const;
%MethodCode %MethodCode
sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection()); sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection());
@@ -84,12 +84,12 @@ def run():
sipRes = wxItemContainerImmutable::GetStringSelection(); sipRes = wxItemContainerImmutable::GetStringSelection();
%End %End
""")) """))
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,44 +10,44 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "bookctrl" # Base name of the file to generate to for this script NAME = "bookctrl" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'interface_2wx_2bookctrl_8h.xml', ITEMS = [ 'interface_2wx_2bookctrl_8h.xml',
'wxBookCtrlBase', 'wxBookCtrlBase',
'wxBookCtrlEvent', 'wxBookCtrlEvent',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
# Ignore the macro. We'll add a Python alias in notebook.py instead. # Ignore the macro. We'll add a Python alias in notebook.py instead.
module.find('wxBookCtrl').ignore() module.find('wxBookCtrl').ignore()
c = module.find('wxBookCtrlBase') c = module.find('wxBookCtrlBase')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
c.find('HitTest.flags').out = True c.find('HitTest.flags').out = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,27 +10,27 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "brush" # Base name of the file to generate to for this script NAME = "brush" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxBrush', 'wxBrushList', ] ITEMS = [ 'wxBrush', 'wxBrushList', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxBrush') c = module.find('wxBrush')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.removeVirtuals(c) tools.removeVirtuals(c)
@@ -44,19 +44,19 @@ def run():
#ifdef __WXMAC__ #ifdef __WXMAC__
#include <wx/osx/private.h> #include <wx/osx/private.h>
#endif #endif
""") """)
c.addCppMethod('void', 'MacSetTheme', '(int macThemeBrushID)', """\ c.addCppMethod('void', 'MacSetTheme', '(int macThemeBrushID)', """\
#ifdef __WXMAC__ #ifdef __WXMAC__
self->SetColour(wxColour(wxMacCreateCGColorFromHITheme(macThemeBrushID))); self->SetColour(wxColour(wxMacCreateCGColorFromHITheme(macThemeBrushID)));
#else #else
wxPyRaiseNotImplemented(); wxPyRaiseNotImplemented();
#endif #endif
""") """)
c.addAutoProperties() c.addAutoProperties()
# The stock Brush items are documented as simple pointers, but in reality # The stock Brush items are documented as simple pointers, but in reality
# they are macros that evaluate to a function call that returns a brush # they are macros that evaluate to a function call that returns a brush
# pointer, and that is only valid *after* the wx.App object has been # pointer, and that is only valid *after* the wx.App object has been
@@ -64,7 +64,7 @@ def run():
# to come up with another solution. So instead we will just create # to come up with another solution. So instead we will just create
# uninitialized brush in a block of Python code, that will then be # uninitialized brush in a block of Python code, that will then be
# intialized later when the wx.App is created. # intialized later when the wx.App is created.
c.addCppMethod('void', '_copyFrom', '(const wxBrush* other)', c.addCppMethod('void', '_copyFrom', '(const wxBrush* other)',
"*self = *other;", "*self = *other;",
briefDoc="For internal use only.") # ?? briefDoc="For internal use only.") # ??
pycode = '# These stock brushes will be initialized when the wx.App object is created.\n' pycode = '# These stock brushes will be initialized when the wx.App object is created.\n'
@@ -83,22 +83,22 @@ def run():
# later.) They are already gone (or wrapped by an #if) in the C++ code, # later.) They are already gone (or wrapped by an #if) in the C++ code,
# and so are not found in the documentation... # and so are not found in the documentation...
module.addPyCode("""\ module.addPyCode("""\
wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE) wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE)
wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK) wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK)
wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE) wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE)
wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH) wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH)
wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH) wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH)
wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH) wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH)
wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH) wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH)
wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH) wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH)
wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH) wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH)
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,37 +10,37 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "busyinfo" # Base name of the file to generate to for this script NAME = "busyinfo" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxBusyInfo", ITEMS = [ "wxBusyInfo",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxBusyInfo') c = module.find('wxBusyInfo')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,30 +16,30 @@ NAME = "button" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxButton' ] ITEMS = [ 'wxButton' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxButton') c = module.find('wxButton')
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.addGlobalStr('wxButtonNameStr', c) module.addGlobalStr('wxButtonNameStr', c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,17 +10,17 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "calctrl" # Base name of the file to generate to for this script NAME = "calctrl" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxCalendarEvent", ITEMS = [ "wxCalendarEvent",
"wxCalendarDateAttr", "wxCalendarDateAttr",
"wxCalendarCtrl", "wxCalendarCtrl",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -28,12 +28,12 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxCalendarEvent') c = module.find('wxCalendarEvent')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixEventClass(c) tools.fixEventClass(c)
@@ -44,20 +44,20 @@ def run():
EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1) EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1)
EVT_CALENDAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_PAGE_CHANGED, 1) EVT_CALENDAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_PAGE_CHANGED, 1)
""") """)
# These are deprecated, get rid of them later... # These are deprecated, get rid of them later...
c.addPyCode("""\ c.addPyCode("""\
EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1) EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1)
EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1) EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1)
EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1) EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1)
""") """)
for name in ['wxEVT_CALENDAR_DAY_CHANGED', for name in ['wxEVT_CALENDAR_DAY_CHANGED',
'wxEVT_CALENDAR_MONTH_CHANGED', 'wxEVT_CALENDAR_MONTH_CHANGED',
'wxEVT_CALENDAR_YEAR_CHANGED']: 'wxEVT_CALENDAR_YEAR_CHANGED']:
item = etgtools.GlobalVarDef(name=name, pyName=name, type='wxEventType') item = etgtools.GlobalVarDef(name=name, pyName=name, type='wxEventType')
module.insertItemAfter(module.find('wxEVT_CALENDAR_WEEK_CLICKED'), item) module.insertItemAfter(module.find('wxEVT_CALENDAR_WEEK_CLICKED'), item)
cc = module.find('wxCalendarCtrl') cc = module.find('wxCalendarCtrl')
gcc = tools.copyClassDef(cc, 'wxGenericCalendarCtrl') gcc = tools.copyClassDef(cc, 'wxGenericCalendarCtrl')
module.insertItemAfter(cc, gcc) module.insertItemAfter(cc, gcc)
@@ -69,23 +69,23 @@ def run():
c.find('HitTest.date').out = True c.find('HitTest.date').out = True
c.find('HitTest.wd').out = True c.find('HitTest.wd').out = True
c.find('SetAttr.attr').transfer = True c.find('SetAttr.attr').transfer = True
c.addPyCode("""\ c.addPyCode("""\
{name}.PyGetDate = wx.deprecated({name}.GetDate, 'Use GetDate instead.') {name}.PyGetDate = wx.deprecated({name}.GetDate, 'Use GetDate instead.')
{name}.PySetDate = wx.deprecated({name}.SetDate, 'Use SetDate instead.') {name}.PySetDate = wx.deprecated({name}.SetDate, 'Use SetDate instead.')
{name}.PySetDateRange = wx.deprecated({name}.SetDateRange, 'Use SetDateRange instead.') {name}.PySetDateRange = wx.deprecated({name}.SetDateRange, 'Use SetDateRange instead.')
""".format(name=c.name[2:])) """.format(name=c.name[2:]))
cc.find('EnableYearChange').ignore() cc.find('EnableYearChange').ignore()
gcc.addHeaderCode("#include <wx/generic/calctrlg.h>") gcc.addHeaderCode("#include <wx/generic/calctrlg.h>")
module.addGlobalStr('wxCalendarNameStr', cc) module.addGlobalStr('wxCalendarNameStr', cc)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,44 +10,44 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "caret" # Base name of the file to generate to for this script NAME = "caret" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxCaret", ITEMS = [ "wxCaret",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxCaret') c = module.find('wxCaret')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('GetPosition').findOverload('int *').ignore() c.find('GetPosition').findOverload('int *').ignore()
c.find('GetSize').findOverload('int *').ignore() c.find('GetSize').findOverload('int *').ignore()
c.addCppMethod('int', '__nonzero__', '()', """\ c.addCppMethod('int', '__nonzero__', '()', """\
return self->IsOk(); return self->IsOk();
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,20 +16,20 @@ NAME = "checkbox" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxCheckBox' ] ITEMS = [ 'wxCheckBox' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxCheckBox') c = module.find('wxCheckBox')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('wxCheckBox.label').default = 'wxEmptyString' c.find('wxCheckBox.label').default = 'wxEmptyString'
@@ -42,14 +42,14 @@ def run():
c.addAutoProperties() c.addAutoProperties()
c.find('Get3StateValue').ignore(False) c.find('Get3StateValue').ignore(False)
c.addProperty('ThreeStateValue Get3StateValue Set3StateValue') c.addProperty('ThreeStateValue Get3StateValue Set3StateValue')
tools.fixWindowClass(c) tools.fixWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,23 +17,23 @@ NAME = "checklst" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxCheckListBox' ] ITEMS = [ 'wxCheckListBox' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxCheckListBox') c = module.find('wxCheckListBox')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('wxCheckListBox').findOverload('wxString choices').ignore() c.find('wxCheckListBox').findOverload('wxString choices').ignore()
c.find('wxCheckListBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' c.find('wxCheckListBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()'
@@ -42,30 +42,30 @@ def run():
tools.fixWindowClass(c) tools.fixWindowClass(c)
# We already have the Python methods below, so just ignore this new method for now. # We already have the Python methods below, so just ignore this new method for now.
c.find('GetCheckedItems').ignore() c.find('GetCheckedItems').ignore()
c.addPyMethod('GetCheckedItems', '(self)', doc="""\ c.addPyMethod('GetCheckedItems', '(self)', doc="""\
GetCheckedItems() GetCheckedItems()
Return a sequence of integers corresponding to the checked items in Return a sequence of integers corresponding to the checked items in
the control, based on :meth:`IsChecked`.""", the control, based on :meth:`IsChecked`.""",
body="return tuple([i for i in range(self.Count) if self.IsChecked(i)])") body="return tuple([i for i in range(self.Count) if self.IsChecked(i)])")
c.addPyMethod('GetCheckedStrings', '(self)', c.addPyMethod('GetCheckedStrings', '(self)',
doc="""\ doc="""\
GetCheckedStrings() GetCheckedStrings()
Return a tuple of strings corresponding to the checked Return a tuple of strings corresponding to the checked
items of the control, based on :meth:`GetChecked`.""", items of the control, based on :meth:`GetChecked`.""",
body="return tuple([self.GetString(i) for i in self.GetCheckedItems()])") body="return tuple([self.GetString(i) for i in self.GetCheckedItems()])")
c.addPyMethod('SetCheckedItems', '(self, indexes)', c.addPyMethod('SetCheckedItems', '(self, indexes)',
doc="""\ doc="""\
SetCheckedItems(indexes) SetCheckedItems(indexes)
Sets the checked state of items if the index of the item is Sets the checked state of items if the index of the item is
found in the indexes sequence.""", found in the indexes sequence.""",
body="""\ body="""\
for i in indexes: for i in indexes:
@@ -73,7 +73,7 @@ def run():
for i in range(self.Count): for i in range(self.Count):
self.Check(i, i in indexes)""") self.Check(i, i in indexes)""")
c.addPyMethod('SetCheckedStrings', '(self, strings)', c.addPyMethod('SetCheckedStrings', '(self, strings)',
doc="""\ doc="""\
SetCheckedStrings(strings) SetCheckedStrings(strings)
@@ -90,17 +90,17 @@ def run():
deprecated='Use GetCheckedItems instead.') deprecated='Use GetCheckedItems instead.')
c.addPyMethod('SetChecked', '(self, indexes)', 'return self.SetCheckedItems(indexes)', c.addPyMethod('SetChecked', '(self, indexes)', 'return self.SetCheckedItems(indexes)',
deprecated='Use SetCheckedItems instead.') deprecated='Use SetCheckedItems instead.')
c.addPyProperty('Checked GetChecked SetChecked') c.addPyProperty('Checked GetChecked SetChecked')
c.addPyProperty('CheckedItems GetCheckedItems SetCheckedItems') c.addPyProperty('CheckedItems GetCheckedItems SetCheckedItems')
c.addPyProperty('CheckedStrings GetCheckedStrings SetCheckedStrings') c.addPyProperty('CheckedStrings GetCheckedStrings SetCheckedStrings')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "choicdlg" # Base name of the file to generate to for this script NAME = "choicdlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxMultiChoiceDialog", ITEMS = [ "wxMultiChoiceDialog",
"wxSingleChoiceDialog", "wxSingleChoiceDialog",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxMultiChoiceDialog') c = module.find('wxMultiChoiceDialog')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
c = module.find('wxSingleChoiceDialog') c = module.find('wxSingleChoiceDialog')
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
# Make a new class so we can ignore the clientData parameter in the ctor # Make a new class so we can ignore the clientData parameter in the ctor
c.addHeaderCode("""\ c.addHeaderCode("""\
class wxPySingleChoiceDialog : public wxSingleChoiceDialog { class wxPySingleChoiceDialog : public wxSingleChoiceDialog {
@@ -54,10 +54,10 @@ def run():
{} {}
}; };
""") """)
for item in c.allItems(): for item in c.allItems():
if item.name == 'wxSingleChoiceDialog': if item.name == 'wxSingleChoiceDialog':
item.name = 'wxPySingleChoiceDialog' item.name = 'wxPySingleChoiceDialog'
c.renameClass('SingleChoiceDialog') c.renameClass('SingleChoiceDialog')
# ignore this ctor # ignore this ctor
@@ -68,7 +68,7 @@ def run():
ctor.find('clientData').ignore() ctor.find('clientData').ignore()
c.find('GetSelectionData').ignore() c.find('GetSelectionData').ignore()
# ignore a bunch of the standalone functions # ignore a bunch of the standalone functions
for f in module.find('wxGetSingleChoiceIndex').all(): for f in module.find('wxGetSingleChoiceIndex').all():
@@ -77,21 +77,21 @@ def run():
f.ignore() f.ignore()
for f in module.find('wxGetSelectedChoices').all(): # TODO, it might be nice to keep this one for f in module.find('wxGetSelectedChoices').all(): # TODO, it might be nice to keep this one
f.ignore() f.ignore()
# keep just the overloads of this function that use wxArrayString, and # keep just the overloads of this function that use wxArrayString, and
# ignore the ones that have "int n" # ignore the ones that have "int n"
for func in module.find('wxGetSingleChoice').all(): for func in module.find('wxGetSingleChoice').all():
for p in func: for p in func:
if p.type == 'int' and p.name == 'n': if p.type == 'int' and p.name == 'n':
func.ignore() func.ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,20 +16,20 @@ NAME = "choice" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxChoice' ] ITEMS = [ 'wxChoice' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxChoice') c = module.find('wxChoice')
c.abstract = False c.abstract = False
c.find('wxChoice').findOverload('wxString choices').ignore() c.find('wxChoice').findOverload('wxString choices').ignore()
@@ -41,12 +41,12 @@ def run():
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.addGlobalStr('wxChoiceNameStr', c) module.addGlobalStr('wxChoiceNameStr', c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,15 +10,15 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "choicebk" # Base name of the file to generate to for this script NAME = "choicebk" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxChoicebook", ITEMS = [ "wxChoicebook",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -26,32 +26,32 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/choicebk.h>') module.addHeaderCode('#include <wx/choicebk.h>')
c = module.find('wxChoicebook') c = module.find('wxChoicebook')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
tools.fixBookctrlClass(c) tools.fixBookctrlClass(c)
module.addPyCode("""\ module.addPyCode("""\
EVT_CHOICEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGED, 1 ) EVT_CHOICEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGED, 1 )
EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGING, 1 ) EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGING, 1 )
# deprecated wxEVT aliases # deprecated wxEVT aliases
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxEVT_CHOICEBOOK_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxEVT_CHOICEBOOK_PAGE_CHANGED
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxEVT_CHOICEBOOK_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxEVT_CHOICEBOOK_PAGE_CHANGING
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,41 +10,41 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "clipbrd" # Base name of the file to generate to for this script NAME = "clipbrd" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxClipboard", ITEMS = [ "wxClipboard",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxClipboard') c = module.find('wxClipboard')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('AddData.data').transfer = True c.find('AddData.data').transfer = True
c.find('SetData.data').transfer = True c.find('SetData.data').transfer = True
# TODO: This init wrapper class may be useful elsewhere... # TODO: This init wrapper class may be useful elsewhere...
module.addPyCode("""\ module.addPyCode("""\
# Since wxTheClipoard is not really a global varaiable (it is a macro # Since wxTheClipoard is not really a global varaiable (it is a macro
# that calls the Get static method) we can't declare it as a global # that calls the Get static method) we can't declare it as a global
# variable for the wrapper generator, otherwise it will try to run the # variable for the wrapper generator, otherwise it will try to run the
# function at module import and the wxApp object won't exist yet. So # function at module import and the wxApp object won't exist yet. So
# we'll use a class that will allow us to delay calling the Get until # we'll use a class that will allow us to delay calling the Get until
# wx.TheClipboard is actually being used for the first time. # wx.TheClipboard is actually being used for the first time.
class _wxPyDelayedInitWrapper(object): class _wxPyDelayedInitWrapper(object):
def __init__(self, initfunc, *args, **kwargs): def __init__(self, initfunc, *args, **kwargs):
@@ -55,7 +55,7 @@ def run():
def _checkInstance(self): def _checkInstance(self):
if self._instance is None: if self._instance is None:
if wx.GetApp(): if wx.GetApp():
self._instance = self._initfunc(*self._args, **self._kwargs) self._instance = self._initfunc(*self._args, **self._kwargs)
def __getattr__(self, name): def __getattr__(self, name):
self._checkInstance() self._checkInstance()
return getattr(self._instance, name) return getattr(self._instance, name)
@@ -71,15 +71,15 @@ def run():
return self return self
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
self.Close() self.Close()
TheClipboard = _wxPyDelayedInitWrapper(Clipboard.Get) TheClipboard = _wxPyDelayedInitWrapper(Clipboard.Get)
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,31 +10,31 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "clntdatactnr" # Base name of the file to generate to for this script NAME = "clntdatactnr" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxClientDataContainer' ] ITEMS = [ 'wxClientDataContainer' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxClientDataContainer') c = module.find('wxClientDataContainer')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('SetClientObject.data').transfer = True c.find('SetClientObject.data').transfer = True
# The [G|S]etClientData methods deal with untyped void* values, which we # The [G|S]etClientData methods deal with untyped void* values, which we
# don't support. The [G|S]etClientObject methods use wxClientData instaces # don't support. The [G|S]etClientObject methods use wxClientData instaces
# which we have a MappedType for, so make the ClientData methods just be # which we have a MappedType for, so make the ClientData methods just be
@@ -44,19 +44,19 @@ def run():
c.find('SetClientData').ignore() c.find('SetClientData').ignore()
c.find('GetClientObject').pyName = 'GetClientData' c.find('GetClientObject').pyName = 'GetClientData'
c.find('SetClientObject').pyName = 'SetClientData' c.find('SetClientObject').pyName = 'SetClientData'
c.addPyMethod('GetClientObject', '(self)', c.addPyMethod('GetClientObject', '(self)',
doc="Alias for :meth:`GetClientData`", doc="Alias for :meth:`GetClientData`",
body="return self.GetClientData()") body="return self.GetClientData()")
c.addPyMethod('SetClientObject', '(self, data)', c.addPyMethod('SetClientObject', '(self, data)',
doc="Alias for :meth:`SetClientData`", doc="Alias for :meth:`SetClientData`",
body="self.SetClientData(data)") body="self.SetClientData(data)")
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,52 +10,52 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "cmdproc" # Base name of the file to generate to for this script NAME = "cmdproc" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxCommand", ITEMS = [ "wxCommand",
"wxCommandProcessor", "wxCommandProcessor",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/cmdproc.h>') module.addHeaderCode('#include <wx/cmdproc.h>')
c = module.find('wxCommand') c = module.find('wxCommand')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c = module.find('wxCommandProcessor') c = module.find('wxCommandProcessor')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('Submit.command').transfer = True c.find('Submit.command').transfer = True
c.find('Store.command').transfer = True c.find('Store.command').transfer = True
module.addItem( module.addItem(
tools.wxListWrapperTemplate('wxList', 'wxCommand', module, tools.wxListWrapperTemplate('wxList', 'wxCommand', module,
fakeListClassName='wxCommandList')) fakeListClassName='wxCommandList'))
c.find('GetCommands').type = 'wxCommandList&' c.find('GetCommands').type = 'wxCommandList&'
c.find('GetCommands').noCopy = True c.find('GetCommands').noCopy = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -11,40 +11,40 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "cmndata" # Base name of the file to generate to for this script NAME = "cmndata" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxPageSetupDialogData', ITEMS = [ 'wxPageSetupDialogData',
'wxPrintData', 'wxPrintData',
'wxPrintDialogData', 'wxPrintDialogData',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxPageSetupDialogData') c = module.find('wxPageSetupDialogData')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.removeVirtuals(c) tools.removeVirtuals(c)
c.find('GetPrintData').overloads = [] c.find('GetPrintData').overloads = []
c.addCppMethod('int', '__nonzero__', '()', """\ c.addCppMethod('int', '__nonzero__', '()', """\
return self->IsOk(); return self->IsOk();
""") """)
c.addProperty('MarginBottomRight', 'GetMarginBottomRight', 'SetMarginBottomRight') c.addProperty('MarginBottomRight', 'GetMarginBottomRight', 'SetMarginBottomRight')
c.addProperty('MarginTopLeft', 'GetMarginTopLeft', 'SetMarginTopLeft') c.addProperty('MarginTopLeft', 'GetMarginTopLeft', 'SetMarginTopLeft')
c.addProperty('MinMarginBottomRight', 'GetMinMarginBottomRight', 'SetMinMarginBottomRight') c.addProperty('MinMarginBottomRight', 'GetMinMarginBottomRight', 'SetMinMarginBottomRight')
@@ -62,7 +62,7 @@ def run():
c.addCppMethod('int', '__nonzero__', '()', """\ c.addCppMethod('int', '__nonzero__', '()', """\
return self->IsOk(); return self->IsOk();
""") """)
# TODO: These two methods should use something other than a PyString for # TODO: These two methods should use something other than a PyString for
# holding the data... # holding the data...
c.addCppMethod('PyObject*', 'GetPrivData', '()', """\ c.addCppMethod('PyObject*', 'GetPrivData', '()', """\
@@ -70,9 +70,9 @@ def run():
wxPyThreadBlocker blocker; wxPyThreadBlocker blocker;
data = PyBytes_FromStringAndSize(self->GetPrivData(), data = PyBytes_FromStringAndSize(self->GetPrivData(),
self->GetPrivDataLen()); self->GetPrivDataLen());
return data; return data;
""") """)
c.addCppMethod('void', 'SetPrivData', '(PyObject* data)', """\ c.addCppMethod('void', 'SetPrivData', '(PyObject* data)', """\
wxPyThreadBlocker blocker; wxPyThreadBlocker blocker;
if (! PyBytes_Check(data)) { if (! PyBytes_Check(data)) {
@@ -82,9 +82,9 @@ def run():
self->SetPrivData(PyBytes_AS_STRING(data), PyBytes_GET_SIZE(data)); self->SetPrivData(PyBytes_AS_STRING(data), PyBytes_GET_SIZE(data));
""") """)
c.addAutoProperties() c.addAutoProperties()
c = module.find('wxPrintDialogData') c = module.find('wxPrintDialogData')
@@ -95,15 +95,15 @@ def run():
c.addCppMethod('int', '__nonzero__', '()', """\ c.addCppMethod('int', '__nonzero__', '()', """\
return self->IsOk(); return self->IsOk();
""") """)
c.addAutoProperties() c.addAutoProperties()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,44 +16,44 @@ NAME = "collpane" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ITEMS = [
'wxCollapsiblePane', 'wxCollapsiblePane',
'wxCollapsiblePaneEvent', 'wxCollapsiblePaneEvent',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/collpane.h>") module.addHeaderCode("#include <wx/collpane.h>")
module.addPyCode("""\ module.addPyCode("""\
EVT_COLLAPSIBLEPANE_CHANGED = wx.PyEventBinder( wxEVT_COLLAPSIBLEPANE_CHANGED ) EVT_COLLAPSIBLEPANE_CHANGED = wx.PyEventBinder( wxEVT_COLLAPSIBLEPANE_CHANGED )
# deprecated wxEVT alias # deprecated wxEVT alias
wxEVT_COMMAND_COLLPANE_CHANGED = wxEVT_COLLAPSIBLEPANE_CHANGED wxEVT_COMMAND_COLLPANE_CHANGED = wxEVT_COLLAPSIBLEPANE_CHANGED
""") """)
c = module.find('wxCollapsiblePane') c = module.find('wxCollapsiblePane')
c.find('wxCollapsiblePane.label').default = 'wxEmptyString' c.find('wxCollapsiblePane.label').default = 'wxEmptyString'
c.find('Create.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString'
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.addGlobalStr('wxCollapsiblePaneNameStr', c) module.addGlobalStr('wxCollapsiblePaneNameStr', c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,40 +10,40 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "colordlg" # Base name of the file to generate to for this script NAME = "colordlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxColourData", ITEMS = [ "wxColourData",
"wxColourDialog", "wxColourDialog",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/colordlg.h>") module.addHeaderCode("#include <wx/colordlg.h>")
c = module.find('wxColourDialog') c = module.find('wxColourDialog')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,66 +10,66 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "colour" # Base name of the file to generate to for this script NAME = "colour" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxColour' ] ITEMS = [ 'wxColour' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
# Add a ctor/factory for the Mac that can use the theme brush # Add a ctor/factory for the Mac that can use the theme brush
module.addCppCode("""\ module.addCppCode("""\
#ifdef __WXMAC__ #ifdef __WXMAC__
#include <wx/osx/private.h> #include <wx/osx/private.h>
#endif #endif
""") """)
module.addCppFunction('wxColour*', 'MacThemeColour', '(int themeBrushID)', """\ module.addCppFunction('wxColour*', 'MacThemeColour', '(int themeBrushID)', """\
#ifdef __WXMAC__ #ifdef __WXMAC__
return new wxColour(wxMacCreateCGColorFromHITheme(themeBrushID)); return new wxColour(wxMacCreateCGColorFromHITheme(themeBrushID));
#else #else
wxPyRaiseNotImplemented(); wxPyRaiseNotImplemented();
return NULL; return NULL;
#endif #endif
""", factory=True) """, factory=True)
# Change this macro into a value so we wont have problems when SIP takes its # Change this macro into a value so we wont have problems when SIP takes its
# address # address
module.addCppCode("""\ module.addCppCode("""\
#undef wxTransparentColour #undef wxTransparentColour
wxColour wxTransparentColour(0, 0, 0, wxALPHA_TRANSPARENT); wxColour wxTransparentColour(0, 0, 0, wxALPHA_TRANSPARENT);
""") """)
module.find('wxFromString').ignore() module.find('wxFromString').ignore()
module.find('wxToString').ignore() module.find('wxToString').ignore()
module.find('wxALPHA_TRANSPARENT').type = 'const int' module.find('wxALPHA_TRANSPARENT').type = 'const int'
module.find('wxALPHA_OPAQUE').type = 'const int' module.find('wxALPHA_OPAQUE').type = 'const int'
c = module.find('wxColour') c = module.find('wxColour')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.removeVirtuals(c) tools.removeVirtuals(c)
# Hide the string ctor so our typemap will be invoked for the copy ctor instead. # Hide the string ctor so our typemap will be invoked for the copy ctor instead.
c.find('wxColour').findOverload('wxString').ignore() c.find('wxColour').findOverload('wxString').ignore()
c.addProperty('Pixel GetPixel') c.addProperty('Pixel GetPixel')
c.addProperty('RGB GetRGB SetRGB') c.addProperty('RGB GetRGB SetRGB')
c.addProperty('RGBA GetRGBA SetRGBA') c.addProperty('RGBA GetRGBA SetRGBA')
@@ -77,7 +77,7 @@ def run():
c.addProperty('green Green') c.addProperty('green Green')
c.addProperty('blue Blue') c.addProperty('blue Blue')
c.addProperty('alpha Alpha') c.addProperty('alpha Alpha')
c.find('GetPixel').ignore() # We need to add a typcast c.find('GetPixel').ignore() # We need to add a typcast
c.addCppMethod('wxIntPtr*', 'GetPixel', '()', """\ c.addCppMethod('wxIntPtr*', 'GetPixel', '()', """\
#ifdef __WXGTK3__ #ifdef __WXGTK3__
@@ -86,46 +86,46 @@ def run():
return new wxIntPtr((wxIntPtr)self->GetPixel()); return new wxIntPtr((wxIntPtr)self->GetPixel());
#endif #endif
""") """)
# Set a flag on the return value and parameter types that are 'unsigned char' # Set a flag on the return value and parameter types that are 'unsigned char'
# such that they will be treated as an integer instead of a string. # such that they will be treated as an integer instead of a string.
for item in c.allItems(): for item in c.allItems():
if hasattr(item, 'type') and item.type == 'unsigned char': if hasattr(item, 'type') and item.type == 'unsigned char':
item.pyInt = True item.pyInt = True
c.find('ChangeLightness.r').inOut = True c.find('ChangeLightness.r').inOut = True
c.find('ChangeLightness.g').inOut = True c.find('ChangeLightness.g').inOut = True
c.find('ChangeLightness.b').inOut = True c.find('ChangeLightness.b').inOut = True
c.find('MakeDisabled.r').inOut = True c.find('MakeDisabled.r').inOut = True
c.find('MakeDisabled.g').inOut = True c.find('MakeDisabled.g').inOut = True
c.find('MakeDisabled.b').inOut = True c.find('MakeDisabled.b').inOut = True
c.find('MakeGrey.r').inOut = True c.find('MakeGrey.r').inOut = True
c.find('MakeGrey.g').inOut = True c.find('MakeGrey.g').inOut = True
c.find('MakeGrey.b').inOut = True c.find('MakeGrey.b').inOut = True
c.find('MakeGrey').findOverload('double').find('r').inOut = True c.find('MakeGrey').findOverload('double').find('r').inOut = True
c.find('MakeGrey').findOverload('double').find('g').inOut = True c.find('MakeGrey').findOverload('double').find('g').inOut = True
c.find('MakeGrey').findOverload('double').find('b').inOut = True c.find('MakeGrey').findOverload('double').find('b').inOut = True
c.find('MakeMono.r').out = True c.find('MakeMono.r').out = True
c.find('MakeMono.g').out = True c.find('MakeMono.g').out = True
c.find('MakeMono.b').out = True c.find('MakeMono.b').out = True
# The stock Colour items are documented as simple pointers, but in # The stock Colour items are documented as simple pointers, but in
# reality they are macros that evaluate to a function call that returns a # reality they are macros that evaluate to a function call that returns a
# Colour pointer, and that is only valid *after* the wx.App object has # Colour pointer, and that is only valid *after* the wx.App object has
# been created. That messes up the code that SIP generates for them. So # been created. That messes up the code that SIP generates for them. So
# instead we will just create uninitialized colours in a block of Python # instead we will just create uninitialized colours in a block of Python
# code, that will then be initialized later when the wx.App is created. # code, that will then be initialized later when the wx.App is created.
c.addCppMethod('void', '_copyFrom', '(const wxColour* other)', c.addCppMethod('void', '_copyFrom', '(const wxColour* other)',
"*self = *other;", "*self = *other;",
briefDoc="For internal use only.") # ?? briefDoc="For internal use only.") # ??
pycode = '# These stock colours will be initialized when the wx.App object is created.\n' pycode = '# These stock colours will be initialized when the wx.App object is created.\n'
for name in [ 'wxBLACK', for name in [ 'wxBLACK',
'wxBLUE', 'wxBLUE',
'wxCYAN', 'wxCYAN',
'wxGREEN', 'wxGREEN',
'wxYELLOW', 'wxYELLOW',
@@ -138,7 +138,7 @@ def run():
pycode += '%s = Colour()\n' % tools.removeWxPrefix(item.name) pycode += '%s = Colour()\n' % tools.removeWxPrefix(item.name)
module.addPyCode(pycode) module.addPyCode(pycode)
c.addCppMethod('PyObject*', 'Get', '(bool includeAlpha=true)', """\ c.addCppMethod('PyObject*', 'Get', '(bool includeAlpha=true)', """\
int red = -1; int red = -1;
int green = -1; int green = -1;
@@ -154,12 +154,12 @@ def run():
return sipBuildResult(0, "(iiii)", red, green, blue, alpha); return sipBuildResult(0, "(iiii)", red, green, blue, alpha);
else else
return sipBuildResult(0, "(iii)", red, green, blue); return sipBuildResult(0, "(iii)", red, green, blue);
""", """,
pyArgsString="(includeAlpha=True) -> (r,g,b) or (r,g,b,a)", pyArgsString="(includeAlpha=True) -> (r,g,b) or (r,g,b,a)",
briefDoc="""\ briefDoc="""\
Returns the RGB intensity values as a tuple, optionally the alpha value as well.""") Returns the RGB intensity values as a tuple, optionally the alpha value as well.""")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.Colour"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Colour"+str(self.Get())')
@@ -174,7 +174,7 @@ def run():
elif idx == 2: self.blue = val elif idx == 2: self.blue = val
elif idx == 3: self.alpha = val elif idx == 3: self.alpha = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('Colour.__safe_for_unpickling__ = True') c.addPyCode('Colour.__safe_for_unpickling__ = True')
# Types that can be converted to wx.Colour: # Types that can be converted to wx.Colour:
@@ -191,10 +191,10 @@ def run():
if (sipCanConvertToType(sipPy, sipType_wxColour, SIP_NO_CONVERTORS)) if (sipCanConvertToType(sipPy, sipType_wxColour, SIP_NO_CONVERTORS))
return 1; return 1;
if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy))
return 1; return 1;
if (PySequence_Check(sipPy)) { if (PySequence_Check(sipPy)) {
size_t len = PySequence_Size(sipPy); size_t len = PySequence_Size(sipPy);
if (len != 3 && len != 4) if (len != 3 && len != 4)
return 0; return 0;
// ensure all the items in the sequence are numbers // ensure all the items in the sequence are numbers
for (int idx=0; idx<len; idx+=1) { for (int idx=0; idx<len; idx+=1) {
@@ -217,15 +217,15 @@ def run():
// Is it a string? // Is it a string?
else if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) { else if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) {
wxString spec = Py2wxString(sipPy); wxString spec = Py2wxString(sipPy);
if (!spec.empty() if (!spec.empty()
&& spec.GetChar(0) == '#' && spec.GetChar(0) == '#'
&& (spec.length() == 7 || spec.length() == 9)) { // It's #RRGGBB[AA] && (spec.length() == 7 || spec.length() == 9)) { // It's #RRGGBB[AA]
long red, green, blue; long red, green, blue;
red = green = blue = 0; red = green = blue = 0;
spec.Mid(1,2).ToLong(&red, 16); spec.Mid(1,2).ToLong(&red, 16);
spec.Mid(3,2).ToLong(&green, 16); spec.Mid(3,2).ToLong(&green, 16);
spec.Mid(5,2).ToLong(&blue, 16); spec.Mid(5,2).ToLong(&blue, 16);
if (spec.length() == 7) // no alpha if (spec.length() == 7) // no alpha
*sipCppPtr = new wxColour(red, green, blue); *sipCppPtr = new wxColour(red, green, blue);
else { // yes alpha else { // yes alpha
@@ -252,11 +252,11 @@ def run():
// Is it a 3 or 4 element sequence? // Is it a 3 or 4 element sequence?
else if (PySequence_Check(sipPy)) { else if (PySequence_Check(sipPy)) {
size_t len = PyObject_Length(sipPy); size_t len = PyObject_Length(sipPy);
PyObject* o1 = PySequence_GetItem(sipPy, 0); PyObject* o1 = PySequence_GetItem(sipPy, 0);
PyObject* o2 = PySequence_GetItem(sipPy, 1); PyObject* o2 = PySequence_GetItem(sipPy, 1);
PyObject* o3 = PySequence_GetItem(sipPy, 2); PyObject* o3 = PySequence_GetItem(sipPy, 2);
if (len == 3) if (len == 3)
*sipCppPtr = new wxColour(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3)); *sipCppPtr = new wxColour(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3));
else { else {
PyObject* o4 = PySequence_GetItem(sipPy, 3); PyObject* o4 = PySequence_GetItem(sipPy, 3);
@@ -269,7 +269,7 @@ def run():
Py_DECREF(o3); Py_DECREF(o3);
return sipGetState(sipTransferObj); return sipGetState(sipTransferObj);
} }
// if we get this far then it must already be a wxColour instance // if we get this far then it must already be a wxColour instance
*sipCppPtr = reinterpret_cast<wxColour*>(sipConvertToType( *sipCppPtr = reinterpret_cast<wxColour*>(sipConvertToType(
sipPy, sipType_wxColour, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); sipPy, sipType_wxColour, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
@@ -277,8 +277,8 @@ def run():
""" """
module.addPyCode('NamedColour = wx.deprecated(Colour, "Use Colour instead.")') module.addPyCode('NamedColour = wx.deprecated(Colour, "Use Colour instead.")')
# Just for TESTING, remove it later # Just for TESTING, remove it later
module.addCppCode("""\ module.addCppCode("""\
wxColour testColourTypeMap(const wxColour& c) wxColour testColourTypeMap(const wxColour& c)
@@ -289,14 +289,14 @@ def run():
module.addItem(etgtools.WigCode("""\ module.addItem(etgtools.WigCode("""\
wxColour testColourTypeMap(const wxColour& c); wxColour testColourTypeMap(const wxColour& c);
""")) """))
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,33 +10,33 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "combo" # Base name of the file to generate to for this script NAME = "combo" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxComboPopup", ITEMS = [ "wxComboPopup",
"wxComboCtrlFeatures", "wxComboCtrlFeatures",
"wxComboCtrl", "wxComboCtrl",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxComboPopup') c = module.find('wxComboPopup')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c = module.find('wxComboCtrl') c = module.find('wxComboCtrl')
tools.fixWindowClass(c) tools.fixWindowClass(c)
@@ -45,25 +45,25 @@ def run():
for name in ['AnimateShow', 'DoSetPopupControl', 'DoShowPopup']: for name in ['AnimateShow', 'DoSetPopupControl', 'DoShowPopup']:
c.find(name).ignore(False) c.find(name).ignore(False)
c.find(name).isVirtual = True c.find(name).isVirtual = True
# other methods that need the virtual flag turned back on # other methods that need the virtual flag turned back on
for name in ['IsKeyPopupToggle', 'ShowPopup', 'HidePopup', 'OnButtonClick', for name in ['IsKeyPopupToggle', 'ShowPopup', 'HidePopup', 'OnButtonClick',
'DoShowPopup', 'Dismiss',]: # 'Cut', 'Copy', 'Paste', ? 'DoShowPopup', 'Dismiss',]: # 'Cut', 'Copy', 'Paste', ?
c.find(name).isVirtual = True c.find(name).isVirtual = True
c.find('SetPopupControl.popup').transfer = True c.find('SetPopupControl.popup').transfer = True
# from is a reserved word # from is a reserved word
c.find('Remove.from').name = 'frm' c.find('Remove.from').name = 'frm'
c.find('Replace.from').name = 'frm' c.find('Replace.from').name = 'frm'
c.find('SetSelection.from').name = 'frm' c.find('SetSelection.from').name = 'frm'
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,24 +17,24 @@ NAME = "combobox" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxComboBox' ] ITEMS = [ 'wxComboBox' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxComboBox') c = module.find('wxComboBox')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
c.find('wxComboBox').findOverload('wxString choices').ignore() c.find('wxComboBox').findOverload('wxString choices').ignore()
c.find('wxComboBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' c.find('wxComboBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()'
c.find('wxComboBox').findOverload('wxArrayString').find('value').default = 'wxEmptyString' c.find('wxComboBox').findOverload('wxArrayString').find('value').default = 'wxEmptyString'
@@ -47,7 +47,7 @@ def run():
# will be ambiguous, so let's give this one a new name. # will be ambiguous, so let's give this one a new name.
m = c.find('GetSelection').renameOverload('long *from, long *to', 'GetTextSelection') m = c.find('GetSelection').renameOverload('long *from, long *to', 'GetTextSelection')
m.find('from').out = True m.find('from').out = True
m.find('to').out = True m.find('to').out = True
# For SetSelection we want to keep the existing method since it is # For SetSelection we want to keep the existing method since it is
# inherited from base classes and has no ambiguities, so just add a new # inherited from base classes and has no ambiguities, so just add a new
@@ -62,7 +62,7 @@ def run():
m.body = "self->SetSelection(from_, to_);" m.body = "self->SetSelection(from_, to_);"
c.insertItemAfter(c.find('SetSelection'), m) c.insertItemAfter(c.find('SetSelection'), m)
# The docs say to not use this one. # The docs say to not use this one.
c.find('IsEmpty').ignore() c.find('IsEmpty').ignore()
@@ -70,12 +70,12 @@ def run():
c.addPyCode("ComboBox.GetMark = wx.deprecated(ComboBox.GetTextSelection, 'Use GetTextSelection instead.')") c.addPyCode("ComboBox.GetMark = wx.deprecated(ComboBox.GetTextSelection, 'Use GetTextSelection instead.')")
module.addGlobalStr('wxComboBoxNameStr', c) module.addGlobalStr('wxComboBoxNameStr', c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,37 +10,37 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "commandlinkbutton" # Base name of the file to generate to for this script NAME = "commandlinkbutton" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxCommandLinkButton", ITEMS = [ "wxCommandLinkButton",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxCommandLinkButton') c = module.find('wxCommandLinkButton')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,26 +17,26 @@ NAME = "config" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxConfigBase', ITEMS = [ 'wxConfigBase',
'wxFileConfig', 'wxFileConfig',
'wxConfigPathChanger', 'wxConfigPathChanger',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxConfigBase') c = module.find('wxConfigBase')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
ctor = c.find('wxConfigBase') ctor = c.find('wxConfigBase')
ctor.items.remove(ctor.find('conv')) ctor.items.remove(ctor.find('conv'))
@@ -44,13 +44,13 @@ def run():
c.find('Set').transferBack = True # Python takes ownership of the return value c.find('Set').transferBack = True # Python takes ownership of the return value
c.find('Set.pConfig').transfer = True # C++ takes ownership of the arg c.find('Set.pConfig').transfer = True # C++ takes ownership of the arg
for func in c.findAll('Read'): for func in c.findAll('Read'):
if not 'wxString' in func.type: if not 'wxString' in func.type:
func.ignore() func.ignore()
else: else:
func.find('defaultVal').default = 'wxEmptyString' func.find('defaultVal').default = 'wxEmptyString'
c.addCppMethod('long', 'ReadInt', '(const wxString& key, long defaultVal=0)', """\ c.addCppMethod('long', 'ReadInt', '(const wxString& key, long defaultVal=0)', """\
long rv; long rv;
self->Read(*key, &rv, defaultVal); self->Read(*key, &rv, defaultVal);
@@ -68,7 +68,7 @@ def run():
return rv; return rv;
""") """)
c.find('Write').overloads = [] c.find('Write').overloads = []
c.addCppMethod('bool', 'WriteInt', '(const wxString& key, long value)', """\ c.addCppMethod('bool', 'WriteInt', '(const wxString& key, long value)', """\
return self->Write(*key, value); return self->Write(*key, value);
@@ -79,13 +79,13 @@ def run():
c.addCppMethod('bool', 'WriteBool', '(const wxString& key, bool value)', """\ c.addCppMethod('bool', 'WriteBool', '(const wxString& key, bool value)', """\
return self->Write(*key, value); return self->Write(*key, value);
""") """)
c.find('GetFirstGroup').ignore() c.find('GetFirstGroup').ignore()
c.find('GetNextGroup').ignore() c.find('GetNextGroup').ignore()
c.find('GetFirstEntry').ignore() c.find('GetFirstEntry').ignore()
c.find('GetNextEntry').ignore() c.find('GetNextEntry').ignore()
c.addCppCode("""\ c.addCppCode("""\
static PyObject* _Config_EnumerationHelper(bool flag, wxString& str, long index) { static PyObject* _Config_EnumerationHelper(bool flag, wxString& str, long index) {
wxPyThreadBlocker blocker; wxPyThreadBlocker blocker;
@@ -101,7 +101,7 @@ def run():
c.addCppMethod('PyObject*', 'GetFirstGroup', '()', c.addCppMethod('PyObject*', 'GetFirstGroup', '()',
doc="""\ doc="""\
GetFirstGroup() -> (more, value, index)\n GetFirstGroup() -> (more, value, index)\n
Allows enumerating the subgroups in a config object. Returns a tuple Allows enumerating the subgroups in a config object. Returns a tuple
containing a flag indicating if there are more items, the name of the containing a flag indicating if there are more items, the name of the
current item, and an index to pass to GetNextGroup to fetch the next current item, and an index to pass to GetNextGroup to fetch the next
@@ -113,7 +113,7 @@ def run():
more = self->GetFirstGroup(value, index); more = self->GetFirstGroup(value, index);
return _Config_EnumerationHelper(more, value, index); return _Config_EnumerationHelper(more, value, index);
""") """)
c.addCppMethod('PyObject*', 'GetNextGroup', '(long index)', c.addCppMethod('PyObject*', 'GetNextGroup', '(long index)',
doc="""\ doc="""\
GetNextGroup(long index) -> (more, value, index)\n GetNextGroup(long index) -> (more, value, index)\n
@@ -127,8 +127,8 @@ def run():
more = self->GetNextGroup(value, index); more = self->GetNextGroup(value, index);
return _Config_EnumerationHelper(more, value, index); return _Config_EnumerationHelper(more, value, index);
""") """)
c.addCppMethod('PyObject*', 'GetFirstEntry', '()', c.addCppMethod('PyObject*', 'GetFirstEntry', '()',
doc="""\ doc="""\
GetFirstEntry() -> (more, value, index)\n GetFirstEntry() -> (more, value, index)\n
@@ -143,7 +143,7 @@ def run():
more = self->GetFirstEntry(value, index); more = self->GetFirstEntry(value, index);
return _Config_EnumerationHelper(more, value, index); return _Config_EnumerationHelper(more, value, index);
""") """)
c.addCppMethod('PyObject*', 'GetNextEntry', '(long index)', c.addCppMethod('PyObject*', 'GetNextEntry', '(long index)',
doc="""\ doc="""\
GetNextEntry() -> (more, value, index)\n GetNextEntry() -> (more, value, index)\n
@@ -158,7 +158,7 @@ def run():
return _Config_EnumerationHelper(more, value, index); return _Config_EnumerationHelper(more, value, index);
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxFileConfig') c = module.find('wxFileConfig')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
@@ -173,16 +173,16 @@ def run():
c.find('GetNextGroup').ignore() c.find('GetNextGroup').ignore()
c.find('GetFirstEntry').ignore() c.find('GetFirstEntry').ignore()
c.find('GetNextEntry').ignore() c.find('GetNextEntry').ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
# In C++ wxConfig is a #define to some other config class. We'll let our # In C++ wxConfig is a #define to some other config class. We'll let our
# backend generator believe that it's a real class with that name. It will # backend generator believe that it's a real class with that name. It will
# end up using the wxConfig #defined in the C++ code, and will actually be # end up using the wxConfig #defined in the C++ code, and will actually be
# whatever is the default config class for the platform. # whatever is the default config class for the platform.
wc = etgtools.WigCode("""\ wc = etgtools.WigCode("""\
class wxConfig : wxConfigBase class wxConfig : wxConfigBase
{ {
public: public:
wxConfig(const wxString& appName = wxEmptyString, wxConfig(const wxString& appName = wxEmptyString,
@@ -191,7 +191,7 @@ def run():
const wxString& globalFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString,
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE); long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE);
~wxConfig(); ~wxConfig();
// pure virtuals with implementations here // pure virtuals with implementations here
const wxString & GetPath() const; const wxString & GetPath() const;
void SetPath(const wxString & strPath); void SetPath(const wxString & strPath);
@@ -200,19 +200,19 @@ def run():
bool HasEntry(const wxString & strName) const; bool HasEntry(const wxString & strName) const;
bool HasGroup(const wxString & strName) const; bool HasGroup(const wxString & strName) const;
bool Flush(bool bCurrentOnly = false); bool Flush(bool bCurrentOnly = false);
bool RenameEntry(const wxString & oldName, const wxString & newName); bool RenameEntry(const wxString & oldName, const wxString & newName);
bool RenameGroup(const wxString & oldName, const wxString & newName); bool RenameGroup(const wxString & oldName, const wxString & newName);
bool DeleteAll(); bool DeleteAll();
bool DeleteEntry(const wxString & key, bool bDeleteGroupIfEmpty = true); bool DeleteEntry(const wxString & key, bool bDeleteGroupIfEmpty = true);
bool DeleteGroup(const wxString & key); bool DeleteGroup(const wxString & key);
private: private:
wxConfig(const wxConfig&); wxConfig(const wxConfig&);
}; };
""") """)
module.addItem(wc) module.addItem(wc)
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxConfigPathChanger') c = module.find('wxConfigPathChanger')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -221,12 +221,12 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,16 +16,16 @@ NAME = "control" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxControl', ] ITEMS = [ 'wxControl', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
@@ -33,16 +33,16 @@ def run():
c = module.find('wxControl') c = module.find('wxControl')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
module.addGlobalStr('wxControlNameStr', c) module.addGlobalStr('wxControlNameStr', c)
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.addPyCode("PyControl = wx.deprecated(Control, 'Use Control instead.')") module.addPyCode("PyControl = wx.deprecated(Control, 'Use Control instead.')")
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,54 +10,54 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "cshelp" # Base name of the file to generate to for this script NAME = "cshelp" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxHelpProvider", ITEMS = [ "wxHelpProvider",
"wxSimpleHelpProvider", "wxSimpleHelpProvider",
"wxHelpControllerHelpProvider", "wxHelpControllerHelpProvider",
"wxContextHelp", "wxContextHelp",
"wxContextHelpButton", "wxContextHelpButton",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxContextHelpButton') c = module.find('wxContextHelpButton')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
c = module.find('wxHelpProvider') c = module.find('wxHelpProvider')
c.abstract = True c.abstract = True
c.find('Set').transferBack = True c.find('Set').transferBack = True
c.find('Set.helpProvider').transfer = True c.find('Set.helpProvider').transfer = True
c = module.find('wxSimpleHelpProvider') c = module.find('wxSimpleHelpProvider')
c.addItem(etgtools.WigCode("virtual wxString GetHelp(const wxWindowBase* window);")) c.addItem(etgtools.WigCode("virtual wxString GetHelp(const wxWindowBase* window);"))
c = module.find('wxHelpControllerHelpProvider') c = module.find('wxHelpControllerHelpProvider')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,15 +10,15 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "ctrlsub" # Base name of the file to generate to for this script NAME = "ctrlsub" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxItemContainerImmutable', 'wxItemContainer', 'wxControlWithItems', ] ITEMS = [ 'wxItemContainerImmutable', 'wxItemContainer', 'wxControlWithItems', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
@@ -26,12 +26,12 @@ def run():
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
check4unittest=False) # all classes abstract, no unitests needed check4unittest=False) # all classes abstract, no unitests needed
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxItemContainerImmutable') c = module.find('wxItemContainerImmutable')
c.abstract = True c.abstract = True
@@ -47,7 +47,7 @@ def run():
if 'void *' in m.argsString or \ if 'void *' in m.argsString or \
'wxClientData **' in m.argsString or \ 'wxClientData **' in m.argsString or \
'wxString *' in m.argsString: 'wxString *' in m.argsString:
m.ignore() m.ignore()
for m in c.findAll('Append'): for m in c.findAll('Append'):
pickOverloads(m) pickOverloads(m)
@@ -55,8 +55,8 @@ def run():
pickOverloads(m) pickOverloads(m)
for m in c.findAll('Set'): for m in c.findAll('Set'):
pickOverloads(m) pickOverloads(m)
# The [G|S]etClientData methods deal with untyped void* values, which we # The [G|S]etClientData methods deal with untyped void* values, which we
# don't support. The [G|S]etClientObject methods use wxClientData instaces # don't support. The [G|S]etClientObject methods use wxClientData instaces
# which we have a MappedType for, so make the ClientData methods just be # which we have a MappedType for, so make the ClientData methods just be
@@ -66,35 +66,35 @@ def run():
c.find('SetClientData').ignore() c.find('SetClientData').ignore()
c.find('GetClientObject').pyName = 'GetClientData' c.find('GetClientObject').pyName = 'GetClientData'
c.find('SetClientObject').pyName = 'SetClientData' c.find('SetClientObject').pyName = 'SetClientData'
c.addPyMethod('GetClientObject', '(self, n)', c.addPyMethod('GetClientObject', '(self, n)',
doc="Alias for :meth:`GetClientData`", doc="Alias for :meth:`GetClientData`",
body="return self.GetClientData(n)") body="return self.GetClientData(n)")
c.addPyMethod('SetClientObject', '(self, n, data)', c.addPyMethod('SetClientObject', '(self, n, data)',
doc="Alias for :meth:`SetClientData`", doc="Alias for :meth:`SetClientData`",
body="self.SetClientData(n, data)") body="self.SetClientData(n, data)")
# Deal with transfering ownership of wxClientData objects # Deal with transfering ownership of wxClientData objects
c.find('DetachClientObject').transfer = True c.find('DetachClientObject').transfer = True
c.find('SetClientObject.data').transfer = True c.find('SetClientObject.data').transfer = True
c.find('Append').findOverload('clientData').find('clientData').transfer = True c.find('Append').findOverload('clientData').find('clientData').transfer = True
c.find('Insert').findOverload('clientData').find('clientData').transfer = True c.find('Insert').findOverload('clientData').find('clientData').transfer = True
# for compatibility, should they be deprecated? # for compatibility, should they be deprecated?
c.addPyMethod('AppendItems', '(self, items)', 'self.Append(items)') c.addPyMethod('AppendItems', '(self, items)', 'self.Append(items)')
c.addPyMethod('GetItems', '(self)', 'return self.GetStrings()') c.addPyMethod('GetItems', '(self)', 'return self.GetStrings()')
c.addPyMethod('SetItems', '(self, items)', 'self.Set(items)') c.addPyMethod('SetItems', '(self, items)', 'self.Set(items)')
c = module.find('wxControlWithItems') c = module.find('wxControlWithItems')
c.abstract = True c.abstract = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,25 +17,25 @@ NAME = "cursor" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxCursor', ] ITEMS = [ 'wxCursor', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxCursor') c = module.find('wxCursor')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('wxCursor').findOverload('bits').ignore() c.find('wxCursor').findOverload('bits').ignore()
c.find('wxCursor').findOverload('cursorName').find('type').default='wxBITMAP_TYPE_ANY' c.find('wxCursor').findOverload('cursorName').find('type').default='wxBITMAP_TYPE_ANY'
# TODO: This ctor ^^ in Classic has a custom implementation for wxGTK that # TODO: This ctor ^^ in Classic has a custom implementation for wxGTK that
# sets the hotspot. Is that still needed? # sets the hotspot. Is that still needed?
@@ -50,15 +50,15 @@ def run():
return 0; return 0;
#endif""", #endif""",
briefDoc="Get the handle for the Cursor. Windows only.") briefDoc="Get the handle for the Cursor. Windows only.")
c.addCppMethod('void', 'SetHandle', '(long handle)', """\ c.addCppMethod('void', 'SetHandle', '(long handle)', """\
#ifdef __WXMSW__ #ifdef __WXMSW__
self->SetHandle((WXHANDLE)handle); self->SetHandle((WXHANDLE)handle);
#endif""", #endif""",
briefDoc="Set the handle to use for this Cursor. Windows only.") briefDoc="Set the handle to use for this Cursor. Windows only.")
# TODO: Classic has MSW-only getters and setters for width, height, depth, and size. # TODO: Classic has MSW-only getters and setters for width, height, depth, and size.
# The stock Cursor items are documented as simple pointers, but in reality # The stock Cursor items are documented as simple pointers, but in reality
# they are macros that evaluate to a function call that returns a cursor # they are macros that evaluate to a function call that returns a cursor
# pointer, and that is only valid *after* the wx.App object has been # pointer, and that is only valid *after* the wx.App object has been
@@ -66,7 +66,7 @@ def run():
# to come up with another solution. So instead we will just create # to come up with another solution. So instead we will just create
# uninitialized cursor in a block of Python code, that will then be # uninitialized cursor in a block of Python code, that will then be
# intialized later when the wx.App is created. # intialized later when the wx.App is created.
c.addCppMethod('void', '_copyFrom', '(const wxCursor* other)', c.addCppMethod('void', '_copyFrom', '(const wxCursor* other)',
"*self = *other;", "*self = *other;",
briefDoc="For internal use only.") # ?? briefDoc="For internal use only.") # ??
pycode = '# These stock cursors will be initialized when the wx.App object is created.\n' pycode = '# These stock cursors will be initialized when the wx.App object is created.\n'
@@ -75,16 +75,16 @@ def run():
item.ignore() item.ignore()
pycode += '%s = Cursor()\n' % tools.removeWxPrefix(item.name) pycode += '%s = Cursor()\n' % tools.removeWxPrefix(item.name)
module.addPyCode(pycode) module.addPyCode(pycode)
# former renamed constructors # former renamed constructors
module.addPyCode('StockCursor = wx.deprecated(Cursor, "Use Cursor instead.")') module.addPyCode('StockCursor = wx.deprecated(Cursor, "Use Cursor instead.")')
module.addPyCode('CursorFromImage = wx.deprecated(Cursor, "Use Cursor instead.")') module.addPyCode('CursorFromImage = wx.deprecated(Cursor, "Use Cursor instead.")')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,7 +16,7 @@ NAME = "dataobj" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxDataFormat', ITEMS = [ 'wxDataFormat',
'wxDataObject', 'wxDataObject',
'wxDataObjectSimple', 'wxDataObjectSimple',
@@ -29,7 +29,7 @@ ITEMS = [ 'wxDataFormat',
'wxHTMLDataObject', 'wxHTMLDataObject',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def addGetAllFormats(klass, pureVirtual=False): def addGetAllFormats(klass, pureVirtual=False):
@@ -37,14 +37,14 @@ def addGetAllFormats(klass, pureVirtual=False):
# the formats as a Python list # the formats as a Python list
m = klass.findItem('GetAllFormats') m = klass.findItem('GetAllFormats')
if m: if m:
m.ignore() m.ignore()
pyArgs = '(dir=Get)' if klass.name == 'wxDataObject' else '(dir=DataObject.Get)' pyArgs = '(dir=Get)' if klass.name == 'wxDataObject' else '(dir=DataObject.Get)'
klass.addCppMethod('PyObject*', 'GetAllFormats', '(wxDataObject::Direction dir=wxDataObject::Get)', klass.addCppMethod('PyObject*', 'GetAllFormats', '(wxDataObject::Direction dir=wxDataObject::Get)',
cppSignature='void (wxDataFormat* formats, Direction dir)', cppSignature='void (wxDataFormat* formats, Direction dir)',
pyArgsString=pyArgs, pyArgsString=pyArgs,
isVirtual=True, isVirtual=True,
isPureVirtual=pureVirtual, isPureVirtual=pureVirtual,
isConst=True, isConst=True,
doc="""\ doc="""\
@@ -60,13 +60,13 @@ def addGetAllFormats(klass, pureVirtual=False):
wxDataFormat* format = new wxDataFormat(formats[i]); wxDataFormat* format = new wxDataFormat(formats[i]);
PyObject* obj = wxPyConstructObject((void*)format, wxT("wxDataFormat"), true); PyObject* obj = wxPyConstructObject((void*)format, wxT("wxDataFormat"), true);
PyList_SET_ITEM(list, i, obj); // PyList_SET_ITEM steals a reference PyList_SET_ITEM(list, i, obj); // PyList_SET_ITEM steals a reference
} }
delete [] formats; delete [] formats;
return list; return list;
""", """,
# This code will be used in the function that calls a Python implementation # This code will be used in the function that calls a Python implementation
# of this method. So we need to translate between the real C++ siganture # of this method. So we need to translate between the real C++ siganture
# and the Python signature. # and the Python signature.
virtualCatcherCode="""\ virtualCatcherCode="""\
// VirtualCatcherCode for wx.DataObject.GetAllFormats // VirtualCatcherCode for wx.DataObject.GetAllFormats
@@ -90,7 +90,7 @@ def addGetAllFormats(klass, pureVirtual=False):
wxDataFormat* fmt; wxDataFormat* fmt;
int err = 0; int err = 0;
fmt = (wxDataFormat*)sipConvertToType( fmt = (wxDataFormat*)sipConvertToType(
item, sipType_wxDataFormat, NULL, item, sipType_wxDataFormat, NULL,
SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &err); SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &err);
formats[idx] = *fmt; formats[idx] = *fmt;
Py_DECREF(item); Py_DECREF(item);
@@ -99,7 +99,7 @@ def addGetAllFormats(klass, pureVirtual=False):
} }
if (PyErr_Occurred()) if (PyErr_Occurred())
PyErr_Print(); PyErr_Print();
Py_XDECREF(resObj); Py_XDECREF(resObj);
""" if pureVirtual else "") """ if pureVirtual else "")
@@ -121,7 +121,7 @@ def addBaseVirtuals(c):
# We need to let SIP know that the pure virtuals in the base class have # We need to let SIP know that the pure virtuals in the base class have
# impelmentations in C even though they will not be used much (if at # impelmentations in C even though they will not be used much (if at
# all.) # all.)
if not c.findItem('GetFormatCount'): if not c.findItem('GetFormatCount'):
c.addItem( c.addItem(
etgtools.WigCode(code="virtual size_t GetFormatCount(Direction dir = Get) const;")) etgtools.WigCode(code="virtual size_t GetFormatCount(Direction dir = Get) const;"))
@@ -148,11 +148,11 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxDataFormat') c = module.find('wxDataFormat')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('GetType').setCppCode("return static_cast<wxDataFormatId>(self->GetType());") c.find('GetType').setCppCode("return static_cast<wxDataFormatId>(self->GetType());")
@@ -160,14 +160,14 @@ def run():
item = module.find('wxFormatInvalid') item = module.find('wxFormatInvalid')
module.items.remove(item) module.items.remove(item)
module.insertItemAfter(c, item) module.insertItemAfter(c, item)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxDataObject') c = module.find('wxDataObject')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
addGetAllFormats(c, True) addGetAllFormats(c, True)
# For initial testing only. TODO: Remove later # For initial testing only. TODO: Remove later
c.addPublic() c.addPublic()
c.addCppMethod('void', '_testGetAllFormats', '()', c.addCppMethod('void', '_testGetAllFormats', '()',
@@ -179,7 +179,7 @@ def run():
# Replace the GetDataHere method with a version that uses a smarter # Replace the GetDataHere method with a version that uses a smarter
# Python buffer object instead of a stupid void pointer. # Python buffer object instead of a stupid void pointer.
c.find('GetDataHere').ignore() c.find('GetDataHere').ignore()
c.addCppMethod('bool', 'GetDataHere', '(const wxDataFormat& format, wxPyBuffer* buf)', c.addCppMethod('bool', 'GetDataHere', '(const wxDataFormat& format, wxPyBuffer* buf)',
cppSignature='bool (const wxDataFormat& format, void* buf)', cppSignature='bool (const wxDataFormat& format, void* buf)',
isVirtual=True, isPureVirtual=True, isVirtual=True, isPureVirtual=True,
@@ -191,40 +191,40 @@ def run():
return self->GetDataHere(*format, buf->m_ptr); return self->GetDataHere(*format, buf->m_ptr);
""", """,
# This code will be used in the function that calls a Python implementation # This code will be used in the function that calls a Python implementation
# of this method. # of this method.
virtualCatcherCode="""\ virtualCatcherCode="""\
// Call self.GetDataSize() to find out how big the buffer should be // Call self.GetDataSize() to find out how big the buffer should be
PyObject* self = NULL; PyObject* self = NULL;
PyObject* fmtObj = NULL; PyObject* fmtObj = NULL;
PyObject* sizeObj = NULL; PyObject* sizeObj = NULL;
PyObject* buffer = NULL; PyObject* buffer = NULL;
PyObject* resObj = NULL; PyObject* resObj = NULL;
Py_ssize_t size = 0; Py_ssize_t size = 0;
self = PyMethod_Self(sipMethod); // this shouldn't fail, and the reference is borrowed self = PyMethod_Self(sipMethod); // this shouldn't fail, and the reference is borrowed
fmtObj = wxPyConstructObject((void*)&format, "wxDataFormat", false); fmtObj = wxPyConstructObject((void*)&format, "wxDataFormat", false);
if (!fmtObj) goto error; if (!fmtObj) goto error;
sizeObj = PyObject_CallMethod(self, "GetDataSize", "(O)", fmtObj, NULL); sizeObj = PyObject_CallMethod(self, "GetDataSize", "(O)", fmtObj, NULL);
if (!sizeObj) goto error; if (!sizeObj) goto error;
size = wxPyInt_AsSsize_t(sizeObj); size = wxPyInt_AsSsize_t(sizeObj);
// Make a buffer that big using the pointer passed to us, and then // Make a buffer that big using the pointer passed to us, and then
// call the Python method. // call the Python method.
buffer = wxPyMakeBuffer(buf, size); buffer = wxPyMakeBuffer(buf, size);
resObj = sipCallMethod(0, sipMethod, "SS", fmtObj, buffer); resObj = sipCallMethod(0, sipMethod, "SS", fmtObj, buffer);
if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0) if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0)
PyErr_Print(); PyErr_Print();
error: error:
Py_XDECREF(resObj); Py_XDECREF(resObj);
Py_XDECREF(buffer); Py_XDECREF(buffer);
Py_XDECREF(fmtObj); Py_XDECREF(fmtObj);
Py_XDECREF(sizeObj); Py_XDECREF(sizeObj);
""") """)
# Replace the SetData method with an implementation that uses Python # Replace the SetData method with an implementation that uses Python
# buffer objects. # buffer objects.
c.find('SetData').ignore() c.find('SetData').ignore()
@@ -233,8 +233,8 @@ def run():
isVirtual=True, isVirtual=True,
doc="Copies data from the provided buffer to this data object for the specified format.", doc="Copies data from the provided buffer to this data object for the specified format.",
body="return self->SetData(*format, buf->m_len, buf->m_ptr);", body="return self->SetData(*format, buf->m_len, buf->m_ptr);",
# This code will be used in the function that calls a Python implementation # This code will be used in the function that calls a Python implementation
# of this method. # of this method.
virtualCatcherCode="""\ virtualCatcherCode="""\
PyObject* buffer = wxPyMakeBuffer((void*)buf, len); PyObject* buffer = wxPyMakeBuffer((void*)buf, len);
@@ -246,18 +246,18 @@ def run():
Py_XDECREF(resObj); Py_XDECREF(resObj);
Py_XDECREF(buffer); Py_XDECREF(buffer);
""") """)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxDataObjectSimple') c = module.find('wxDataObjectSimple')
c.addCppCtor_sip('(const wxString& formatName)', c.addCppCtor_sip('(const wxString& formatName)',
body='sipCpp = new sipwxDataObjectSimple(wxDataFormat(*formatName));') body='sipCpp = new sipwxDataObjectSimple(wxDataFormat(*formatName));')
# As in wxDataObject above replace GetDataHere and SetData with methods # As in wxDataObject above replace GetDataHere and SetData with methods
# that use buffer objects instead of void*, but this time we do not pass # that use buffer objects instead of void*, but this time we do not pass
# a DataFormat object with it. # a DataFormat object with it.
c.find('GetDataHere').ignore() c.find('GetDataHere').ignore()
c.addCppMethod('bool', 'GetDataHere', '(wxPyBuffer* buf)', c.addCppMethod('bool', 'GetDataHere', '(wxPyBuffer* buf)',
cppSignature='bool (void* buf)', cppSignature='bool (void* buf)',
isVirtual=True, isVirtual=True,
@@ -270,32 +270,32 @@ def run():
""", """,
virtualCatcherCode="""\ virtualCatcherCode="""\
// Call self.GetDataSize() to find out how big the buffer should be // Call self.GetDataSize() to find out how big the buffer should be
PyObject* self = NULL; PyObject* self = NULL;
PyObject* sizeObj = NULL; PyObject* sizeObj = NULL;
PyObject* buffer = NULL; PyObject* buffer = NULL;
PyObject* resObj = NULL; PyObject* resObj = NULL;
Py_ssize_t size = 0; Py_ssize_t size = 0;
self = PyMethod_Self(sipMethod); self = PyMethod_Self(sipMethod);
sizeObj = PyObject_CallMethod(self, "GetDataSize", "", NULL); sizeObj = PyObject_CallMethod(self, "GetDataSize", "", NULL);
if (!sizeObj) goto error; if (!sizeObj) goto error;
size = wxPyInt_AsSsize_t(sizeObj); size = wxPyInt_AsSsize_t(sizeObj);
// Make a buffer that big using the pointer passed to us, and then // Make a buffer that big using the pointer passed to us, and then
// call the Python method. // call the Python method.
buffer = wxPyMakeBuffer(buf, size); buffer = wxPyMakeBuffer(buf, size);
resObj = sipCallMethod(0, sipMethod, "S", buffer); resObj = sipCallMethod(0, sipMethod, "S", buffer);
if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0) if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0)
PyErr_Print(); PyErr_Print();
error: error:
Py_XDECREF(resObj); Py_XDECREF(resObj);
Py_XDECREF(buffer); Py_XDECREF(buffer);
Py_XDECREF(sizeObj); Py_XDECREF(sizeObj);
""") """)
c.find('SetData').ignore() c.find('SetData').ignore()
c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)', c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)',
cppSignature='bool (size_t len, const void* buf)', cppSignature='bool (size_t len, const void* buf)',
@@ -314,24 +314,24 @@ def run():
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxCustomDataObject') c = module.find('wxCustomDataObject')
tools.removeVirtuals(c) tools.removeVirtuals(c)
c.addCppCtor_sip('(const wxString& formatName)', c.addCppCtor_sip('(const wxString& formatName)',
body='sipCpp = new sipwxCustomDataObject(wxDataFormat(*formatName));') body='sipCpp = new sipwxCustomDataObject(wxDataFormat(*formatName));')
# remove the methods having to do with allocating or owning the data buffer # remove the methods having to do with allocating or owning the data buffer
c.find('Alloc').ignore() c.find('Alloc').ignore()
c.find('Free').ignore() c.find('Free').ignore()
c.find('TakeData').ignore() c.find('TakeData').ignore()
c.find('GetData').ignore() c.find('GetData').ignore()
c.addCppMethod('PyObject*', 'GetData', '()', isConst=True, c.addCppMethod('PyObject*', 'GetData', '()', isConst=True,
doc="Returns a reference to the data buffer.", doc="Returns a reference to the data buffer.",
body="return wxPyMakeBuffer(self->GetData(), self->GetSize());") body="return wxPyMakeBuffer(self->GetData(), self->GetSize());")
c.find('SetData').ignore() c.find('SetData').ignore()
c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)', c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)',
cppSignature='bool (size_t len, const void* buf)', cppSignature='bool (size_t len, const void* buf)',
@@ -341,68 +341,68 @@ def run():
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
addSimpleVirtuals(c) addSimpleVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxDataObjectComposite') c = module.find('wxDataObjectComposite')
c.find('Add.dataObject').transfer = True c.find('Add.dataObject').transfer = True
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxTextDataObject') c = module.find('wxTextDataObject')
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
addSimpleVirtuals(c) addSimpleVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxURLDataObject') c = module.find('wxURLDataObject')
# wxURLDataObject derives from wxDataObjectComposite on some platforms, # wxURLDataObject derives from wxDataObjectComposite on some platforms,
# and wxTextDataObject on others, so we need to take a least common # and wxTextDataObject on others, so we need to take a least common
# denominator approach here to be able to work on all platforms. # denominator approach here to be able to work on all platforms.
c.bases = ['wxDataObject'] c.bases = ['wxDataObject']
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
addSimpleVirtuals(c) addSimpleVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxBitmapDataObject') c = module.find('wxBitmapDataObject')
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
addSimpleVirtuals(c) addSimpleVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxFileDataObject') c = module.find('wxFileDataObject')
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
addSimpleVirtuals(c) addSimpleVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
c = module.find('wxHTMLDataObject') c = module.find('wxHTMLDataObject')
addGetAllFormats(c) addGetAllFormats(c)
addBaseVirtuals(c) addBaseVirtuals(c)
addSimpleVirtuals(c) addSimpleVirtuals(c)
#------------------------------------------------------------ #------------------------------------------------------------
module.addPyCode("PyDataObjectSimple = wx.deprecated(DataObjectSimple), 'Use DataObjectSimple instead.'") module.addPyCode("PyDataObjectSimple = wx.deprecated(DataObjectSimple), 'Use DataObjectSimple instead.'")
module.addPyCode("PyTextDataObject = wx.deprecated(TextDataObject, 'Use TextDataObject instead.')") module.addPyCode("PyTextDataObject = wx.deprecated(TextDataObject, 'Use TextDataObject instead.')")
module.addPyCode("PyBitmapDataObject = wx.deprecated(BitmapDataObject, 'Use TextDataObject instead.')") module.addPyCode("PyBitmapDataObject = wx.deprecated(BitmapDataObject, 'Use TextDataObject instead.')")
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,18 +17,18 @@ NAME = "dataview" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ITEMS = [
'wxDataViewItem', 'wxDataViewItem',
'wxDataViewItemAttr', 'wxDataViewItemAttr',
'wxDataViewIconText', 'wxDataViewIconText',
'wxDataViewModelNotifier', 'wxDataViewModelNotifier',
'wxDataViewModel', 'wxDataViewModel',
'wxDataViewListModel', 'wxDataViewListModel',
'wxDataViewIndexListModel', 'wxDataViewIndexListModel',
'wxDataViewVirtualListModel', 'wxDataViewVirtualListModel',
'wxDataViewRenderer', 'wxDataViewRenderer',
'wxDataViewCustomRenderer', 'wxDataViewCustomRenderer',
'wxDataViewTextRenderer', 'wxDataViewTextRenderer',
@@ -36,22 +36,22 @@ ITEMS = [
'wxDataViewProgressRenderer', 'wxDataViewProgressRenderer',
'wxDataViewSpinRenderer', 'wxDataViewSpinRenderer',
'wxDataViewToggleRenderer', 'wxDataViewToggleRenderer',
'wxDataViewChoiceRenderer', 'wxDataViewChoiceRenderer',
#'wxDataViewChoiceByIndexRenderer', # only available in generic dvc #'wxDataViewChoiceByIndexRenderer', # only available in generic dvc
'wxDataViewDateRenderer', 'wxDataViewDateRenderer',
'wxDataViewBitmapRenderer', 'wxDataViewBitmapRenderer',
'wxDataViewColumn', 'wxDataViewColumn',
'wxDataViewCtrl', 'wxDataViewCtrl',
'wxDataViewEvent', 'wxDataViewEvent',
'wxDataViewListCtrl', 'wxDataViewListCtrl',
'wxDataViewListStore', 'wxDataViewListStore',
'wxDataViewTreeCtrl', 'wxDataViewTreeCtrl',
'wxDataViewTreeStore', 'wxDataViewTreeStore',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -59,7 +59,7 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
@@ -96,20 +96,20 @@ def run():
module.addPyCode("NullDataViewItem = DataViewItem()") module.addPyCode("NullDataViewItem = DataViewItem()")
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewModel') c = module.find('wxDataViewModel')
c.addAutoProperties() c.addAutoProperties()
c.find('~wxDataViewModel').ignore(False) c.find('~wxDataViewModel').ignore(False)
c.find('AddNotifier.notifier').transfer = True c.find('AddNotifier.notifier').transfer = True
c.find('RemoveNotifier.notifier').transferBack = True c.find('RemoveNotifier.notifier').transferBack = True
# Change the GetValue method to return the value instead of passing it # Change the GetValue method to return the value instead of passing it
# through a parameter for modification. # through a parameter for modification.
c.find('GetValue.variant').out = True c.find('GetValue.variant').out = True
# The DataViewItemObjectMapper class helps map from data items to Python # The DataViewItemObjectMapper class helps map from data items to Python
# objects, and is used as a base class of PyDataViewModel as a # objects, and is used as a base class of PyDataViewModel as a
# convenience. # convenience.
@@ -121,23 +121,23 @@ def run():
:meth:`ObjectToItem` to create a :class:`DataViewItem` using a Python object as its ID, :meth:`ObjectToItem` to create a :class:`DataViewItem` using a Python object as its ID,
and use :meth:`ItemToObject` to fetch that Python object again later for a given and use :meth:`ItemToObject` to fetch that Python object again later for a given
:class:`DataViewItem`. :class:`DataViewItem`.
By default a regular dictionary is used to implement the ID to object By default a regular dictionary is used to implement the ID to object
mapping. Optionally a WeakValueDictionary can be useful when there will be mapping. Optionally a WeakValueDictionary can be useful when there will be
a high turnover of objects and mantaining an extra reference to the a high turnover of objects and mantaining an extra reference to the
objects would be unwise. If weak references are used then the objects objects would be unwise. If weak references are used then the objects
associated with data items must be weak-referenceable. (Things like associated with data items must be weak-referenceable. (Things like
stock lists and dictionaries are not.) See :meth:`UseWeakRefs`. stock lists and dictionaries are not.) See :meth:`UseWeakRefs`.
This class is used in :class:`PyDataViewModel` as a mixin for convenience. This class is used in :class:`PyDataViewModel` as a mixin for convenience.
""", """,
items=[ items=[
PyFunctionDef('__init__', '(self)', PyFunctionDef('__init__', '(self)',
body="""\ body="""\
self.mapper = dict() self.mapper = dict()
self.usingWeakRefs = False self.usingWeakRefs = False
"""), """),
PyFunctionDef('ObjectToItem', '(self, obj)', PyFunctionDef('ObjectToItem', '(self, obj)',
doc="Create a :class:`DataViewItem` for the object, and remember the ID-->obj mapping.", doc="Create a :class:`DataViewItem` for the object, and remember the ID-->obj mapping.",
body="""\ body="""\
@@ -146,7 +146,7 @@ def run():
while oid > sys.maxsize: while oid > sys.maxsize:
# risk of conflict here... May need some more thought. # risk of conflict here... May need some more thought.
oid -= sys.maxsize oid -= sys.maxsize
self.mapper[oid] = obj self.mapper[oid] = obj
return DataViewItem(oid) return DataViewItem(oid)
"""), """),
@@ -156,8 +156,8 @@ def run():
oid = int(item.GetID()) oid = int(item.GetID())
return self.mapper[oid] return self.mapper[oid]
"""), """),
PyFunctionDef('UseWeakRefs', '(self, flag)', PyFunctionDef('UseWeakRefs', '(self, flag)',
doc="""\ doc="""\
Switch to or from using a weak value dictionary for keeping the ID to Switch to or from using a weak value dictionary for keeping the ID to
object map.""", object map.""",
@@ -178,22 +178,22 @@ def run():
module.addPyClass('PyDataViewModel', ['DataViewModel', 'DataViewItemObjectMapper'], module.addPyClass('PyDataViewModel', ['DataViewModel', 'DataViewItemObjectMapper'],
doc="A convenience class that is a :class:`DataViewModel` combined with an object mapper.", doc="A convenience class that is a :class:`DataViewModel` combined with an object mapper.",
items=[ items=[
PyFunctionDef('__init__', '(self)', PyFunctionDef('__init__', '(self)',
body="""\ body="""\
DataViewModel.__init__(self) DataViewModel.__init__(self)
DataViewItemObjectMapper.__init__(self) DataViewItemObjectMapper.__init__(self)
""") """)
]) ])
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewListModel') c = module.find('wxDataViewListModel')
c.addAutoProperties() c.addAutoProperties()
# Change the GetValueByRow method to return the value instead of passing # Change the GetValueByRow method to return the value instead of passing
# it through a parameter for modification. # it through a parameter for modification.
c.find('GetValueByRow.variant').out = True c.find('GetValueByRow.variant').out = True
# declare implementations for base class virtuals # declare implementations for base class virtuals
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
@@ -204,20 +204,20 @@ def run():
virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const; virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const;
virtual bool IsListModel() const; virtual bool IsListModel() const;
""")) """))
# Add some of the pure virtuals since there are undocumented # Add some of the pure virtuals since there are undocumented
# implementations of them in these classes. The others will need to be # implementations of them in these classes. The others will need to be
# implemented in Python classes derived from these. # implemented in Python classes derived from these.
for name in ['wxDataViewIndexListModel', 'wxDataViewVirtualListModel']: for name in ['wxDataViewIndexListModel', 'wxDataViewVirtualListModel']:
c = module.find(name) c = module.find(name)
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
virtual unsigned int GetRow(const wxDataViewItem& item) const; virtual unsigned int GetRow(const wxDataViewItem& item) const;
virtual unsigned int GetCount() const; virtual unsigned int GetCount() const;
virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
""")) """))
# compatibility aliases # compatibility aliases
module.addPyCode("""\ module.addPyCode("""\
@@ -227,28 +227,28 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
def _fixupBoolGetters(method, sig): def _fixupBoolGetters(method, sig):
method.type = 'void' method.type = 'void'
method.find('value').out = True method.find('value').out = True
method.cppSignature = sig method.cppSignature = sig
c = module.find('wxDataViewRenderer') c = module.find('wxDataViewRenderer')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.abstract = True c.abstract = True
c.addAutoProperties() c.addAutoProperties()
c.find('GetView').ignore(False) c.find('GetView').ignore(False)
# Change variant getters to return the value # Change variant getters to return the value
for name, sig in [ for name, sig in [
('GetValue', 'bool (wxDVCVariant& value)'), ('GetValue', 'bool (wxDVCVariant& value)'),
('GetValueFromEditorCtrl', 'bool (wxWindow * editor, wxDVCVariant& value)'), ('GetValueFromEditorCtrl', 'bool (wxWindow * editor, wxDVCVariant& value)'),
]: ]:
_fixupBoolGetters(c.find(name), sig) _fixupBoolGetters(c.find(name), sig)
# Add the pure virtuals since there are undocumented implementations of # Add the pure virtuals since there are undocumented implementations of
# them in all these classes # them in all these classes
for name in [ 'wxDataViewTextRenderer', for name in [ 'wxDataViewTextRenderer',
@@ -263,23 +263,23 @@ def run():
]: ]:
c = module.find(name) c = module.find(name)
c.addAutoProperties() c.addAutoProperties()
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
virtual bool SetValue( const wxDVCVariant &value ); virtual bool SetValue( const wxDVCVariant &value );
virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxDVCVariant& value)]; virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxDVCVariant& value)];
%Property(name=Value, get=GetValue, set=SetValue) %Property(name=Value, get=GetValue, set=SetValue)
""")) """))
c = module.find('wxDataViewCustomRenderer') c = module.find('wxDataViewCustomRenderer')
_fixupBoolGetters(c.find('GetValueFromEditorCtrl'), _fixupBoolGetters(c.find('GetValueFromEditorCtrl'),
'bool (wxWindow * editor, wxDVCVariant& value)') 'bool (wxWindow * editor, wxDVCVariant& value)')
c.find('GetTextExtent').ignore(False) c.find('GetTextExtent').ignore(False)
module.addPyCode("""\ module.addPyCode("""\
PyDataViewCustomRenderer = wx.deprecated(DataViewCustomRenderer, PyDataViewCustomRenderer = wx.deprecated(DataViewCustomRenderer,
"Use DataViewCustomRenderer instead")""") "Use DataViewCustomRenderer instead")""")
# The SpinRenderer has a few more pure virtuals that need to be declared # The SpinRenderer has a few more pure virtuals that need to be declared
# since it derives from DataViewCustomRenderer # since it derives from DataViewCustomRenderer
c = module.find('wxDataViewSpinRenderer') c = module.find('wxDataViewSpinRenderer')
@@ -288,12 +288,12 @@ def run():
virtual bool Render(wxRect cell, wxDC* dc, int state); virtual bool Render(wxRect cell, wxDC* dc, int state);
""")) """))
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewColumn') c = module.find('wxDataViewColumn')
for m in c.find('wxDataViewColumn').all(): for m in c.find('wxDataViewColumn').all():
m.find('renderer').transfer = True m.find('renderer').transfer = True
# declare the virtuals from wxSettableHeaderColumn # declare the virtuals from wxSettableHeaderColumn
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
virtual void SetTitle(const wxString& title); virtual void SetTitle(const wxString& title);
@@ -311,13 +311,13 @@ def run():
virtual bool IsSortKey() const; virtual bool IsSortKey() const;
virtual void SetSortOrder(bool ascending); virtual void SetSortOrder(bool ascending);
virtual bool IsSortOrderAscending() const; virtual bool IsSortOrderAscending() const;
virtual void SetResizeable(bool resizable); virtual void SetResizeable(bool resizable);
virtual void SetSortable(bool sortable); virtual void SetSortable(bool sortable);
virtual void SetReorderable(bool reorderable); virtual void SetReorderable(bool reorderable);
virtual void SetHidden(bool hidden); virtual void SetHidden(bool hidden);
""")) """))
c.addAutoProperties() c.addAutoProperties()
c.addProperty('Title', 'GetTitle', 'SetTitle') c.addProperty('Title', 'GetTitle', 'SetTitle')
c.addProperty('Bitmap', 'GetBitmap', 'SetBitmap') c.addProperty('Bitmap', 'GetBitmap', 'SetBitmap')
@@ -326,9 +326,9 @@ def run():
c.addProperty('Alignment', 'GetAlignment', 'SetAlignment') c.addProperty('Alignment', 'GetAlignment', 'SetAlignment')
c.addProperty('Flags', 'GetFlags', 'SetFlags') c.addProperty('Flags', 'GetFlags', 'SetFlags')
c.addProperty('SortOrder', 'IsSortOrderAscending', 'SetSortOrder') c.addProperty('SortOrder', 'IsSortOrderAscending', 'SetSortOrder')
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewCtrl') c = module.find('wxDataViewCtrl')
tools.fixWindowClass(c) tools.fixWindowClass(c)
@@ -336,33 +336,33 @@ def run():
c.find('AssociateModel.model').transfer = True c.find('AssociateModel.model').transfer = True
c.find('AssociateModel').pyName = '_AssociateModel' c.find('AssociateModel').pyName = '_AssociateModel'
c.addPyMethod('AssociateModel', '(self, model)', c.addPyMethod('AssociateModel', '(self, model)',
doc="""\ doc="""\
Associates a :class:`DataViewModel` with the control. Associates a :class:`DataViewModel` with the control.
Ownership of the model object is passed to C++, however it Ownership of the model object is passed to C++, however it
is reference counted so it can be shared with other views. is reference counted so it can be shared with other views.
""", """,
body="""\ body="""\
import wx.siplib import wx.siplib
wasPyOwned = wx.siplib.ispyowned(model) wasPyOwned = wx.siplib.ispyowned(model)
self._AssociateModel(model) self._AssociateModel(model)
# Ownership of the python object has just been transferred to # Ownership of the python object has just been transferred to
# C++, so DecRef the C++ instance associated with this python # C++, so DecRef the C++ instance associated with this python
# reference. # reference.
if wasPyOwned: if wasPyOwned:
model.DecRef() model.DecRef()
""") """)
c.find('PrependColumn.col').transfer = True c.find('PrependColumn.col').transfer = True
c.find('InsertColumn.col').transfer = True c.find('InsertColumn.col').transfer = True
c.find('AppendColumn.col').transfer = True c.find('AppendColumn.col').transfer = True
c.addPyMethod('GetColumns', '(self)', c.addPyMethod('GetColumns', '(self)',
doc="Returns a list of column objects.", doc="Returns a list of column objects.",
body="return [self.GetColumn(i) for i in range(self.GetColumnCount())]") body="return [self.GetColumn(i) for i in range(self.GetColumnCount())]")
c.find('GetSelections').ignore() c.find('GetSelections').ignore()
c.addCppMethod('wxDataViewItemArray*', 'GetSelections', '()', c.addCppMethod('wxDataViewItemArray*', 'GetSelections', '()',
isConst=True, factory=True, isConst=True, factory=True,
doc="Returns a list of the currently selected items.", doc="Returns a list of the currently selected items.",
body="""\ body="""\
@@ -382,9 +382,9 @@ def run():
body="""\ body="""\
wxDataViewItem* item = new wxDataViewItem();; wxDataViewItem* item = new wxDataViewItem();;
wxDataViewColumn* col = NULL; wxDataViewColumn* col = NULL;
self->HitTest(*point, *item, col); self->HitTest(*point, *item, col);
wxPyThreadBlocker blocker; wxPyThreadBlocker blocker;
PyObject* value = PyTuple_New(2); PyObject* value = PyTuple_New(2);
PyObject* item_obj = PyObject* item_obj =
@@ -401,17 +401,17 @@ def run():
// PyTuple steals a reference, so we don't need to decref the items here // PyTuple steals a reference, so we don't need to decref the items here
return value; return value;
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewEvent') c = module.find('wxDataViewEvent')
tools.fixEventClass(c) tools.fixEventClass(c)
c.addProperty('EditCancelled', 'IsEditCancelled', 'SetEditCanceled') c.addProperty('EditCancelled', 'IsEditCancelled', 'SetEditCanceled')
c.find('SetCache.from').name = 'from_' c.find('SetCache.from').name = 'from_'
c.find('SetCache.to').name = 'to_' c.find('SetCache.to').name = 'to_'
c.find('GetDataBuffer').ignore() c.find('GetDataBuffer').ignore()
c.addCppMethod('PyObject*', 'GetDataBuffer', '()', isConst=True, c.addCppMethod('PyObject*', 'GetDataBuffer', '()', isConst=True,
doc="Gets the data buffer for a drop data transfer", doc="Gets the data buffer for a drop data transfer",
@@ -423,8 +423,8 @@ def run():
# TODO: SetDataBuffer # TODO: SetDataBuffer
c.find('SetDataObject.obj').transfer = True c.find('SetDataObject.obj').transfer = True
module.addPyCode("""\ module.addPyCode("""\
EVT_DATAVIEW_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_SELECTION_CHANGED, 1) EVT_DATAVIEW_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_SELECTION_CHANGED, 1)
EVT_DATAVIEW_ITEM_ACTIVATED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_ACTIVATED, 1) EVT_DATAVIEW_ITEM_ACTIVATED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_ACTIVATED, 1)
@@ -432,7 +432,7 @@ def run():
EVT_DATAVIEW_ITEM_EXPANDED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDED, 1) EVT_DATAVIEW_ITEM_EXPANDED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDED, 1)
EVT_DATAVIEW_ITEM_COLLAPSING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_COLLAPSING, 1) EVT_DATAVIEW_ITEM_COLLAPSING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_COLLAPSING, 1)
EVT_DATAVIEW_ITEM_EXPANDING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDING, 1) EVT_DATAVIEW_ITEM_EXPANDING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDING, 1)
EVT_DATAVIEW_ITEM_START_EDITING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_START_EDITING, 1) EVT_DATAVIEW_ITEM_START_EDITING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_START_EDITING, 1)
EVT_DATAVIEW_ITEM_EDITING_STARTED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, 1) EVT_DATAVIEW_ITEM_EDITING_STARTED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, 1)
EVT_DATAVIEW_ITEM_EDITING_DONE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_DONE, 1) EVT_DATAVIEW_ITEM_EDITING_DONE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_DONE, 1)
EVT_DATAVIEW_ITEM_VALUE_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, 1) EVT_DATAVIEW_ITEM_VALUE_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, 1)
@@ -442,10 +442,10 @@ def run():
EVT_DATAVIEW_COLUMN_SORTED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_SORTED, 1) EVT_DATAVIEW_COLUMN_SORTED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_SORTED, 1)
EVT_DATAVIEW_COLUMN_REORDERED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_REORDERED, 1) EVT_DATAVIEW_COLUMN_REORDERED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_REORDERED, 1)
EVT_DATAVIEW_ITEM_BEGIN_DRAG = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, 1) EVT_DATAVIEW_ITEM_BEGIN_DRAG = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, 1)
EVT_DATAVIEW_ITEM_DROP_POSSIBLE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, 1) EVT_DATAVIEW_ITEM_DROP_POSSIBLE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, 1)
EVT_DATAVIEW_ITEM_DROP = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP, 1) EVT_DATAVIEW_ITEM_DROP = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP, 1)
EVT_DATAVIEW_CACHE_HINT = wx.PyEventBinder( wxEVT_DATAVIEW_CACHE_HINT, 1 ) EVT_DATAVIEW_CACHE_HINT = wx.PyEventBinder( wxEVT_DATAVIEW_CACHE_HINT, 1 )
# deprecated wxEVT aliases # deprecated wxEVT aliases
wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED = wxEVT_DATAVIEW_SELECTION_CHANGED wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED = wxEVT_DATAVIEW_SELECTION_CHANGED
wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED = wxEVT_DATAVIEW_ITEM_ACTIVATED wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED = wxEVT_DATAVIEW_ITEM_ACTIVATED
@@ -467,11 +467,11 @@ def run():
wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE = wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE = wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE
wxEVT_COMMAND_DATAVIEW_ITEM_DROP = wxEVT_DATAVIEW_ITEM_DROP wxEVT_COMMAND_DATAVIEW_ITEM_DROP = wxEVT_DATAVIEW_ITEM_DROP
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewListCtrl') c = module.find('wxDataViewListCtrl')
tools.fixWindowClass(c) tools.fixWindowClass(c)
c.find('GetStore').overloads = [] c.find('GetStore').overloads = []
c.find('AppendItem.values').type = 'const wxVariantVector&' c.find('AppendItem.values').type = 'const wxVariantVector&'
@@ -479,20 +479,20 @@ def run():
c.find('InsertItem.values').type = 'const wxVariantVector&' c.find('InsertItem.values').type = 'const wxVariantVector&'
c.find('GetValue.value').out = True c.find('GetValue.value').out = True
for name in 'AppendColumn InsertColumn PrependColumn'.split(): for name in 'AppendColumn InsertColumn PrependColumn'.split():
for m in c.find(name).all(): for m in c.find(name).all():
m.find('column').transfer = True m.find('column').transfer = True
c = module.find('wxDataViewListStore') c = module.find('wxDataViewListStore')
c.find('AppendItem.values').type = 'const wxVariantVector&' c.find('AppendItem.values').type = 'const wxVariantVector&'
c.find('PrependItem.values').type = 'const wxVariantVector&' c.find('PrependItem.values').type = 'const wxVariantVector&'
c.find('InsertItem.values').type = 'const wxVariantVector&' c.find('InsertItem.values').type = 'const wxVariantVector&'
c.find('GetValueByRow.value').out = True c.find('GetValueByRow.value').out = True
c.addAutoProperties() c.addAutoProperties()
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDataViewTreeCtrl') c = module.find('wxDataViewTreeCtrl')
tools.fixWindowClass(c) tools.fixWindowClass(c)
@@ -502,12 +502,12 @@ def run():
c = module.find('wxDataViewTreeStore') c = module.find('wxDataViewTreeStore')
c.addAutoProperties() c.addAutoProperties()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -11,29 +11,29 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "datectrl" # Base name of the file to generate to for this script NAME = "datectrl" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxDatePickerCtrl", ITEMS = [ "wxDatePickerCtrl",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/datectrl.h>") module.addHeaderCode("#include <wx/datectrl.h>")
dpc = module.find('wxDatePickerCtrl') dpc = module.find('wxDatePickerCtrl')
assert isinstance(dpc, etgtools.ClassDef) assert isinstance(dpc, etgtools.ClassDef)
@@ -44,7 +44,7 @@ def run():
module.insertItemAfter(dpc, gdpc) module.insertItemAfter(dpc, gdpc)
# and give it a new Python name to match Classic # and give it a new Python name to match Classic
gdpc.pyName = 'GenericDatePickerCtrl' gdpc.pyName = 'GenericDatePickerCtrl'
# now back to our regular tweaking # now back to our regular tweaking
for c in [dpc, gdpc]: for c in [dpc, gdpc]:
tools.fixWindowClass(c) tools.fixWindowClass(c)
@@ -52,12 +52,12 @@ def run():
c.find('GetRange.dt2').out = True c.find('GetRange.dt2').out = True
gdpc.addHeaderCode("#include <wx/generic/datectrl.h>") gdpc.addHeaderCode("#include <wx/generic/datectrl.h>")
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,48 +10,48 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "dateevt" # Base name of the file to generate to for this script NAME = "dateevt" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxDateEvent", ITEMS = [ "wxDateEvent",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/dateevt.h>") module.addHeaderCode("#include <wx/dateevt.h>")
c = module.find('wxDateEvent') c = module.find('wxDateEvent')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixEventClass(c) tools.fixEventClass(c)
c.addPyCode("""\ c.addPyCode("""\
EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 ) EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
EVT_TIME_CHANGED = wx.PyEventBinder( wxEVT_TIME_CHANGED, 1 ) EVT_TIME_CHANGED = wx.PyEventBinder( wxEVT_TIME_CHANGED, 1 )
""") """)
c.addPyCode("""\ c.addPyCode("""\
DateEvent.PyGetDate = wx.deprecated(DateEvent.GetDate, 'Use GetDate instead.') DateEvent.PyGetDate = wx.deprecated(DateEvent.GetDate, 'Use GetDate instead.')
DateEvent.PySetDate = wx.deprecated(DateEvent.SetDate, 'Use SetDate instead.') DateEvent.PySetDate = wx.deprecated(DateEvent.SetDate, 'Use SetDate instead.')
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -19,29 +19,29 @@ NAME = "dc" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxFontMetrics', ITEMS = [ 'wxFontMetrics',
'wxDC', 'wxDC',
'wxDCClipper', 'wxDCClipper',
'wxDCBrushChanger', 'wxDCBrushChanger',
'wxDCPenChanger', 'wxDCPenChanger',
'wxDCTextColourChanger', 'wxDCTextColourChanger',
'wxDCFontChanger', 'wxDCFontChanger',
] ]
OTHERDEPS = [ 'src/dc_ex.cpp', ] OTHERDEPS = [ 'src/dc_ex.cpp', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxDC') c = module.find('wxDC')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -52,7 +52,7 @@ def run():
# Keep only the wxSize overloads of these # Keep only the wxSize overloads of these
c.find('GetSize').findOverload('wxCoord').ignore() c.find('GetSize').findOverload('wxCoord').ignore()
c.find('GetSizeMM').findOverload('wxCoord').ignore() c.find('GetSizeMM').findOverload('wxCoord').ignore()
# TODO: needs wxAffineMatrix2D support. # TODO: needs wxAffineMatrix2D support.
#c.find('GetTransformMatrix').ignore() #c.find('GetTransformMatrix').ignore()
#c.find('SetTransformMatrix').ignore() #c.find('SetTransformMatrix').ignore()
@@ -66,23 +66,23 @@ def run():
# are multiple array parameters involved... # are multiple array parameters involved...
c.find('DrawPolyPolygon').ignore() c.find('DrawPolyPolygon').ignore()
# Add output param annotations so the generated docstrings will be correct # Add output param annotations so the generated docstrings will be correct
c.find('GetUserScale.x').out = True c.find('GetUserScale.x').out = True
c.find('GetUserScale.y').out = True c.find('GetUserScale.y').out = True
c.find('GetLogicalScale.x').out = True c.find('GetLogicalScale.x').out = True
c.find('GetLogicalScale.y').out = True c.find('GetLogicalScale.y').out = True
c.find('GetLogicalOrigin').overloads = [] c.find('GetLogicalOrigin').overloads = []
c.find('GetLogicalOrigin.x').out = True c.find('GetLogicalOrigin.x').out = True
c.find('GetLogicalOrigin.y').out = True c.find('GetLogicalOrigin.y').out = True
c.find('GetClippingBox.x').out = True c.find('GetClippingBox.x').out = True
c.find('GetClippingBox.y').out = True c.find('GetClippingBox.y').out = True
c.find('GetClippingBox.width').out = True c.find('GetClippingBox.width').out = True
c.find('GetClippingBox.height').out = True c.find('GetClippingBox.height').out = True
c.addPyMethod('GetClippingRect', '(self)', c.addPyMethod('GetClippingRect', '(self)',
doc="Gets the rectangle surrounding the current clipping region", doc="Gets the rectangle surrounding the current clipping region",
body="return wx.Rect(*self.GetClippingBox())") body="return wx.Rect(*self.GetClippingBox())")
@@ -187,7 +187,7 @@ def run():
# avoid using parameters as return values, etc. as well as Classic # avoid using parameters as return values, etc. as well as Classic
# compatibility. # compatibility.
c.find('GetPixel').ignore() c.find('GetPixel').ignore()
c.addCppMethod('wxColour*', 'GetPixel', '(wxCoord x, wxCoord y)', c.addCppMethod('wxColour*', 'GetPixel', '(wxCoord x, wxCoord y)',
doc="Gets the colour at the specified location on the DC.", doc="Gets the colour at the specified location on the DC.",
body="""\ body="""\
wxColour* col = new wxColour; wxColour* col = new wxColour;
@@ -220,17 +220,17 @@ def run():
return new wxArrayInt(rval); return new wxArrayInt(rval);
""") """)
c.addCppMethod('int', '__nonzero__', '()', """\ c.addCppMethod('int', '__nonzero__', '()', """\
return self->IsOk(); return self->IsOk();
""") """)
c.addPyMethod('GetBoundingBox', '(self)', doc="""\ c.addPyMethod('GetBoundingBox', '(self)', doc="""\
GetBoundingBox() -> (x1,y1, x2,y2)\n GetBoundingBox() -> (x1,y1, x2,y2)\n
Returns the min and max points used in drawing commands so far.""", Returns the min and max points used in drawing commands so far.""",
body="return (self.MinX(), self.MinY(), self.MaxX(), self.MaxY())") body="return (self.MinX(), self.MinY(), self.MaxX(), self.MaxY())")
c.addCppMethod('long', 'GetHDC', '()', """\ c.addCppMethod('long', 'GetHDC', '()', """\
#ifdef __WXMSW__ #ifdef __WXMSW__
return (long)self->GetHandle(); return (long)self->GetHandle();
@@ -252,17 +252,17 @@ def run():
wxPyRaiseNotImplemented(); wxPyRaiseNotImplemented();
return NULL; return NULL;
#endif""") #endif""")
c.addPyCode('DC.GetHDC = wx.deprecated(DC.GetHDC, "Use GetHandle instead.")') c.addPyCode('DC.GetHDC = wx.deprecated(DC.GetHDC, "Use GetHandle instead.")')
c.addPyCode('DC.GetCGContext = wx.deprecated(DC.GetCGContext, "Use GetHandle instead.")') c.addPyCode('DC.GetCGContext = wx.deprecated(DC.GetCGContext, "Use GetHandle instead.")')
c.addPyCode('DC.GetGdkDrawable = wx.deprecated(DC.GetGdkDrawable, "Use GetHandle instead.")') c.addPyCode('DC.GetGdkDrawable = wx.deprecated(DC.GetGdkDrawable, "Use GetHandle instead.")')
# This file contains implementations of functions for quickly drawing # This file contains implementations of functions for quickly drawing
# lists of items on the DC. They are called from the CppMethods defined # lists of items on the DC. They are called from the CppMethods defined
# below, which in turn are called from the PyMethods below that. # below, which in turn are called from the PyMethods below that.
c.includeCppCode('src/dc_ex.cpp') c.includeCppCode('src/dc_ex.cpp')
c.addCppMethod('PyObject*', '_DrawPointList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)', c.addCppMethod('PyObject*', '_DrawPointList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)',
body="return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);") body="return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);")
@@ -278,19 +278,19 @@ def run():
c.addCppMethod('PyObject*', '_DrawPolygonList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)', c.addCppMethod('PyObject*', '_DrawPolygonList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)',
body="return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);") body="return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);")
c.addCppMethod('PyObject*', '_DrawTextList', c.addCppMethod('PyObject*', '_DrawTextList',
'(PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)', '(PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)',
body="return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);") body="return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);")
c.addPyMethod('DrawPointList', '(self, points, pens=None)', c.addPyMethod('DrawPointList', '(self, points, pens=None)',
doc="""\ doc="""\
Draw a list of points as quickly as possible. Draw a list of points as quickly as possible.
:param points: A sequence of 2-element sequences representing :param points: A sequence of 2-element sequences representing
each point to draw, (x,y). each point to draw, (x,y).
:param pens: If None, then the current pen is used. If a single :param pens: If None, then the current pen is used. If a single
pen then it will be used for all points. If a list of pen then it will be used for all points. If a list of
pens then there should be one for each point in points. pens then there should be one for each point in points.
""", """,
body="""\ body="""\
@@ -306,7 +306,7 @@ def run():
c.addPyMethod('DrawLineList', '(self, lines, pens=None)', c.addPyMethod('DrawLineList', '(self, lines, pens=None)',
doc="""\ doc="""\
Draw a list of lines as quickly as possible. Draw a list of lines as quickly as possible.
:param lines: A sequence of 4-element sequences representing :param lines: A sequence of 4-element sequences representing
each line to draw, (x1,y1, x2,y2). each line to draw, (x1,y1, x2,y2).
:param pens: If None, then the current pen is used. If a :param pens: If None, then the current pen is used. If a
@@ -327,12 +327,12 @@ def run():
c.addPyMethod('DrawRectangleList', '(self, rectangles, pens=None, brushes=None)', c.addPyMethod('DrawRectangleList', '(self, rectangles, pens=None, brushes=None)',
doc="""\ doc="""\
Draw a list of rectangles as quickly as possible. Draw a list of rectangles as quickly as possible.
:param rectangles: A sequence of 4-element sequences representing :param rectangles: A sequence of 4-element sequences representing
each rectangle to draw, (x,y, w,h). each rectangle to draw, (x,y, w,h).
:param pens: If None, then the current pen is used. If a :param pens: If None, then the current pen is used. If a
single pen then it will be used for all rectangles. single pen then it will be used for all rectangles.
If a list of pens then there should be one for each If a list of pens then there should be one for each
rectangle in rectangles. rectangle in rectangles.
:param brushes: A brush or brushes to be used to fill the rectagles, :param brushes: A brush or brushes to be used to fill the rectagles,
with similar semantics as the pens parameter. with similar semantics as the pens parameter.
@@ -352,16 +352,16 @@ def run():
raise ValueError('rectangles and brushes must have same length') raise ValueError('rectangles and brushes must have same length')
return self._DrawRectangleList(rectangles, pens, brushes) return self._DrawRectangleList(rectangles, pens, brushes)
""") """)
c.addPyMethod('DrawEllipseList', '(self, ellipses, pens=None, brushes=None)', c.addPyMethod('DrawEllipseList', '(self, ellipses, pens=None, brushes=None)',
doc="""\ doc="""\
Draw a list of ellipses as quickly as possible. Draw a list of ellipses as quickly as possible.
:param ellipses: A sequence of 4-element sequences representing :param ellipses: A sequence of 4-element sequences representing
each ellipse to draw, (x,y, w,h). each ellipse to draw, (x,y, w,h).
:param pens: If None, then the current pen is used. If a :param pens: If None, then the current pen is used. If a
single pen then it will be used for all ellipses. single pen then it will be used for all ellipses.
If a list of pens then there should be one for each If a list of pens then there should be one for each
ellipse in ellipses. ellipse in ellipses.
:param brushes: A brush or brushes to be used to fill the ellipses, :param brushes: A brush or brushes to be used to fill the ellipses,
with similar semantics as the pens parameter. with similar semantics as the pens parameter.
@@ -381,17 +381,17 @@ def run():
raise ValueError('ellipses and brushes must have same length') raise ValueError('ellipses and brushes must have same length')
return self._DrawEllipseList(ellipses, pens, brushes) return self._DrawEllipseList(ellipses, pens, brushes)
""") """)
c.addPyMethod('DrawPolygonList', '(self, polygons, pens=None, brushes=None)', c.addPyMethod('DrawPolygonList', '(self, polygons, pens=None, brushes=None)',
doc="""\ doc="""\
Draw a list of polygons, each of which is a list of points. Draw a list of polygons, each of which is a list of points.
:param polygons: A sequence of sequences of sequences. :param polygons: A sequence of sequences of sequences.
[[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]] [[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]]
:param pens: If None, then the current pen is used. If a :param pens: If None, then the current pen is used. If a
single pen then it will be used for all polygons. single pen then it will be used for all polygons.
If a list of pens then there should be one for each If a list of pens then there should be one for each
polygon. polygon.
:param brushes: A brush or brushes to be used to fill the polygons, :param brushes: A brush or brushes to be used to fill the polygons,
with similar semantics as the pens parameter. with similar semantics as the pens parameter.
@@ -411,18 +411,18 @@ def run():
raise ValueError('polygons and brushes must have same length') raise ValueError('polygons and brushes must have same length')
return self._DrawPolygonList(polygons, pens, brushes) return self._DrawPolygonList(polygons, pens, brushes)
""") """)
c.addPyMethod('DrawTextList', '(self, textList, coords, foregrounds=None, backgrounds=None)', c.addPyMethod('DrawTextList', '(self, textList, coords, foregrounds=None, backgrounds=None)',
doc="""\ doc="""\
Draw a list of strings using a list of coordinants for positioning each string. Draw a list of strings using a list of coordinants for positioning each string.
:param textList: A list of strings :param textList: A list of strings
:param coords: A list of (x,y) positions :param coords: A list of (x,y) positions
:param foregrounds: A list of `wx.Colour` objects to use for the :param foregrounds: A list of `wx.Colour` objects to use for the
foregrounds of the strings. foregrounds of the strings.
:param backgrounds: A list of `wx.Colour` objects to use for the :param backgrounds: A list of `wx.Colour` objects to use for the
backgrounds of the strings. backgrounds of the strings.
NOTE: Make sure you set background mode to wx.Solid (DC.SetBackgroundMode) NOTE: Make sure you set background mode to wx.Solid (DC.SetBackgroundMode)
If you want backgrounds to do anything. If you want backgrounds to do anything.
""", """,
@@ -452,7 +452,7 @@ def run():
# TODO: Port the PseudoDC from Classic # TODO: Port the PseudoDC from Classic
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDCClipper') c = module.find('wxDCClipper')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -461,7 +461,7 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDCBrushChanger') c = module.find('wxDCBrushChanger')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -470,7 +470,7 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDCPenChanger') c = module.find('wxDCPenChanger')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -479,7 +479,7 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDCTextColourChanger') c = module.find('wxDCTextColourChanger')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -488,7 +488,7 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxDCFontChanger') c = module.find('wxDCFontChanger')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
@@ -496,13 +496,13 @@ def run():
# context manager methods # context manager methods
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,29 +10,29 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcbuffer" # Base name of the file to generate to for this script NAME = "dcbuffer" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxBufferedDC', ITEMS = [ 'wxBufferedDC',
'wxBufferedPaintDC', 'wxBufferedPaintDC',
'wxAutoBufferedPaintDC', 'wxAutoBufferedPaintDC',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/dcbuffer.h>") module.addHeaderCode("#include <wx/dcbuffer.h>")
c = module.find('wxBufferedDC') c = module.find('wxBufferedDC')
@@ -43,22 +43,22 @@ def run():
if m.findItem('buffer'): if m.findItem('buffer'):
m.findItem('buffer').keepReference = True m.findItem('buffer').keepReference = True
c = module.find('wxBufferedPaintDC') c = module.find('wxBufferedPaintDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('wxBufferedPaintDC').findOverload('wxBitmap').find('buffer').keepReference = True c.find('wxBufferedPaintDC').findOverload('wxBitmap').find('buffer').keepReference = True
c = module.find('wxAutoBufferedPaintDC') c = module.find('wxAutoBufferedPaintDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
module.find('wxAutoBufferedPaintDCFactory').factory = True module.find('wxAutoBufferedPaintDCFactory').factory = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,45 +10,45 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcclient" # Base name of the file to generate to for this script NAME = "dcclient" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxWindowDC', ITEMS = [ 'wxWindowDC',
'wxClientDC', 'wxClientDC',
'wxPaintDC', 'wxPaintDC',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxPaintDC') c = module.find('wxPaintDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c = module.find('wxClientDC') c = module.find('wxClientDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c = module.find('wxWindowDC') c = module.find('wxWindowDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,27 +10,27 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcgraph" # Base name of the file to generate to for this script NAME = "dcgraph" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxGCDC' ] ITEMS = [ 'wxGCDC' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxGCDC') c = module.find('wxGCDC')
# FIXME: Do we handle platform-specific classes, and if so, how? # FIXME: Do we handle platform-specific classes, and if so, how?
c.find('wxGCDC').findOverload('wxEnhMetaFileDC').ignore() c.find('wxGCDC').findOverload('wxEnhMetaFileDC').ignore()
@@ -40,15 +40,15 @@ def run():
c.find('wxGCDC.memoryDC').keepReference = True c.find('wxGCDC.memoryDC').keepReference = True
c.find('wxGCDC.printerDC').keepReference = True c.find('wxGCDC.printerDC').keepReference = True
c.find('wxGCDC.context').transfer = True c.find('wxGCDC.context').transfer = True
c.find('SetGraphicsContext.ctx').transfer = True c.find('SetGraphicsContext.ctx').transfer = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcmemory" # Base name of the file to generate to for this script NAME = "dcmemory" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxMemoryDC' ] ITEMS = [ 'wxMemoryDC' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxMemoryDC') c = module.find('wxMemoryDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcmirror" # Base name of the file to generate to for this script NAME = "dcmirror" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxMirrorDC' ] ITEMS = [ 'wxMirrorDC' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxMirrorDC') c = module.find('wxMirrorDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,37 +10,37 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcprint" # Base name of the file to generate to for this script NAME = "dcprint" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxPrinterDC', ] ITEMS = [ 'wxPrinterDC', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxPrinterDC') c = module.find('wxPrinterDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcps" # Base name of the file to generate to for this script NAME = "dcps" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxPostScriptDC' ] ITEMS = [ 'wxPostScriptDC' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxPostScriptDC') c = module.find('wxPostScriptDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcscreen" # Base name of the file to generate to for this script NAME = "dcscreen" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxScreenDC' ] ITEMS = [ 'wxScreenDC' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxScreenDC') c = module.find('wxScreenDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dcsvg" # Base name of the file to generate to for this script NAME = "dcsvg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxSVGFileDC' ] ITEMS = [ 'wxSVGFileDC' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxSVGFileDC') c = module.find('wxSVGFileDC')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,42 +10,42 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "debug" # Base name of the file to generate to for this script NAME = "debug" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "debug_8h.xml", ITEMS = [ "debug_8h.xml",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
# We only need a couple items from this interface file, so ignore # We only need a couple items from this interface file, so ignore
# everything and just enable the ones we want. # everything and just enable the ones we want.
for item in module: for item in module:
item.ignore() item.ignore()
module.find('wxAbort').ignore(False) module.find('wxAbort').ignore(False)
module.find('wxTrap').ignore(False) module.find('wxTrap').ignore(False)
module.find('wxDisableAsserts').ignore(False) module.find('wxDisableAsserts').ignore(False)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -12,15 +12,15 @@ import sys
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "defs" # Base name of the file to generate to for this script NAME = "defs" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'defs_8h.xml' ] ITEMS = [ 'defs_8h.xml' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
@@ -29,20 +29,20 @@ def run():
check4unittest=False) check4unittest=False)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
module.check4unittest = False module.check4unittest = False
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
# tweaks for defs.h to help SIP understand the types better # tweaks for defs.h to help SIP understand the types better
module.find('wxInt16').type = 'short' module.find('wxInt16').type = 'short'
module.find('wxInt64').type = 'long long' module.find('wxInt64').type = 'long long'
module.find('wxUint64').type = 'unsigned long long' module.find('wxUint64').type = 'unsigned long long'
# See src/wacky_ints.sip # See src/wacky_ints.sip
module.find('wxIntPtr').ignore() module.find('wxIntPtr').ignore()
module.find('wxUIntPtr').ignore() module.find('wxUIntPtr').ignore()
# Correct the types for these as their values are outside the range of int # Correct the types for these as their values are outside the range of int
module.find('wxUINT32_MAX').type = 'unsigned long' module.find('wxUINT32_MAX').type = 'unsigned long'
module.find('wxINT64_MIN').type = 'long long' module.find('wxINT64_MIN').type = 'long long'
@@ -58,12 +58,12 @@ def run():
module.find('wxInt8').pyInt = True module.find('wxInt8').pyInt = True
module.find('wxUint8').pyInt = True module.find('wxUint8').pyInt = True
module.find('wxByte').pyInt = True module.find('wxByte').pyInt = True
module.find('wxDELETE').ignore() module.find('wxDELETE').ignore()
module.find('wxDELETEA').ignore() module.find('wxDELETEA').ignore()
module.find('wxSwap').ignore() module.find('wxSwap').ignore()
module.find('wxVaCopy').ignore() module.find('wxVaCopy').ignore()
# Add some typedefs for basic wx types and others so the backend # Add some typedefs for basic wx types and others so the backend
# generator knows what they are # generator knows what they are
td = module.find('wxUIntPtr') td = module.find('wxUIntPtr')
@@ -74,26 +74,26 @@ def run():
module.insertItemAfter(td, etgtools.TypedefDef(type='SIP_SSIZE_T', name='ssize_t')) module.insertItemAfter(td, etgtools.TypedefDef(type='SIP_SSIZE_T', name='ssize_t'))
module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned char', name='byte', pyInt=True)) module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned char', name='byte', pyInt=True))
module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned long', name='ulong')) module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned long', name='ulong'))
# Forward declarations for classes that are referenced but not defined # Forward declarations for classes that are referenced but not defined
# yet. # yet.
# #
# TODO: Remove these when the classes are added for real. # TODO: Remove these when the classes are added for real.
# TODO: Add these classes for real :-) # TODO: Add these classes for real :-)
module.insertItem(0, etgtools.WigCode("""\ module.insertItem(0, etgtools.WigCode("""\
// forward declarations // forward declarations
class wxExecuteEnv; class wxExecuteEnv;
""")) """))
# Add some code for getting the version numbers # Add some code for getting the version numbers
module.addCppCode(""" module.addCppCode("""
#include <wx/version.h> #include <wx/version.h>
const int MAJOR_VERSION = wxMAJOR_VERSION; const int MAJOR_VERSION = wxMAJOR_VERSION;
const int MINOR_VERSION = wxMINOR_VERSION; const int MINOR_VERSION = wxMINOR_VERSION;
const int RELEASE_NUMBER = wxRELEASE_NUMBER; const int RELEASE_NUMBER = wxRELEASE_NUMBER;
""") """)
module.addItem(etgtools.WigCode(""" module.addItem(etgtools.WigCode("""
const int MAJOR_VERSION; const int MAJOR_VERSION;
@@ -103,14 +103,14 @@ def run():
module.addPyCode("BG_STYLE_CUSTOM = BG_STYLE_PAINT") module.addPyCode("BG_STYLE_CUSTOM = BG_STYLE_PAINT")
module.addItem(etgtools.DefineDef(name='wxADJUST_MINSIZE', value='0')) module.addItem(etgtools.DefineDef(name='wxADJUST_MINSIZE', value='0'))
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,26 +10,26 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dialog" # Base name of the file to generate to for this script NAME = "dialog" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ITEMS = [
'wxDialog', 'wxDialog',
'wxDialogLayoutAdapter', 'wxDialogLayoutAdapter',
'wxWindowModalDialogEvent', 'wxWindowModalDialogEvent',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
@@ -41,18 +41,18 @@ def run():
c.find('wxDialog.title').default = 'wxEmptyString' c.find('wxDialog.title').default = 'wxEmptyString'
c.find('Create.title').default = 'wxEmptyString' c.find('Create.title').default = 'wxEmptyString'
# PocketPC only, don't think we'll need these ;) # PocketPC only, don't think we'll need these ;)
c.find('DoOK').ignore() c.find('DoOK').ignore()
c.find('GetToolBar').ignore() c.find('GetToolBar').ignore()
# Uses a template, but it would be easier to reimplement it in Python if # Uses a template, but it would be easier to reimplement it in Python if
# it is ever needed so don't bother complexifying the wrapper for it. # it is ever needed so don't bother complexifying the wrapper for it.
c.find('ShowWindowModalThenDo').ignore() c.find('ShowWindowModalThenDo').ignore()
# Release the GIL for potentially blocking or long-running functions # Release the GIL for potentially blocking or long-running functions
c.find('ShowModal').releaseGIL() c.find('ShowModal').releaseGIL()
# context manager methods # context manager methods
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Destroy()') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Destroy()')
@@ -67,8 +67,8 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,16 +10,16 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dirctrl" # Base name of the file to generate to for this script NAME = "dirctrl" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxGenericDirCtrl", ITEMS = [ "wxGenericDirCtrl",
"wxDirFilterListCtrl", "wxDirFilterListCtrl",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -27,27 +27,27 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/dirctrl.h>") module.addHeaderCode("#include <wx/dirctrl.h>")
c = module.find('wxGenericDirCtrl') c = module.find('wxGenericDirCtrl')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
c.addPyCode("""\ c.addPyCode("""\
EVT_DIRCTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_DIRCTRL_SELECTIONCHANGED, 1 ) EVT_DIRCTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_DIRCTRL_SELECTIONCHANGED, 1 )
EVT_DIRCTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_DIRCTRL_FILEACTIVATED, 1 ) EVT_DIRCTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_DIRCTRL_FILEACTIVATED, 1 )
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,33 +16,33 @@ NAME = "dirdlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxDirDialog' ] ITEMS = [ 'wxDirDialog' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxDirDialog') c = module.find('wxDirDialog')
module.addGlobalStr('wxDirDialogNameStr', c) module.addGlobalStr('wxDirDialogNameStr', c)
module.addGlobalStr('wxDirDialogDefaultFolderStr', c) module.addGlobalStr('wxDirDialogDefaultFolderStr', c)
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.find('wxDirSelectorPromptStr').ignore() module.find('wxDirSelectorPromptStr').ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,14 +10,14 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "display" # Base name of the file to generate to for this script NAME = "display" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxDisplay', ] ITEMS = [ 'wxDisplay', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -25,31 +25,31 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode("#include <wx/display.h>") module.addHeaderCode("#include <wx/display.h>")
c = module.find('wxDisplay') c = module.find('wxDisplay')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateAssignOp() c.addPrivateAssignOp()
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.addProperty('ClientArea GetClientArea') c.addProperty('ClientArea GetClientArea')
c.addProperty('CurrentMode GetCurrentMode') c.addProperty('CurrentMode GetCurrentMode')
c.addProperty('Geometry GetGeometry') c.addProperty('Geometry GetGeometry')
c.addProperty('Name GetName') c.addProperty('Name GetName')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,19 +10,19 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dnd" # Base name of the file to generate to for this script NAME = "dnd" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "interface_2wx_2dnd_8h.xml", ITEMS = [ "interface_2wx_2dnd_8h.xml",
"wxDropSource", "wxDropSource",
"wxDropTarget", "wxDropTarget",
"wxTextDropTarget", "wxTextDropTarget",
"wxFileDropTarget", "wxFileDropTarget",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -30,13 +30,13 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/dnd.h>') module.addHeaderCode('#include <wx/dnd.h>')
c = module.find('wxDropSource') c = module.find('wxDropSource')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
@@ -53,8 +53,8 @@ def run():
m.find('iconCopy').ignore() m.find('iconCopy').ignore()
m.find('iconMove').ignore() m.find('iconMove').ignore()
m.find('iconNone').ignore() m.find('iconNone').ignore()
# void SetCursor(wxDragResult res, const wxCursor& cursor); # void SetCursor(wxDragResult res, const wxCursor& cursor);
c.find('SetCursor').setCppCode("""\ c.find('SetCursor').setCppCode("""\
#ifdef __WXGTK__ #ifdef __WXGTK__
wxPyRaiseNotImplementedMsg("Cursors not supported, use SetIcon on wxGTK instead."); wxPyRaiseNotImplementedMsg("Cursors not supported, use SetIcon on wxGTK instead.");
@@ -62,7 +62,7 @@ def run():
self->SetCursor(res, *cursor); self->SetCursor(res, *cursor);
#endif #endif
""") """)
# void SetIcon(wxDragResult res, const wxIcon& icon) # void SetIcon(wxDragResult res, const wxIcon& icon)
c.find('SetIcon').setCppCode("""\ c.find('SetIcon').setCppCode("""\
#ifdef __WXGTK__ #ifdef __WXGTK__
@@ -71,29 +71,29 @@ def run():
wxPyRaiseNotImplementedMsg("Icons not supported, use SetCursor on non-wxGTK ports."); wxPyRaiseNotImplementedMsg("Icons not supported, use SetCursor on non-wxGTK ports.");
#endif #endif
""") """)
c = module.find('wxDropTarget') c = module.find('wxDropTarget')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('wxDropTarget.data').transfer = True c.find('wxDropTarget.data').transfer = True
c.find('SetDataObject.data').transfer = True c.find('SetDataObject.data').transfer = True
module.addPyCode("PyDropTarget = wx.deprecated(DropTarget, 'Use DropTarget instead.')") module.addPyCode("PyDropTarget = wx.deprecated(DropTarget, 'Use DropTarget instead.')")
c = module.find('wxTextDropTarget') c = module.find('wxTextDropTarget')
c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);")) c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);"))
c = module.find('wxFileDropTarget') c = module.find('wxFileDropTarget')
c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);")) c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);"))
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,31 +10,31 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "dragimag" # Base name of the file to generate to for this script NAME = "dragimag" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxDragImage", ITEMS = [ "wxDragImage",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
di = module.find('wxDragImage') di = module.find('wxDragImage')
assert isinstance(di, etgtools.ClassDef) assert isinstance(di, etgtools.ClassDef)
# make a copy and rename it to 'wxGenericDragImage' # make a copy and rename it to 'wxGenericDragImage'
gdi = tools.copyClassDef(di, 'wxGenericDragImage') gdi = tools.copyClassDef(di, 'wxGenericDragImage')
module.insertItemAfter(di, gdi) module.insertItemAfter(di, gdi)
@@ -44,17 +44,17 @@ def run():
di.find('GetImageRect').ignore() di.find('GetImageRect').ignore()
di.find('UpdateBackingFromWindow').ignore() di.find('UpdateBackingFromWindow').ignore()
di.addPrivateCopyCtor() di.addPrivateCopyCtor()
# and for wxGenericDragImage # and for wxGenericDragImage
gdi.addPrivateCopyCtor() gdi.addPrivateCopyCtor()
gdi.addHeaderCode("#include <wx/generic/dragimgg.h>") gdi.addHeaderCode("#include <wx/generic/dragimgg.h>")
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,52 +10,52 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_adv" MODULE = "_adv"
NAME = "editlbox" # Base name of the file to generate to for this script NAME = "editlbox" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxEditableListBox", ITEMS = [ "wxEditableListBox",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxEditableListBox') c = module.find('wxEditableListBox')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
c.find('wxEditableListBox.label').default = 'wxEmptyString' c.find('wxEditableListBox.label').default = 'wxEmptyString'
c.find('Create.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString'
module.addHeaderCode('#include <wx/editlbox.h>') module.addHeaderCode('#include <wx/editlbox.h>')
module.addGlobalStr('wxEditableListBoxNameStr', c) module.addGlobalStr('wxEditableListBoxNameStr', c)
c.find('GetStrings').ignore() c.find('GetStrings').ignore()
c.addCppMethod('wxArrayString*', 'GetStrings', '()', c.addCppMethod('wxArrayString*', 'GetStrings', '()',
doc="Returns a list of the current contents of the control.", doc="Returns a list of the current contents of the control.",
body="""\ body="""\
wxArrayString* arr = new wxArrayString; wxArrayString* arr = new wxArrayString;
self->GetStrings(*arr); self->GetStrings(*arr);
return arr;""", return arr;""",
factory=True) factory=True)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -11,14 +11,14 @@ import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "event" # Base name of the file to generate to for this script NAME = "event" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ITEMS = [
'wxEvtHandler', 'wxEvtHandler',
'wxEventBlocker', 'wxEventBlocker',
'wxPropagationDisabler', 'wxPropagationDisabler',
@@ -62,14 +62,14 @@ ITEMS = [
'wxUpdateUIEvent', 'wxUpdateUIEvent',
'wxWindowCreateEvent', 'wxWindowCreateEvent',
'wxWindowDestroyEvent', 'wxWindowDestroyEvent',
#'wxThreadEvent',
]
OTHERDEPS = [ 'src/event_ex.py', #'wxThreadEvent',
'src/event_ex.cpp',
]
OTHERDEPS = [ 'src/event_ex.py',
'src/event_ex.cpp',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -78,17 +78,17 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addCppCode(""" module.addCppCode("""
#if !wxUSE_HOTKEY #if !wxUSE_HOTKEY
#define wxEVT_HOTKEY 0 #define wxEVT_HOTKEY 0
#endif #endif
""") """)
# C macros that need to be ignored # C macros that need to be ignored
module.find('wx__DECLARE_EVT0').ignore() module.find('wx__DECLARE_EVT0').ignore()
module.find('wx__DECLARE_EVT1').ignore() module.find('wx__DECLARE_EVT1').ignore()
@@ -97,7 +97,7 @@ def run():
module.find('wxDECLARE_EXPORTED_EVENT').ignore() module.find('wxDECLARE_EXPORTED_EVENT').ignore()
module.find('wxDECLARE_EVENT').ignore() module.find('wxDECLARE_EVENT').ignore()
module.find('wxDEFINE_EVENT').ignore() module.find('wxDEFINE_EVENT').ignore()
module.addPyClass('PyEventBinder', ['object'], module.addPyClass('PyEventBinder', ['object'],
doc="""\ doc="""\
@@ -109,20 +109,20 @@ def run():
if expectedIDs not in [0, 1, 2]: if expectedIDs not in [0, 1, 2]:
raise ValueError("Invalid number of expectedIDs") raise ValueError("Invalid number of expectedIDs")
self.expectedIDs = expectedIDs self.expectedIDs = expectedIDs
if isinstance(evtType, (list, tuple)): if isinstance(evtType, (list, tuple)):
self.evtType = list(evtType) self.evtType = list(evtType)
else: else:
self.evtType = [evtType] self.evtType = [evtType]
"""), """),
PyFunctionDef('Bind', '(self, target, id1, id2, function)', PyFunctionDef('Bind', '(self, target, id1, id2, function)',
doc="""Bind this set of event types to target using its Connect() method.""", doc="""Bind this set of event types to target using its Connect() method.""",
body="""\ body="""\
for et in self.evtType: for et in self.evtType:
target.Connect(id1, id2, et, function) target.Connect(id1, id2, et, function)
"""), """),
PyFunctionDef('Unbind', '(self, target, id1, id2, handler=None)', PyFunctionDef('Unbind', '(self, target, id1, id2, handler=None)',
doc="""Remove an event binding.""", doc="""Remove an event binding.""",
body="""\ body="""\
@@ -131,16 +131,16 @@ def run():
success += target.Disconnect(id1, id2, et, handler) success += target.Disconnect(id1, id2, et, handler)
return success != 0 return success != 0
"""), """),
PyFunctionDef('_getEvtType', '(self)', PyFunctionDef('_getEvtType', '(self)',
doc="""\ doc="""\
Make it easy to get to the default wxEventType typeID for this Make it easy to get to the default wxEventType typeID for this
event binder. event binder.
""", """,
body="""return self.evtType[0]"""), body="""return self.evtType[0]"""),
PyPropertyDef('typeId', '_getEvtType'), PyPropertyDef('typeId', '_getEvtType'),
PyFunctionDef('__call__', '(self, *args)', PyFunctionDef('__call__', '(self, *args)',
deprecated="Use :meth:`EvtHandler.Bind` instead.", deprecated="Use :meth:`EvtHandler.Bind` instead.",
doc="""\ doc="""\
@@ -165,14 +165,14 @@ def run():
func = args[3] func = args[3]
else: else:
raise ValueError("Unexpected number of IDs") raise ValueError("Unexpected number of IDs")
self.Bind(target, id1, id2, func) self.Bind(target, id1, id2, func)
""") """)
]) ])
module.includePyCode('src/event_ex.py') module.includePyCode('src/event_ex.py')
#--------------------------------------- #---------------------------------------
# wxEvtHandler # wxEvtHandler
c = module.find('wxEvtHandler') c = module.find('wxEvtHandler')
@@ -180,13 +180,13 @@ def run():
c.addPublic() c.addPublic()
c.includeCppCode('src/event_ex.cpp') c.includeCppCode('src/event_ex.cpp')
# Ignore the Connect/Disconnect and Bind/Unbind methods (and all overloads) for now. # Ignore the Connect/Disconnect and Bind/Unbind methods (and all overloads) for now.
for item in c.allItems(): for item in c.allItems():
if item.name in ['Connect', 'Disconnect', 'Bind', 'Unbind']: if item.name in ['Connect', 'Disconnect', 'Bind', 'Unbind']:
item.ignore() item.ignore()
# Connect and Disconnect methods for wxPython. Hold a reference to the # Connect and Disconnect methods for wxPython. Hold a reference to the
# event handler function in the event table, so we can fetch it later when # event handler function in the event table, so we can fetch it later when
# it is time to handle the event. # it is time to handle the event.
@@ -214,7 +214,7 @@ def run():
c.addCppMethod( c.addCppMethod(
'bool', 'Disconnect', '(int id, int lastId=-1, ' 'bool', 'Disconnect', '(int id, int lastId=-1, '
'wxEventType eventType=wxEVT_NULL, ' 'wxEventType eventType=wxEVT_NULL, '
'PyObject* func=NULL)', 'PyObject* func=NULL)',
doc="Remove an event binding by removing its entry in the dynamic event table.", doc="Remove an event binding by removing its entry in the dynamic event table.",
body="""\ body="""\
if (func && func != Py_None) { if (func && func != Py_None) {
@@ -239,7 +239,7 @@ def run():
self->GetDynamicEventTable()->Erase(node); self->GetDynamicEventTable()->Erase(node);
delete entry; delete entry;
return true; return true;
} }
} }
node = node->GetNext(); node = node->GetNext();
} }
@@ -252,20 +252,20 @@ def run():
} }
""") """)
# Ignore the C++ version of CallAfter. We have our own. # Ignore the C++ version of CallAfter. We have our own.
# TODO: If we want to support this we'll need concrete implementations of # TODO: If we want to support this we'll need concrete implementations of
# the template, probably using PyObject* args. # the template, probably using PyObject* args.
for m in c.find('CallAfter').all(): for m in c.find('CallAfter').all():
m.ignore() m.ignore()
# wxEventTable is not documented so we have to ignore SearchEventTable. # wxEventTable is not documented so we have to ignore SearchEventTable.
# TODO: Should wxEventTable be available to language bindings? # TODO: Should wxEventTable be available to language bindings?
c.find('SearchEventTable').ignore() c.find('SearchEventTable').ignore()
c.find('QueueEvent.event').transfer = True c.find('QueueEvent.event').transfer = True
module.find('wxQueueEvent.event').transfer = True module.find('wxQueueEvent.event').transfer = True
# TODO: If we don't need to use the wxEvtHandler's client data for our own # TODO: If we don't need to use the wxEvtHandler's client data for our own
# tracking then enable these.... # tracking then enable these....
c.find('GetClientObject').ignore() c.find('GetClientObject').ignore()
@@ -292,14 +292,14 @@ def run():
c.addPyMethod('Bind', '(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY)', c.addPyMethod('Bind', '(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY)',
doc="""\ doc="""\
Bind an event to an event handler. Bind an event to an event handler.
:param event: One of the ``EVT_*`` event binder objects that :param event: One of the ``EVT_*`` event binder objects that
specifies the type of event to bind. specifies the type of event to bind.
:param handler: A callable object to be invoked when the :param handler: A callable object to be invoked when the
event is delivered to self. Pass ``None`` to event is delivered to self. Pass ``None`` to
disconnect an event handler. disconnect an event handler.
:param source: Sometimes the event originates from a :param source: Sometimes the event originates from a
different window than self, but you still different window than self, but you still
want to catch it in self. (For example, a want to catch it in self. (For example, a
@@ -308,10 +308,10 @@ def run():
handling system is able to differentiate handling system is able to differentiate
between the same event type from different between the same event type from different
controls. controls.
:param id: Used to spcify the event source by ID instead :param id: Used to spcify the event source by ID instead
of instance. of instance.
:param id2: Used when it is desirable to bind a handler :param id2: Used when it is desirable to bind a handler
to a range of IDs, such as with EVT_MENU_RANGE. to a range of IDs, such as with EVT_MENU_RANGE.
""", """,
@@ -321,10 +321,10 @@ def run():
assert source is None or hasattr(source, 'GetId') assert source is None or hasattr(source, 'GetId')
if source is not None: if source is not None:
id = source.GetId() id = source.GetId()
event.Bind(self, id, id2, handler) event.Bind(self, id, id2, handler)
""") """)
c.addPyMethod('Unbind', '(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None)', c.addPyMethod('Unbind', '(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None)',
doc="""\ doc="""\
Disconnects the event handler binding for event from `self`. Disconnects the event handler binding for event from `self`.
@@ -333,7 +333,7 @@ def run():
body="""\ body="""\
if source is not None: if source is not None:
id = source.GetId() id = source.GetId()
return event.Unbind(self, id, id2, handler) return event.Unbind(self, id, id2, handler)
""") """)
module.addPyCode('PyEvtHandler = wx.deprecated(EvtHandler, "Use :class:`EvtHandler` instead.")') module.addPyCode('PyEvtHandler = wx.deprecated(EvtHandler, "Use :class:`EvtHandler` instead.")')
@@ -345,40 +345,40 @@ def run():
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
c.find('Clone').factory = True c.find('Clone').factory = True
c.addProperty('EventObject GetEventObject SetEventObject') c.addProperty('EventObject GetEventObject SetEventObject')
c.addProperty('EventType GetEventType SetEventType') c.addProperty('EventType GetEventType SetEventType')
c.addProperty('Id GetId SetId') c.addProperty('Id GetId SetId')
c.addProperty('Skipped GetSkipped') c.addProperty('Skipped GetSkipped')
c.addProperty('Timestamp GetTimestamp SetTimestamp') c.addProperty('Timestamp GetTimestamp SetTimestamp')
#--------------------------------------- #---------------------------------------
# wxCommandEvent # wxCommandEvent
c = module.find('wxCommandEvent') c = module.find('wxCommandEvent')
c.find('GetClientData').ignore() c.find('GetClientData').ignore()
c.find('SetClientData').ignore() c.find('SetClientData').ignore()
c.addPyCode("""\ c.addPyCode("""\
CommandEvent.GetClientData = CommandEvent.GetClientObject CommandEvent.GetClientData = CommandEvent.GetClientObject
CommandEvent.SetClientData = CommandEvent.SetClientObject""") CommandEvent.SetClientData = CommandEvent.SetClientObject""")
c.addProperty('ClientObject GetClientObject SetClientObject') c.addProperty('ClientObject GetClientObject SetClientObject')
c.addPyCode('CommandEvent.ClientData = CommandEvent.ClientObject') c.addPyCode('CommandEvent.ClientData = CommandEvent.ClientObject')
c.addProperty('ExtraLong GetExtraLong SetExtraLong') c.addProperty('ExtraLong GetExtraLong SetExtraLong')
c.addProperty('Int GetInt SetInt') c.addProperty('Int GetInt SetInt')
c.addProperty('Selection GetSelection') c.addProperty('Selection GetSelection')
c.addProperty('String GetString SetString') c.addProperty('String GetString SetString')
#--------------------------------------- #---------------------------------------
# wxKeyEvent # wxKeyEvent
c = module.find('wxKeyEvent') c = module.find('wxKeyEvent')
c.find('GetPosition').findOverload('wxCoord').ignore() c.find('GetPosition').findOverload('wxCoord').ignore()
c.find('GetUnicodeKey').type = 'int' c.find('GetUnicodeKey').type = 'int'
c.addProperty('X GetX') c.addProperty('X GetX')
c.addProperty('Y GetY') c.addProperty('Y GetY')
c.addProperty('KeyCode GetKeyCode') c.addProperty('KeyCode GetKeyCode')
@@ -386,19 +386,19 @@ def run():
c.addProperty('RawKeyCode GetRawKeyCode') c.addProperty('RawKeyCode GetRawKeyCode')
c.addProperty('RawKeyFlags GetRawKeyFlags') c.addProperty('RawKeyFlags GetRawKeyFlags')
c.addProperty('UnicodeKey GetUnicodeKey') c.addProperty('UnicodeKey GetUnicodeKey')
#--------------------------------------- #---------------------------------------
# wxScrollEvent # wxScrollEvent
c = module.find('wxScrollEvent') c = module.find('wxScrollEvent')
c.addProperty('Orientation GetOrientation SetOrientation') c.addProperty('Orientation GetOrientation SetOrientation')
c.addProperty('Position GetPosition SetPosition') c.addProperty('Position GetPosition SetPosition')
#--------------------------------------- #---------------------------------------
# wxScrollWinEvent # wxScrollWinEvent
c = module.find('wxScrollWinEvent') c = module.find('wxScrollWinEvent')
c.addProperty('Orientation GetOrientation SetOrientation') c.addProperty('Orientation GetOrientation SetOrientation')
c.addProperty('Position GetPosition SetPosition') c.addProperty('Position GetPosition SetPosition')
#--------------------------------------- #---------------------------------------
# wxMouseEvent # wxMouseEvent
c = module.find('wxMouseEvent') c = module.find('wxMouseEvent')
@@ -406,59 +406,59 @@ def run():
c.addProperty('LogicalPosition GetLogicalPosition') c.addProperty('LogicalPosition GetLogicalPosition')
c.addProperty('WheelDelta GetWheelDelta') c.addProperty('WheelDelta GetWheelDelta')
c.addProperty('WheelRotation GetWheelRotation') c.addProperty('WheelRotation GetWheelRotation')
#--------------------------------------- #---------------------------------------
# wxSetCursorEvent # wxSetCursorEvent
c = module.find('wxSetCursorEvent') c = module.find('wxSetCursorEvent')
c.addProperty('Cursor GetCursor SetCursor') c.addProperty('Cursor GetCursor SetCursor')
c.addProperty('X GetX') c.addProperty('X GetX')
c.addProperty('Y GetY') c.addProperty('Y GetY')
#--------------------------------------- #---------------------------------------
# wxSizeEvent # wxSizeEvent
c = module.find('wxSizeEvent') c = module.find('wxSizeEvent')
c.addProperty('Rect GetRect SetRect') c.addProperty('Rect GetRect SetRect')
c.addProperty('Size GetSize SetSize') c.addProperty('Size GetSize SetSize')
#--------------------------------------- #---------------------------------------
# wxMoveEvent # wxMoveEvent
c = module.find('wxMoveEvent') c = module.find('wxMoveEvent')
c.addProperty('Rect GetRect SetRect') c.addProperty('Rect GetRect SetRect')
c.addProperty('Position GetPosition SetPosition') c.addProperty('Position GetPosition SetPosition')
#--------------------------------------- #---------------------------------------
# wxEraseEvent # wxEraseEvent
c = module.find('wxEraseEvent') c = module.find('wxEraseEvent')
c.addProperty('DC GetDC') c.addProperty('DC GetDC')
#--------------------------------------- #---------------------------------------
# wxFocusEvent # wxFocusEvent
c = module.find('wxFocusEvent') c = module.find('wxFocusEvent')
c.addProperty('Window GetWindow SetWindow') c.addProperty('Window GetWindow SetWindow')
#--------------------------------------- #---------------------------------------
# wxChildFocusEvent # wxChildFocusEvent
c = module.find('wxChildFocusEvent') c = module.find('wxChildFocusEvent')
c.addProperty('Window GetWindow') c.addProperty('Window GetWindow')
#--------------------------------------- #---------------------------------------
# wxActivateEvent # wxActivateEvent
c = module.find('wxActivateEvent') c = module.find('wxActivateEvent')
c.addProperty('Active GetActive') c.addProperty('Active GetActive')
#--------------------------------------- #---------------------------------------
# wxMenuEvent # wxMenuEvent
c = module.find('wxMenuEvent') c = module.find('wxMenuEvent')
c.addProperty('Menu GetMenu') c.addProperty('Menu GetMenu')
c.addProperty('MenuId GetMenuId') c.addProperty('MenuId GetMenuId')
#--------------------------------------- #---------------------------------------
# wxShowEvent # wxShowEvent
c = module.find('wxShowEvent') c = module.find('wxShowEvent')
c.find('GetShow').ignore() # deprecated c.find('GetShow').ignore() # deprecated
c.addProperty('Show IsShown SetShow') c.addProperty('Show IsShown SetShow')
#--------------------------------------- #---------------------------------------
# wxDropFilesEvent # wxDropFilesEvent
c = module.find('wxDropFilesEvent') c = module.find('wxDropFilesEvent')
@@ -472,25 +472,25 @@ def run():
# one to the API, and also assign a Python reference to it to the event # one to the API, and also assign a Python reference to it to the event
# object, so it will get garbage collected later. # object, so it will get garbage collected later.
c.find('wxDropFilesEvent.files').array = True c.find('wxDropFilesEvent.files').array = True
c.find('wxDropFilesEvent.files').transfer = True c.find('wxDropFilesEvent.files').transfer = True
c.find('wxDropFilesEvent.noFiles').arraySize = True c.find('wxDropFilesEvent.noFiles').arraySize = True
c.addHeaderCode('#include "arrayholder.h"') c.addHeaderCode('#include "arrayholder.h"')
c.find('wxDropFilesEvent').setCppCode_sip("""\ c.find('wxDropFilesEvent').setCppCode_sip("""\
if (files) { if (files) {
wxStringCArrayHolder* holder = new wxStringCArrayHolder; wxStringCArrayHolder* holder = new wxStringCArrayHolder;
holder->m_array = files; holder->m_array = files;
// Make a PyObject for the holder, and transfer its ownership to self. // Make a PyObject for the holder, and transfer its ownership to self.
PyObject* pyHolder = sipConvertFromNewType( PyObject* pyHolder = sipConvertFromNewType(
(void*)holder, sipType_wxStringCArrayHolder, (PyObject*)sipSelf); (void*)holder, sipType_wxStringCArrayHolder, (PyObject*)sipSelf);
Py_DECREF(pyHolder); Py_DECREF(pyHolder);
sipCpp = new sipwxDropFilesEvent(id,(int)noFiles, holder->m_array); sipCpp = new sipwxDropFilesEvent(id,(int)noFiles, holder->m_array);
} }
else else
sipCpp = new sipwxDropFilesEvent(id); sipCpp = new sipwxDropFilesEvent(id);
""") """)
c.find('GetFiles').type = 'PyObject*' c.find('GetFiles').type = 'PyObject*'
c.find('GetFiles').setCppCode("""\ c.find('GetFiles').setCppCode("""\
int count = self->GetNumberOfFiles(); int count = self->GetNumberOfFiles();
@@ -505,13 +505,13 @@ def run():
PyObject* s = wx2PyString(files[i]); PyObject* s = wx2PyString(files[i]);
PyList_SET_ITEM(list, i, s); PyList_SET_ITEM(list, i, s);
} }
return list; return list;
""") """)
c.addProperty('Files GetFiles') c.addProperty('Files GetFiles')
c.addProperty('NumberOfFiles GetNumberOfFiles') c.addProperty('NumberOfFiles GetNumberOfFiles')
c.addProperty('Position GetPosition') c.addProperty('Position GetPosition')
#--------------------------------------- #---------------------------------------
# wxUpdateUIEvent # wxUpdateUIEvent
c = module.find('wxUpdateUIEvent') c = module.find('wxUpdateUIEvent')
@@ -519,49 +519,49 @@ def run():
c.addProperty('Enabled GetEnabled Enable') c.addProperty('Enabled GetEnabled Enable')
c.addProperty('Shown GetShown Show') c.addProperty('Shown GetShown Show')
c.addProperty('Text GetText SetText') c.addProperty('Text GetText SetText')
#--------------------------------------- #---------------------------------------
# wxMouseCaptureChangedEvent # wxMouseCaptureChangedEvent
c = module.find('wxMouseCaptureChangedEvent') c = module.find('wxMouseCaptureChangedEvent')
c.addProperty('CapturedWindow GetCapturedWindow') c.addProperty('CapturedWindow GetCapturedWindow')
#--------------------------------------- #---------------------------------------
# wxPaletteChangedEvent # wxPaletteChangedEvent
c = module.find('wxPaletteChangedEvent') c = module.find('wxPaletteChangedEvent')
c.addProperty('ChangedWindow GetChangedWindow SetChangedWindow') c.addProperty('ChangedWindow GetChangedWindow SetChangedWindow')
#--------------------------------------- #---------------------------------------
# wxQueryNewPaletteEvent # wxQueryNewPaletteEvent
c = module.find('wxQueryNewPaletteEvent') c = module.find('wxQueryNewPaletteEvent')
c.addProperty('PaletteRealized GetPaletteRealized SetPaletteRealized') c.addProperty('PaletteRealized GetPaletteRealized SetPaletteRealized')
#--------------------------------------- #---------------------------------------
# wxNavigationKeyEvent # wxNavigationKeyEvent
c = module.find('wxNavigationKeyEvent') c = module.find('wxNavigationKeyEvent')
c.addProperty('CurrentFocus GetCurrentFocus SetCurrentFocus') c.addProperty('CurrentFocus GetCurrentFocus SetCurrentFocus')
c.addProperty('Direction GetDirection SetDirection') c.addProperty('Direction GetDirection SetDirection')
#--------------------------------------- #---------------------------------------
# wxWindowCreateEvent # wxWindowCreateEvent
c = module.find('wxWindowCreateEvent') c = module.find('wxWindowCreateEvent')
c.addProperty('Window GetWindow') c.addProperty('Window GetWindow')
#--------------------------------------- #---------------------------------------
# wxWindowDestroyEvent # wxWindowDestroyEvent
c = module.find('wxWindowDestroyEvent') c = module.find('wxWindowDestroyEvent')
c.addProperty('Window GetWindow') c.addProperty('Window GetWindow')
#--------------------------------------- #---------------------------------------
# wxContextMenuEvent # wxContextMenuEvent
c = module.find('wxContextMenuEvent') c = module.find('wxContextMenuEvent')
c.addProperty('Position GetPosition SetPosition') c.addProperty('Position GetPosition SetPosition')
#--------------------------------------- #---------------------------------------
# wxIconizeEvent # wxIconizeEvent
module.find('wxIconizeEvent.Iconized').deprecated = True module.find('wxIconizeEvent.Iconized').deprecated = True
# Apply common fixups for all the event classes # Apply common fixups for all the event classes
for name in [n for n in ITEMS if n.endswith('Event')]: for name in [n for n in ITEMS if n.endswith('Event')]:
c = module.find(name) c = module.find(name)
@@ -586,13 +586,13 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,15 +10,15 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "eventfilter" # Base name of the file to generate to for this script NAME = "eventfilter" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxEventFilter" ] ITEMS = [ "wxEventFilter" ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
@@ -26,20 +26,20 @@ def run():
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
check4unittest=False) check4unittest=False)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxEventFilter') c = module.find('wxEventFilter')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True c.noDefCtor = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,24 +10,24 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "evtloop" # Base name of the file to generate to for this script NAME = "evtloop" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxEventLoopBase', ITEMS = [ 'wxEventLoopBase',
'wxEventLoopActivator', 'wxEventLoopActivator',
'wxGUIEventLoop', 'wxGUIEventLoop',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
check4unittest=False # wxEventLoop is well tested in check4unittest=False # wxEventLoop is well tested in
# myYield used by other tests... # myYield used by other tests...
) )
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
@@ -35,7 +35,7 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxEventLoopBase') c = module.find('wxEventLoopBase')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.abstract = True c.abstract = True
@@ -43,21 +43,21 @@ def run():
c.find('Yield').releaseGIL() c.find('Yield').releaseGIL()
c.find('YieldFor').releaseGIL() c.find('YieldFor').releaseGIL()
c.find('OnExit').ignore(False) c.find('OnExit').ignore(False)
c = module.find('wxEventLoopActivator') c = module.find('wxEventLoopActivator')
c.addPrivateAssignOp() c.addPrivateAssignOp()
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
# context manager methods # context manager methods
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
c = module.find('wxGUIEventLoop') c = module.find('wxGUIEventLoop')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
# Add declaration of the base class pure virtuals so sip knows they have # Add declaration of the base class pure virtuals so sip knows they have
# implementations here # implementations here
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
@@ -71,7 +71,7 @@ def run():
virtual void WakeUp(); virtual void WakeUp();
virtual bool YieldFor(long eventsToProcess); virtual bool YieldFor(long eventsToProcess);
""")) """))
module.addPyCode("""\ module.addPyCode("""\
@wx.deprecatedMsg('Use GUIEventLoop instead.') @wx.deprecatedMsg('Use GUIEventLoop instead.')
class EventLoop(GUIEventLoop): class EventLoop(GUIEventLoop):
@@ -79,13 +79,13 @@ def run():
def __init__(self): def __init__(self):
GUIEventLoop.__init__(self) GUIEventLoop.__init__(self)
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,40 +10,40 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "fdrepdlg" # Base name of the file to generate to for this script NAME = "fdrepdlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFindDialogEvent", ITEMS = [ "wxFindDialogEvent",
"wxFindReplaceData", "wxFindReplaceData",
"wxFindReplaceDialog", "wxFindReplaceDialog",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFindDialogEvent') c = module.find('wxFindDialogEvent')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixEventClass(c) tools.fixEventClass(c)
c.addPyCode("""\ c.addPyCode("""\
EVT_FIND = wx.PyEventBinder( wxEVT_FIND, 1 ) EVT_FIND = wx.PyEventBinder( wxEVT_FIND, 1 )
EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_FIND_NEXT, 1 ) EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_FIND_NEXT, 1 )
EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_FIND_REPLACE, 1 ) EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_FIND_REPLACE, 1 )
EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_FIND_REPLACE_ALL, 1 ) EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_FIND_REPLACE_ALL, 1 )
EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_FIND_CLOSE, 1 ) EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_FIND_CLOSE, 1 )
# deprecated wxEVT aliases # deprecated wxEVT aliases
wxEVT_COMMAND_FIND = wxEVT_FIND wxEVT_COMMAND_FIND = wxEVT_FIND
wxEVT_COMMAND_FIND_NEXT = wxEVT_FIND_NEXT wxEVT_COMMAND_FIND_NEXT = wxEVT_FIND_NEXT
@@ -51,16 +51,16 @@ def run():
wxEVT_COMMAND_FIND_REPLACE_ALL = wxEVT_FIND_REPLACE_ALL wxEVT_COMMAND_FIND_REPLACE_ALL = wxEVT_FIND_REPLACE_ALL
wxEVT_COMMAND_FIND_CLOSE = wxEVT_FIND_CLOSE wxEVT_COMMAND_FIND_CLOSE = wxEVT_FIND_CLOSE
""") """)
c = module.find('wxFindReplaceDialog') c = module.find('wxFindReplaceDialog')
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,51 +10,51 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "filectrl" # Base name of the file to generate to for this script NAME = "filectrl" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFileCtrl", ITEMS = [ "wxFileCtrl",
"wxFileCtrlEvent", "wxFileCtrlEvent",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/filectrl.h>') module.addHeaderCode('#include <wx/filectrl.h>')
c = module.find('wxFileCtrl') c = module.find('wxFileCtrl')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c) tools.fixWindowClass(c)
module.addGlobalStr('wxFileCtrlNameStr', c) module.addGlobalStr('wxFileCtrlNameStr', c)
c.find('GetFilenames').ignore() c.find('GetFilenames').ignore()
c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\ c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\
Returns a list of filenames selected in the control. This function Returns a list of filenames selected in the control. This function
should only be used with controls which have the wx.FC_MULTIPLE style, should only be used with controls which have the wx.FC_MULTIPLE style,
use GetFilename for the others.""", use GetFilename for the others.""",
body="""\ body="""\
wxArrayString* arr = new wxArrayString; wxArrayString* arr = new wxArrayString;
self->GetFilenames(*arr); self->GetFilenames(*arr);
return arr;""", return arr;""",
factory=True) factory=True)
c.find('GetPaths').ignore() c.find('GetPaths').ignore()
c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\ c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\
Returns a list of the full paths (directory and filename) of the files Returns a list of the full paths (directory and filename) of the files
chosen. This function should only be used with controlss which have chosen. This function should only be used with controlss which have
the wx.FC_MULTIPLE style, use GetPath for the others. the wx.FC_MULTIPLE style, use GetPath for the others.
""", """,
body="""\ body="""\
@@ -62,9 +62,9 @@ def run():
self->GetPaths(*arr); self->GetPaths(*arr);
return arr;""", return arr;""",
factory=True) factory=True)
c = module.find('wxFileCtrlEvent') c = module.find('wxFileCtrlEvent')
tools.fixEventClass(c) tools.fixEventClass(c)
c.addPyCode("""\ c.addPyCode("""\
@@ -73,12 +73,12 @@ def run():
EVT_FILECTRL_FOLDERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FOLDERCHANGED, 1) EVT_FILECTRL_FOLDERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FOLDERCHANGED, 1)
EVT_FILECTRL_FILTERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FILTERCHANGED, 1) EVT_FILECTRL_FILTERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FILTERCHANGED, 1)
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,26 +17,26 @@ NAME = "filedlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxFileDialog' ] ITEMS = [ 'wxFileDialog' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFileDialog') c = module.find('wxFileDialog')
isinstance(c, etgtools.ClassDef) isinstance(c, etgtools.ClassDef)
module.addGlobalStr('wxFileDialogNameStr', c) module.addGlobalStr('wxFileDialogNameStr', c)
module.find('wxFileSelectorDefaultWildcardStr').ignore() module.find('wxFileSelectorDefaultWildcardStr').ignore()
# TODO: add this back. We'll need a way to pass it a callable that can be # TODO: add this back. We'll need a way to pass it a callable that can be
# called from a C ExtraControlCreatorFunction function # called from a C ExtraControlCreatorFunction function
c.find('SetExtraControlCreator').ignore() c.find('SetExtraControlCreator').ignore()
@@ -46,18 +46,18 @@ def run():
c.find('GetFilenames').ignore() c.find('GetFilenames').ignore()
c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\ c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\
Returns a list of filenames chosen in the dialog. This function Returns a list of filenames chosen in the dialog. This function
should only be used with the dialogs which have wx.MULTIPLE style, should only be used with the dialogs which have wx.MULTIPLE style,
use GetFilename for the others.""", use GetFilename for the others.""",
body="""\ body="""\
wxArrayString* arr = new wxArrayString; wxArrayString* arr = new wxArrayString;
self->GetFilenames(*arr); self->GetFilenames(*arr);
return arr;""", return arr;""",
factory=True) factory=True)
c.find('GetPaths').ignore() c.find('GetPaths').ignore()
c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\ c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\
Returns a list of the full paths of the files chosen. This function Returns a list of the full paths of the files chosen. This function
should only be used with the dialogs which have wx.MULTIPLE style, use should only be used with the dialogs which have wx.MULTIPLE style, use
GetPath for the others. GetPath for the others.
""", """,
body="""\ body="""\
@@ -65,15 +65,15 @@ def run():
self->GetPaths(*arr); self->GetPaths(*arr);
return arr;""", return arr;""",
factory=True) factory=True)
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,43 +10,43 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "filehistory" # Base name of the file to generate to for this script NAME = "filehistory" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFileHistory", ITEMS = [ "wxFileHistory",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFileHistory') c = module.find('wxFileHistory')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
# There is already a wxMenuList class so we have to name this one something else. # There is already a wxMenuList class so we have to name this one something else.
module.addItem( module.addItem(
tools.wxListWrapperTemplate('wxList', 'wxMenu', module, tools.wxListWrapperTemplate('wxList', 'wxMenu', module,
fakeListClassName='wxFileHistoryMenuList')) fakeListClassName='wxFileHistoryMenuList'))
c.find('GetMenus').type = 'const wxFileHistoryMenuList&' c.find('GetMenus').type = 'const wxFileHistoryMenuList&'
c.find('GetMenus').noCopy = True c.find('GetMenus').noCopy = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,13 +10,13 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "filesys" # Base name of the file to generate to for this script NAME = "filesys" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFileSystem", ITEMS = [ "wxFileSystem",
"wxFSFile", "wxFSFile",
"wxFileSystemHandler", "wxFileSystemHandler",
@@ -24,19 +24,19 @@ ITEMS = [ "wxFileSystem",
"wxArchiveFSHandler", "wxArchiveFSHandler",
"wxFilterFSHandler", "wxFilterFSHandler",
"wxInternetFSHandler", "wxInternetFSHandler",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFileSystem') c = module.find('wxFileSystem')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
@@ -61,15 +61,15 @@ def run():
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
module.addPyCode('ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")') module.addPyCode('ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")')
_fixHandlerClass(c) _fixHandlerClass(c)
c = module.find('wxFSFile') c = module.find('wxFSFile')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
_fixHandlerClass(c) _fixHandlerClass(c)
c = module.find('wxFilterFSHandler') c = module.find('wxFilterFSHandler')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
_fixHandlerClass(c) _fixHandlerClass(c)
c = module.find('wxInternetFSHandler') c = module.find('wxInternetFSHandler')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
_fixHandlerClass(c) _fixHandlerClass(c)
@@ -103,8 +103,8 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,35 +10,35 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "font" # Base name of the file to generate to for this script NAME = "font" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxFontInfo', ITEMS = [ 'wxFontInfo',
'wxFont', 'wxFont',
'wxFontList', 'wxFontList',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFont') c = module.find('wxFont')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.removeVirtuals(c) tools.removeVirtuals(c)
# FFont factory function for backwards compatibility # FFont factory function for backwards compatibility
module.addCppFunction('wxFont*', 'FFont', module.addCppFunction('wxFont*', 'FFont',
"""(int pointSize, """(int pointSize,
wxFontFamily family, wxFontFamily family,
int flags = wxFONTFLAG_DEFAULT, int flags = wxFONTFLAG_DEFAULT,
@@ -49,10 +49,10 @@ def run():
wxFont* font = wxFont::New(pointSize, family, flags, *faceName, encoding); wxFont* font = wxFont::New(pointSize, family, flags, *faceName, encoding);
return font; return font;
""", factory=True) """, factory=True)
for item in c.findAll('New'): for item in c.findAll('New'):
item.factory = True item.factory = True
c.addProperty('Encoding GetEncoding SetEncoding') c.addProperty('Encoding GetEncoding SetEncoding')
c.addProperty('FaceName GetFaceName SetFaceName') c.addProperty('FaceName GetFaceName SetFaceName')
c.addProperty('Family GetFamily SetFamily') c.addProperty('Family GetFamily SetFamily')
@@ -72,7 +72,7 @@ def run():
return self->IsOk(); return self->IsOk();
""") """)
c.addCppMethod('void*', 'GetHFONT', '()', c.addCppMethod('void*', 'GetHFONT', '()',
doc="Returns the font's native handle.", doc="Returns the font's native handle.",
body="""\ body="""\
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -81,8 +81,8 @@ def run():
return 0; return 0;
#endif #endif
""") """)
c.addCppMethod('void*', 'OSXGetCGFont', '()', c.addCppMethod('void*', 'OSXGetCGFont', '()',
doc="Returns the font's native handle.", doc="Returns the font's native handle.",
body="""\ body="""\
#ifdef __WXMAC__ #ifdef __WXMAC__
@@ -92,7 +92,7 @@ def run():
#endif #endif
""") """)
c.addCppMethod('void*', 'GetPangoFontDescription', '()', c.addCppMethod('void*', 'GetPangoFontDescription', '()',
doc="Returns the font's native handle.", doc="Returns the font's native handle.",
body="""\ body="""\
#ifdef __WXGTK__ #ifdef __WXGTK__
@@ -101,9 +101,9 @@ def run():
return 0; return 0;
#endif #endif
""") """)
# The stock Font items are documented as simple pointers, but in reality # The stock Font items are documented as simple pointers, but in reality
# they are macros that evaluate to a function call that returns a font # they are macros that evaluate to a function call that returns a font
# pointer, and that is only valid *after* the wx.App object has been # pointer, and that is only valid *after* the wx.App object has been
@@ -111,7 +111,7 @@ def run():
# to come up with another solution. So instead we will just create # to come up with another solution. So instead we will just create
# uninitialized fonts in a block of Python code, that will then be # uninitialized fonts in a block of Python code, that will then be
# initialized later when the wx.App is created. # initialized later when the wx.App is created.
c.addCppMethod('void', '_copyFrom', '(const wxFont* other)', c.addCppMethod('void', '_copyFrom', '(const wxFont* other)',
"*self = *other;", "*self = *other;",
briefDoc="For internal use only.") # ?? briefDoc="For internal use only.") # ??
pycode = '# These stock fonts will be initialized when the wx.App object is created.\n' pycode = '# These stock fonts will be initialized when the wx.App object is created.\n'
@@ -145,19 +145,19 @@ def run():
wx.NORMAL = int(wx.FONTWEIGHT_NORMAL) wx.NORMAL = int(wx.FONTWEIGHT_NORMAL)
wx.LIGHT = int(wx.FONTWEIGHT_LIGHT) wx.LIGHT = int(wx.FONTWEIGHT_LIGHT)
wx.BOLD = int(wx.FONTWEIGHT_BOLD) wx.BOLD = int(wx.FONTWEIGHT_BOLD)
wx.NORMAL = int(wx.FONTSTYLE_NORMAL) wx.NORMAL = int(wx.FONTSTYLE_NORMAL)
wx.ITALIC = int(wx.FONTSTYLE_ITALIC) wx.ITALIC = int(wx.FONTSTYLE_ITALIC)
wx.SLANT = int(wx.FONTSTYLE_SLANT) wx.SLANT = int(wx.FONTSTYLE_SLANT)
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,42 +10,42 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "fontdlg" # Base name of the file to generate to for this script NAME = "fontdlg" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFontData", ITEMS = [ "wxFontData",
"wxFontDialog", "wxFontDialog",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/fontdlg.h>') module.addHeaderCode('#include <wx/fontdlg.h>')
c = module.find('wxFontDialog') c = module.find('wxFontDialog')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
# there are two of these, ignore one of them # there are two of these, ignore one of them
c.find('GetFontData').ignore() c.find('GetFontData').ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,36 +10,36 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "fontenum" # Base name of the file to generate to for this script NAME = "fontenum" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFontEnumerator", ITEMS = [ "wxFontEnumerator",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFontEnumerator') c = module.find('wxFontEnumerator')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,42 +10,42 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "fontmap" # Base name of the file to generate to for this script NAME = "fontmap" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFontMapper", ITEMS = [ "wxFontMapper",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFontMapper') c = module.find('wxFontMapper')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('GetAltForEncoding').findOverload('wxNativeEncodingInfo').ignore() c.find('GetAltForEncoding').findOverload('wxNativeEncodingInfo').ignore()
c.find('GetAltForEncoding.alt_encoding').out = True c.find('GetAltForEncoding.alt_encoding').out = True
c.find('GetAllEncodingNames').ignore() c.find('GetAllEncodingNames').ignore()
c.addCppMethod('wxArrayString*', 'GetAllEncodingNames', '(wxFontEncoding encoding)', c.addCppMethod('wxArrayString*', 'GetAllEncodingNames', '(wxFontEncoding encoding)',
isStatic=True, isStatic=True,
doc="""\ doc="""\
Returns the array of all possible names for the given encoding. If it Returns the array of all possible names for the given encoding. If it
isn't empty, the first name in it is the canonical encoding name, isn't empty, the first name in it is the canonical encoding name,
i.e. the same string as returned by GetEncodingName() i.e. the same string as returned by GetEncodingName()
""", """,
body="""\ body="""\
wxArrayString* sArr = new wxArrayString; wxArrayString* sArr = new wxArrayString;
@@ -53,16 +53,16 @@ def run():
if (cArr) { if (cArr) {
for (int idx=0; cArr[idx]; idx+=1) for (int idx=0; cArr[idx]; idx+=1)
sArr->Add(cArr[idx]); sArr->Add(cArr[idx]);
} }
return sArr; return sArr;
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,27 +10,27 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "fontutil" # Base name of the file to generate to for this script NAME = "fontutil" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxNativeFontInfo', ITEMS = [ 'wxNativeFontInfo',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxNativeFontInfo') c = module.find('wxNativeFontInfo')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.addCppMethod('wxString*', '__str__', '()', """\ c.addCppMethod('wxString*', '__str__', '()', """\
@@ -40,16 +40,16 @@ def run():
# linker errors on all but MSW... # linker errors on all but MSW...
c.find('GetPixelSize').ignore() c.find('GetPixelSize').ignore()
c.find('SetPixelSize').ignore() c.find('SetPixelSize').ignore()
c.addAutoProperties() c.addAutoProperties()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,34 +10,34 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "frame" # Base name of the file to generate to for this script NAME = "frame" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxFrame' ] ITEMS = [ 'wxFrame' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxFrame') c = module.find('wxFrame')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c.find('wxFrame.title').default = 'wxEmptyString' c.find('wxFrame.title').default = 'wxEmptyString'
c.find('Create.title').default = 'wxEmptyString' c.find('Create.title').default = 'wxEmptyString'
c.find('SetMenuBar.menuBar').transfer = True c.find('SetMenuBar.menuBar').transfer = True
# We already have a MappedType for wxArrayInt, so just tweak the # 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. # interface to use that instead of an array size and a const int pointer.
m = c.find('SetStatusWidths') m = c.find('SetStatusWidths')
@@ -49,25 +49,25 @@ def run():
const int* ptr = &widths->front(); const int* ptr = &widths->front();
self->SetStatusWidths(widths->size(), ptr); self->SetStatusWidths(widths->size(), ptr);
""") """)
c.addProperty('MenuBar GetMenuBar SetMenuBar') c.addProperty('MenuBar GetMenuBar SetMenuBar')
c.addProperty('StatusBar GetStatusBar SetStatusBar') c.addProperty('StatusBar GetStatusBar SetStatusBar')
c.addProperty('StatusBarPane GetStatusBarPane SetStatusBarPane') c.addProperty('StatusBarPane GetStatusBarPane SetStatusBarPane')
c.addProperty('ToolBar GetToolBar SetToolBar') c.addProperty('ToolBar GetToolBar SetToolBar')
tools.fixTopLevelWindowClass(c) tools.fixTopLevelWindowClass(c)
# Add back the virtual flag for these methods. # Add back the virtual flag for these methods.
# TODO: maybe these should go into a tools.addFrameVirtuals function? # TODO: maybe these should go into a tools.addFrameVirtuals function?
c.find('OnCreateStatusBar').isVirtual = True c.find('OnCreateStatusBar').isVirtual = True
c.find('OnCreateToolBar').isVirtual = True c.find('OnCreateToolBar').isVirtual = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,13 +10,13 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "fswatcher" # Base name of the file to generate to for this script NAME = "fswatcher" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxFileSystemWatcher", ITEMS = [ "wxFileSystemWatcher",
"wxFileSystemWatcherEvent", "wxFileSystemWatcherEvent",
] ]
@@ -27,34 +27,34 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode(""" module.addHeaderCode("""
#include <wx/fswatcher.h> #include <wx/fswatcher.h>
#ifndef wxHAS_INOTIFY #ifndef wxHAS_INOTIFY
#define wxFSW_EVENT_UNMOUNT 0x2000 #define wxFSW_EVENT_UNMOUNT 0x2000
#endif #endif
""") """)
c = module.find('wxFileSystemWatcher') c = module.find('wxFileSystemWatcher')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
c = module.find('wxFileSystemWatcherEvent') c = module.find('wxFileSystemWatcherEvent')
tools.fixEventClass(c) tools.fixEventClass(c)
c.addPyCode("""\ c.addPyCode("""\
EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER)
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,33 +16,33 @@ NAME = "gauge" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxGauge' ] ITEMS = [ 'wxGauge' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxGauge') c = module.find('wxGauge')
c.find('wxGauge.range').default = '100' c.find('wxGauge.range').default = '100'
c.find('Create.range').default = '100' c.find('Create.range').default = '100'
module.addGlobalStr('wxGaugeNameStr', c) module.addGlobalStr('wxGaugeNameStr', c)
tools.fixWindowClass(c) tools.fixWindowClass(c)
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,18 +10,18 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "gbsizer" # Base name of the file to generate to for this script NAME = "gbsizer" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ "wxGBPosition", ITEMS = [ "wxGBPosition",
"wxGBSpan", "wxGBSpan",
"wxGBSizerItem", "wxGBSizerItem",
"wxGridBagSizer", "wxGridBagSizer",
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -29,28 +29,28 @@ def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
c = module.find('wxGBPosition') c = module.find('wxGBPosition')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
# allow a 2 element sequence to be auto converted # allow a 2 element sequence to be auto converted
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBPosition') c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBPosition')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol()); return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol());
""", """,
pyArgsString="() -> (row, col)", pyArgsString="() -> (row, col)",
briefDoc="Return the row and col properties as a tuple.") briefDoc="Return the row and col properties as a tuple.")
c.addCppMethod('void', 'Set', '(int row=0, int col=0)', """\ c.addCppMethod('void', 'Set', '(int row=0, int col=0)', """\
self->SetRow(row); self->SetRow(row);
self->SetCol(col); self->SetCol(col);
""", """,
briefDoc="Set both the row and column properties.") briefDoc="Set both the row and column properties.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.GBPosition"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.GBPosition"+str(self.Get())')
@@ -63,7 +63,7 @@ def run():
if idx == 0: self.Row = val if idx == 0: self.Row = val
elif idx == 1: self.Col = val elif idx == 1: self.Col = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('GBPosition.__safe_for_unpickling__ = True') c.addPyCode('GBPosition.__safe_for_unpickling__ = True')
# In addition to the normal Row and Col properties let's also have lower # In addition to the normal Row and Col properties let's also have lower
@@ -80,18 +80,18 @@ def run():
# allow a 2 element sequence to be auto converted # allow a 2 element sequence to be auto converted
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBSpan') c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBSpan')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(ii)", self->GetRowspan(), self->GetColspan()); return sipBuildResult(0, "(ii)", self->GetRowspan(), self->GetColspan());
""", """,
pyArgsString="() -> (rowspan, colspan)", pyArgsString="() -> (rowspan, colspan)",
briefDoc="Return the rowspan and colspan properties as a tuple.") briefDoc="Return the rowspan and colspan properties as a tuple.")
c.addCppMethod('void', 'Set', '(int rowspan=0, int colspan=0)', """\ c.addCppMethod('void', 'Set', '(int rowspan=0, int colspan=0)', """\
self->SetRowspan(rowspan); self->SetRowspan(rowspan);
self->SetColspan(colspan); self->SetColspan(colspan);
""", """,
briefDoc="Set both the rowspan and colspan properties.") briefDoc="Set both the rowspan and colspan properties.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.GBSpan"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.GBSpan"+str(self.Get())')
@@ -104,7 +104,7 @@ def run():
if idx == 0: self.Rowspan = val if idx == 0: self.Rowspan = val
elif idx == 1: self.Colspan = val elif idx == 1: self.Colspan = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('GBSpan.__safe_for_unpickling__ = True') c.addPyCode('GBSpan.__safe_for_unpickling__ = True')
# In addition to the normal Rowspan and Colspan properties let's also have lower # In addition to the normal Rowspan and Colspan properties let's also have lower
@@ -121,26 +121,26 @@ def run():
# transfer ownership of a sizer if the item is managing one # transfer ownership of a sizer if the item is managing one
c.find('wxGBSizerItem.sizer').transfer = True c.find('wxGBSizerItem.sizer').transfer = True
# deal with userData args in the ctors # deal with userData args in the ctors
for m in c.find('wxGBSizerItem').all(): for m in c.find('wxGBSizerItem').all():
if isinstance(m, etgtools.MethodDef) and m.findItem('userData'): if isinstance(m, etgtools.MethodDef) and m.findItem('userData'):
m.find('userData').transfer = True m.find('userData').transfer = True
m.find('userData').type = 'wxPyUserData*' m.find('userData').type = 'wxPyUserData*'
# ignore some overloads that would be ambiguous from Python # ignore some overloads that would be ambiguous from Python
c.find('GetPos').findOverload('row').ignore() c.find('GetPos').findOverload('row').ignore()
c.find('GetSpan').findOverload('rowspan').ignore() c.find('GetSpan').findOverload('rowspan').ignore()
c.find('GetEndPos.row').out = True c.find('GetEndPos.row').out = True
c.find('GetEndPos.col').out = True c.find('GetEndPos.col').out = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridBagSizer') c = module.find('wxGridBagSizer')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.fixSizerClass(c) tools.fixSizerClass(c)
for func in c.findAll('Add'): for func in c.findAll('Add'):
if func.findItem('sizer'): if func.findItem('sizer'):
func.find('sizer').transfer = True func.find('sizer').transfer = True
@@ -160,20 +160,19 @@ def run():
c.addPyCode( c.addPyCode(
"GridBagSizer.CheckForIntersectionPos = wx.deprecated(GridBagSizer.CheckForIntersection, 'Use CheckForIntersection instead.')") "GridBagSizer.CheckForIntersectionPos = wx.deprecated(GridBagSizer.CheckForIntersection, 'Use CheckForIntersection instead.')")
# TODO: In Classic we had GetChildren return a list of wxGBSizerItems (in # TODO: In Classic we had GetChildren return a list of wxGBSizerItems (in
# a faked out way). Figure out how to do that here too.... # a faked out way). Figure out how to do that here too....
#module.addItem( #module.addItem(
# tools.wxListWrapperTemplate('wxGBSizerItemList', 'wxGBSizerItem', module, 'wxSizerItem')) # tools.wxListWrapperTemplate('wxGBSizerItemList', 'wxGBSizerItem', module, 'wxSizerItem'))
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,79 +16,79 @@ NAME = "gdicmn"
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxPoint', ITEMS = [ 'wxPoint',
'wxSize', 'wxSize',
'wxRect', 'wxRect',
'wxRealPoint', 'wxRealPoint',
'wxColourDatabase', 'wxColourDatabase',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
# ignore some of these enum values # ignore some of these enum values
e = module.find('wxBitmapType') e = module.find('wxBitmapType')
for i in e: for i in e:
if i.name.endswith('_RESOURCE'): if i.name.endswith('_RESOURCE'):
i.ignore() i.ignore()
module.addCppCode("""\ module.addCppCode("""\
#if !defined(__WXMAC__) #if !defined(__WXMAC__)
#define wxCURSOR_COPY_ARROW wxCURSOR_ARROW #define wxCURSOR_COPY_ARROW wxCURSOR_ARROW
#endif #endif
""") """)
# these are X11 only # these are X11 only
e = module.find('wxStockCursor') e = module.find('wxStockCursor')
e.find('wxCURSOR_BASED_ARROW_DOWN').ignore() e.find('wxCURSOR_BASED_ARROW_DOWN').ignore()
e.find('wxCURSOR_BASED_ARROW_UP').ignore() e.find('wxCURSOR_BASED_ARROW_UP').ignore()
e.find('wxCURSOR_CROSS_REVERSE').ignore() e.find('wxCURSOR_CROSS_REVERSE').ignore()
e.find('wxCURSOR_DOUBLE_ARROW').ignore() e.find('wxCURSOR_DOUBLE_ARROW').ignore()
module.find('wxClientDisplayRect.x').out = True module.find('wxClientDisplayRect.x').out = True
module.find('wxClientDisplayRect.y').out = True module.find('wxClientDisplayRect.y').out = True
module.find('wxClientDisplayRect.width').out = True module.find('wxClientDisplayRect.width').out = True
module.find('wxClientDisplayRect.height').out = True module.find('wxClientDisplayRect.height').out = True
module.find('wxDisplaySize.width').out = True module.find('wxDisplaySize.width').out = True
module.find('wxDisplaySize.height').out = True module.find('wxDisplaySize.height').out = True
module.find('wxDisplaySizeMM.width').out = True module.find('wxDisplaySizeMM.width').out = True
module.find('wxDisplaySizeMM.height').out = True module.find('wxDisplaySizeMM.height').out = True
#--------------------------------------- #---------------------------------------
# wxPoint tweaks # wxPoint tweaks
c = module.find('wxPoint') c = module.find('wxPoint')
tools.addAutoProperties(c) tools.addAutoProperties(c)
# Some operators are documented within the class that shouldn't be, so just # Some operators are documented within the class that shouldn't be, so just
# ignore them all. # ignore them all.
tools.ignoreAllOperators(c) tools.ignoreAllOperators(c)
# Undo a few of those ignores for legitimate items that were # Undo a few of those ignores for legitimate items that were
# documented correctly # documented correctly
for f in c.find('operator+=').all() + c.find('operator-=').all(): for f in c.find('operator+=').all() + c.find('operator-=').all():
f.ignore(False) f.ignore(False)
# Add some method declarations for operators that really do exist. Note # Add some method declarations for operators that really do exist. Note
# that these actually use C++ global operator functions, but we treat # that these actually use C++ global operator functions, but we treat
# them as methods to help disambiguate implementations due to how # them as methods to help disambiguate implementations due to how
# multiple classes can be converted automatically to/from 2-element # multiple classes can be converted automatically to/from 2-element
# sequences. # sequences.
c.addCppMethod('bool', '__eq__', '(const wxPoint& other)', c.addCppMethod('bool', '__eq__', '(const wxPoint& other)',
body="return *self == *other;") body="return *self == *other;")
c.addCppMethod('bool', '__ne__', '(const wxPoint& other)', c.addCppMethod('bool', '__ne__', '(const wxPoint& other)',
body="return *self != *other;") body="return *self != *other;")
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
wxPoint operator+(const wxPoint& other); wxPoint operator+(const wxPoint& other);
wxPoint operator-(); wxPoint operator-();
@@ -96,17 +96,17 @@ def run():
wxPoint operator*(int i); wxPoint operator*(int i);
wxPoint operator/(int i); wxPoint operator/(int i);
""")) """))
# wxPoint typemap # wxPoint typemap
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxPoint') c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxPoint')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(ii)", self->x, self->y); return sipBuildResult(0, "(ii)", self->x, self->y);
""", """,
pyArgsString="() -> (x,y)", pyArgsString="() -> (x,y)",
briefDoc="Return the x and y properties as a tuple.") briefDoc="Return the x and y properties as a tuple.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.Point"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Point"+str(self.Get())')
@@ -119,13 +119,13 @@ def run():
if idx == 0: self.x = val if idx == 0: self.x = val
elif idx == 1: self.y = val elif idx == 1: self.y = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('Point.__safe_for_unpickling__ = True') c.addPyCode('Point.__safe_for_unpickling__ = True')
module.addItem( module.addItem(
tools.wxListWrapperTemplate('wxPointList', 'wxPoint', module, includeConvertToType=True)) tools.wxListWrapperTemplate('wxPointList', 'wxPoint', module, includeConvertToType=True))
#--------------------------------------- #---------------------------------------
# wxSize tweaks # wxSize tweaks
c = module.find('wxSize') c = module.find('wxSize')
@@ -135,14 +135,14 @@ def run():
#c.find('wxSize').findOverload('int width, int height').releaseGIL() #c.find('wxSize').findOverload('int width, int height').releaseGIL()
#c.find('DecBy').findOverload('int dx, int dy').releaseGIL() #c.find('DecBy').findOverload('int dx, int dy').releaseGIL()
#c.find('IncBy').findOverload('int dx, int dy').releaseGIL() #c.find('IncBy').findOverload('int dx, int dy').releaseGIL()
c.addProperty("width GetWidth SetWidth") c.addProperty("width GetWidth SetWidth")
c.addProperty("height GetHeight SetHeight") c.addProperty("height GetHeight SetHeight")
# TODO: How prevalent is the use of x,y properties on a size object? Can we deprecate them? # TODO: How prevalent is the use of x,y properties on a size object? Can we deprecate them?
c.addProperty("x GetWidth SetWidth") c.addProperty("x GetWidth SetWidth")
c.addProperty("y GetHeight SetHeight") c.addProperty("y GetHeight SetHeight")
# Take care of the same issues as wxPoint # Take care of the same issues as wxPoint
tools.ignoreAllOperators(c) tools.ignoreAllOperators(c)
for f in c.find('operator+=').all() + \ for f in c.find('operator+=').all() + \
@@ -150,12 +150,12 @@ def run():
c.find('operator*=').all() + \ c.find('operator*=').all() + \
c.find('operator/=').all(): c.find('operator/=').all():
f.ignore(False) f.ignore(False)
c.addCppMethod('bool', '__eq__', '(const wxSize& other)', c.addCppMethod('bool', '__eq__', '(const wxSize& other)',
body="return *self == *other;") body="return *self == *other;")
c.addCppMethod('bool', '__ne__', '(const wxSize& other)', c.addCppMethod('bool', '__ne__', '(const wxSize& other)',
body="return *self != *other;") body="return *self != *other;")
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
wxSize operator+(const wxSize& other); wxSize operator+(const wxSize& other);
wxSize operator-(const wxSize& other); wxSize operator-(const wxSize& other);
@@ -167,17 +167,17 @@ def run():
wxRealPoint operator+(const wxRealPoint& other); wxRealPoint operator+(const wxRealPoint& other);
wxRealPoint operator-(const wxRealPoint& other); wxRealPoint operator-(const wxRealPoint& other);
""")) """))
# wxSize typemap # wxSize typemap
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxSize') c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxSize')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(ii)", self->GetWidth(), self->GetHeight()); return sipBuildResult(0, "(ii)", self->GetWidth(), self->GetHeight());
""", """,
pyArgsString="() -> (width, height)", pyArgsString="() -> (width, height)",
briefDoc="Return the width and height properties as a tuple.") briefDoc="Return the width and height properties as a tuple.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.Size"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Size"+str(self.Get())')
@@ -190,44 +190,44 @@ def run():
if idx == 0: self.width = val if idx == 0: self.width = val
elif idx == 1: self.height = val elif idx == 1: self.height = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('Size.__safe_for_unpickling__ = True') c.addPyCode('Size.__safe_for_unpickling__ = True')
#--------------------------------------- #---------------------------------------
# wxRect tweaks # wxRect tweaks
c = module.find('wxRect') c = module.find('wxRect')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.addAutoProperties(c) tools.addAutoProperties(c)
c.addProperty("left GetLeft SetLeft") c.addProperty("left GetLeft SetLeft")
c.addProperty("top GetTop SetTop") c.addProperty("top GetTop SetTop")
c.addProperty("right GetRight SetRight") c.addProperty("right GetRight SetRight")
c.addProperty("bottom GetBottom SetBottom") c.addProperty("bottom GetBottom SetBottom")
c.addProperty("bottomLeft GetBottomLeft SetBottomLeft") c.addProperty("bottomLeft GetBottomLeft SetBottomLeft")
c.addProperty("bottomRight GetBottomRight SetBottomRight") c.addProperty("bottomRight GetBottomRight SetBottomRight")
c.addProperty("topLeft GetTopLeft SetTopLeft") c.addProperty("topLeft GetTopLeft SetTopLeft")
c.addProperty("topRight GetTopRight SetTopRight") c.addProperty("topRight GetTopRight SetTopRight")
# take care of the same issues as wxPoint # take care of the same issues as wxPoint
tools.ignoreAllOperators(c) tools.ignoreAllOperators(c)
for f in c.find('operator+=').all() + \ for f in c.find('operator+=').all() + \
c.find('operator*=').all(): c.find('operator*=').all():
f.ignore(False) f.ignore(False)
c.addCppMethod('bool', '__eq__', '(const wxRect& other)', c.addCppMethod('bool', '__eq__', '(const wxRect& other)',
body="return *self == *other;") body="return *self == *other;")
c.addCppMethod('bool', '__ne__', '(const wxRect& other)', c.addCppMethod('bool', '__ne__', '(const wxRect& other)',
body="return *self != *other;") body="return *self != *other;")
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
wxRect operator+(const wxRect& other); wxRect operator+(const wxRect& other);
wxRect operator*(const wxRect& other); wxRect operator*(const wxRect& other);
""")) """))
# Because of our add-ons that make wx.Point and wx.Size act like 2-element # Because of our add-ons that make wx.Point and wx.Size act like 2-element
# sequences, and also the typecheck code that allows 2-element sequences, then # sequences, and also the typecheck code that allows 2-element sequences, then
# we end up with a bit of confusion about the (Point,Point) and the # we end up with a bit of confusion about the (Point,Point) and the
@@ -238,24 +238,24 @@ def run():
mo = m.findOverload('topLeft') mo = m.findOverload('topLeft')
del m.overloads[m.overloads.index(mo)] del m.overloads[m.overloads.index(mo)]
m.overloads.append(mo) m.overloads.append(mo)
# These methods have some overloads that will end up with the same signature # These methods have some overloads that will end up with the same signature
# in Python, so we have to remove one. # in Python, so we have to remove one.
module.find('wxRect.Deflate').findOverload(') const').ignore() module.find('wxRect.Deflate').findOverload(') const').ignore()
module.find('wxRect.Inflate').findOverload(') const').ignore() module.find('wxRect.Inflate').findOverload(') const').ignore()
module.find('wxRect.Union').findOverload(') const').ignore() module.find('wxRect.Union').findOverload(') const').ignore()
module.find('wxRect.Intersect').findOverload(') const').ignore() module.find('wxRect.Intersect').findOverload(') const').ignore()
# wxRect typemap # wxRect typemap
c.convertFromPyObject = tools.convertFourIntegersTemplate('wxRect') c.convertFromPyObject = tools.convertFourIntegersTemplate('wxRect')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(iiii)", return sipBuildResult(0, "(iiii)",
self->x, self->y, self->width, self->height); self->x, self->y, self->width, self->height);
""", """,
pyArgsString="() -> (x, y, width, height)", pyArgsString="() -> (x, y, width, height)",
briefDoc="Return the rectangle's properties as a tuple.") briefDoc="Return the rectangle's properties as a tuple.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.Rect"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Rect"+str(self.Get())')
@@ -270,27 +270,27 @@ def run():
elif idx == 2: self.width = val elif idx == 2: self.width = val
elif idx == 3: self.height = val elif idx == 3: self.height = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('Rect.__safe_for_unpickling__ = True') c.addPyCode('Rect.__safe_for_unpickling__ = True')
#--------------------------------------- #---------------------------------------
# wxRealPoint tweaks # wxRealPoint tweaks
c = module.find('wxRealPoint') c = module.find('wxRealPoint')
tools.addAutoProperties(c) tools.addAutoProperties(c)
# take care of the same issues as wxPoint # take care of the same issues as wxPoint
tools.ignoreAllOperators(c) tools.ignoreAllOperators(c)
for f in c.find('operator+=').all() + \ for f in c.find('operator+=').all() + \
c.find('operator-=').all(): c.find('operator-=').all():
f.ignore(False) f.ignore(False)
c.addCppMethod('bool', '__eq__', '(const wxRealPoint& other)', c.addCppMethod('bool', '__eq__', '(const wxRealPoint& other)',
body="return *self == *other;") body="return *self == *other;")
c.addCppMethod('bool', '__ne__', '(const wxRealPoint& other)', c.addCppMethod('bool', '__ne__', '(const wxRealPoint& other)',
body="return *self != *other;") body="return *self != *other;")
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
wxRealPoint operator+(const wxRealPoint& other); wxRealPoint operator+(const wxRealPoint& other);
wxRealPoint operator-(const wxRealPoint& other); wxRealPoint operator-(const wxRealPoint& other);
@@ -298,16 +298,16 @@ def run():
wxRealPoint operator/(int i); wxRealPoint operator/(int i);
""")) """))
# wxRealPoint typemap # wxRealPoint typemap
c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxRealPoint') c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxRealPoint')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(dd)", self->x, self->y); return sipBuildResult(0, "(dd)", self->x, self->y);
""", """,
pyArgsString="() -> (x, y)", pyArgsString="() -> (x, y)",
briefDoc="Return the point's properties as a tuple.") briefDoc="Return the point's properties as a tuple.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.RealPoint"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.RealPoint"+str(self.Get())')
@@ -320,22 +320,22 @@ def run():
if idx == 0: self.x = val if idx == 0: self.x = val
elif idx == 1: self.y = val elif idx == 1: self.y = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('RealPoint.__safe_for_unpickling__ = True') c.addPyCode('RealPoint.__safe_for_unpickling__ = True')
c = module.find('wxColourDatabase') c = module.find('wxColourDatabase')
c.addPyMethod('FindColour', '(self, colour)', 'return self.Find(colour)') c.addPyMethod('FindColour', '(self, colour)', 'return self.Find(colour)')
module.find('wxTheColourDatabase').ignore() module.find('wxTheColourDatabase').ignore()
#----------------------------------------------------------------- #-----------------------------------------------------------------
module.addCppFunction('PyObject*', 'IntersectRect', '(wxRect* r1, wxRect* r2)', module.addCppFunction('PyObject*', 'IntersectRect', '(wxRect* r1, wxRect* r2)',
doc="""\ doc="""\
Calculate and return the intersection of r1 and r2. Returns None if there Calculate and return the intersection of r1 and r2. Returns None if there
is no intersection.""", is no intersection.""",
body="""\ body="""\
wxRegion reg1(*r1); wxRegion reg1(*r1);
@@ -360,9 +360,9 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -2,7 +2,7 @@
# Name: etg/gdiobj.py # Name: etg/gdiobj.py
# Author: Robin Dunn # Author: Robin Dunn
# #
# Created: # Created:
# Copyright: (c) 2013 by Total Control Software # Copyright: (c) 2013 by Total Control Software
# License: wxWindows License # License: wxWindows License
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -10,15 +10,15 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_core" MODULE = "_core"
NAME = "gdiobj" # Base name of the file to generate to for this script NAME = "gdiobj" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxGDIObject' ] ITEMS = [ 'wxGDIObject' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
@@ -26,22 +26,22 @@ def run():
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
check4unittest=False) check4unittest=False)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.find('wxGDIObject').abstract = True module.find('wxGDIObject').abstract = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -16,55 +16,55 @@ NAME = "geometry"
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ITEMS = [
'wxPoint2DDouble', 'wxPoint2DDouble',
'wxRect2DDouble', 'wxRect2DDouble',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/wx.h>') module.addHeaderCode('#include <wx/wx.h>')
#--------------------------------------- #---------------------------------------
# wxPoint2D and wxRect2D tweaks # wxPoint2D and wxRect2D tweaks
c = module.find('wxPoint2DDouble') c = module.find('wxPoint2DDouble')
c.renameClass('Point2D') c.renameClass('Point2D')
c.find('wxPoint2DDouble').findOverload('wxPoint2DInt').ignore() c.find('wxPoint2DDouble').findOverload('wxPoint2DInt').ignore()
c.find('m_x').pyName = 'x' c.find('m_x').pyName = 'x'
c.find('m_y').pyName = 'y' c.find('m_y').pyName = 'y'
c.find('GetFloor.x').out = True c.find('GetFloor.x').out = True
c.find('GetFloor.y').out = True c.find('GetFloor.y').out = True
c.find('GetRounded.x').out = True c.find('GetRounded.x').out = True
c.find('GetRounded.y').out = True c.find('GetRounded.y').out = True
# these have link errors # these have link errors
c.find('SetPolarCoordinates').ignore() c.find('SetPolarCoordinates').ignore()
c.find('operator/=').findOverload('wxDouble').ignore() c.find('operator/=').findOverload('wxDouble').ignore()
c.find('operator*=').findOverload('wxDouble').ignore() c.find('operator*=').findOverload('wxDouble').ignore()
c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxPoint2DDouble') c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxPoint2DDouble')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(dd)", self->m_x, self->m_y); return sipBuildResult(0, "(dd)", self->m_x, self->m_y);
""", """,
briefDoc="""\ briefDoc="""\
Get() -> (x,y)\n Get() -> (x,y)\n
Return the x and y properties as a tuple.""") Return the x and y properties as a tuple.""")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.Point2D"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Point2D"+str(self.Get())')
@@ -77,39 +77,39 @@ def run():
if idx == 0: self.x = val if idx == 0: self.x = val
elif idx == 1: self.y = val elif idx == 1: self.y = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('Point2D.__safe_for_unpickling__ = True') c.addPyCode('Point2D.__safe_for_unpickling__ = True')
# ignore these operator methods, since we are not wrapping the Int version # ignore these operator methods, since we are not wrapping the Int version
c.find('operator*=').findOverload('wxInt32').ignore() c.find('operator*=').findOverload('wxInt32').ignore()
c.find('operator/=').findOverload('wxInt32').ignore() c.find('operator/=').findOverload('wxInt32').ignore()
# ignore all the global operators too, there is no equivallent in Python # ignore all the global operators too, there is no equivallent in Python
for item in module: for item in module:
if isinstance(item, etgtools.FunctionDef) and item.name.startswith('operator'): if isinstance(item, etgtools.FunctionDef) and item.name.startswith('operator'):
for f in item.all(): for f in item.all():
f.ignore() f.ignore()
c = module.find('wxRect2DDouble') c = module.find('wxRect2DDouble')
c.renameClass('Rect2D') c.renameClass('Rect2D')
c.find('m_x').pyName = 'x' c.find('m_x').pyName = 'x'
c.find('m_y').pyName = 'y' c.find('m_y').pyName = 'y'
c.find('m_width').pyName = 'width' c.find('m_width').pyName = 'width'
c.find('m_height').pyName = 'height' c.find('m_height').pyName = 'height'
c.convertFromPyObject = tools.convertFourDoublesTemplate('wxRect2DDouble') c.convertFromPyObject = tools.convertFourDoublesTemplate('wxRect2DDouble')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(dddd)", return sipBuildResult(0, "(dddd)",
self->m_x, self->m_y, self->m_width, self->m_height); self->m_x, self->m_y, self->m_width, self->m_height);
""", """,
briefDoc="""\ briefDoc="""\
Get() -> (x, y, width, height)\n Get() -> (x, y, width, height)\n
Return the rectangle's properties as a tuple.""") Return the rectangle's properties as a tuple.""")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "wx.Rect2D"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Rect2D"+str(self.Get())')
@@ -124,16 +124,16 @@ def run():
elif idx == 2: self.width = val elif idx == 2: self.width = val
elif idx == 3: self.height = val elif idx == 3: self.height = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('Rect2D.__safe_for_unpickling__ = True') c.addPyCode('Rect2D.__safe_for_unpickling__ = True')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,8 +17,8 @@ NAME = "graphics" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ ITEMS = [
'wxGraphicsObject', 'wxGraphicsObject',
'wxGraphicsBitmap', 'wxGraphicsBitmap',
'wxGraphicsBrush', 'wxGraphicsBrush',
@@ -31,7 +31,7 @@ ITEMS = [
'wxGraphicsPath', 'wxGraphicsPath',
'wxGraphicsRenderer', 'wxGraphicsRenderer',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
@@ -44,7 +44,7 @@ def run():
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/gdicmn.h>') module.addHeaderCode('#include <wx/gdicmn.h>')
def markFactories(klass): def markFactories(klass):
for func in klass.allItems(): for func in klass.allItems():
if isinstance(func, etgtools.FunctionDef) \ if isinstance(func, etgtools.FunctionDef) \
@@ -74,8 +74,8 @@ def run():
for p in m.items: for p in m.items:
if 'DC' in p.name or p.name == 'image': if 'DC' in p.name or p.name == 'image':
p.keepReference = True p.keepReference = True
# FIXME: Handle wxEnhMetaFileDC? # FIXME: Handle wxEnhMetaFileDC?
c.find('Create').findOverload('wxEnhMetaFileDC').ignore() c.find('Create').findOverload('wxEnhMetaFileDC').ignore()
@@ -83,7 +83,7 @@ def run():
c.find('GetSize.height').out = True c.find('GetSize.height').out = True
c.find('GetDPI.dpiX').out = True c.find('GetDPI.dpiX').out = True
c.find('GetDPI.dpiY').out = True c.find('GetDPI.dpiY').out = True
m = c.find('GetPartialTextExtents') m = c.find('GetPartialTextExtents')
m.find('widths').ignore() m.find('widths').ignore()
m.type = 'wxArrayDouble*' m.type = 'wxArrayDouble*'
@@ -93,15 +93,15 @@ def run():
self->GetPartialTextExtents(*text, rval); self->GetPartialTextExtents(*text, rval);
return new wxArrayDouble(rval); return new wxArrayDouble(rval);
""") """)
m = c.find('GetTextExtent') m = c.find('GetTextExtent')
m.pyName = 'GetFullTextExtent' m.pyName = 'GetFullTextExtent'
m.find('width').out = True m.find('width').out = True
m.find('height').out = True m.find('height').out = True
m.find('descent').out = True m.find('descent').out = True
m.find('externalLeading').out = True m.find('externalLeading').out = True
c.addCppMethod('PyObject*', 'GetTextExtent', '(const wxString& text)', c.addCppMethod('PyObject*', 'GetTextExtent', '(const wxString& text)',
pyArgsString="(text) -> (width, height)", pyArgsString="(text) -> (width, height)",
doc="Gets the dimensions of the string using the currently selected font.", doc="Gets the dimensions of the string using the currently selected font.",
body="""\ body="""\
@@ -112,13 +112,13 @@ def run():
c.addPyCode("GraphicsContext.DrawRotatedText = wx.deprecated(GraphicsContext.DrawText, 'Use DrawText instead.')") c.addPyCode("GraphicsContext.DrawRotatedText = wx.deprecated(GraphicsContext.DrawText, 'Use DrawText instead.')")
c.addCppCode(tools.ObjArrayHelperTemplate('wxPoint2D', 'sipType_wxPoint2DDouble', c.addCppCode(tools.ObjArrayHelperTemplate('wxPoint2D', 'sipType_wxPoint2DDouble',
"Expected a sequence of length-2 sequences or wx.Point2D objects.")) "Expected a sequence of length-2 sequences or wx.Point2D objects."))
# we'll reimplement this overload as StrokeLineSegments # we'll reimplement this overload as StrokeLineSegments
c.find('StrokeLines').findOverload('beginPoints').ignore() c.find('StrokeLines').findOverload('beginPoints').ignore()
c.addCppMethod('void', 'StrokeLineSegments', '(PyObject* beginPoints, PyObject* endPoints)', c.addCppMethod('void', 'StrokeLineSegments', '(PyObject* beginPoints, PyObject* endPoints)',
pyArgsString="(beginPoint2Ds, endPoint2Ds)", pyArgsString="(beginPoint2Ds, endPoint2Ds)",
doc="Stroke disconnected lines from begin to end points.", doc="Stroke disconnected lines from begin to end points.",
body="""\ body="""\
@@ -137,7 +137,7 @@ def run():
# Also reimplement the main StrokeLines method to reuse the same helper # Also reimplement the main StrokeLines method to reuse the same helper
# function as StrokLineSegments # function as StrokLineSegments
m = c.find('StrokeLines').findOverload('points').ignore() m = c.find('StrokeLines').findOverload('points').ignore()
c.addCppMethod('void', 'StrokeLines', '(PyObject* points)', c.addCppMethod('void', 'StrokeLines', '(PyObject* points)',
pyArgsString="(point2Ds)", pyArgsString="(point2Ds)",
doc="Stroke lines conencting all the points.", doc="Stroke lines conencting all the points.",
body="""\ body="""\
@@ -152,7 +152,7 @@ def run():
# and once more for DrawLines # and once more for DrawLines
m = c.find('DrawLines').ignore() m = c.find('DrawLines').ignore()
c.addCppMethod('void', 'DrawLines', '(PyObject* points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)', c.addCppMethod('void', 'DrawLines', '(PyObject* points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)',
pyArgsString="(point2Ds, fillStyle=ODDEVEN_RULE)", pyArgsString="(point2Ds, fillStyle=ODDEVEN_RULE)",
doc="Draws a polygon.", doc="Draws a polygon.",
body="""\ body="""\
@@ -164,51 +164,51 @@ def run():
delete [] ptsArray; delete [] ptsArray;
} }
""") """)
#--------------------------------------------- #---------------------------------------------
c = module.find('wxGraphicsPath') c = module.find('wxGraphicsPath')
tools.removeVirtuals(c) tools.removeVirtuals(c)
c.find('GetBox').findOverload('wxDouble *x, wxDouble *y').ignore() c.find('GetBox').findOverload('wxDouble *x, wxDouble *y').ignore()
c.find('GetCurrentPoint').findOverload('wxDouble *x, wxDouble *y').ignore() c.find('GetCurrentPoint').findOverload('wxDouble *x, wxDouble *y').ignore()
#--------------------------------------------- #---------------------------------------------
c = module.find('wxGraphicsRenderer') c = module.find('wxGraphicsRenderer')
tools.removeVirtuals(c) tools.removeVirtuals(c)
markFactories(c) markFactories(c)
c.abstract = True c.abstract = True
for m in c.find('CreateContext').all(): for m in c.find('CreateContext').all():
for p in m.items: for p in m.items:
if 'DC' in p.name or p.name == 'image': if 'DC' in p.name or p.name == 'image':
p.keepReference = True p.keepReference = True
c.find('CreateContextFromImage.image').keepReference = True c.find('CreateContextFromImage.image').keepReference = True
# FIXME: Handle wxEnhMetaFileDC? # FIXME: Handle wxEnhMetaFileDC?
c.find('CreateContext').findOverload('wxEnhMetaFileDC').ignore() c.find('CreateContext').findOverload('wxEnhMetaFileDC').ignore()
#--------------------------------------------- #---------------------------------------------
c = module.find('wxGraphicsMatrix') c = module.find('wxGraphicsMatrix')
tools.removeVirtuals(c) tools.removeVirtuals(c)
c.find('Concat').overloads = [] c.find('Concat').overloads = []
c.find('IsEqual').overloads = [] c.find('IsEqual').overloads = []
c.find('Get.a').out = True c.find('Get.a').out = True
c.find('Get.b').out = True c.find('Get.b').out = True
c.find('Get.c').out = True c.find('Get.c').out = True
c.find('Get.d').out = True c.find('Get.d').out = True
c.find('Get.tx').out = True c.find('Get.tx').out = True
c.find('Get.ty').out = True c.find('Get.ty').out = True
c.find('TransformDistance.dx').inOut = True c.find('TransformDistance.dx').inOut = True
c.find('TransformDistance.dy').inOut = True c.find('TransformDistance.dy').inOut = True
c.find('TransformPoint.x').inOut = True c.find('TransformPoint.x').inOut = True
c.find('TransformPoint.y').inOut = True c.find('TransformPoint.y').inOut = True
#--------------------------------------------- #---------------------------------------------
c = module.find('wxGraphicsGradientStops') c = module.find('wxGraphicsGradientStops')
c.addCppMethod('SIP_SSIZE_T', '__len__', '()', body="return (SIP_SSIZE_T)self->GetCount();") c.addCppMethod('SIP_SSIZE_T', '__len__', '()', body="return (SIP_SSIZE_T)self->GetCount();")
@@ -217,19 +217,19 @@ def run():
body="return new wxGraphicsGradientStop(self->Item(n));", body="return new wxGraphicsGradientStop(self->Item(n));",
factory=True) factory=True)
#--------------------------------------------- #---------------------------------------------
# Use the pyNames we set for these classes in geometry.py so the old # Use the pyNames we set for these classes in geometry.py so the old
# names do not show up in the docstrings, etc. # names do not show up in the docstrings, etc.
tools.changeTypeNames(module, 'wxPoint2DDouble', 'wxPoint2D') tools.changeTypeNames(module, 'wxPoint2DDouble', 'wxPoint2D')
tools.changeTypeNames(module, 'wxRect2DDouble', 'wxRect2D') tools.changeTypeNames(module, 'wxRect2DDouble', 'wxRect2D')
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -10,15 +10,15 @@
import etgtools import etgtools
import etgtools.tweaker_tools as tools import etgtools.tweaker_tools as tools
PACKAGE = "wx" PACKAGE = "wx"
MODULE = "_grid" MODULE = "_grid"
NAME = "grid" # Base name of the file to generate to for this script NAME = "grid" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxGridCellCoords', ITEMS = [ 'wxGridCellCoords',
'wxGridCellRenderer', 'wxGridCellRenderer',
'wxGridCellAutoWrapStringRenderer', 'wxGridCellAutoWrapStringRenderer',
'wxGridCellBoolRenderer', 'wxGridCellBoolRenderer',
@@ -27,7 +27,7 @@ ITEMS = [ 'wxGridCellCoords',
'wxGridCellFloatRenderer', 'wxGridCellFloatRenderer',
'wxGridCellNumberRenderer', 'wxGridCellNumberRenderer',
'wxGridCellStringRenderer', 'wxGridCellStringRenderer',
'wxGridCellEditor', 'wxGridCellEditor',
'wxGridCellAutoWrapStringEditor', 'wxGridCellAutoWrapStringEditor',
'wxGridCellBoolEditor', 'wxGridCellBoolEditor',
@@ -36,9 +36,9 @@ ITEMS = [ 'wxGridCellCoords',
'wxGridCellTextEditor', 'wxGridCellTextEditor',
'wxGridCellFloatEditor', 'wxGridCellFloatEditor',
'wxGridCellNumberEditor', 'wxGridCellNumberEditor',
'wxGridCellAttr', 'wxGridCellAttr',
'wxGridCornerHeaderRenderer', 'wxGridCornerHeaderRenderer',
'wxGridHeaderLabelsRenderer', 'wxGridHeaderLabelsRenderer',
'wxGridRowHeaderRenderer', 'wxGridRowHeaderRenderer',
@@ -46,35 +46,35 @@ ITEMS = [ 'wxGridCellCoords',
'wxGridRowHeaderRendererDefault', 'wxGridRowHeaderRendererDefault',
'wxGridColumnHeaderRendererDefault', 'wxGridColumnHeaderRendererDefault',
'wxGridCornerHeaderRendererDefault', 'wxGridCornerHeaderRendererDefault',
'wxGridCellAttrProvider', 'wxGridCellAttrProvider',
'wxGridTableBase', 'wxGridTableBase',
'wxGridTableMessage', 'wxGridTableMessage',
'wxGridStringTable', 'wxGridStringTable',
'wxGridSizesInfo', 'wxGridSizesInfo',
'wxGrid', 'wxGrid',
'wxGridUpdateLocker', 'wxGridUpdateLocker',
'wxGridEvent', 'wxGridEvent',
'wxGridSizeEvent', 'wxGridSizeEvent',
'wxGridRangeSelectEvent', 'wxGridRangeSelectEvent',
'wxGridEditorCreatedEvent', 'wxGridEditorCreatedEvent',
] ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addGlobalStr('wxGridNameStr', module.items[0]) module.addGlobalStr('wxGridNameStr', module.items[0])
module.addPyCode("""\ module.addPyCode("""\
GRID_VALUE_STRING = "string" GRID_VALUE_STRING = "string"
GRID_VALUE_BOOL = "bool" GRID_VALUE_BOOL = "bool"
@@ -86,23 +86,23 @@ def run():
GRID_VALUE_CHOICEINT = "choiceint" GRID_VALUE_CHOICEINT = "choiceint"
GRID_VALUE_DATETIME = "datetime" GRID_VALUE_DATETIME = "datetime"
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridCellCoords') c = module.find('wxGridCellCoords')
assert isinstance(c, etgtools.ClassDef) assert isinstance(c, etgtools.ClassDef)
tools.addAutoProperties(c) tools.addAutoProperties(c)
c.find('operator!').ignore() c.find('operator!').ignore()
c.find('operator=').ignore() c.find('operator=').ignore()
# Add a typemap for 2 element sequences # Add a typemap for 2 element sequences
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGridCellCoords') c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGridCellCoords')
c.addCppMethod('PyObject*', 'Get', '()', """\ c.addCppMethod('PyObject*', 'Get', '()', """\
return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol()); return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol());
""", """,
pyArgsString="() -> (row,col)", pyArgsString="() -> (row,col)",
briefDoc="Return the row and col properties as a tuple.") briefDoc="Return the row and col properties as a tuple.")
# Add sequence protocol methods and other goodies # Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "GridCellCoords"+str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "GridCellCoords"+str(self.Get())')
@@ -115,24 +115,24 @@ def run():
if idx == 0: self.Row = val if idx == 0: self.Row = val
elif idx == 1: self.Col = val elif idx == 1: self.Col = val
else: raise IndexError else: raise IndexError
""") """)
c.addPyCode('GridCellCoords.__safe_for_unpickling__ = True') c.addPyCode('GridCellCoords.__safe_for_unpickling__ = True')
module.addItem( module.addItem(
tools.wxArrayWrapperTemplate('wxGridCellCoordsArray', 'wxGridCellCoords', module)) tools.wxArrayWrapperTemplate('wxGridCellCoordsArray', 'wxGridCellCoords', module))
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridSizesInfo') c = module.find('wxGridSizesInfo')
c.find('m_customSizes').ignore() # TODO: Add support for wxUnsignedToIntHashMap?? c.find('m_customSizes').ignore() # TODO: Add support for wxUnsignedToIntHashMap??
#----------------------------------------------------------------- #-----------------------------------------------------------------
def fixRendererClass(name): def fixRendererClass(name):
klass = module.find(name) klass = module.find(name)
assert isinstance(klass, etgtools.ClassDef) assert isinstance(klass, etgtools.ClassDef)
tools.addAutoProperties(klass) tools.addAutoProperties(klass)
methods = [ methods = [
('Clone', "virtual wxGridCellRenderer* Clone() const /Factory/;"), ('Clone', "virtual wxGridCellRenderer* Clone() const /Factory/;"),
('Draw', "virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, " ('Draw', "virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, "
@@ -143,20 +143,20 @@ def run():
for method, code in methods: for method, code in methods:
if not klass.findItem(method): if not klass.findItem(method):
klass.addItem(etgtools.WigCode(code)) klass.addItem(etgtools.WigCode(code))
c = module.find('wxGridCellRenderer') c = module.find('wxGridCellRenderer')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('~wxGridCellRenderer').ignore(False) c.find('~wxGridCellRenderer').ignore(False)
c.find('Clone').factory = True c.find('Clone').factory = True
for name in ITEMS: for name in ITEMS:
if 'Cell' in name and 'Renderer' in name: if 'Cell' in name and 'Renderer' in name:
fixRendererClass(name) fixRendererClass(name)
module.addPyCode("PyGridCellRenderer = wx.deprecated(GridCellRenderer, 'Use GridCellRenderer instead.')") module.addPyCode("PyGridCellRenderer = wx.deprecated(GridCellRenderer, 'Use GridCellRenderer instead.')")
#----------------------------------------------------------------- #-----------------------------------------------------------------
def fixEditorClass(name): def fixEditorClass(name):
klass = module.find(name) klass = module.find(name)
@@ -176,13 +176,13 @@ def run():
if not klass.findItem(method): if not klass.findItem(method):
klass.addItem(etgtools.WigCode(code)) klass.addItem(etgtools.WigCode(code))
# Fix up EndEdit so it returns newval on success or None on failure # Fix up EndEdit so it returns newval on success or None on failure
pureVirtual = False pureVirtual = False
if klass.findItem('EndEdit'): if klass.findItem('EndEdit'):
klass.find('EndEdit').ignore() klass.find('EndEdit').ignore()
pureVirtual = True pureVirtual = True
# The Python version of EndEdit has a different signature than the # The Python version of EndEdit has a different signature than the
# C++ version, so we need to take care of mapping between them so the # C++ version, so we need to take care of mapping between them so the
# C++ compiler still recognizes this as a match for the virtual # C++ compiler still recognizes this as a match for the virtual
@@ -190,22 +190,22 @@ def run():
klass.addCppMethod('PyObject*', 'EndEdit', '(int row, int col, const wxGrid* grid, const wxString& oldval)', klass.addCppMethod('PyObject*', 'EndEdit', '(int row, int col, const wxGrid* grid, const wxString& oldval)',
cppSignature='bool (int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval)', cppSignature='bool (int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval)',
pyArgsString='(row, col, grid, oldval)', pyArgsString='(row, col, grid, oldval)',
isVirtual=True, isVirtual=True,
isPureVirtual=pureVirtual, isPureVirtual=pureVirtual,
doc="""\ doc="""\
End editing the cell. End editing the cell.
This function must check if the current value of the editing cell This function must check if the current value of the editing cell
is valid and different from the original value in its string is valid and different from the original value in its string
form. If not then simply return None. If it has changed then form. If not then simply return None. If it has changed then
this method should save the new value so that ApplyEdit can this method should save the new value so that ApplyEdit can
apply it later and the string representation of the new value apply it later and the string representation of the new value
should be returned. should be returned.
Notice that this method shoiuld not modify the grid as the Notice that this method shoiuld not modify the grid as the
change could still be vetoed. change could still be vetoed.
""", """,
# Code for Python --> C++ calls. Make it return newval or None. # Code for Python --> C++ calls. Make it return newval or None.
body="""\ body="""\
bool rv; bool rv;
@@ -219,7 +219,7 @@ def run():
return Py_None; return Py_None;
} }
""", """,
# Code for C++ --> Python calls. This is used when a C++ method # Code for C++ --> Python calls. This is used when a C++ method
# call needs to be reflected to a call to the overridden Python # call needs to be reflected to a call to the overridden Python
# method, so we need to translate between the real C++ siganture # method, so we need to translate between the real C++ siganture
@@ -232,7 +232,7 @@ def run():
new wxString(oldval),sipType_wxString,NULL); new wxString(oldval),sipType_wxString,NULL);
if (result == Py_None) { if (result == Py_None) {
sipRes = false; sipRes = false;
} }
else { else {
sipRes = true; sipRes = true;
*newval = Py2wxString(result); *newval = Py2wxString(result);
@@ -240,8 +240,8 @@ def run():
Py_DECREF(result); Py_DECREF(result);
""" if pureVirtual else "", # only used with the base class """ if pureVirtual else "", # only used with the base class
) )
c = module.find('wxGridCellEditor') c = module.find('wxGridCellEditor')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('~wxGridCellEditor').ignore(False) c.find('~wxGridCellEditor').ignore(False)
@@ -249,13 +249,13 @@ def run():
c = module.find('wxGridCellChoiceEditor') c = module.find('wxGridCellChoiceEditor')
c.find('wxGridCellChoiceEditor').findOverload('count').ignore() c.find('wxGridCellChoiceEditor').findOverload('count').ignore()
for name in ITEMS: for name in ITEMS:
if 'Cell' in name and 'Editor' in name: if 'Cell' in name and 'Editor' in name:
fixEditorClass(name) fixEditorClass(name)
module.addPyCode("PyGridCellEditor = wx.deprecated(GridCellEditor, 'Use GridCellEditor instead.')") module.addPyCode("PyGridCellEditor = wx.deprecated(GridCellEditor, 'Use GridCellEditor instead.')")
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridCellAttr') c = module.find('wxGridCellAttr')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
@@ -272,15 +272,15 @@ def run():
c.find('SetEditor.editor').transfer = True c.find('SetEditor.editor').transfer = True
c.find('SetRenderer.renderer').transfer = True c.find('SetRenderer.renderer').transfer = True
#----------------------------------------------------------------- #-----------------------------------------------------------------
# The instanceCode attribute is code that is used to make a default # The instanceCode attribute is code that is used to make a default
# instance of the class. We can't create them using the same class in # instance of the class. We can't create them using the same class in
# this case because they are abstract. # this case because they are abstract.
c = module.find('wxGridCornerHeaderRenderer') c = module.find('wxGridCornerHeaderRenderer')
c.instanceCode = 'sipCpp = new wxGridCornerHeaderRendererDefault;' c.instanceCode = 'sipCpp = new wxGridCornerHeaderRendererDefault;'
c = module.find('wxGridRowHeaderRenderer') c = module.find('wxGridRowHeaderRenderer')
c.instanceCode = 'sipCpp = new wxGridRowHeaderRendererDefault;' c.instanceCode = 'sipCpp = new wxGridRowHeaderRendererDefault;'
@@ -288,22 +288,22 @@ def run():
c.instanceCode = 'sipCpp = new wxGridColumnHeaderRendererDefault;' c.instanceCode = 'sipCpp = new wxGridColumnHeaderRendererDefault;'
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridCellAttrProvider') c = module.find('wxGridCellAttrProvider')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('SetAttr.attr').transfer = True c.find('SetAttr.attr').transfer = True
c.find('SetRowAttr.attr').transfer = True c.find('SetRowAttr.attr').transfer = True
c.find('SetColAttr.attr').transfer = True c.find('SetColAttr.attr').transfer = True
module.addPyCode("PyGridCellAttrProvider = wx.deprecated(GridCellAttrProvider, 'Use GridCellAttrProvider instead.')") module.addPyCode("PyGridCellAttrProvider = wx.deprecated(GridCellAttrProvider, 'Use GridCellAttrProvider instead.')")
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridTableBase') c = module.find('wxGridTableBase')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
c.find('SetAttr.attr').transfer = True c.find('SetAttr.attr').transfer = True
c.find('SetRowAttr.attr').transfer = True c.find('SetRowAttr.attr').transfer = True
c.find('SetColAttr.attr').transfer = True c.find('SetColAttr.attr').transfer = True
@@ -314,7 +314,7 @@ def run():
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridTableMessage') c = module.find('wxGridTableMessage')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGrid') c = module.find('wxGrid')
@@ -342,14 +342,14 @@ def run():
# This overload is deprecated, so don't generate code for it. # This overload is deprecated, so don't generate code for it.
c.find('SetCellValue').findOverload('wxString &val').ignore() c.find('SetCellValue').findOverload('wxString &val').ignore()
c.find('SetDefaultEditor.editor').transfer = True c.find('SetDefaultEditor.editor').transfer = True
c.find('SetDefaultRenderer.renderer').transfer = True c.find('SetDefaultRenderer.renderer').transfer = True
for n in ['GetColGridLinePen', 'GetDefaultGridLinePen', 'GetRowGridLinePen']: for n in ['GetColGridLinePen', 'GetDefaultGridLinePen', 'GetRowGridLinePen']:
c.find(n).isVirtual = True c.find(n).isVirtual = True
# The SetTable method can optionally pass ownership of the table # The SetTable method can optionally pass ownership of the table
# object to the grid, so we need to optionally update the # object to the grid, so we need to optionally update the
# ownership of the Python proxy object to match. # ownership of the Python proxy object to match.
@@ -363,7 +363,7 @@ def run():
wx.siplib.transferto(table, self) wx.siplib.transferto(table, self)
return val return val
""") """)
# SIP will normally try to add support for overriding this method since # SIP will normally try to add support for overriding this method since
# it is inherited from super classes, but in this case we want it to be # it is inherited from super classes, but in this case we want it to be
@@ -372,17 +372,17 @@ def run():
c.addItem(etgtools.WigCode("""\ c.addItem(etgtools.WigCode("""\
wxSize GetSizeAvailableForScrollTarget(const wxSize& size); wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
""", protection='private')) """, protection='private'))
#----------------------------------------------------------------- #-----------------------------------------------------------------
c = module.find('wxGridUpdateLocker') c = module.find('wxGridUpdateLocker')
c.addPrivateCopyCtor() c.addPrivateCopyCtor()
# context manager methods # context manager methods
c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#----------------------------------------------------------------- #-----------------------------------------------------------------
for name in ['wxGridSizeEvent', for name in ['wxGridSizeEvent',
@@ -392,7 +392,7 @@ def run():
]: ]:
c = module.find(name) c = module.find(name)
tools.fixEventClass(c) tools.fixEventClass(c)
c.addPyCode("""\ c.addPyCode("""\
EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK ) EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
@@ -440,13 +440,13 @@ def run():
EVT_GRID_CMD_COL_SORT = wx.PyEventBinder( wxEVT_GRID_COL_SORT, 1 ) EVT_GRID_CMD_COL_SORT = wx.PyEventBinder( wxEVT_GRID_COL_SORT, 1 )
EVT_GRID_CMD_TABBING = wx.PyEventBinder( wxEVT_GRID_TABBING, 1 ) EVT_GRID_CMD_TABBING = wx.PyEventBinder( wxEVT_GRID_TABBING, 1 )
""") """)
#----------------------------------------------------------------- #-----------------------------------------------------------------
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

View File

@@ -17,29 +17,29 @@ NAME = "headercol" # Base name of the file to generate to for this script
DOCSTRING = "" DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by # The classes and/or the basename of the Doxygen XML files to be processed by
# this script. # this script.
ITEMS = [ 'wxHeaderColumn', 'wxSettableHeaderColumn', 'wxHeaderColumnSimple', ] ITEMS = [ 'wxHeaderColumn', 'wxSettableHeaderColumn', 'wxHeaderColumnSimple', ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def run(): def run():
# Parse the XML file(s) building a collection of Extractor objects # Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS) etgtools.parseDoxyXML(module, ITEMS)
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for # Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings. # customizing the generated code and docstrings.
module.addHeaderCode('#include <wx/headercol.h>') module.addHeaderCode('#include <wx/headercol.h>')
c = module.find('wxHeaderColumn') c = module.find('wxHeaderColumn')
isinstance(c, etgtools.ClassDef) isinstance(c, etgtools.ClassDef)
#c.abstract = True #c.abstract = True
c.addAutoProperties() c.addAutoProperties()
c.instanceCode = 'sipCpp = new wxHeaderColumnSimple("");' c.instanceCode = 'sipCpp = new wxHeaderColumnSimple("");'
# addAutoProperties doesn't recognize 'IsFoo' as a getter, but it still # addAutoProperties doesn't recognize 'IsFoo' as a getter, but it still
# makes sense to use these, so add them manually. # makes sense to use these, so add them manually.
c.addProperty('Resizeable', 'IsResizeable') c.addProperty('Resizeable', 'IsResizeable')
@@ -54,7 +54,7 @@ def run():
c = module.find('wxSettableHeaderColumn') c = module.find('wxSettableHeaderColumn')
#c.abstract = True #c.abstract = True
c.addAutoProperties() c.addAutoProperties()
# This class adds some setters to go with the getters (and IsFoo) methods # This class adds some setters to go with the getters (and IsFoo) methods
# in the base class, but we can't make properties without them being in # in the base class, but we can't make properties without them being in
# the current class, so we'll monkey-patch in the properties from Python # the current class, so we'll monkey-patch in the properties from Python
@@ -70,17 +70,17 @@ def run():
c.addPyProperty('Sortable', 'HeaderColumn.IsSortable', 'SetSortable') c.addPyProperty('Sortable', 'HeaderColumn.IsSortable', 'SetSortable')
c.addPyProperty('Reorderable', 'HeaderColumn.IsReorderable', 'SetReorderable') c.addPyProperty('Reorderable', 'HeaderColumn.IsReorderable', 'SetReorderable')
c.addPyProperty('Hidden', 'HeaderColumn.IsHidden', 'SetHidden') c.addPyProperty('Hidden', 'HeaderColumn.IsHidden', 'SetHidden')
c = module.find('wxHeaderColumnSimple') c = module.find('wxHeaderColumnSimple')
c.addAutoProperties() c.addAutoProperties()
#----------------------------------------------------------------- #-----------------------------------------------------------------
tools.doCommonTweaks(module) tools.doCommonTweaks(module)
tools.runGenerators(module) tools.runGenerators(module)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
run() run()

Some files were not shown because too many files have changed in this diff Show More