mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
trim trailing space etg directory
This commit is contained in:
22
etg/_adv.py
22
etg/_adv.py
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "_adv" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# The list of other ETG scripts and back-end generator modules that are
|
||||
# included as part of this module. These should all be items that are put in
|
||||
# the wxWidgets "adv" library in a multi-lib build.
|
||||
INCLUDES = [
|
||||
INCLUDES = [
|
||||
'aboutdlg',
|
||||
'helpext',
|
||||
'commandlinkbutton',
|
||||
@@ -66,7 +66,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode("import wx", order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
98
etg/_core.py
98
etg/_core.py
@@ -11,7 +11,7 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "_core" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
|
||||
@@ -47,20 +47,20 @@ INCLUDES = [ # base and core stuff
|
||||
'clntdata',
|
||||
'clntdatactnr',
|
||||
'userdata',
|
||||
'wxpybuffer',
|
||||
|
||||
'wxpybuffer',
|
||||
|
||||
'stockgdi',
|
||||
'longlong',
|
||||
'wxdatetime',
|
||||
'stopwatch',
|
||||
|
||||
|
||||
'windowid',
|
||||
'platinfo',
|
||||
'vidmode',
|
||||
'display',
|
||||
'intl',
|
||||
'translation',
|
||||
|
||||
|
||||
'cmndata',
|
||||
'gdicmn',
|
||||
'geometry',
|
||||
@@ -97,7 +97,7 @@ INCLUDES = [ # base and core stuff
|
||||
'palette',
|
||||
'renderer',
|
||||
'rawbmp',
|
||||
|
||||
|
||||
# more core
|
||||
'accel',
|
||||
'log',
|
||||
@@ -115,7 +115,7 @@ INCLUDES = [ # base and core stuff
|
||||
'pyevent',
|
||||
'sizer', 'gbsizer', 'wrapsizer',
|
||||
'stdpaths',
|
||||
|
||||
|
||||
'eventfilter',
|
||||
'evtloop',
|
||||
'apptrait',
|
||||
@@ -126,11 +126,11 @@ INCLUDES = [ # base and core stuff
|
||||
'window',
|
||||
'validate',
|
||||
'panel',
|
||||
'menuitem',
|
||||
'menuitem',
|
||||
'menu',
|
||||
'scrolwin',
|
||||
'vscroll',
|
||||
|
||||
|
||||
# controls
|
||||
'control',
|
||||
'ctrlsub',
|
||||
@@ -159,7 +159,7 @@ INCLUDES = [ # base and core stuff
|
||||
'headercol',
|
||||
'headerctrl',
|
||||
'srchctrl',
|
||||
'radiobox',
|
||||
'radiobox',
|
||||
'radiobut',
|
||||
'slider',
|
||||
'spinbutt',
|
||||
@@ -179,7 +179,7 @@ INCLUDES = [ # base and core stuff
|
||||
'toolbook',
|
||||
'treebook',
|
||||
'vlbox',
|
||||
|
||||
|
||||
# toplevel and dialogs
|
||||
'nonownedwnd',
|
||||
'toplevel',
|
||||
@@ -206,7 +206,7 @@ INCLUDES = [ # base and core stuff
|
||||
'power',
|
||||
'utils',
|
||||
'process',
|
||||
'uiaction',
|
||||
'uiaction',
|
||||
'snglinst',
|
||||
'help',
|
||||
'cshelp',
|
||||
@@ -241,7 +241,7 @@ OTHERDEPS = [ 'src/core_ex.py',
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
|
||||
|
||||
module.addInclude(INCLUDES)
|
||||
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
|
||||
method calls from non-GUI threads. Any extra positional or
|
||||
keyword args are passed on to the callable when it is called.
|
||||
|
||||
|
||||
:param PyObject callableObj: the callable object
|
||||
:param args: arguments to be passed to the callable object
|
||||
:param kw: keywords to be passed to the callable object
|
||||
|
||||
|
||||
.. seealso::
|
||||
:ref:`wx.CallLater`
|
||||
|
||||
|
||||
""",
|
||||
body="""\
|
||||
assert callable(callableObj), "callableObj is not callable"
|
||||
app = wx.GetApp()
|
||||
assert app is not None, 'No wx.App created yet'
|
||||
|
||||
|
||||
if not hasattr(app, "_CallAfterId"):
|
||||
app._CallAfterId = wx.NewEventType()
|
||||
app.Connect(-1, -1, app._CallAfterId,
|
||||
@@ -310,24 +310,24 @@ def run():
|
||||
wx.PostEvent(app, evt)""")
|
||||
|
||||
|
||||
module.addPyClass('CallLater', ['object'],
|
||||
module.addPyClass('CallLater', ['object'],
|
||||
doc="""\
|
||||
A convenience class for :class:`wx.Timer`, that calls the given callable
|
||||
object once after the given amount of milliseconds, passing any
|
||||
positional or keyword args. The return value of the callable is
|
||||
available after it has been run with the :meth:`~wx.CallLater.GetResult`
|
||||
method.
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
broken when the timer completes, automatically cleaning up the
|
||||
:class:`wx.CallLater` object.
|
||||
|
||||
|
||||
.. seealso::
|
||||
:func:`wx.CallAfter`
|
||||
|
||||
|
||||
""",
|
||||
items = [
|
||||
PyFunctionDef('__init__', '(self, millis, callableObj, *args, **kwargs)',
|
||||
@@ -339,7 +339,7 @@ def run():
|
||||
:param args: arguments to be passed to the callable object
|
||||
:param kw: keywords to be passed to the callable object
|
||||
""",
|
||||
|
||||
|
||||
body="""\
|
||||
assert callable(callableObj), "callableObj is not callable"
|
||||
self.millis = millis
|
||||
@@ -351,10 +351,10 @@ def run():
|
||||
self.result = None
|
||||
self.timer = None
|
||||
self.Start()"""),
|
||||
|
||||
|
||||
PyFunctionDef('__del__', '(self)', 'self.Stop()'),
|
||||
|
||||
PyFunctionDef('Start', '(self, millis=None, *args, **kwargs)',
|
||||
|
||||
PyFunctionDef('Start', '(self, millis=None, *args, **kwargs)',
|
||||
doc="""\
|
||||
(Re)start the timer
|
||||
|
||||
@@ -374,24 +374,24 @@ def run():
|
||||
self.timer.Start(self.millis, wx.TIMER_ONE_SHOT)
|
||||
self.running = True"""),
|
||||
PyCodeDef('Restart = Start'),
|
||||
|
||||
PyFunctionDef('Stop', '(self)',
|
||||
|
||||
PyFunctionDef('Stop', '(self)',
|
||||
doc="Stop and destroy the timer.",
|
||||
body="""\
|
||||
if self.timer is not None:
|
||||
self.timer.Stop()
|
||||
self.timer = None"""),
|
||||
|
||||
|
||||
PyFunctionDef('GetInterval', '(self)', """\
|
||||
if self.timer is not None:
|
||||
return self.timer.GetInterval()
|
||||
else:
|
||||
return 0"""),
|
||||
|
||||
PyFunctionDef('IsRunning', '(self)',
|
||||
|
||||
PyFunctionDef('IsRunning', '(self)',
|
||||
"""return self.timer is not None and self.timer.IsRunning()"""),
|
||||
|
||||
PyFunctionDef('SetArgs', '(self, *args, **kwargs)',
|
||||
|
||||
PyFunctionDef('SetArgs', '(self, *args, **kwargs)',
|
||||
doc="""\
|
||||
(Re)set the args passed to the callable object. This is
|
||||
useful in conjunction with :meth:`Start` if
|
||||
@@ -400,29 +400,29 @@ def run():
|
||||
|
||||
:param args: arguments to be passed to the callable object
|
||||
:param kw: keywords to be passed to the callable object
|
||||
|
||||
|
||||
""",
|
||||
body="""\
|
||||
self.args = args
|
||||
self.kwargs = kwargs"""),
|
||||
|
||||
|
||||
PyFunctionDef('HasRun', '(self)', 'return self.hasRun',
|
||||
doc="""\
|
||||
Returns whether or not the callable has run.
|
||||
|
||||
|
||||
:rtype: bool
|
||||
|
||||
|
||||
"""),
|
||||
|
||||
PyFunctionDef('GetResult', '(self)', 'return self.result',
|
||||
doc="""\
|
||||
Returns the value of the callable.
|
||||
|
||||
|
||||
: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.",
|
||||
body="""\
|
||||
if self.callable and getattr(self.callable, 'im_self', True):
|
||||
@@ -433,9 +433,9 @@ def run():
|
||||
if not self.running:
|
||||
# if it wasn't restarted, then cleanup
|
||||
wx.CallAfter(self.Stop)"""),
|
||||
|
||||
|
||||
PyPropertyDef('Interval', 'GetInterval'),
|
||||
PyPropertyDef('Result', 'GetResult'),
|
||||
PyPropertyDef('Result', 'GetResult'),
|
||||
])
|
||||
|
||||
module.addPyCode("FutureCall = deprecated(CallLater, 'Use CallLater instead.')")
|
||||
@@ -449,7 +449,7 @@ def run():
|
||||
module.addCppFunction('bool', 'IsMainThread', '()',
|
||||
doc="Returns ``True`` if the current thread is what wx considers the GUI thread.",
|
||||
body="return wxThread::IsMain();")
|
||||
|
||||
|
||||
|
||||
module.addInitializerCode("""\
|
||||
wxPyPreInit(sipModuleDict);
|
||||
@@ -462,14 +462,14 @@ def run():
|
||||
# Here is the function it calls
|
||||
module.includeCppCode('src/core_ex.cpp')
|
||||
module.addItem(etgtools.WigCode("void _wxPyCleanup();"))
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_dataview"
|
||||
NAME = "_dataview" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# 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
|
||||
@@ -46,7 +46,7 @@ OTHERDEPS = []
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode("import wx", order=10)
|
||||
|
||||
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_glcanvas"
|
||||
NAME = "_glcanvas" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ 'wxGLContext',
|
||||
# this script.
|
||||
ITEMS = [ 'wxGLContext',
|
||||
'wxGLCanvas',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
|
||||
# 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
|
||||
@@ -39,7 +39,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode('import wx', order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/glcanvas.h>')
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxGLContext')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxGLCanvas')
|
||||
tools.fixWindowClass(c)
|
||||
@@ -93,8 +93,8 @@ def run():
|
||||
""",
|
||||
noDerivedCtor=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
m = c.find('IsDisplaySupported')
|
||||
m.find('attribList').type = 'wxArrayInt*'
|
||||
m.setCppCode_sip("""\
|
||||
@@ -103,13 +103,13 @@ def run():
|
||||
attribPtr = &attribList->front();
|
||||
sipRes = wxGLCanvas::IsDisplaySupported(attribPtr);
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
22
etg/_grid.py
22
etg/_grid.py
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_grid"
|
||||
NAME = "_grid" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# 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
|
||||
@@ -44,7 +44,7 @@ OTHERDEPS = []
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode("import wx", order=10)
|
||||
|
||||
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
26
etg/_html.py
26
etg/_html.py
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_html"
|
||||
NAME = "_html" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# The list of other ETG scripts and back-end generator modules that are
|
||||
# included as part of this module. These should all be items that are put in
|
||||
# the wxWidgets "html" library in a multi-lib build.
|
||||
INCLUDES = [
|
||||
INCLUDES = [
|
||||
'htmldefs',
|
||||
'htmlcell',
|
||||
'htmlfilt',
|
||||
@@ -42,13 +42,13 @@ INCLUDES = [
|
||||
'htmlwin',
|
||||
'htmlprint',
|
||||
'htmlwinpars',
|
||||
|
||||
|
||||
'helpdata',
|
||||
'helpfrm',
|
||||
'helpdlg',
|
||||
'helpwnd',
|
||||
'helpctrl',
|
||||
|
||||
|
||||
'htmllbox',
|
||||
]
|
||||
|
||||
@@ -62,7 +62,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode("import wx", order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
module.addCppCode("""\
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/html/htmprint.h>
|
||||
@@ -86,13 +86,13 @@ def run():
|
||||
#include <wx/html/helpfrm.h>
|
||||
#include <wx/html/helpdlg.h>
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -11,7 +11,7 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_html2"
|
||||
NAME = "_html2" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# The list of other ETG scripts and back-end generator modules that are
|
||||
# included as part of this module. These should all be items that are put in
|
||||
@@ -44,7 +44,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode('import wx', order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_media"
|
||||
NAME = "_media" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode('import wx', order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_propgrid"
|
||||
NAME = "_propgrid" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# The list of other ETG scripts and back-end generator modules that are
|
||||
# included as part of this module. These should all be items that are put in
|
||||
@@ -43,7 +43,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
@@ -65,9 +65,9 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_ribbon"
|
||||
NAME = "_ribbon" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# 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,
|
||||
check4unittest = False)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
@@ -69,8 +69,8 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_richtext"
|
||||
NAME = "_richtext" # Base name of the file to generate to for this script
|
||||
DOCSTRING = """\
|
||||
@@ -25,9 +25,9 @@ of the :class:`RichTextCtrl`.
|
||||
"""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# The list of other ETG scripts and back-end generator modules that are
|
||||
# included as part of this module. These should all be items that are put in
|
||||
@@ -53,7 +53,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode("import wx", order=10)
|
||||
@@ -75,13 +75,13 @@ def run():
|
||||
module.addPyCode("import wx.adv", order=10)
|
||||
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
54
etg/_stc.py
54
etg/_stc.py
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_stc"
|
||||
NAME = "_stc" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ 'wxStyledTextCtrl',
|
||||
# this script.
|
||||
ITEMS = [ 'wxStyledTextCtrl',
|
||||
'wxStyledTextEvent',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
|
||||
# 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
|
||||
@@ -41,7 +41,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode('''\
|
||||
@@ -59,20 +59,20 @@ def run():
|
||||
ID_ANY = wx.ID_ANY # Needed for some parameter defaults in this module
|
||||
''', order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/stc/stc.h>')
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxStyledTextCtrl')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.bases = ['wxControl'] # wxTextCtrlIface is also a base...
|
||||
c.piBases = ['wx.Control', 'wx.TextEntry']
|
||||
tools.fixWindowClass(c, False)
|
||||
module.addGlobalStr('wxSTCNameStr', c)
|
||||
|
||||
|
||||
|
||||
c.find('GetCurLine.linePos').out = True
|
||||
c.find('GetCurLineRaw.linePos').out = True
|
||||
@@ -80,12 +80,12 @@ def run():
|
||||
m = c.find(name)
|
||||
m.find('from').name = 'from_'
|
||||
m.find('to').name = 'to_'
|
||||
|
||||
|
||||
c.find('GetSelection.from_').out = True
|
||||
c.find('GetSelection.to_').out = True
|
||||
c.find('PositionToXY.x').out = True
|
||||
c.find('PositionToXY.y').out = True
|
||||
|
||||
|
||||
# Split the HitTest overloads into separately named methods since once
|
||||
# the output parameters are applied they will have the same function
|
||||
# signature.
|
||||
@@ -98,12 +98,12 @@ def run():
|
||||
ht2.find('row').out = True
|
||||
ht2.find('col').out = True
|
||||
|
||||
|
||||
|
||||
# Replace the *Pointer methods with ones that return a memoryview object instead.
|
||||
c.find('GetCharacterPointer').ignore()
|
||||
c.addCppMethod('PyObject*', 'GetCharacterPointer', '()',
|
||||
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.""",
|
||||
body="""
|
||||
const char* ptr = self->GetCharacterPointer();
|
||||
@@ -112,12 +112,12 @@ def run():
|
||||
wxPyBLOCK_THREADS( rv = wxPyMakeBuffer((void*)ptr, len, true) );
|
||||
return rv;
|
||||
""")
|
||||
|
||||
|
||||
c.find('GetRangePointer').ignore()
|
||||
c.addCppMethod('PyObject*', 'GetRangePointer', '(int position, int rangeLength)',
|
||||
doc="""\
|
||||
Return a read-only pointer to a range of characters in the
|
||||
document. May move the gap so that the range is contiguous,
|
||||
Return a read-only pointer to a range of characters in the
|
||||
document. May move the gap so that the range is contiguous,
|
||||
but will only move up to rangeLength bytes.""",
|
||||
body="""
|
||||
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)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxStyledTextEvent')
|
||||
tools.fixEventClass(c)
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
EVT_STC_CHANGE = wx.PyEventBinder( wxEVT_STC_CHANGE, 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_RELEASE = wx.PyEventBinder( wxEVT_STC_INDICATOR_RELEASE, 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.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_webkit"
|
||||
NAME = "_webkit" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
# The list of other ETG scripts and back-end generator modules that are
|
||||
# included as part of this module. These should all be items that are put in
|
||||
@@ -41,7 +41,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode('import wx', order=10)
|
||||
module.addInclude(INCLUDES)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
40
etg/_xml.py
40
etg/_xml.py
@@ -10,7 +10,7 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_xml"
|
||||
NAME = "_xml" # Base name of the file to generate to for this script
|
||||
DOCSTRING = """\
|
||||
@@ -21,12 +21,12 @@ provided by Python.
|
||||
"""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxXmlNode',
|
||||
'wxXmlAttribute',
|
||||
'wxXmlDocument',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
|
||||
# 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
|
||||
@@ -43,7 +43,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addPyCode('import wx', order=10)
|
||||
@@ -61,31 +61,31 @@ def run():
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
module.addPyCode("""\
|
||||
XmlProperty = wx.deprecated(XmlAttribute, 'Use XmlProperty instead.')
|
||||
""")
|
||||
|
||||
|
||||
c = module.find('wxXmlNode')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c.find('wxXmlNode.parent').transferThis = True
|
||||
|
||||
|
||||
c.find('AddAttribute.attr').transfer = True
|
||||
c.find('AddChild.child').transfer = True
|
||||
c.find('InsertChild.child').transfer = True
|
||||
c.find('InsertChildAfter.child').transfer = True
|
||||
c.find('RemoveChild.child').transferBack = True
|
||||
|
||||
|
||||
# we like the other overload better
|
||||
c.find('GetAttribute').findOverload('value').ignore()
|
||||
|
||||
|
||||
c.find('SetAttributes').ignore()
|
||||
c.find('SetChildren').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxXmlDocument')
|
||||
c.piBases = ['wx.Object']
|
||||
c.find('GetEncoding').ignore()
|
||||
@@ -96,14 +96,14 @@ def run():
|
||||
c.find('DetachRoot').transferBack = True
|
||||
c.find('SetDocumentNode.node').transfer = True
|
||||
c.find('SetRoot.node').transfer = True
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
70
etg/_xrc.py
70
etg/_xrc.py
@@ -11,7 +11,7 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
from etgtools import ClassDef, MethodDef, ParamDef
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_xrc"
|
||||
NAME = "_xrc" # Base name of the file to generate to for this script
|
||||
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
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxXmlResource',
|
||||
'wxXmlResourceHandler',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
|
||||
# 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
|
||||
@@ -40,7 +40,7 @@ OTHERDEPS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
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
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wxpy_api.h>')
|
||||
module.addImport('_core')
|
||||
module.addImport('_xml')
|
||||
module.addImport('_xml')
|
||||
module.addPyCode('''\
|
||||
import wx
|
||||
ID_NONE = wx.ID_NONE # Needed for some parameter defaults in this module
|
||||
@@ -73,9 +73,9 @@ def run():
|
||||
// forward declarations
|
||||
class wxAnimation;
|
||||
"""))
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
c = module.find('wxXmlResource')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.piBases = ['wx.Object']
|
||||
@@ -88,19 +88,19 @@ def run():
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
sipCpp = new sipwxXmlResource({args});
|
||||
sipCpp->InitAllHandlers();
|
||||
Py_END_ALLOW_THREADS
|
||||
Py_END_ALLOW_THREADS
|
||||
"""
|
||||
if 'filemask' in ctor.argsString:
|
||||
args = '*filemask,flags,*domain'
|
||||
else:
|
||||
args = 'flags,*domain'
|
||||
ctor.setCppCode_sip(template.format(args=args))
|
||||
|
||||
|
||||
|
||||
c.addPublic()
|
||||
c.addCppMethod('bool', 'LoadFromBuffer', '(wxPyBuffer* data)',
|
||||
doc="Load the resource from a bytes string or other data buffer compatible object.",
|
||||
#protection='public',
|
||||
#protection='public',
|
||||
body="""\
|
||||
static int s_memFileIdx = 0;
|
||||
|
||||
@@ -126,31 +126,31 @@ def run():
|
||||
return retval;
|
||||
""")
|
||||
c.addPyCode("XmlResource.LoadFromString = wx.deprecated(XmlResource.LoadFromBuffer, 'Use LoadFromBuffer instead')")
|
||||
|
||||
|
||||
c.find('AddHandler.handler').transfer = True
|
||||
c.find('InsertHandler.handler').transfer = True
|
||||
c.find('Set.res').transfer = True
|
||||
c.find('Set').transferBack = True
|
||||
c.find('AddSubclassFactory.factory').transfer = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxXmlResourceHandler')
|
||||
|
||||
# un-ignore all the protected methods
|
||||
for item in c.allItems():
|
||||
if isinstance(item, etgtools.MethodDef):
|
||||
item.ignore(False)
|
||||
|
||||
|
||||
c.find('DoCreateResource').factory = True
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
module.addPyFunction('EmptyXmlResource', '(flags=XRC_USE_LOCALE, domain="")',
|
||||
deprecated="Use :class:`xrc.XmlResource` instead",
|
||||
doc='A compatibility wrapper for the XmlResource(flags, domain) constructor',
|
||||
body='return XmlResource(flags, domain)')
|
||||
|
||||
|
||||
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.',
|
||||
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="",
|
||||
items=[
|
||||
MethodDef(name='wxXmlSubclassFactory', isCtor=True),
|
||||
MethodDef(name='~wxXmlSubclassFactory', isDtor=True),
|
||||
MethodDef(name='Create', type='wxObject*',
|
||||
MethodDef(name='Create', type='wxObject*',
|
||||
isVirtual=True, isPureVirtual=True,
|
||||
items=[ParamDef(type='const wxString&', name='className')])
|
||||
])
|
||||
module.addItem(cls)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
module.addPyCode("""\
|
||||
# Create a factory for handling the subclass property of XRC's
|
||||
# object tag. This factory will search for the specified
|
||||
# package.module.class and will try to instantiate it for XRC's
|
||||
# use. The class must support instantiation with no parameters and
|
||||
# Create a factory for handling the subclass property of XRC's
|
||||
# object tag. This factory will search for the specified
|
||||
# package.module.class and will try to instantiate it for XRC's
|
||||
# use. The class must support instantiation with no parameters and
|
||||
# delayed creation of the UI widget (aka 2-phase create).
|
||||
|
||||
def _my_import(name):
|
||||
@@ -192,11 +192,11 @@ def run():
|
||||
for comp in components[1:]:
|
||||
mod = getattr(mod, comp)
|
||||
return mod
|
||||
|
||||
|
||||
class XmlSubclassFactory_Python(XmlSubclassFactory):
|
||||
def __init__(self):
|
||||
XmlSubclassFactory.__init__(self)
|
||||
|
||||
|
||||
def Create(self, className):
|
||||
assert className.find('.') != -1, "Module name must be specified!"
|
||||
mname = className[:className.rfind('.')]
|
||||
@@ -204,17 +204,17 @@ def run():
|
||||
module = _my_import(mname)
|
||||
klass = getattr(module, cname)
|
||||
inst = klass()
|
||||
return inst
|
||||
|
||||
return inst
|
||||
|
||||
XmlResource.AddSubclassFactory(XmlSubclassFactory_Python())
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "aboutdlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxAboutDialogInfo",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/generic/aboutdlgg.h>')
|
||||
|
||||
c = module.find('wxAboutDialogInfo')
|
||||
@@ -48,8 +48,8 @@ def run():
|
||||
AboutDialogInfo.License = AboutDialogInfo.Licence
|
||||
""")
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
30
etg/accel.py
30
etg/accel.py
@@ -17,16 +17,16 @@ NAME = "accel" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxAcceleratorEntry', 'wxAcceleratorTable', ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxAcceleratorEntry', 'wxAcceleratorTable', ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
@@ -37,8 +37,8 @@ def run():
|
||||
|
||||
c = module.find('wxAcceleratorTable')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
# Replace the implementation of the AcceleratorTable ctor so it can
|
||||
# accept a Python sequence of tuples or AcceleratorEntry objects like
|
||||
# Classic does. Using the arraySize and array annotations does let us
|
||||
@@ -49,11 +49,11 @@ def run():
|
||||
|
||||
# Ignore the current constructor
|
||||
c.find('wxAcceleratorTable').findOverload('entries').ignore()
|
||||
|
||||
|
||||
# and add the code for the new constructor
|
||||
c.addCppCtor(
|
||||
briefDoc="TODO",
|
||||
argsString='(PyObject* entries)',
|
||||
argsString='(PyObject* entries)',
|
||||
body="""\
|
||||
const char* errmsg = "Expected a sequence of 3-tuples or wx.AcceleratorEntry objects.";
|
||||
if (!PySequence_Check(entries)) {
|
||||
@@ -82,7 +82,7 @@ def run():
|
||||
tmpEntries[idx].Set(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3));
|
||||
Py_DECREF(o1);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, errmsg);
|
||||
@@ -90,7 +90,7 @@ def run():
|
||||
}
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
|
||||
wxAcceleratorTable* table = new wxAcceleratorTable(count, tmpEntries);
|
||||
delete tmpEntries;
|
||||
return table;
|
||||
@@ -99,8 +99,8 @@ def run():
|
||||
# Mac doesn't have this, and we don't real with resource files from
|
||||
# wxPython anyway.
|
||||
c.find('wxAcceleratorTable').findOverload('resource').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
module.addPyFunction('GetAccelFromString', '(label)',
|
||||
deprecated=True,
|
||||
body="""\
|
||||
@@ -108,12 +108,12 @@ def run():
|
||||
accel.FromString(label)
|
||||
return accel
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "affinematrix2d" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxMatrix2D",
|
||||
"wxAffineMatrix2DBase",
|
||||
"wxAffineMatrix2D",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxAffineMatrix2DBase')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
|
||||
|
||||
for c in [module.find('wxAffineMatrix2DBase'),
|
||||
module.find('wxAffineMatrix2D')]:
|
||||
|
||||
|
||||
c.find('Get.mat2D').out = True
|
||||
c.find('Get.tr').out = True
|
||||
|
||||
@@ -48,12 +48,12 @@ def run():
|
||||
|
||||
c.find('TransformDistance.dx').inOut = True
|
||||
c.find('TransformDistance.dy').inOut = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,49 +10,49 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "animate" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxAnimation",
|
||||
"wxAnimationCtrl",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxAnimation')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c = module.find('wxAnimationCtrl')
|
||||
tools.fixWindowClass(c)
|
||||
module.addGlobalStr('wxAnimationCtrlNameStr', c)
|
||||
|
||||
|
||||
# move this before wxAnimationCtrl so it can be used for default arg values
|
||||
item = module.find('wxNullAnimation')
|
||||
module.items.remove(item)
|
||||
module.insertItemBefore(c, item)
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO: It would be nice to be able to use the generic verison on all
|
||||
# platforms since the native GTK version has some limitations...
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,35 +10,35 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "anybutton" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ "wxAnyButton", ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ "wxAnyButton", ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxAnyButton')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
178
etg/app.py
178
etg/app.py
@@ -11,16 +11,16 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "app" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxAppConsole',
|
||||
'wxApp',
|
||||
]
|
||||
'wxApp',
|
||||
]
|
||||
|
||||
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
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.find('wxDISABLE_DEBUG_SUPPORT').ignore()
|
||||
|
||||
c = module.find('wxAppConsole')
|
||||
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 "
|
||||
"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
|
||||
# deal with that
|
||||
c.find('argc').ignore()
|
||||
c.find('argv').ignore()
|
||||
c.find('argv').ignore()
|
||||
c.find('OnCmdLineError').ignore()
|
||||
c.find('OnCmdLineHelp').ignore()
|
||||
c.find('OnCmdLineParsed').ignore()
|
||||
c.find('OnInitCmdLine').ignore()
|
||||
|
||||
|
||||
c.find('HandleEvent').ignore()
|
||||
c.find('UsesEventLoop').ignore()
|
||||
|
||||
# We will use OnAssertFailure, but I don't think we should let it be
|
||||
# overridden in Python.
|
||||
# overridden in Python.
|
||||
c.find('OnAssertFailure').ignore()
|
||||
|
||||
|
||||
# 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
|
||||
# to deal with unhandled Python exceptions using these (overridable)
|
||||
@@ -68,37 +68,37 @@ def run():
|
||||
c.find('OnExceptionInMainLoop').ignore()
|
||||
c.find('OnFatalException').ignore()
|
||||
c.find('OnUnhandledException').ignore()
|
||||
|
||||
|
||||
# Release the GIL for potentially blocking or long-running functions
|
||||
c.find('MainLoop').releaseGIL()
|
||||
c.find('ProcessPendingEvents').releaseGIL()
|
||||
c.find('Yield').releaseGIL()
|
||||
|
||||
|
||||
c.addProperty('AppDisplayName GetAppDisplayName SetAppDisplayName')
|
||||
c.addProperty('AppName GetAppName SetAppName')
|
||||
c.addProperty('ClassName GetClassName SetClassName')
|
||||
c.addProperty('VendorDisplayName GetVendorDisplayName SetVendorDisplayName')
|
||||
c.addProperty('VendorName GetVendorName SetVendorName')
|
||||
c.addProperty('Traits GetTraits')
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
c = module.find('wxApp')
|
||||
|
||||
|
||||
# Add a new C++ wxPyApp class that adds empty Mac* methods for other
|
||||
# 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
|
||||
# the DoxyXML.
|
||||
# the DoxyXML.
|
||||
c.includeCppCode('src/app_ex.cpp')
|
||||
|
||||
|
||||
# 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':
|
||||
item.name = 'wxPyApp'
|
||||
item.name = 'wxPyApp'
|
||||
if item.name == '~wxApp':
|
||||
item.name = '~wxPyApp'
|
||||
|
||||
|
||||
c.find('ProcessMessage').ignore()
|
||||
|
||||
|
||||
c.addCppMethod('void', 'MacHideApp', '()',
|
||||
doc="""\
|
||||
Hide all application windows just as the user can do with the
|
||||
@@ -137,12 +137,12 @@ def run():
|
||||
""")
|
||||
|
||||
|
||||
# Remove the virtualness from these methods
|
||||
for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive',
|
||||
'SafeYield', 'SafeYieldFor', 'SetDisplayMode',
|
||||
# Remove the virtualness from these methods
|
||||
for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive',
|
||||
'SafeYield', 'SafeYieldFor', 'SetDisplayMode',
|
||||
'SetNativeTheme', ]:
|
||||
c.find(m).isVirtual = False
|
||||
|
||||
|
||||
# Methods we implement in wxPyApp beyond what are in wxApp, plus some
|
||||
# overridden virtuals (or at least some that we want the wrapper
|
||||
# generator to treat as if they are overridden.)
|
||||
@@ -181,29 +181,29 @@ def run():
|
||||
protection='public', type='wxAppAssertMode', name='GetAssertMode', argsString='()',
|
||||
briefDoc="Returns the current mode for how the application responds to wx asserts.",
|
||||
className=c.name))
|
||||
|
||||
|
||||
m = etgtools.MethodDef(
|
||||
protection='public', type='void', name='SetAssertMode', argsString='(wxAppAssertMode mode)',
|
||||
briefDoc="""\
|
||||
Set the mode indicating how the application responds to wx assertion
|
||||
statements. Valid settings are a combination of these flags:
|
||||
|
||||
- wx.APP_ASSERT_SUPPRESS
|
||||
- wx.APP_ASSERT_EXCEPTION
|
||||
- wx.APP_ASSERT_DIALOG
|
||||
Set the mode indicating how the application responds to wx assertion
|
||||
statements. Valid settings are a combination of these flags:
|
||||
|
||||
- wx.APP_ASSERT_SUPPRESS
|
||||
- wx.APP_ASSERT_EXCEPTION
|
||||
- wx.APP_ASSERT_DIALOG
|
||||
- wx.APP_ASSERT_LOG
|
||||
|
||||
|
||||
The default behavior is to raise a wx.wxAssertionError exception.
|
||||
""",
|
||||
className=c.name)
|
||||
|
||||
|
||||
m.addItem(etgtools.ParamDef(type='wxAppAssertMode', name='wxAppAssertMode'))
|
||||
c.addItem(m)
|
||||
|
||||
c.addItem(etgtools.MethodDef(
|
||||
protection='public', isStatic=True, type='bool', name='IsDisplayAvailable', argsString='()',
|
||||
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.""",
|
||||
className=c.name))
|
||||
|
||||
@@ -217,11 +217,11 @@ def run():
|
||||
c.addProperty('LayoutDirection GetLayoutDirection')
|
||||
c.addProperty('UseBestVisual GetUseBestVisual SetUseBestVisual')
|
||||
c.addProperty('TopWindow GetTopWindow SetTopWindow')
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
module.addHeaderCode("""\
|
||||
enum wxAppAssertMode {
|
||||
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():
|
||||
enum.addItem(etgtools.EnumValueDef(name=eitem))
|
||||
module.insertItemBefore(c, enum)
|
||||
|
||||
|
||||
module.addHeaderCode("""\
|
||||
class wxPyApp;
|
||||
wxPyApp* wxGetApp();
|
||||
@@ -248,14 +248,14 @@ def run():
|
||||
|
||||
module.find('wxYield').releaseGIL()
|
||||
module.find('wxSafeYield').releaseGIL()
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
|
||||
# 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
|
||||
# stdio helper class too.
|
||||
|
||||
|
||||
|
||||
module.addPyClass('PyOnDemandOutputWindow', ['object'],
|
||||
doc="""\
|
||||
A class that can be used for redirecting Python's stdout and
|
||||
@@ -272,11 +272,11 @@ def run():
|
||||
self.size = (450, 300)
|
||||
self.parent = None
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('SetParent', '(self, parent)',
|
||||
doc="""Set the window to be used as the popup Frame's parent.""",
|
||||
body="""self.parent = parent"""),
|
||||
|
||||
|
||||
PyFunctionDef('CreateOutputWindow', '(self, txt)',
|
||||
doc="",
|
||||
body="""\
|
||||
@@ -288,7 +288,7 @@ def run():
|
||||
self.frame.Show(True)
|
||||
self.frame.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('OnCloseWindow', '(self, event)',
|
||||
doc="",
|
||||
body="""\
|
||||
@@ -298,12 +298,12 @@ def run():
|
||||
self.text = None
|
||||
self.parent = None
|
||||
"""),
|
||||
|
||||
|
||||
# These methods provide the file-like output behaviour.
|
||||
PyFunctionDef('write', '(self, text)',
|
||||
doc="""\
|
||||
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.
|
||||
""",
|
||||
body="""\
|
||||
@@ -318,94 +318,94 @@ def run():
|
||||
else:
|
||||
self.text.AppendText(text)
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('close', '(self)',
|
||||
doc="",
|
||||
body="""\
|
||||
if self.frame is not None:
|
||||
wx.CallAfter(self.frame.Close)
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('flush', '(self)', 'pass'),
|
||||
])
|
||||
|
||||
|
||||
|
||||
module.addPyClass('App', ['PyApp'],
|
||||
doc="""\
|
||||
The ``wx.App`` class represents the application and is used to:
|
||||
|
||||
|
||||
* bootstrap the wxPython system and initialize the underlying
|
||||
gui toolkit
|
||||
* set and get application-wide properties
|
||||
* implement the native windowing system main message or event loop,
|
||||
and to dispatch events to window instances
|
||||
* etc.
|
||||
|
||||
|
||||
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
|
||||
has been created in order to ensure that the gui platform and wxWidgets
|
||||
have been fully initialized.
|
||||
|
||||
|
||||
Normally you would derive from this class and implement an ``OnInit``
|
||||
method that creates a frame and then calls ``self.SetTopWindow(frame)``,
|
||||
however ``wx.App`` is also usable on it's own without derivation.
|
||||
""",
|
||||
|
||||
|
||||
items=[
|
||||
PyCodeDef('outputWindowClass = PyOnDemandOutputWindow'),
|
||||
|
||||
|
||||
PyFunctionDef('__init__', '(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True)',
|
||||
doc="""\
|
||||
Construct a ``wx.App`` object.
|
||||
|
||||
Construct a ``wx.App`` object.
|
||||
|
||||
:param redirect: Should ``sys.stdout`` and ``sys.stderr`` be
|
||||
redirected? Defaults to False. If ``filename`` is None
|
||||
then output will be redirected to a window that pops up
|
||||
as needed. (You can control what kind of window is created
|
||||
for the output by resetting the class variable
|
||||
``outputWindowClass`` to a class of your choosing.)
|
||||
|
||||
|
||||
:param filename: The name of a file to redirect output to, if
|
||||
redirect is True.
|
||||
|
||||
|
||||
:param useBestVisual: Should the app try to use the best
|
||||
available visual provided by the system (only relevant on
|
||||
systems that have more than one visual.) This parameter
|
||||
must be used instead of calling `SetUseBestVisual` later
|
||||
on because it must be set before the underlying GUI
|
||||
toolkit is initialized.
|
||||
|
||||
|
||||
:param clearSigInt: Should SIGINT be cleared? This allows the
|
||||
app to terminate upon a Ctrl-C in the console like other
|
||||
GUI apps will.
|
||||
|
||||
|
||||
:note: You should override OnInit to do application
|
||||
initialization to ensure that the system, toolkit and
|
||||
wxWidgets are fully initialized.
|
||||
""",
|
||||
body="""\
|
||||
PyApp.__init__(self)
|
||||
|
||||
|
||||
# make sure we can create a GUI
|
||||
if not self.IsDisplayAvailable():
|
||||
|
||||
|
||||
if wx.Port == "__WXMAC__":
|
||||
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" \\
|
||||
"on the main display of your Mac."
|
||||
|
||||
|
||||
elif wx.Port == "__WXGTK__":
|
||||
msg ="Unable to access the X Display, is $DISPLAY set properly?"
|
||||
|
||||
|
||||
else:
|
||||
msg = "Unable to create GUI"
|
||||
# TODO: more description is needed for wxMSW...
|
||||
|
||||
|
||||
raise SystemExit(msg)
|
||||
|
||||
|
||||
# This has to be done before OnInit
|
||||
self.SetUseBestVisual(useBestVisual)
|
||||
|
||||
|
||||
# Set the default handler for SIGINT. This fixes a problem
|
||||
# where if Ctrl-C is pressed in the console that started this
|
||||
# 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)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# Save and redirect the stdio to a window?
|
||||
self.stdioWin = None
|
||||
self.saveStdio = (_sys.stdout, _sys.stderr)
|
||||
if redirect:
|
||||
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)
|
||||
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
# This finishes the initialization of wxWindows and then calls
|
||||
# the OnInit that should be present in the derived class
|
||||
self._BootstrapApp()
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('OnPreInit', '(self)',
|
||||
doc="""\
|
||||
Things that must be done after _BootstrapApp has done its thing, but
|
||||
@@ -444,17 +444,17 @@ def run():
|
||||
this method from there.
|
||||
""",
|
||||
body="wx.StockGDI._initStockObjects()"),
|
||||
|
||||
|
||||
PyFunctionDef('__del__', '(self)',
|
||||
doc="",
|
||||
body="""\
|
||||
# Just in case the MainLoop was overridden without calling RestoreStio
|
||||
self.RestoreStdio()
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('SetTopWindow', '(self, frame)',
|
||||
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
|
||||
an explicit parent set.
|
||||
""",
|
||||
@@ -463,7 +463,7 @@ def run():
|
||||
self.stdioWin.SetParent(frame)
|
||||
wx.PyApp.SetTopWindow(self, frame)
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('MainLoop', '(self)',
|
||||
doc="""Execute the main GUI event loop""",
|
||||
body="""\
|
||||
@@ -471,7 +471,7 @@ def run():
|
||||
self.RestoreStdio()
|
||||
return rv
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('RedirectStdio', '(self, filename=None)',
|
||||
doc="""Redirect sys.stdout and sys.stderr to a file or a popup window.""",
|
||||
body="""\
|
||||
@@ -481,7 +481,7 @@ def run():
|
||||
self.stdioWin = self.outputWindowClass()
|
||||
_sys.stdout = _sys.stderr = self.stdioWin
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('RestoreStdio', '(self)',
|
||||
doc="",
|
||||
body="""\
|
||||
@@ -490,7 +490,7 @@ def run():
|
||||
except:
|
||||
pass
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('SetOutputWindowAttributes', '(self, title=None, pos=None, size=None)',
|
||||
doc="""\
|
||||
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:
|
||||
self.stdioWin.size = size
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('Get', '()', isStatic=True,
|
||||
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`.""",
|
||||
body="return GetApp()"
|
||||
)
|
||||
@@ -533,14 +533,14 @@ def run():
|
||||
for item in module.allItems():
|
||||
if item.name == 'wxEntry':
|
||||
item.ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -10,51 +10,51 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "apptrait" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxAppTraits' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxAppTraits' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxAppTraits')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO: Enable these as etg scripts for their return types are added
|
||||
for name in [ 'CreateFontMapper',
|
||||
'CreateMessageOutput',
|
||||
'CreateRenderer',
|
||||
]:
|
||||
c.find(name).ignore()
|
||||
|
||||
|
||||
for name in [ 'CreateConfig',
|
||||
'CreateEventLoop',
|
||||
'CreateLogTarget',
|
||||
#'GetStandardPaths',
|
||||
]:
|
||||
c.find(name).factory = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,35 +10,35 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "artprov" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxArtProvider",
|
||||
]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxArtProvider')
|
||||
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('CreateIconBundle').ignore(False)
|
||||
|
||||
|
||||
# deal with ownership transfers
|
||||
c.find('Push.provider').transfer = True
|
||||
c.find('PushBack.provider').transfer = True
|
||||
@@ -58,13 +58,13 @@ def run():
|
||||
for item in artConsts:
|
||||
module.items.remove(item)
|
||||
module.items.insert(0, item)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -11,22 +11,22 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
from etgtools import (ClassDef, MethodDef, ParamDef, TypedefDef)
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_msw"
|
||||
NAME = "axbase" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# The wxPyAxBaseWindow class does not come from the parsed Doxygen xml,
|
||||
# instead it is manufactured entirely in this ETG script. We're doing it
|
||||
@@ -93,8 +93,8 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "bannerwindow" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxBannerWindow",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxBannerWindow')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
@@ -40,13 +40,13 @@ def run():
|
||||
# We can already do with keyword args what this ctor does for C++ people,
|
||||
# so ignore it to avoid signature conflicts.
|
||||
c.find('wxBannerWindow').findOverload('parent, wxDirection').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,11 +17,11 @@ NAME = "bitmap" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxBitmap',
|
||||
'wxBitmapHandler',
|
||||
'wxMask' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxBitmap',
|
||||
'wxBitmapHandler',
|
||||
'wxMask' ]
|
||||
|
||||
OTHERDEPS = [ 'src/bitmap_ex.h',
|
||||
'src/bitmap_ex.cpp', ]
|
||||
|
||||
@@ -32,14 +32,14 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
c = module.find('wxBitmap')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
c.find('wxBitmap.bits').type = 'const char*'
|
||||
@@ -55,7 +55,7 @@ def run():
|
||||
char** cArray = NULL;
|
||||
int count;
|
||||
char errMsg[] = "Expected a list of bytes objects.";
|
||||
|
||||
|
||||
if (!PyList_Check(listOfBytes)) {
|
||||
PyErr_SetString(PyExc_TypeError, errMsg);
|
||||
return NULL;
|
||||
@@ -88,7 +88,7 @@ def run():
|
||||
c.addCppMethod('int', '__nonzero__', '()', """\
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
|
||||
c.addCppMethod('long', 'GetHandle', '()',
|
||||
doc='MSW-only method to fetch the windows handle for the bitmap.',
|
||||
body="""\
|
||||
@@ -98,7 +98,7 @@ def run():
|
||||
return 0;
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
c.addCppMethod('void', 'SetHandle', '(long handle)',
|
||||
doc='MSW-only method to set the windows handle for the bitmap.',
|
||||
body="""\
|
||||
@@ -126,11 +126,11 @@ def run():
|
||||
c.find('GetHandlers').ignore()
|
||||
c.find('InsertHandler').ignore()
|
||||
c.find('RemoveHandler').ignore()
|
||||
|
||||
|
||||
# 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.
|
||||
c.find('InitStandardHandlers').ignore()
|
||||
|
||||
|
||||
module.find('wxBitmapHandler').ignore()
|
||||
#module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler', module))
|
||||
|
||||
@@ -152,14 +152,14 @@ def run():
|
||||
module.addHeaderCode('#include "bitmap_ex.h"')
|
||||
|
||||
|
||||
c.addCppMethod('void', 'CopyFromBuffer',
|
||||
c.addCppMethod('void', 'CopyFromBuffer',
|
||||
'(wxPyBuffer* data, wxBitmapBufferFormat format=wxBitmapBufferFormat_RGB, int stride=-1)',
|
||||
doc="""\
|
||||
Copy data from a buffer object to replace the bitmap pixel data.
|
||||
Default format is plain RGB, but other formats are now supported as
|
||||
well. The following symbols are used to specify the format of the
|
||||
bytes in the buffer:
|
||||
|
||||
|
||||
============================= ================================
|
||||
wx.BitmapBufferFormat_RGB A simple sequence of RGB bytes
|
||||
wx.BitmapBufferFormat_RGBA A simple sequence of RGBA bytes
|
||||
@@ -182,43 +182,43 @@ def run():
|
||||
|
||||
|
||||
# Some bitmap factories added as static methods
|
||||
|
||||
c.addCppMethod('wxBitmap*', 'FromBufferAndAlpha',
|
||||
|
||||
c.addCppMethod('wxBitmap*', 'FromBufferAndAlpha',
|
||||
'(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)',
|
||||
isStatic=True,
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a :class:`wx.Bitmap` from in-memory data. The data and alpha
|
||||
parameters must be a Python object that implements the buffer
|
||||
interface, such 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, while the alpha object is expected
|
||||
parameters must be a Python object that implements the buffer
|
||||
interface, such 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, while the alpha object is expected
|
||||
to be width*height bytes long and represents the image's alpha
|
||||
channel. On Windows and Mac the RGB values will be
|
||||
'premultiplied' by the alpha values. (The other platforms do
|
||||
channel. On Windows and Mac the RGB values will be
|
||||
'premultiplied' by the alpha values. (The other platforms do
|
||||
the multiplication themselves.)
|
||||
|
||||
|
||||
Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function
|
||||
does not share the memory block with the buffer object. This is
|
||||
because the native pixel buffer format varies on different
|
||||
platforms, and so instead an efficient as possible copy of the
|
||||
data is made from the buffer object to the bitmap's native pixel
|
||||
buffer.
|
||||
buffer.
|
||||
""",
|
||||
body="""\
|
||||
if (!data->checkSize(width*height*3) || !alpha->checkSize(width*height))
|
||||
return NULL;
|
||||
|
||||
|
||||
byte* ddata = (byte*)data->m_ptr;
|
||||
byte* adata = (byte*)alpha->m_ptr;
|
||||
wxBitmap* bmp = new wxBitmap(width, height, 32);
|
||||
|
||||
|
||||
wxAlphaPixelData pixData(*bmp, wxPoint(0,0), wxSize(width,height));
|
||||
if (! pixData) {
|
||||
wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
wxAlphaPixelData::Iterator p(pixData);
|
||||
for (int y=0; y<height; y++) {
|
||||
wxAlphaPixelData::Iterator rowStart = p;
|
||||
@@ -228,12 +228,12 @@ def run():
|
||||
p.Green() = wxPy_premultiply(*(ddata++), a);
|
||||
p.Blue() = wxPy_premultiply(*(ddata++), a);
|
||||
p.Alpha() = a;
|
||||
++p;
|
||||
++p;
|
||||
}
|
||||
p = rowStart;
|
||||
p.OffsetY(pixData, 1);
|
||||
}
|
||||
return bmp;
|
||||
return bmp;
|
||||
""")
|
||||
|
||||
c.addCppMethod('wxBitmap*', 'FromBuffer', '(int width, int height, wxPyBuffer* data)',
|
||||
@@ -241,16 +241,16 @@ def run():
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a :class:`wx.Bitmap` from in-memory data. The data parameter
|
||||
must be a Python object that implements the buffer interface, such
|
||||
as a string, bytearray, etc. The data object is expected to contain
|
||||
must be a Python object that implements the buffer interface, such
|
||||
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.
|
||||
|
||||
|
||||
Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function
|
||||
does not share the memory block with the buffer object. This is
|
||||
because the native pixel buffer format varies on different
|
||||
platforms, and so instead an efficient as possible copy of the
|
||||
data is made from the buffer object to the bitmap's native pixel
|
||||
buffer.
|
||||
buffer.
|
||||
""",
|
||||
body="""\
|
||||
wxBitmap* bmp = new wxBitmap(width, height, 24);
|
||||
@@ -281,18 +281,18 @@ def run():
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a :class:`wx.Bitmap` from in-memory data. The data parameter
|
||||
must be a Python object that implements the buffer interface, such
|
||||
as a string, bytearray, etc. The data object is expected to contain
|
||||
must be a Python object that implements the buffer interface, such
|
||||
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.
|
||||
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.)
|
||||
|
||||
|
||||
Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function
|
||||
does not share the memory block with the buffer object. This is
|
||||
because the native pixel buffer format varies on different
|
||||
platforms, and so instead an efficient as possible copy of the
|
||||
data is made from the buffer object to the bitmap's native pixel
|
||||
buffer.
|
||||
buffer.
|
||||
""",
|
||||
body="""\
|
||||
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)',
|
||||
isStatic=True,
|
||||
factory=True,
|
||||
@@ -333,7 +333,7 @@ def run():
|
||||
wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
wxAlphaPixelData::Iterator p(pixData);
|
||||
for (int y=0; y<height; y++) {
|
||||
wxAlphaPixelData::Iterator rowStart = p;
|
||||
@@ -342,12 +342,12 @@ def run():
|
||||
p.Green() = wxPy_premultiply(green, alpha);
|
||||
p.Blue() = wxPy_premultiply(blue, alpha);
|
||||
p.Alpha() = alpha;
|
||||
++p;
|
||||
++p;
|
||||
}
|
||||
p = rowStart;
|
||||
p.OffsetY(pixData, 1);
|
||||
}
|
||||
return bmp;
|
||||
return bmp;
|
||||
""")
|
||||
|
||||
module.addPyFunction('EmptyBitmapRGBA', '(width, height, red=0, green=0, blue=0, alpha=0)',
|
||||
@@ -371,8 +371,8 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,40 +10,40 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "bmpbuttn" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxBitmapButton' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxBitmapButton' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxBitmapButton')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c.find('wxBitmapButton.bitmap').default = 'wxNullBitmap'
|
||||
c.find('Create.bitmap').default = 'wxNullBitmap'
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,41 +10,41 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "bmpcbox" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxBitmapComboBox",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/bmpcbox.h>")
|
||||
|
||||
|
||||
c = module.find('wxBitmapComboBox')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
module.addGlobalStr('wxBitmapComboBoxNameStr', c)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
# The MSW and GTK version of this class derive from wxComboBox, but the
|
||||
# OSX version derives from wxOwnerDrawnCombo. To make all platforms happy
|
||||
# with the generated wrapper code switch the declared base with the bases
|
||||
# that both of those classes have in common.
|
||||
c.bases = ['wxControl', 'wxTextEntry', 'wxItemContainer']
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
# the args
|
||||
@@ -58,16 +58,16 @@ def run():
|
||||
m = c.find('Create').findOverload('wxArrayString')
|
||||
m.find('value').default = 'wxEmptyString'
|
||||
m.find('choices').default = 'wxArrayString()'
|
||||
|
||||
|
||||
# Ignore the Append and Insert taking a void* for clientData
|
||||
c.find('Append').findOverload('void *').ignore()
|
||||
c.find('Insert').findOverload('void *').ignore()
|
||||
|
||||
|
||||
# And set the ownership transfer for the other one
|
||||
c.find('Append').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
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
virtual unsigned int GetCount() const;
|
||||
@@ -75,7 +75,7 @@ def run():
|
||||
virtual void SetString(unsigned int n, const wxString& s);
|
||||
virtual int GetSelection() const;
|
||||
virtual void SetSelection(int n);
|
||||
|
||||
|
||||
virtual wxString GetStringSelection() const;
|
||||
%MethodCode
|
||||
sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection());
|
||||
@@ -84,12 +84,12 @@ def run():
|
||||
sipRes = wxItemContainerImmutable::GetStringSelection();
|
||||
%End
|
||||
"""))
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,44 +10,44 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "bookctrl" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'interface_2wx_2bookctrl_8h.xml',
|
||||
# this script.
|
||||
ITEMS = [ 'interface_2wx_2bookctrl_8h.xml',
|
||||
'wxBookCtrlBase',
|
||||
'wxBookCtrlEvent',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
# 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')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
|
||||
|
||||
c.find('HitTest.flags').out = True
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
50
etg/brush.py
50
etg/brush.py
@@ -10,27 +10,27 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "brush" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxBrush', 'wxBrushList', ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxBrush', 'wxBrushList', ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxBrush')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.removeVirtuals(c)
|
||||
@@ -44,19 +44,19 @@ def run():
|
||||
#ifdef __WXMAC__
|
||||
#include <wx/osx/private.h>
|
||||
#endif
|
||||
""")
|
||||
""")
|
||||
c.addCppMethod('void', 'MacSetTheme', '(int macThemeBrushID)', """\
|
||||
#ifdef __WXMAC__
|
||||
self->SetColour(wxColour(wxMacCreateCGColorFromHITheme(macThemeBrushID)));
|
||||
#else
|
||||
wxPyRaiseNotImplemented();
|
||||
wxPyRaiseNotImplemented();
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# uninitialized brush in a block of Python code, that will then be
|
||||
# intialized later when the wx.App is created.
|
||||
c.addCppMethod('void', '_copyFrom', '(const wxBrush* other)',
|
||||
c.addCppMethod('void', '_copyFrom', '(const wxBrush* other)',
|
||||
"*self = *other;",
|
||||
briefDoc="For internal use only.") # ??
|
||||
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,
|
||||
# and so are not found in the documentation...
|
||||
module.addPyCode("""\
|
||||
wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE)
|
||||
wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK)
|
||||
wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE)
|
||||
wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH)
|
||||
wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH)
|
||||
wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH)
|
||||
wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH)
|
||||
wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH)
|
||||
wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH)
|
||||
wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE)
|
||||
wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK)
|
||||
wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE)
|
||||
wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH)
|
||||
wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH)
|
||||
wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH)
|
||||
wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH)
|
||||
wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH)
|
||||
wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH)
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,37 +10,37 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "busyinfo" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxBusyInfo",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxBusyInfo')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,30 +16,30 @@ NAME = "button" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxButton' ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxButton')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
module.addGlobalStr('wxButtonNameStr', c)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "calctrl" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxCalendarEvent",
|
||||
"wxCalendarDateAttr",
|
||||
"wxCalendarCtrl",
|
||||
]
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -28,12 +28,12 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxCalendarEvent')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixEventClass(c)
|
||||
@@ -44,20 +44,20 @@ def run():
|
||||
EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1)
|
||||
EVT_CALENDAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_PAGE_CHANGED, 1)
|
||||
""")
|
||||
|
||||
|
||||
# These are deprecated, get rid of them later...
|
||||
c.addPyCode("""\
|
||||
EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1)
|
||||
EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1)
|
||||
EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1)
|
||||
""")
|
||||
for name in ['wxEVT_CALENDAR_DAY_CHANGED',
|
||||
'wxEVT_CALENDAR_MONTH_CHANGED',
|
||||
for name in ['wxEVT_CALENDAR_DAY_CHANGED',
|
||||
'wxEVT_CALENDAR_MONTH_CHANGED',
|
||||
'wxEVT_CALENDAR_YEAR_CHANGED']:
|
||||
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')
|
||||
gcc = tools.copyClassDef(cc, 'wxGenericCalendarCtrl')
|
||||
module.insertItemAfter(cc, gcc)
|
||||
@@ -69,23 +69,23 @@ def run():
|
||||
c.find('HitTest.date').out = True
|
||||
c.find('HitTest.wd').out = True
|
||||
c.find('SetAttr.attr').transfer = True
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
{name}.PyGetDate = wx.deprecated({name}.GetDate, 'Use GetDate 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:]))
|
||||
|
||||
|
||||
cc.find('EnableYearChange').ignore()
|
||||
gcc.addHeaderCode("#include <wx/generic/calctrlg.h>")
|
||||
|
||||
module.addGlobalStr('wxCalendarNameStr', cc)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
22
etg/caret.py
22
etg/caret.py
@@ -10,44 +10,44 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "caret" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxCaret",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxCaret')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c.find('GetPosition').findOverload('int *').ignore()
|
||||
c.find('GetSize').findOverload('int *').ignore()
|
||||
|
||||
c.addCppMethod('int', '__nonzero__', '()', """\
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,20 +16,20 @@ NAME = "checkbox" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxCheckBox' ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxCheckBox')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.find('wxCheckBox.label').default = 'wxEmptyString'
|
||||
@@ -42,14 +42,14 @@ def run():
|
||||
c.addAutoProperties()
|
||||
c.find('Get3StateValue').ignore(False)
|
||||
c.addProperty('ThreeStateValue Get3StateValue Set3StateValue')
|
||||
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,23 +17,23 @@ NAME = "checklst" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxCheckListBox' ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxCheckListBox')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c.find('wxCheckListBox').findOverload('wxString choices').ignore()
|
||||
c.find('wxCheckListBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()'
|
||||
|
||||
@@ -42,30 +42,30 @@ def run():
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
|
||||
# We already have the Python methods below, so just ignore this new method for now.
|
||||
c.find('GetCheckedItems').ignore()
|
||||
|
||||
|
||||
c.addPyMethod('GetCheckedItems', '(self)', doc="""\
|
||||
GetCheckedItems()
|
||||
|
||||
|
||||
Return a sequence of integers corresponding to the checked items in
|
||||
the control, based on :meth:`IsChecked`.""",
|
||||
body="return tuple([i for i in range(self.Count) if self.IsChecked(i)])")
|
||||
|
||||
c.addPyMethod('GetCheckedStrings', '(self)',
|
||||
c.addPyMethod('GetCheckedStrings', '(self)',
|
||||
doc="""\
|
||||
GetCheckedStrings()
|
||||
|
||||
|
||||
Return a tuple of strings corresponding to the checked
|
||||
items of the control, based on :meth:`GetChecked`.""",
|
||||
body="return tuple([self.GetString(i) for i in self.GetCheckedItems()])")
|
||||
|
||||
c.addPyMethod('SetCheckedItems', '(self, indexes)',
|
||||
|
||||
c.addPyMethod('SetCheckedItems', '(self, indexes)',
|
||||
doc="""\
|
||||
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.""",
|
||||
body="""\
|
||||
for i in indexes:
|
||||
@@ -73,7 +73,7 @@ def run():
|
||||
for i in range(self.Count):
|
||||
self.Check(i, i in indexes)""")
|
||||
|
||||
c.addPyMethod('SetCheckedStrings', '(self, strings)',
|
||||
c.addPyMethod('SetCheckedStrings', '(self, strings)',
|
||||
doc="""\
|
||||
SetCheckedStrings(strings)
|
||||
|
||||
@@ -90,17 +90,17 @@ def run():
|
||||
deprecated='Use GetCheckedItems instead.')
|
||||
c.addPyMethod('SetChecked', '(self, indexes)', 'return self.SetCheckedItems(indexes)',
|
||||
deprecated='Use SetCheckedItems instead.')
|
||||
|
||||
|
||||
c.addPyProperty('Checked GetChecked SetChecked')
|
||||
c.addPyProperty('CheckedItems GetCheckedItems SetCheckedItems')
|
||||
c.addPyProperty('CheckedItems GetCheckedItems SetCheckedItems')
|
||||
c.addPyProperty('CheckedStrings GetCheckedStrings SetCheckedStrings')
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "choicdlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxMultiChoiceDialog",
|
||||
"wxSingleChoiceDialog",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxMultiChoiceDialog')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
|
||||
c = module.find('wxSingleChoiceDialog')
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
# Make a new class so we can ignore the clientData parameter in the ctor
|
||||
c.addHeaderCode("""\
|
||||
class wxPySingleChoiceDialog : public wxSingleChoiceDialog {
|
||||
@@ -54,10 +54,10 @@ def run():
|
||||
{}
|
||||
};
|
||||
""")
|
||||
|
||||
for item in c.allItems():
|
||||
|
||||
for item in c.allItems():
|
||||
if item.name == 'wxSingleChoiceDialog':
|
||||
item.name = 'wxPySingleChoiceDialog'
|
||||
item.name = 'wxPySingleChoiceDialog'
|
||||
c.renameClass('SingleChoiceDialog')
|
||||
|
||||
# ignore this ctor
|
||||
@@ -68,7 +68,7 @@ def run():
|
||||
ctor.find('clientData').ignore()
|
||||
|
||||
c.find('GetSelectionData').ignore()
|
||||
|
||||
|
||||
|
||||
# ignore a bunch of the standalone functions
|
||||
for f in module.find('wxGetSingleChoiceIndex').all():
|
||||
@@ -77,21 +77,21 @@ def run():
|
||||
f.ignore()
|
||||
for f in module.find('wxGetSelectedChoices').all(): # TODO, it might be nice to keep this one
|
||||
f.ignore()
|
||||
|
||||
|
||||
# keep just the overloads of this function that use wxArrayString, and
|
||||
# ignore the ones that have "int n"
|
||||
for func in module.find('wxGetSingleChoice').all():
|
||||
for p in func:
|
||||
if p.type == 'int' and p.name == 'n':
|
||||
func.ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,20 +16,20 @@ NAME = "choice" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxChoice' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxChoice' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxChoice')
|
||||
c.abstract = False
|
||||
c.find('wxChoice').findOverload('wxString choices').ignore()
|
||||
@@ -41,12 +41,12 @@ def run():
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
module.addGlobalStr('wxChoiceNameStr', c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "choicebk" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxChoicebook",
|
||||
]
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -26,32 +26,32 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/choicebk.h>')
|
||||
|
||||
|
||||
c = module.find('wxChoicebook')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
tools.fixBookctrlClass(c)
|
||||
|
||||
|
||||
module.addPyCode("""\
|
||||
EVT_CHOICEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGED, 1 )
|
||||
EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGING, 1 )
|
||||
|
||||
|
||||
# deprecated wxEVT aliases
|
||||
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxEVT_CHOICEBOOK_PAGE_CHANGED
|
||||
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxEVT_CHOICEBOOK_PAGE_CHANGING
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,41 +10,41 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "clipbrd" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxClipboard",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxClipboard')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c.find('AddData.data').transfer = True
|
||||
c.find('SetData.data').transfer = True
|
||||
|
||||
|
||||
|
||||
# TODO: This init wrapper class may be useful elsewhere...
|
||||
module.addPyCode("""\
|
||||
# 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
|
||||
# variable for the wrapper generator, otherwise it will try to run the
|
||||
# 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
|
||||
# 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
|
||||
# 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.
|
||||
class _wxPyDelayedInitWrapper(object):
|
||||
def __init__(self, initfunc, *args, **kwargs):
|
||||
@@ -55,7 +55,7 @@ def run():
|
||||
def _checkInstance(self):
|
||||
if self._instance is None:
|
||||
if wx.GetApp():
|
||||
self._instance = self._initfunc(*self._args, **self._kwargs)
|
||||
self._instance = self._initfunc(*self._args, **self._kwargs)
|
||||
def __getattr__(self, name):
|
||||
self._checkInstance()
|
||||
return getattr(self._instance, name)
|
||||
@@ -71,15 +71,15 @@ def run():
|
||||
return self
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.Close()
|
||||
|
||||
|
||||
TheClipboard = _wxPyDelayedInitWrapper(Clipboard.Get)
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,31 +10,31 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "clntdatactnr" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxClientDataContainer' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxClientDataContainer' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxClientDataContainer')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
c.find('SetClientObject.data').transfer = True
|
||||
|
||||
|
||||
# The [G|S]etClientData methods deal with untyped void* values, which we
|
||||
# don't support. The [G|S]etClientObject methods use wxClientData instaces
|
||||
# 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('GetClientObject').pyName = 'GetClientData'
|
||||
c.find('SetClientObject').pyName = 'SetClientData'
|
||||
c.addPyMethod('GetClientObject', '(self)',
|
||||
c.addPyMethod('GetClientObject', '(self)',
|
||||
doc="Alias for :meth:`GetClientData`",
|
||||
body="return self.GetClientData()")
|
||||
c.addPyMethod('SetClientObject', '(self, data)',
|
||||
c.addPyMethod('SetClientObject', '(self, data)',
|
||||
doc="Alias for :meth:`SetClientData`",
|
||||
body="self.SetClientData(data)")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,52 +10,52 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "cmdproc" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxCommand",
|
||||
"wxCommandProcessor",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/cmdproc.h>')
|
||||
|
||||
|
||||
c = module.find('wxCommand')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxCommandProcessor')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c.find('Submit.command').transfer = True
|
||||
c.find('Store.command').transfer = True
|
||||
|
||||
|
||||
module.addItem(
|
||||
tools.wxListWrapperTemplate('wxList', 'wxCommand', module,
|
||||
tools.wxListWrapperTemplate('wxList', 'wxCommand', module,
|
||||
fakeListClassName='wxCommandList'))
|
||||
c.find('GetCommands').type = 'wxCommandList&'
|
||||
c.find('GetCommands').noCopy = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -11,40 +11,40 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "cmndata" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxPageSetupDialogData',
|
||||
'wxPrintData',
|
||||
'wxPrintData',
|
||||
'wxPrintDialogData',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
|
||||
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxPageSetupDialogData')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
|
||||
c.find('GetPrintData').overloads = []
|
||||
|
||||
|
||||
c.addCppMethod('int', '__nonzero__', '()', """\
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
|
||||
c.addProperty('MarginBottomRight', 'GetMarginBottomRight', 'SetMarginBottomRight')
|
||||
c.addProperty('MarginTopLeft', 'GetMarginTopLeft', 'SetMarginTopLeft')
|
||||
c.addProperty('MinMarginBottomRight', 'GetMinMarginBottomRight', 'SetMinMarginBottomRight')
|
||||
@@ -62,7 +62,7 @@ def run():
|
||||
c.addCppMethod('int', '__nonzero__', '()', """\
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
|
||||
# TODO: These two methods should use something other than a PyString for
|
||||
# holding the data...
|
||||
c.addCppMethod('PyObject*', 'GetPrivData', '()', """\
|
||||
@@ -70,9 +70,9 @@ def run():
|
||||
wxPyThreadBlocker blocker;
|
||||
data = PyBytes_FromStringAndSize(self->GetPrivData(),
|
||||
self->GetPrivDataLen());
|
||||
return data;
|
||||
return data;
|
||||
""")
|
||||
|
||||
|
||||
c.addCppMethod('void', 'SetPrivData', '(PyObject* data)', """\
|
||||
wxPyThreadBlocker blocker;
|
||||
if (! PyBytes_Check(data)) {
|
||||
@@ -82,9 +82,9 @@ def run():
|
||||
|
||||
self->SetPrivData(PyBytes_AS_STRING(data), PyBytes_GET_SIZE(data));
|
||||
""")
|
||||
|
||||
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxPrintDialogData')
|
||||
@@ -95,15 +95,15 @@ def run():
|
||||
c.addCppMethod('int', '__nonzero__', '()', """\
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,44 +16,44 @@ NAME = "collpane" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [
|
||||
'wxCollapsiblePane',
|
||||
'wxCollapsiblePaneEvent',
|
||||
]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/collpane.h>")
|
||||
module.addPyCode("""\
|
||||
EVT_COLLAPSIBLEPANE_CHANGED = wx.PyEventBinder( wxEVT_COLLAPSIBLEPANE_CHANGED )
|
||||
|
||||
|
||||
# deprecated wxEVT alias
|
||||
wxEVT_COMMAND_COLLPANE_CHANGED = wxEVT_COLLAPSIBLEPANE_CHANGED
|
||||
""")
|
||||
|
||||
|
||||
c = module.find('wxCollapsiblePane')
|
||||
c.find('wxCollapsiblePane.label').default = 'wxEmptyString'
|
||||
c.find('Create.label').default = 'wxEmptyString'
|
||||
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
module.addGlobalStr('wxCollapsiblePaneNameStr', c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,40 +10,40 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "colordlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ "wxColourData",
|
||||
# this script.
|
||||
ITEMS = [ "wxColourData",
|
||||
"wxColourDialog",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode("#include <wx/colordlg.h>")
|
||||
|
||||
|
||||
c = module.find('wxColourDialog')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
104
etg/colour.py
104
etg/colour.py
@@ -10,66 +10,66 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "colour" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxColour' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxColour' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
# Add a ctor/factory for the Mac that can use the theme brush
|
||||
module.addCppCode("""\
|
||||
#ifdef __WXMAC__
|
||||
#include <wx/osx/private.h>
|
||||
#endif
|
||||
""")
|
||||
""")
|
||||
module.addCppFunction('wxColour*', 'MacThemeColour', '(int themeBrushID)', """\
|
||||
#ifdef __WXMAC__
|
||||
return new wxColour(wxMacCreateCGColorFromHITheme(themeBrushID));
|
||||
#else
|
||||
wxPyRaiseNotImplemented();
|
||||
return NULL;
|
||||
wxPyRaiseNotImplemented();
|
||||
return NULL;
|
||||
#endif
|
||||
""", factory=True)
|
||||
|
||||
|
||||
|
||||
|
||||
# Change this macro into a value so we wont have problems when SIP takes its
|
||||
# address
|
||||
module.addCppCode("""\
|
||||
#undef wxTransparentColour
|
||||
wxColour wxTransparentColour(0, 0, 0, wxALPHA_TRANSPARENT);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
module.find('wxFromString').ignore()
|
||||
module.find('wxToString').ignore()
|
||||
|
||||
|
||||
module.find('wxALPHA_TRANSPARENT').type = 'const int'
|
||||
module.find('wxALPHA_OPAQUE').type = 'const int'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxColour')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
|
||||
# Hide the string ctor so our typemap will be invoked for the copy ctor instead.
|
||||
c.find('wxColour').findOverload('wxString').ignore()
|
||||
|
||||
|
||||
c.addProperty('Pixel GetPixel')
|
||||
c.addProperty('RGB GetRGB SetRGB')
|
||||
c.addProperty('RGBA GetRGBA SetRGBA')
|
||||
@@ -77,7 +77,7 @@ def run():
|
||||
c.addProperty('green Green')
|
||||
c.addProperty('blue Blue')
|
||||
c.addProperty('alpha Alpha')
|
||||
|
||||
|
||||
c.find('GetPixel').ignore() # We need to add a typcast
|
||||
c.addCppMethod('wxIntPtr*', 'GetPixel', '()', """\
|
||||
#ifdef __WXGTK3__
|
||||
@@ -86,46 +86,46 @@ def run():
|
||||
return new wxIntPtr((wxIntPtr)self->GetPixel());
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
# 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():
|
||||
if hasattr(item, 'type') and item.type == 'unsigned char':
|
||||
item.pyInt = True
|
||||
|
||||
|
||||
|
||||
|
||||
c.find('ChangeLightness.r').inOut = True
|
||||
c.find('ChangeLightness.g').inOut = True
|
||||
c.find('ChangeLightness.b').inOut = True
|
||||
|
||||
|
||||
c.find('MakeDisabled.r').inOut = True
|
||||
c.find('MakeDisabled.g').inOut = True
|
||||
c.find('MakeDisabled.b').inOut = True
|
||||
|
||||
|
||||
c.find('MakeGrey.r').inOut = True
|
||||
c.find('MakeGrey.g').inOut = True
|
||||
c.find('MakeGrey.b').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('b').inOut = True
|
||||
|
||||
|
||||
c.find('MakeMono.r').out = True
|
||||
c.find('MakeMono.g').out = True
|
||||
c.find('MakeMono.b').out = True
|
||||
|
||||
|
||||
|
||||
|
||||
# The stock Colour items are documented as simple pointers, but in
|
||||
# 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
|
||||
# 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
|
||||
# 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;",
|
||||
briefDoc="For internal use only.") # ??
|
||||
pycode = '# These stock colours will be initialized when the wx.App object is created.\n'
|
||||
for name in [ 'wxBLACK',
|
||||
'wxBLUE',
|
||||
'wxBLUE',
|
||||
'wxCYAN',
|
||||
'wxGREEN',
|
||||
'wxYELLOW',
|
||||
@@ -138,7 +138,7 @@ def run():
|
||||
pycode += '%s = Colour()\n' % tools.removeWxPrefix(item.name)
|
||||
module.addPyCode(pycode)
|
||||
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '(bool includeAlpha=true)', """\
|
||||
int red = -1;
|
||||
int green = -1;
|
||||
@@ -154,12 +154,12 @@ def run():
|
||||
return sipBuildResult(0, "(iiii)", red, green, blue, alpha);
|
||||
else
|
||||
return sipBuildResult(0, "(iii)", red, green, blue);
|
||||
""",
|
||||
""",
|
||||
pyArgsString="(includeAlpha=True) -> (r,g,b) or (r,g,b,a)",
|
||||
briefDoc="""\
|
||||
Returns the RGB intensity values as a tuple, optionally the alpha value as well.""")
|
||||
|
||||
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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 == 3: self.alpha = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('Colour.__safe_for_unpickling__ = True')
|
||||
|
||||
# Types that can be converted to wx.Colour:
|
||||
@@ -191,10 +191,10 @@ def run():
|
||||
if (sipCanConvertToType(sipPy, sipType_wxColour, SIP_NO_CONVERTORS))
|
||||
return 1;
|
||||
if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy))
|
||||
return 1;
|
||||
return 1;
|
||||
if (PySequence_Check(sipPy)) {
|
||||
size_t len = PySequence_Size(sipPy);
|
||||
if (len != 3 && len != 4)
|
||||
if (len != 3 && len != 4)
|
||||
return 0;
|
||||
// ensure all the items in the sequence are numbers
|
||||
for (int idx=0; idx<len; idx+=1) {
|
||||
@@ -217,15 +217,15 @@ def run():
|
||||
// Is it a string?
|
||||
else if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) {
|
||||
wxString spec = Py2wxString(sipPy);
|
||||
if (!spec.empty()
|
||||
&& spec.GetChar(0) == '#'
|
||||
if (!spec.empty()
|
||||
&& spec.GetChar(0) == '#'
|
||||
&& (spec.length() == 7 || spec.length() == 9)) { // It's #RRGGBB[AA]
|
||||
long red, green, blue;
|
||||
red = green = blue = 0;
|
||||
spec.Mid(1,2).ToLong(&red, 16);
|
||||
spec.Mid(3,2).ToLong(&green, 16);
|
||||
spec.Mid(5,2).ToLong(&blue, 16);
|
||||
|
||||
|
||||
if (spec.length() == 7) // no alpha
|
||||
*sipCppPtr = new wxColour(red, green, blue);
|
||||
else { // yes alpha
|
||||
@@ -252,11 +252,11 @@ def run():
|
||||
// Is it a 3 or 4 element sequence?
|
||||
else if (PySequence_Check(sipPy)) {
|
||||
size_t len = PyObject_Length(sipPy);
|
||||
|
||||
|
||||
PyObject* o1 = PySequence_GetItem(sipPy, 0);
|
||||
PyObject* o2 = PySequence_GetItem(sipPy, 1);
|
||||
PyObject* o3 = PySequence_GetItem(sipPy, 2);
|
||||
if (len == 3)
|
||||
if (len == 3)
|
||||
*sipCppPtr = new wxColour(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3));
|
||||
else {
|
||||
PyObject* o4 = PySequence_GetItem(sipPy, 3);
|
||||
@@ -269,7 +269,7 @@ def run():
|
||||
Py_DECREF(o3);
|
||||
return sipGetState(sipTransferObj);
|
||||
}
|
||||
|
||||
|
||||
// if we get this far then it must already be a wxColour instance
|
||||
*sipCppPtr = reinterpret_cast<wxColour*>(sipConvertToType(
|
||||
sipPy, sipType_wxColour, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
|
||||
@@ -277,8 +277,8 @@ def run():
|
||||
"""
|
||||
|
||||
module.addPyCode('NamedColour = wx.deprecated(Colour, "Use Colour instead.")')
|
||||
|
||||
|
||||
|
||||
|
||||
# Just for TESTING, remove it later
|
||||
module.addCppCode("""\
|
||||
wxColour testColourTypeMap(const wxColour& c)
|
||||
@@ -289,14 +289,14 @@ def run():
|
||||
module.addItem(etgtools.WigCode("""\
|
||||
wxColour testColourTypeMap(const wxColour& c);
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
28
etg/combo.py
28
etg/combo.py
@@ -10,33 +10,33 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "combo" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxComboPopup",
|
||||
"wxComboCtrlFeatures",
|
||||
"wxComboCtrl",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxComboPopup')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxComboCtrl')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
@@ -45,25 +45,25 @@ def run():
|
||||
for name in ['AnimateShow', 'DoSetPopupControl', 'DoShowPopup']:
|
||||
c.find(name).ignore(False)
|
||||
c.find(name).isVirtual = True
|
||||
|
||||
|
||||
# other methods that need the virtual flag turned back on
|
||||
for name in ['IsKeyPopupToggle', 'ShowPopup', 'HidePopup', 'OnButtonClick',
|
||||
'DoShowPopup', 'Dismiss',]: # 'Cut', 'Copy', 'Paste', ?
|
||||
c.find(name).isVirtual = True
|
||||
|
||||
c.find('SetPopupControl.popup').transfer = True
|
||||
|
||||
|
||||
# from is a reserved word
|
||||
c.find('Remove.from').name = 'frm'
|
||||
c.find('Replace.from').name = 'frm'
|
||||
c.find('SetSelection.from').name = 'frm'
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,24 +17,24 @@ NAME = "combobox" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxComboBox' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxComboBox' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxComboBox')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
c.find('wxComboBox').findOverload('wxString choices').ignore()
|
||||
c.find('wxComboBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()'
|
||||
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.
|
||||
m = c.find('GetSelection').renameOverload('long *from, long *to', 'GetTextSelection')
|
||||
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
|
||||
# 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_);"
|
||||
c.insertItemAfter(c.find('SetSelection'), m)
|
||||
|
||||
|
||||
|
||||
# The docs say to not use this one.
|
||||
c.find('IsEmpty').ignore()
|
||||
|
||||
@@ -70,12 +70,12 @@ def run():
|
||||
c.addPyCode("ComboBox.GetMark = wx.deprecated(ComboBox.GetTextSelection, 'Use GetTextSelection instead.')")
|
||||
|
||||
module.addGlobalStr('wxComboBoxNameStr', c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,37 +10,37 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "commandlinkbutton" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxCommandLinkButton",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxCommandLinkButton')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,26 +17,26 @@ NAME = "config" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxConfigBase',
|
||||
'wxFileConfig',
|
||||
# this script.
|
||||
ITEMS = [ 'wxConfigBase',
|
||||
'wxFileConfig',
|
||||
'wxConfigPathChanger',
|
||||
]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxConfigBase')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c.abstract = True
|
||||
ctor = c.find('wxConfigBase')
|
||||
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.pConfig').transfer = True # C++ takes ownership of the arg
|
||||
|
||||
|
||||
for func in c.findAll('Read'):
|
||||
if not 'wxString' in func.type:
|
||||
func.ignore()
|
||||
else:
|
||||
func.find('defaultVal').default = 'wxEmptyString'
|
||||
|
||||
|
||||
c.addCppMethod('long', 'ReadInt', '(const wxString& key, long defaultVal=0)', """\
|
||||
long rv;
|
||||
self->Read(*key, &rv, defaultVal);
|
||||
@@ -68,7 +68,7 @@ def run():
|
||||
return rv;
|
||||
""")
|
||||
|
||||
|
||||
|
||||
c.find('Write').overloads = []
|
||||
c.addCppMethod('bool', 'WriteInt', '(const wxString& key, long value)', """\
|
||||
return self->Write(*key, value);
|
||||
@@ -79,13 +79,13 @@ def run():
|
||||
c.addCppMethod('bool', 'WriteBool', '(const wxString& key, bool value)', """\
|
||||
return self->Write(*key, value);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
c.find('GetFirstGroup').ignore()
|
||||
c.find('GetNextGroup').ignore()
|
||||
c.find('GetFirstEntry').ignore()
|
||||
c.find('GetNextEntry').ignore()
|
||||
|
||||
|
||||
c.addCppCode("""\
|
||||
static PyObject* _Config_EnumerationHelper(bool flag, wxString& str, long index) {
|
||||
wxPyThreadBlocker blocker;
|
||||
@@ -101,7 +101,7 @@ def run():
|
||||
|
||||
c.addCppMethod('PyObject*', 'GetFirstGroup', '()',
|
||||
doc="""\
|
||||
GetFirstGroup() -> (more, value, index)\n
|
||||
GetFirstGroup() -> (more, value, index)\n
|
||||
Allows enumerating the subgroups in a config object. Returns a tuple
|
||||
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
|
||||
@@ -113,7 +113,7 @@ def run():
|
||||
more = self->GetFirstGroup(value, index);
|
||||
return _Config_EnumerationHelper(more, value, index);
|
||||
""")
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'GetNextGroup', '(long index)',
|
||||
doc="""\
|
||||
GetNextGroup(long index) -> (more, value, index)\n
|
||||
@@ -127,8 +127,8 @@ def run():
|
||||
more = self->GetNextGroup(value, index);
|
||||
return _Config_EnumerationHelper(more, value, index);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'GetFirstEntry', '()',
|
||||
doc="""\
|
||||
GetFirstEntry() -> (more, value, index)\n
|
||||
@@ -143,7 +143,7 @@ def run():
|
||||
more = self->GetFirstEntry(value, index);
|
||||
return _Config_EnumerationHelper(more, value, index);
|
||||
""")
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'GetNextEntry', '(long index)',
|
||||
doc="""\
|
||||
GetNextEntry() -> (more, value, index)\n
|
||||
@@ -158,7 +158,7 @@ def run():
|
||||
return _Config_EnumerationHelper(more, value, index);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxFileConfig')
|
||||
c.addPrivateCopyCtor()
|
||||
@@ -173,16 +173,16 @@ def run():
|
||||
c.find('GetNextGroup').ignore()
|
||||
c.find('GetFirstEntry').ignore()
|
||||
c.find('GetNextEntry').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# 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
|
||||
# end up using the wxConfig #defined in the C++ code, and will actually be
|
||||
# whatever is the default config class for the platform.
|
||||
wc = etgtools.WigCode("""\
|
||||
class wxConfig : wxConfigBase
|
||||
class wxConfig : wxConfigBase
|
||||
{
|
||||
public:
|
||||
wxConfig(const wxString& appName = wxEmptyString,
|
||||
@@ -191,7 +191,7 @@ def run():
|
||||
const wxString& globalFilename = wxEmptyString,
|
||||
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE);
|
||||
~wxConfig();
|
||||
|
||||
|
||||
// pure virtuals with implementations here
|
||||
const wxString & GetPath() const;
|
||||
void SetPath(const wxString & strPath);
|
||||
@@ -200,19 +200,19 @@ def run():
|
||||
bool HasEntry(const wxString & strName) const;
|
||||
bool HasGroup(const wxString & strName) const;
|
||||
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 DeleteAll();
|
||||
bool DeleteEntry(const wxString & key, bool bDeleteGroupIfEmpty = true);
|
||||
bool DeleteGroup(const wxString & key);
|
||||
|
||||
|
||||
private:
|
||||
wxConfig(const wxConfig&);
|
||||
};
|
||||
""")
|
||||
module.addItem(wc)
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxConfigPathChanger')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
@@ -221,12 +221,12 @@ def run():
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,16 +16,16 @@ NAME = "control" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxControl', ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
@@ -33,16 +33,16 @@ def run():
|
||||
c = module.find('wxControl')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
module.addGlobalStr('wxControlNameStr', c)
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
module.addPyCode("PyControl = wx.deprecated(Control, 'Use Control instead.')")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,54 +10,54 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "cshelp" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxHelpProvider",
|
||||
"wxSimpleHelpProvider",
|
||||
"wxHelpControllerHelpProvider",
|
||||
"wxContextHelp",
|
||||
"wxContextHelpButton",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxContextHelpButton')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
|
||||
c = module.find('wxHelpProvider')
|
||||
c.abstract = True
|
||||
c.find('Set').transferBack = True
|
||||
c.find('Set.helpProvider').transfer = True
|
||||
|
||||
|
||||
|
||||
c = module.find('wxSimpleHelpProvider')
|
||||
c.addItem(etgtools.WigCode("virtual wxString GetHelp(const wxWindowBase* window);"))
|
||||
|
||||
|
||||
c = module.find('wxHelpControllerHelpProvider')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "ctrlsub" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxItemContainerImmutable', 'wxItemContainer', 'wxControlWithItems', ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxItemContainerImmutable', 'wxItemContainer', 'wxControlWithItems', ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
@@ -26,12 +26,12 @@ def run():
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
|
||||
check4unittest=False) # all classes abstract, no unitests needed
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxItemContainerImmutable')
|
||||
c.abstract = True
|
||||
|
||||
@@ -47,7 +47,7 @@ def run():
|
||||
if 'void *' in m.argsString or \
|
||||
'wxClientData **' in m.argsString or \
|
||||
'wxString *' in m.argsString:
|
||||
m.ignore()
|
||||
m.ignore()
|
||||
|
||||
for m in c.findAll('Append'):
|
||||
pickOverloads(m)
|
||||
@@ -55,8 +55,8 @@ def run():
|
||||
pickOverloads(m)
|
||||
for m in c.findAll('Set'):
|
||||
pickOverloads(m)
|
||||
|
||||
|
||||
|
||||
|
||||
# The [G|S]etClientData methods deal with untyped void* values, which we
|
||||
# don't support. The [G|S]etClientObject methods use wxClientData instaces
|
||||
# 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('GetClientObject').pyName = 'GetClientData'
|
||||
c.find('SetClientObject').pyName = 'SetClientData'
|
||||
c.addPyMethod('GetClientObject', '(self, n)',
|
||||
c.addPyMethod('GetClientObject', '(self, n)',
|
||||
doc="Alias for :meth:`GetClientData`",
|
||||
body="return self.GetClientData(n)")
|
||||
c.addPyMethod('SetClientObject', '(self, n, data)',
|
||||
c.addPyMethod('SetClientObject', '(self, n, data)',
|
||||
doc="Alias for :meth:`SetClientData`",
|
||||
body="self.SetClientData(n, data)")
|
||||
|
||||
|
||||
|
||||
|
||||
# Deal with transfering ownership of wxClientData objects
|
||||
c.find('DetachClientObject').transfer = True
|
||||
c.find('SetClientObject.data').transfer = True
|
||||
c.find('Append').findOverload('clientData').find('clientData').transfer = True
|
||||
c.find('Insert').findOverload('clientData').find('clientData').transfer = True
|
||||
|
||||
|
||||
# for compatibility, should they be deprecated?
|
||||
c.addPyMethod('AppendItems', '(self, items)', 'self.Append(items)')
|
||||
c.addPyMethod('GetItems', '(self)', 'return self.GetStrings()')
|
||||
c.addPyMethod('SetItems', '(self, items)', 'self.Set(items)')
|
||||
|
||||
|
||||
|
||||
c = module.find('wxControlWithItems')
|
||||
c.abstract = True
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,25 +17,25 @@ NAME = "cursor" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxCursor', ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxCursor', ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxCursor')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
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
|
||||
# sets the hotspot. Is that still needed?
|
||||
|
||||
@@ -50,15 +50,15 @@ def run():
|
||||
return 0;
|
||||
#endif""",
|
||||
briefDoc="Get the handle for the Cursor. Windows only.")
|
||||
|
||||
|
||||
c.addCppMethod('void', 'SetHandle', '(long handle)', """\
|
||||
#ifdef __WXMSW__
|
||||
self->SetHandle((WXHANDLE)handle);
|
||||
#endif""",
|
||||
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.
|
||||
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# uninitialized cursor in a block of Python code, that will then be
|
||||
# intialized later when the wx.App is created.
|
||||
c.addCppMethod('void', '_copyFrom', '(const wxCursor* other)',
|
||||
c.addCppMethod('void', '_copyFrom', '(const wxCursor* other)',
|
||||
"*self = *other;",
|
||||
briefDoc="For internal use only.") # ??
|
||||
pycode = '# These stock cursors will be initialized when the wx.App object is created.\n'
|
||||
@@ -75,16 +75,16 @@ def run():
|
||||
item.ignore()
|
||||
pycode += '%s = Cursor()\n' % tools.removeWxPrefix(item.name)
|
||||
module.addPyCode(pycode)
|
||||
|
||||
|
||||
# former renamed constructors
|
||||
module.addPyCode('StockCursor = wx.deprecated(Cursor, "Use Cursor instead.")')
|
||||
module.addPyCode('CursorFromImage = wx.deprecated(Cursor, "Use Cursor instead.")')
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
132
etg/dataobj.py
132
etg/dataobj.py
@@ -16,7 +16,7 @@ NAME = "dataobj" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxDataFormat',
|
||||
'wxDataObject',
|
||||
'wxDataObjectSimple',
|
||||
@@ -29,7 +29,7 @@ ITEMS = [ 'wxDataFormat',
|
||||
'wxHTMLDataObject',
|
||||
]
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def addGetAllFormats(klass, pureVirtual=False):
|
||||
@@ -37,14 +37,14 @@ def addGetAllFormats(klass, pureVirtual=False):
|
||||
# the formats as a Python list
|
||||
m = klass.findItem('GetAllFormats')
|
||||
if m:
|
||||
m.ignore()
|
||||
m.ignore()
|
||||
|
||||
pyArgs = '(dir=Get)' if klass.name == 'wxDataObject' else '(dir=DataObject.Get)'
|
||||
|
||||
|
||||
klass.addCppMethod('PyObject*', 'GetAllFormats', '(wxDataObject::Direction dir=wxDataObject::Get)',
|
||||
cppSignature='void (wxDataFormat* formats, Direction dir)',
|
||||
pyArgsString=pyArgs,
|
||||
isVirtual=True,
|
||||
isVirtual=True,
|
||||
isPureVirtual=pureVirtual,
|
||||
isConst=True,
|
||||
doc="""\
|
||||
@@ -60,13 +60,13 @@ def addGetAllFormats(klass, pureVirtual=False):
|
||||
wxDataFormat* format = new wxDataFormat(formats[i]);
|
||||
PyObject* obj = wxPyConstructObject((void*)format, wxT("wxDataFormat"), true);
|
||||
PyList_SET_ITEM(list, i, obj); // PyList_SET_ITEM steals a reference
|
||||
}
|
||||
}
|
||||
delete [] formats;
|
||||
return list;
|
||||
""",
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
# and the Python signature.
|
||||
virtualCatcherCode="""\
|
||||
// VirtualCatcherCode for wx.DataObject.GetAllFormats
|
||||
@@ -90,7 +90,7 @@ def addGetAllFormats(klass, pureVirtual=False):
|
||||
wxDataFormat* fmt;
|
||||
int err = 0;
|
||||
fmt = (wxDataFormat*)sipConvertToType(
|
||||
item, sipType_wxDataFormat, NULL,
|
||||
item, sipType_wxDataFormat, NULL,
|
||||
SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &err);
|
||||
formats[idx] = *fmt;
|
||||
Py_DECREF(item);
|
||||
@@ -99,7 +99,7 @@ def addGetAllFormats(klass, pureVirtual=False):
|
||||
}
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Print();
|
||||
Py_XDECREF(resObj);
|
||||
Py_XDECREF(resObj);
|
||||
""" 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
|
||||
# impelmentations in C even though they will not be used much (if at
|
||||
# all.)
|
||||
# all.)
|
||||
if not c.findItem('GetFormatCount'):
|
||||
c.addItem(
|
||||
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
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxDataFormat')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.find('GetType').setCppCode("return static_cast<wxDataFormatId>(self->GetType());")
|
||||
@@ -160,14 +160,14 @@ def run():
|
||||
item = module.find('wxFormatInvalid')
|
||||
module.items.remove(item)
|
||||
module.insertItemAfter(c, item)
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxDataObject')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
addGetAllFormats(c, True)
|
||||
|
||||
|
||||
# For initial testing only. TODO: Remove later
|
||||
c.addPublic()
|
||||
c.addCppMethod('void', '_testGetAllFormats', '()',
|
||||
@@ -179,7 +179,7 @@ def run():
|
||||
|
||||
# Replace the GetDataHere method with a version that uses a smarter
|
||||
# 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)',
|
||||
cppSignature='bool (const wxDataFormat& format, void* buf)',
|
||||
isVirtual=True, isPureVirtual=True,
|
||||
@@ -191,40 +191,40 @@ def run():
|
||||
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.
|
||||
virtualCatcherCode="""\
|
||||
// Call self.GetDataSize() to find out how big the buffer should be
|
||||
PyObject* self = NULL;
|
||||
PyObject* self = NULL;
|
||||
PyObject* fmtObj = NULL;
|
||||
PyObject* sizeObj = NULL;
|
||||
PyObject* buffer = NULL;
|
||||
PyObject* resObj = NULL;
|
||||
Py_ssize_t size = 0;
|
||||
|
||||
|
||||
self = PyMethod_Self(sipMethod); // this shouldn't fail, and the reference is borrowed
|
||||
|
||||
|
||||
fmtObj = wxPyConstructObject((void*)&format, "wxDataFormat", false);
|
||||
if (!fmtObj) goto error;
|
||||
sizeObj = PyObject_CallMethod(self, "GetDataSize", "(O)", fmtObj, NULL);
|
||||
if (!sizeObj) goto error;
|
||||
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.
|
||||
buffer = wxPyMakeBuffer(buf, size);
|
||||
resObj = sipCallMethod(0, sipMethod, "SS", fmtObj, buffer);
|
||||
|
||||
if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0)
|
||||
PyErr_Print();
|
||||
|
||||
|
||||
error:
|
||||
Py_XDECREF(resObj);
|
||||
Py_XDECREF(buffer);
|
||||
Py_XDECREF(fmtObj);
|
||||
Py_XDECREF(sizeObj);
|
||||
""")
|
||||
|
||||
|
||||
# Replace the SetData method with an implementation that uses Python
|
||||
# buffer objects.
|
||||
c.find('SetData').ignore()
|
||||
@@ -233,8 +233,8 @@ def run():
|
||||
isVirtual=True,
|
||||
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);",
|
||||
|
||||
# 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.
|
||||
virtualCatcherCode="""\
|
||||
PyObject* buffer = wxPyMakeBuffer((void*)buf, len);
|
||||
@@ -246,18 +246,18 @@ def run():
|
||||
Py_XDECREF(resObj);
|
||||
Py_XDECREF(buffer);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxDataObjectSimple')
|
||||
|
||||
c.addCppCtor_sip('(const wxString& formatName)',
|
||||
|
||||
c.addCppCtor_sip('(const wxString& formatName)',
|
||||
body='sipCpp = new sipwxDataObjectSimple(wxDataFormat(*formatName));')
|
||||
|
||||
|
||||
# As in wxDataObject above replace GetDataHere and SetData with methods
|
||||
# that use buffer objects instead of void*, but this time we do not pass
|
||||
# a DataFormat object with it.
|
||||
c.find('GetDataHere').ignore()
|
||||
c.find('GetDataHere').ignore()
|
||||
c.addCppMethod('bool', 'GetDataHere', '(wxPyBuffer* buf)',
|
||||
cppSignature='bool (void* buf)',
|
||||
isVirtual=True,
|
||||
@@ -270,32 +270,32 @@ def run():
|
||||
""",
|
||||
virtualCatcherCode="""\
|
||||
// Call self.GetDataSize() to find out how big the buffer should be
|
||||
PyObject* self = NULL;
|
||||
PyObject* self = NULL;
|
||||
PyObject* sizeObj = NULL;
|
||||
PyObject* buffer = NULL;
|
||||
PyObject* resObj = NULL;
|
||||
Py_ssize_t size = 0;
|
||||
|
||||
|
||||
self = PyMethod_Self(sipMethod);
|
||||
|
||||
|
||||
sizeObj = PyObject_CallMethod(self, "GetDataSize", "", NULL);
|
||||
if (!sizeObj) goto error;
|
||||
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.
|
||||
buffer = wxPyMakeBuffer(buf, size);
|
||||
resObj = sipCallMethod(0, sipMethod, "S", buffer);
|
||||
|
||||
if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0)
|
||||
PyErr_Print();
|
||||
|
||||
|
||||
error:
|
||||
Py_XDECREF(resObj);
|
||||
Py_XDECREF(buffer);
|
||||
Py_XDECREF(sizeObj);
|
||||
""")
|
||||
|
||||
|
||||
c.find('SetData').ignore()
|
||||
c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)',
|
||||
cppSignature='bool (size_t len, const void* buf)',
|
||||
@@ -314,24 +314,24 @@ def run():
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxCustomDataObject')
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
c.addCppCtor_sip('(const wxString& formatName)',
|
||||
c.addCppCtor_sip('(const wxString& formatName)',
|
||||
body='sipCpp = new sipwxCustomDataObject(wxDataFormat(*formatName));')
|
||||
|
||||
# remove the methods having to do with allocating or owning the data buffer
|
||||
c.find('Alloc').ignore()
|
||||
c.find('Free').ignore()
|
||||
c.find('TakeData').ignore()
|
||||
|
||||
|
||||
c.find('GetData').ignore()
|
||||
c.addCppMethod('PyObject*', 'GetData', '()', isConst=True,
|
||||
doc="Returns a reference to the data buffer.",
|
||||
body="return wxPyMakeBuffer(self->GetData(), self->GetSize());")
|
||||
|
||||
|
||||
c.find('SetData').ignore()
|
||||
c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)',
|
||||
cppSignature='bool (size_t len, const void* buf)',
|
||||
@@ -341,68 +341,68 @@ def run():
|
||||
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxDataObjectComposite')
|
||||
|
||||
c.find('Add.dataObject').transfer = True
|
||||
|
||||
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxTextDataObject')
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxURLDataObject')
|
||||
|
||||
|
||||
# wxURLDataObject derives from wxDataObjectComposite on some platforms,
|
||||
# and wxTextDataObject on others, so we need to take a least common
|
||||
# denominator approach here to be able to work on all platforms.
|
||||
c.bases = ['wxDataObject']
|
||||
|
||||
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxBitmapDataObject')
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxFileDataObject')
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
#------------------------------------------------------------
|
||||
c = module.find('wxHTMLDataObject')
|
||||
addGetAllFormats(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
addBaseVirtuals(c)
|
||||
addSimpleVirtuals(c)
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
module.addPyCode("PyDataObjectSimple = wx.deprecated(DataObjectSimple), 'Use DataObjectSimple instead.'")
|
||||
module.addPyCode("PyTextDataObject = wx.deprecated(TextDataObject, 'Use TextDataObject instead.')")
|
||||
module.addPyCode("PyBitmapDataObject = wx.deprecated(BitmapDataObject, 'Use TextDataObject instead.')")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
168
etg/dataview.py
168
etg/dataview.py
@@ -17,18 +17,18 @@ NAME = "dataview" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [
|
||||
# this script.
|
||||
ITEMS = [
|
||||
'wxDataViewItem',
|
||||
'wxDataViewItemAttr',
|
||||
'wxDataViewIconText',
|
||||
'wxDataViewModelNotifier',
|
||||
|
||||
|
||||
'wxDataViewModel',
|
||||
'wxDataViewListModel',
|
||||
'wxDataViewIndexListModel',
|
||||
'wxDataViewVirtualListModel',
|
||||
|
||||
|
||||
'wxDataViewRenderer',
|
||||
'wxDataViewCustomRenderer',
|
||||
'wxDataViewTextRenderer',
|
||||
@@ -36,22 +36,22 @@ ITEMS = [
|
||||
'wxDataViewProgressRenderer',
|
||||
'wxDataViewSpinRenderer',
|
||||
'wxDataViewToggleRenderer',
|
||||
'wxDataViewChoiceRenderer',
|
||||
'wxDataViewChoiceRenderer',
|
||||
#'wxDataViewChoiceByIndexRenderer', # only available in generic dvc
|
||||
'wxDataViewDateRenderer',
|
||||
'wxDataViewDateRenderer',
|
||||
'wxDataViewBitmapRenderer',
|
||||
|
||||
|
||||
'wxDataViewColumn',
|
||||
'wxDataViewCtrl',
|
||||
'wxDataViewEvent',
|
||||
|
||||
|
||||
'wxDataViewListCtrl',
|
||||
'wxDataViewListStore',
|
||||
|
||||
|
||||
'wxDataViewTreeCtrl',
|
||||
'wxDataViewTreeStore',
|
||||
]
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -59,7 +59,7 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
@@ -96,20 +96,20 @@ def run():
|
||||
module.addPyCode("NullDataViewItem = DataViewItem()")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewModel')
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
c.find('~wxDataViewModel').ignore(False)
|
||||
|
||||
|
||||
c.find('AddNotifier.notifier').transfer = True
|
||||
c.find('RemoveNotifier.notifier').transferBack = True
|
||||
|
||||
|
||||
# Change the GetValue method to return the value instead of passing it
|
||||
# through a parameter for modification.
|
||||
c.find('GetValue.variant').out = True
|
||||
|
||||
|
||||
|
||||
|
||||
# The DataViewItemObjectMapper class helps map from data items to Python
|
||||
# objects, and is used as a base class of PyDataViewModel as a
|
||||
# convenience.
|
||||
@@ -121,23 +121,23 @@ def run():
|
||||
: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
|
||||
:class:`DataViewItem`.
|
||||
|
||||
|
||||
By default a regular dictionary is used to implement the ID to object
|
||||
mapping. Optionally a WeakValueDictionary can be useful when there will be
|
||||
a high turnover of objects and mantaining an extra reference to the
|
||||
objects would be unwise. If weak references are used then the objects
|
||||
associated with data items must be weak-referenceable. (Things like
|
||||
stock lists and dictionaries are not.) See :meth:`UseWeakRefs`.
|
||||
|
||||
|
||||
This class is used in :class:`PyDataViewModel` as a mixin for convenience.
|
||||
""",
|
||||
items=[
|
||||
PyFunctionDef('__init__', '(self)',
|
||||
PyFunctionDef('__init__', '(self)',
|
||||
body="""\
|
||||
self.mapper = dict()
|
||||
self.usingWeakRefs = False
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('ObjectToItem', '(self, obj)',
|
||||
doc="Create a :class:`DataViewItem` for the object, and remember the ID-->obj mapping.",
|
||||
body="""\
|
||||
@@ -146,7 +146,7 @@ def run():
|
||||
while oid > sys.maxsize:
|
||||
# risk of conflict here... May need some more thought.
|
||||
oid -= sys.maxsize
|
||||
self.mapper[oid] = obj
|
||||
self.mapper[oid] = obj
|
||||
return DataViewItem(oid)
|
||||
"""),
|
||||
|
||||
@@ -156,8 +156,8 @@ def run():
|
||||
oid = int(item.GetID())
|
||||
return self.mapper[oid]
|
||||
"""),
|
||||
|
||||
PyFunctionDef('UseWeakRefs', '(self, flag)',
|
||||
|
||||
PyFunctionDef('UseWeakRefs', '(self, flag)',
|
||||
doc="""\
|
||||
Switch to or from using a weak value dictionary for keeping the ID to
|
||||
object map.""",
|
||||
@@ -178,22 +178,22 @@ def run():
|
||||
module.addPyClass('PyDataViewModel', ['DataViewModel', 'DataViewItemObjectMapper'],
|
||||
doc="A convenience class that is a :class:`DataViewModel` combined with an object mapper.",
|
||||
items=[
|
||||
PyFunctionDef('__init__', '(self)',
|
||||
PyFunctionDef('__init__', '(self)',
|
||||
body="""\
|
||||
DataViewModel.__init__(self)
|
||||
DataViewItemObjectMapper.__init__(self)
|
||||
""")
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewListModel')
|
||||
c.addAutoProperties()
|
||||
|
||||
c.addAutoProperties()
|
||||
|
||||
# Change the GetValueByRow method to return the value instead of passing
|
||||
# it through a parameter for modification.
|
||||
c.find('GetValueByRow.variant').out = True
|
||||
|
||||
|
||||
# declare implementations for base class virtuals
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
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 IsListModel() const;
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
|
||||
# Add some of the pure virtuals since there are undocumented
|
||||
# implementations of them in these classes. The others will need to be
|
||||
# implemented in Python classes derived from these.
|
||||
for name in ['wxDataViewIndexListModel', 'wxDataViewVirtualListModel']:
|
||||
c = module.find(name)
|
||||
|
||||
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
virtual unsigned int GetRow(const wxDataViewItem& item) const;
|
||||
virtual unsigned int GetCount() const;
|
||||
virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
# compatibility aliases
|
||||
module.addPyCode("""\
|
||||
@@ -227,28 +227,28 @@ def run():
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
def _fixupBoolGetters(method, sig):
|
||||
method.type = 'void'
|
||||
method.find('value').out = True
|
||||
method.cppSignature = sig
|
||||
|
||||
|
||||
c = module.find('wxDataViewRenderer')
|
||||
|
||||
|
||||
c = module.find('wxDataViewRenderer')
|
||||
c.addPrivateCopyCtor()
|
||||
c.abstract = True
|
||||
c.addAutoProperties()
|
||||
c.find('GetView').ignore(False)
|
||||
|
||||
|
||||
|
||||
|
||||
# Change variant getters to return the value
|
||||
for name, sig in [
|
||||
for name, sig in [
|
||||
('GetValue', 'bool (wxDVCVariant& value)'),
|
||||
('GetValueFromEditorCtrl', 'bool (wxWindow * editor, wxDVCVariant& value)'),
|
||||
]:
|
||||
_fixupBoolGetters(c.find(name), sig)
|
||||
|
||||
|
||||
|
||||
|
||||
# Add the pure virtuals since there are undocumented implementations of
|
||||
# them in all these classes
|
||||
for name in [ 'wxDataViewTextRenderer',
|
||||
@@ -263,23 +263,23 @@ def run():
|
||||
]:
|
||||
c = module.find(name)
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
virtual bool SetValue( const wxDVCVariant &value );
|
||||
virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxDVCVariant& value)];
|
||||
%Property(name=Value, get=GetValue, set=SetValue)
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxDataViewCustomRenderer')
|
||||
_fixupBoolGetters(c.find('GetValueFromEditorCtrl'),
|
||||
'bool (wxWindow * editor, wxDVCVariant& value)')
|
||||
c.find('GetTextExtent').ignore(False)
|
||||
|
||||
|
||||
module.addPyCode("""\
|
||||
PyDataViewCustomRenderer = wx.deprecated(DataViewCustomRenderer,
|
||||
"Use DataViewCustomRenderer instead")""")
|
||||
|
||||
|
||||
# The SpinRenderer has a few more pure virtuals that need to be declared
|
||||
# since it derives from DataViewCustomRenderer
|
||||
c = module.find('wxDataViewSpinRenderer')
|
||||
@@ -288,12 +288,12 @@ def run():
|
||||
virtual bool Render(wxRect cell, wxDC* dc, int state);
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewColumn')
|
||||
for m in c.find('wxDataViewColumn').all():
|
||||
m.find('renderer').transfer = True
|
||||
|
||||
|
||||
# declare the virtuals from wxSettableHeaderColumn
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
virtual void SetTitle(const wxString& title);
|
||||
@@ -311,13 +311,13 @@ def run():
|
||||
virtual bool IsSortKey() const;
|
||||
virtual void SetSortOrder(bool ascending);
|
||||
virtual bool IsSortOrderAscending() const;
|
||||
|
||||
|
||||
virtual void SetResizeable(bool resizable);
|
||||
virtual void SetSortable(bool sortable);
|
||||
virtual void SetReorderable(bool reorderable);
|
||||
virtual void SetHidden(bool hidden);
|
||||
"""))
|
||||
|
||||
|
||||
c.addAutoProperties()
|
||||
c.addProperty('Title', 'GetTitle', 'SetTitle')
|
||||
c.addProperty('Bitmap', 'GetBitmap', 'SetBitmap')
|
||||
@@ -326,9 +326,9 @@ def run():
|
||||
c.addProperty('Alignment', 'GetAlignment', 'SetAlignment')
|
||||
c.addProperty('Flags', 'GetFlags', 'SetFlags')
|
||||
c.addProperty('SortOrder', 'IsSortOrderAscending', 'SetSortOrder')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewCtrl')
|
||||
tools.fixWindowClass(c)
|
||||
@@ -336,33 +336,33 @@ def run():
|
||||
|
||||
c.find('AssociateModel.model').transfer = True
|
||||
c.find('AssociateModel').pyName = '_AssociateModel'
|
||||
c.addPyMethod('AssociateModel', '(self, model)',
|
||||
c.addPyMethod('AssociateModel', '(self, model)',
|
||||
doc="""\
|
||||
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.
|
||||
""",
|
||||
body="""\
|
||||
import wx.siplib
|
||||
wasPyOwned = wx.siplib.ispyowned(model)
|
||||
self._AssociateModel(model)
|
||||
# Ownership of the python object has just been transferred to
|
||||
# C++, so DecRef the C++ instance associated with this python
|
||||
# Ownership of the python object has just been transferred to
|
||||
# C++, so DecRef the C++ instance associated with this python
|
||||
# reference.
|
||||
if wasPyOwned:
|
||||
model.DecRef()
|
||||
""")
|
||||
|
||||
|
||||
c.find('PrependColumn.col').transfer = True
|
||||
c.find('InsertColumn.col').transfer = True
|
||||
c.find('AppendColumn.col').transfer = True
|
||||
|
||||
|
||||
c.addPyMethod('GetColumns', '(self)',
|
||||
doc="Returns a list of column objects.",
|
||||
body="return [self.GetColumn(i) for i in range(self.GetColumnCount())]")
|
||||
|
||||
|
||||
c.find('GetSelections').ignore()
|
||||
c.addCppMethod('wxDataViewItemArray*', 'GetSelections', '()',
|
||||
c.addCppMethod('wxDataViewItemArray*', 'GetSelections', '()',
|
||||
isConst=True, factory=True,
|
||||
doc="Returns a list of the currently selected items.",
|
||||
body="""\
|
||||
@@ -382,9 +382,9 @@ def run():
|
||||
body="""\
|
||||
wxDataViewItem* item = new wxDataViewItem();;
|
||||
wxDataViewColumn* col = NULL;
|
||||
|
||||
|
||||
self->HitTest(*point, *item, col);
|
||||
|
||||
|
||||
wxPyThreadBlocker blocker;
|
||||
PyObject* value = PyTuple_New(2);
|
||||
PyObject* item_obj =
|
||||
@@ -401,17 +401,17 @@ def run():
|
||||
// PyTuple steals a reference, so we don't need to decref the items here
|
||||
return value;
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewEvent')
|
||||
tools.fixEventClass(c)
|
||||
|
||||
|
||||
c.addProperty('EditCancelled', 'IsEditCancelled', 'SetEditCanceled')
|
||||
|
||||
|
||||
c.find('SetCache.from').name = 'from_'
|
||||
c.find('SetCache.to').name = 'to_'
|
||||
|
||||
|
||||
c.find('GetDataBuffer').ignore()
|
||||
c.addCppMethod('PyObject*', 'GetDataBuffer', '()', isConst=True,
|
||||
doc="Gets the data buffer for a drop data transfer",
|
||||
@@ -423,8 +423,8 @@ def run():
|
||||
# TODO: SetDataBuffer
|
||||
|
||||
c.find('SetDataObject.obj').transfer = True
|
||||
|
||||
|
||||
|
||||
|
||||
module.addPyCode("""\
|
||||
EVT_DATAVIEW_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_SELECTION_CHANGED, 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_COLLAPSING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_COLLAPSING, 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_DONE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_DONE, 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_REORDERED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_REORDERED, 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_CACHE_HINT = wx.PyEventBinder( wxEVT_DATAVIEW_CACHE_HINT, 1 )
|
||||
|
||||
|
||||
# deprecated wxEVT aliases
|
||||
wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED = wxEVT_DATAVIEW_SELECTION_CHANGED
|
||||
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 = wxEVT_DATAVIEW_ITEM_DROP
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewListCtrl')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
c.find('GetStore').overloads = []
|
||||
|
||||
c.find('AppendItem.values').type = 'const wxVariantVector&'
|
||||
@@ -479,20 +479,20 @@ def run():
|
||||
c.find('InsertItem.values').type = 'const wxVariantVector&'
|
||||
|
||||
c.find('GetValue.value').out = True
|
||||
|
||||
|
||||
for name in 'AppendColumn InsertColumn PrependColumn'.split():
|
||||
for m in c.find(name).all():
|
||||
m.find('column').transfer = True
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxDataViewListStore')
|
||||
c.find('AppendItem.values').type = 'const wxVariantVector&'
|
||||
c.find('PrependItem.values').type = 'const wxVariantVector&'
|
||||
c.find('InsertItem.values').type = 'const wxVariantVector&'
|
||||
c.find('GetValueByRow.value').out = True
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDataViewTreeCtrl')
|
||||
tools.fixWindowClass(c)
|
||||
@@ -502,12 +502,12 @@ def run():
|
||||
c = module.find('wxDataViewTreeStore')
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -11,29 +11,29 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "datectrl" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxDatePickerCtrl",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/datectrl.h>")
|
||||
|
||||
|
||||
dpc = module.find('wxDatePickerCtrl')
|
||||
assert isinstance(dpc, etgtools.ClassDef)
|
||||
|
||||
@@ -44,7 +44,7 @@ def run():
|
||||
module.insertItemAfter(dpc, gdpc)
|
||||
# and give it a new Python name to match Classic
|
||||
gdpc.pyName = 'GenericDatePickerCtrl'
|
||||
|
||||
|
||||
# now back to our regular tweaking
|
||||
for c in [dpc, gdpc]:
|
||||
tools.fixWindowClass(c)
|
||||
@@ -52,12 +52,12 @@ def run():
|
||||
c.find('GetRange.dt2').out = True
|
||||
|
||||
gdpc.addHeaderCode("#include <wx/generic/datectrl.h>")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,48 +10,48 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "dateevt" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxDateEvent",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode("#include <wx/dateevt.h>")
|
||||
|
||||
|
||||
c = module.find('wxDateEvent')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixEventClass(c)
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
|
||||
EVT_TIME_CHANGED = wx.PyEventBinder( wxEVT_TIME_CHANGED, 1 )
|
||||
""")
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
DateEvent.PyGetDate = wx.deprecated(DateEvent.GetDate, 'Use GetDate instead.')
|
||||
DateEvent.PySetDate = wx.deprecated(DateEvent.SetDate, 'Use SetDate instead.')
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
98
etg/dc.py
98
etg/dc.py
@@ -19,29 +19,29 @@ NAME = "dc" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxFontMetrics',
|
||||
'wxDC',
|
||||
'wxDC',
|
||||
'wxDCClipper',
|
||||
'wxDCBrushChanger',
|
||||
'wxDCPenChanger',
|
||||
'wxDCTextColourChanger',
|
||||
'wxDCFontChanger',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
OTHERDEPS = [ 'src/dc_ex.cpp', ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxDC')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
@@ -52,7 +52,7 @@ def run():
|
||||
# Keep only the wxSize overloads of these
|
||||
c.find('GetSize').findOverload('wxCoord').ignore()
|
||||
c.find('GetSizeMM').findOverload('wxCoord').ignore()
|
||||
|
||||
|
||||
# TODO: needs wxAffineMatrix2D support.
|
||||
#c.find('GetTransformMatrix').ignore()
|
||||
#c.find('SetTransformMatrix').ignore()
|
||||
@@ -66,23 +66,23 @@ def run():
|
||||
# are multiple array parameters involved...
|
||||
c.find('DrawPolyPolygon').ignore()
|
||||
|
||||
|
||||
|
||||
# Add output param annotations so the generated docstrings will be correct
|
||||
c.find('GetUserScale.x').out = True
|
||||
c.find('GetUserScale.y').out = True
|
||||
|
||||
c.find('GetLogicalScale.x').out = True
|
||||
c.find('GetLogicalScale.y').out = True
|
||||
|
||||
|
||||
c.find('GetLogicalOrigin').overloads = []
|
||||
c.find('GetLogicalOrigin.x').out = True
|
||||
c.find('GetLogicalOrigin.y').out = True
|
||||
|
||||
|
||||
c.find('GetClippingBox.x').out = True
|
||||
c.find('GetClippingBox.y').out = True
|
||||
c.find('GetClippingBox.width').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",
|
||||
body="return wx.Rect(*self.GetClippingBox())")
|
||||
|
||||
@@ -187,7 +187,7 @@ def run():
|
||||
# avoid using parameters as return values, etc. as well as Classic
|
||||
# compatibility.
|
||||
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.",
|
||||
body="""\
|
||||
wxColour* col = new wxColour;
|
||||
@@ -220,17 +220,17 @@ def run():
|
||||
return new wxArrayInt(rval);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
c.addCppMethod('int', '__nonzero__', '()', """\
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
|
||||
c.addPyMethod('GetBoundingBox', '(self)', doc="""\
|
||||
GetBoundingBox() -> (x1,y1, x2,y2)\n
|
||||
Returns the min and max points used in drawing commands so far.""",
|
||||
body="return (self.MinX(), self.MinY(), self.MaxX(), self.MaxY())")
|
||||
|
||||
|
||||
|
||||
|
||||
c.addCppMethod('long', 'GetHDC', '()', """\
|
||||
#ifdef __WXMSW__
|
||||
return (long)self->GetHandle();
|
||||
@@ -252,17 +252,17 @@ def run():
|
||||
wxPyRaiseNotImplemented();
|
||||
return NULL;
|
||||
#endif""")
|
||||
|
||||
|
||||
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.GetGdkDrawable = wx.deprecated(DC.GetGdkDrawable, "Use GetHandle instead.")')
|
||||
|
||||
|
||||
|
||||
|
||||
# This file contains implementations of functions for quickly drawing
|
||||
# lists of items on the DC. They are called from the CppMethods defined
|
||||
# below, which in turn are called from the PyMethods below that.
|
||||
c.includeCppCode('src/dc_ex.cpp')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', '_DrawPointList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* 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)',
|
||||
body="return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);")
|
||||
|
||||
c.addCppMethod('PyObject*', '_DrawTextList',
|
||||
c.addCppMethod('PyObject*', '_DrawTextList',
|
||||
'(PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)',
|
||||
body="return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);")
|
||||
|
||||
|
||||
|
||||
c.addPyMethod('DrawPointList', '(self, points, pens=None)',
|
||||
doc="""\
|
||||
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).
|
||||
: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
|
||||
: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
|
||||
pens then there should be one for each point in points.
|
||||
""",
|
||||
body="""\
|
||||
@@ -306,7 +306,7 @@ def run():
|
||||
c.addPyMethod('DrawLineList', '(self, lines, pens=None)',
|
||||
doc="""\
|
||||
Draw a list of lines as quickly as possible.
|
||||
|
||||
|
||||
:param lines: A sequence of 4-element sequences representing
|
||||
each line to draw, (x1,y1, x2,y2).
|
||||
: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)',
|
||||
doc="""\
|
||||
Draw a list of rectangles as quickly as possible.
|
||||
|
||||
|
||||
:param rectangles: A sequence of 4-element sequences representing
|
||||
each rectangle to draw, (x,y, w,h).
|
||||
:param pens: If None, then the current pen is used. If a
|
||||
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.
|
||||
:param brushes: A brush or brushes to be used to fill the rectagles,
|
||||
with similar semantics as the pens parameter.
|
||||
@@ -352,16 +352,16 @@ def run():
|
||||
raise ValueError('rectangles and brushes must have same length')
|
||||
return self._DrawRectangleList(rectangles, pens, brushes)
|
||||
""")
|
||||
|
||||
|
||||
c.addPyMethod('DrawEllipseList', '(self, ellipses, pens=None, brushes=None)',
|
||||
doc="""\
|
||||
Draw a list of ellipses as quickly as possible.
|
||||
|
||||
|
||||
:param ellipses: A sequence of 4-element sequences representing
|
||||
each ellipse to draw, (x,y, w,h).
|
||||
:param pens: If None, then the current pen is used. If a
|
||||
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.
|
||||
:param brushes: A brush or brushes to be used to fill the ellipses,
|
||||
with similar semantics as the pens parameter.
|
||||
@@ -381,17 +381,17 @@ def run():
|
||||
raise ValueError('ellipses and brushes must have same length')
|
||||
return self._DrawEllipseList(ellipses, pens, brushes)
|
||||
""")
|
||||
|
||||
|
||||
c.addPyMethod('DrawPolygonList', '(self, polygons, pens=None, brushes=None)',
|
||||
doc="""\
|
||||
Draw a list of polygons, each of which is a list of points.
|
||||
|
||||
|
||||
:param polygons: A sequence of sequences of sequences.
|
||||
[[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]]
|
||||
|
||||
|
||||
:param pens: If None, then the current pen is used. If a
|
||||
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.
|
||||
:param brushes: A brush or brushes to be used to fill the polygons,
|
||||
with similar semantics as the pens parameter.
|
||||
@@ -411,18 +411,18 @@ def run():
|
||||
raise ValueError('polygons and brushes must have same length')
|
||||
return self._DrawPolygonList(polygons, pens, brushes)
|
||||
""")
|
||||
|
||||
|
||||
c.addPyMethod('DrawTextList', '(self, textList, coords, foregrounds=None, backgrounds=None)',
|
||||
doc="""\
|
||||
Draw a list of strings using a list of coordinants for positioning each string.
|
||||
|
||||
|
||||
:param textList: A list of strings
|
||||
:param coords: A list of (x,y) positions
|
||||
:param foregrounds: A list of `wx.Colour` objects to use for the
|
||||
foregrounds of the strings.
|
||||
:param backgrounds: A list of `wx.Colour` objects to use for the
|
||||
backgrounds of the strings.
|
||||
|
||||
|
||||
NOTE: Make sure you set background mode to wx.Solid (DC.SetBackgroundMode)
|
||||
If you want backgrounds to do anything.
|
||||
""",
|
||||
@@ -452,7 +452,7 @@ def run():
|
||||
# TODO: Port the PseudoDC from Classic
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDCClipper')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
@@ -461,7 +461,7 @@ def run():
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDCBrushChanger')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
@@ -470,7 +470,7 @@ def run():
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDCPenChanger')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
@@ -479,7 +479,7 @@ def run():
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDCTextColourChanger')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
@@ -488,7 +488,7 @@ def run():
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxDCFontChanger')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
@@ -496,13 +496,13 @@ def run():
|
||||
# context manager methods
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,29 +10,29 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcbuffer" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxBufferedDC',
|
||||
'wxBufferedPaintDC',
|
||||
'wxAutoBufferedPaintDC',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/dcbuffer.h>")
|
||||
|
||||
c = module.find('wxBufferedDC')
|
||||
@@ -43,22 +43,22 @@ def run():
|
||||
if m.findItem('buffer'):
|
||||
m.findItem('buffer').keepReference = True
|
||||
|
||||
|
||||
|
||||
c = module.find('wxBufferedPaintDC')
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('wxBufferedPaintDC').findOverload('wxBitmap').find('buffer').keepReference = True
|
||||
|
||||
|
||||
c = module.find('wxAutoBufferedPaintDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
module.find('wxAutoBufferedPaintDCFactory').factory = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,45 +10,45 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcclient" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxWindowDC',
|
||||
'wxClientDC',
|
||||
'wxPaintDC',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxPaintDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c = module.find('wxClientDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c = module.find('wxWindowDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcgraph" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxGCDC' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxGCDC' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxGCDC')
|
||||
# FIXME: Do we handle platform-specific classes, and if so, how?
|
||||
c.find('wxGCDC').findOverload('wxEnhMetaFileDC').ignore()
|
||||
@@ -40,15 +40,15 @@ def run():
|
||||
c.find('wxGCDC.memoryDC').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
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcmemory" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxMemoryDC' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxMemoryDC' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxMemoryDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcmirror" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxMirrorDC' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxMirrorDC' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxMirrorDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,37 +10,37 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcprint" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxPrinterDC', ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxPrinterDC', ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
|
||||
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxPrinterDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
22
etg/dcps.py
22
etg/dcps.py
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcps" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxPostScriptDC' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxPostScriptDC' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxPostScriptDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcscreen" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxScreenDC' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxScreenDC' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxScreenDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
22
etg/dcsvg.py
22
etg/dcsvg.py
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dcsvg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxSVGFileDC' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxSVGFileDC' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxSVGFileDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
22
etg/debug.py
22
etg/debug.py
@@ -10,42 +10,42 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "debug" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "debug_8h.xml",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
# We only need a couple items from this interface file, so ignore
|
||||
# everything and just enable the ones we want.
|
||||
for item in module:
|
||||
item.ignore()
|
||||
|
||||
|
||||
module.find('wxAbort').ignore(False)
|
||||
module.find('wxTrap').ignore(False)
|
||||
module.find('wxDisableAsserts').ignore(False)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
44
etg/defs.py
44
etg/defs.py
@@ -12,15 +12,15 @@ import sys
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "defs" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'defs_8h.xml' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'defs_8h.xml' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
@@ -29,20 +29,20 @@ def run():
|
||||
check4unittest=False)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
module.check4unittest = False
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
# tweaks for defs.h to help SIP understand the types better
|
||||
module.find('wxInt16').type = 'short'
|
||||
module.find('wxInt64').type = 'long long'
|
||||
module.find('wxUint64').type = 'unsigned long long'
|
||||
|
||||
|
||||
# See src/wacky_ints.sip
|
||||
module.find('wxIntPtr').ignore()
|
||||
module.find('wxUIntPtr').ignore()
|
||||
|
||||
|
||||
# Correct the types for these as their values are outside the range of int
|
||||
module.find('wxUINT32_MAX').type = 'unsigned long'
|
||||
module.find('wxINT64_MIN').type = 'long long'
|
||||
@@ -58,12 +58,12 @@ def run():
|
||||
module.find('wxInt8').pyInt = True
|
||||
module.find('wxUint8').pyInt = True
|
||||
module.find('wxByte').pyInt = True
|
||||
|
||||
|
||||
module.find('wxDELETE').ignore()
|
||||
module.find('wxDELETEA').ignore()
|
||||
module.find('wxSwap').ignore()
|
||||
module.find('wxVaCopy').ignore()
|
||||
|
||||
|
||||
# Add some typedefs for basic wx types and others so the backend
|
||||
# generator knows what they are
|
||||
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='unsigned char', name='byte', pyInt=True))
|
||||
module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned long', name='ulong'))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Forward declarations for classes that are referenced but not defined
|
||||
# yet.
|
||||
#
|
||||
# yet.
|
||||
#
|
||||
# TODO: Remove these when the classes are added for real.
|
||||
# TODO: Add these classes for real :-)
|
||||
module.insertItem(0, etgtools.WigCode("""\
|
||||
// forward declarations
|
||||
class wxExecuteEnv;
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
|
||||
# Add some code for getting the version numbers
|
||||
module.addCppCode("""
|
||||
#include <wx/version.h>
|
||||
const int MAJOR_VERSION = wxMAJOR_VERSION;
|
||||
const int MINOR_VERSION = wxMINOR_VERSION;
|
||||
const int RELEASE_NUMBER = wxRELEASE_NUMBER;
|
||||
const int MINOR_VERSION = wxMINOR_VERSION;
|
||||
const int RELEASE_NUMBER = wxRELEASE_NUMBER;
|
||||
""")
|
||||
module.addItem(etgtools.WigCode("""
|
||||
const int MAJOR_VERSION;
|
||||
@@ -103,14 +103,14 @@ def run():
|
||||
|
||||
module.addPyCode("BG_STYLE_CUSTOM = BG_STYLE_PAINT")
|
||||
module.addItem(etgtools.DefineDef(name='wxADJUST_MINSIZE', value='0'))
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,26 +10,26 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dialog" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [
|
||||
'wxDialog',
|
||||
'wxDialogLayoutAdapter',
|
||||
'wxDialogLayoutAdapter',
|
||||
'wxWindowModalDialogEvent',
|
||||
]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
@@ -41,18 +41,18 @@ def run():
|
||||
|
||||
c.find('wxDialog.title').default = 'wxEmptyString'
|
||||
c.find('Create.title').default = 'wxEmptyString'
|
||||
|
||||
|
||||
# PocketPC only, don't think we'll need these ;)
|
||||
c.find('DoOK').ignore()
|
||||
c.find('DoOK').ignore()
|
||||
c.find('GetToolBar').ignore()
|
||||
|
||||
# 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.
|
||||
c.find('ShowWindowModalThenDo').ignore()
|
||||
|
||||
|
||||
# Release the GIL for potentially blocking or long-running functions
|
||||
c.find('ShowModal').releaseGIL()
|
||||
|
||||
|
||||
# context manager methods
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Destroy()')
|
||||
@@ -67,8 +67,8 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dirctrl" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxGenericDirCtrl",
|
||||
"wxDirFilterListCtrl",
|
||||
]
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -27,27 +27,27 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/dirctrl.h>")
|
||||
|
||||
|
||||
c = module.find('wxGenericDirCtrl')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
EVT_DIRCTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_DIRCTRL_SELECTIONCHANGED, 1 )
|
||||
EVT_DIRCTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_DIRCTRL_FILEACTIVATED, 1 )
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,33 +16,33 @@ NAME = "dirdlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxDirDialog' ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxDirDialog')
|
||||
module.addGlobalStr('wxDirDialogNameStr', c)
|
||||
module.addGlobalStr('wxDirDialogDefaultFolderStr', c)
|
||||
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
module.find('wxDirSelectorPromptStr').ignore()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "display" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxDisplay', ]
|
||||
# this script.
|
||||
ITEMS = [ 'wxDisplay', ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -25,31 +25,31 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/display.h>")
|
||||
|
||||
|
||||
c = module.find('wxDisplay')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateAssignOp()
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
|
||||
c.addProperty('ClientArea GetClientArea')
|
||||
c.addProperty('CurrentMode GetCurrentMode')
|
||||
c.addProperty('Geometry GetGeometry')
|
||||
c.addProperty('Name GetName')
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
34
etg/dnd.py
34
etg/dnd.py
@@ -10,19 +10,19 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dnd" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "interface_2wx_2dnd_8h.xml",
|
||||
"wxDropSource",
|
||||
"wxDropTarget",
|
||||
"wxTextDropTarget",
|
||||
"wxFileDropTarget",
|
||||
]
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -30,13 +30,13 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/dnd.h>')
|
||||
|
||||
|
||||
c = module.find('wxDropSource')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
@@ -53,8 +53,8 @@ def run():
|
||||
m.find('iconCopy').ignore()
|
||||
m.find('iconMove').ignore()
|
||||
m.find('iconNone').ignore()
|
||||
|
||||
# void SetCursor(wxDragResult res, const wxCursor& cursor);
|
||||
|
||||
# void SetCursor(wxDragResult res, const wxCursor& cursor);
|
||||
c.find('SetCursor').setCppCode("""\
|
||||
#ifdef __WXGTK__
|
||||
wxPyRaiseNotImplementedMsg("Cursors not supported, use SetIcon on wxGTK instead.");
|
||||
@@ -62,7 +62,7 @@ def run():
|
||||
self->SetCursor(res, *cursor);
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
# void SetIcon(wxDragResult res, const wxIcon& icon)
|
||||
c.find('SetIcon').setCppCode("""\
|
||||
#ifdef __WXGTK__
|
||||
@@ -71,29 +71,29 @@ def run():
|
||||
wxPyRaiseNotImplementedMsg("Icons not supported, use SetCursor on non-wxGTK ports.");
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxDropTarget')
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('wxDropTarget.data').transfer = True
|
||||
c.find('SetDataObject.data').transfer = True
|
||||
|
||||
|
||||
module.addPyCode("PyDropTarget = wx.deprecated(DropTarget, 'Use DropTarget instead.')")
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxTextDropTarget')
|
||||
c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);"))
|
||||
|
||||
c = module.find('wxFileDropTarget')
|
||||
c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);"))
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,31 +10,31 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dragimag" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxDragImage",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
di = module.find('wxDragImage')
|
||||
assert isinstance(di, etgtools.ClassDef)
|
||||
|
||||
|
||||
# make a copy and rename it to 'wxGenericDragImage'
|
||||
gdi = tools.copyClassDef(di, 'wxGenericDragImage')
|
||||
module.insertItemAfter(di, gdi)
|
||||
@@ -44,17 +44,17 @@ def run():
|
||||
di.find('GetImageRect').ignore()
|
||||
di.find('UpdateBackingFromWindow').ignore()
|
||||
di.addPrivateCopyCtor()
|
||||
|
||||
|
||||
# and for wxGenericDragImage
|
||||
gdi.addPrivateCopyCtor()
|
||||
gdi.addHeaderCode("#include <wx/generic/dragimgg.h>")
|
||||
|
||||
|
||||
gdi.addHeaderCode("#include <wx/generic/dragimgg.h>")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,52 +10,52 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "editlbox" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxEditableListBox",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxEditableListBox')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
c.find('wxEditableListBox.label').default = 'wxEmptyString'
|
||||
c.find('Create.label').default = 'wxEmptyString'
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/editlbox.h>')
|
||||
module.addGlobalStr('wxEditableListBoxNameStr', c)
|
||||
|
||||
|
||||
c.find('GetStrings').ignore()
|
||||
c.addCppMethod('wxArrayString*', 'GetStrings', '()',
|
||||
c.addCppMethod('wxArrayString*', 'GetStrings', '()',
|
||||
doc="Returns a list of the current contents of the control.",
|
||||
body="""\
|
||||
wxArrayString* arr = new wxArrayString;
|
||||
self->GetStrings(*arr);
|
||||
return arr;""",
|
||||
factory=True)
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
178
etg/event.py
178
etg/event.py
@@ -11,14 +11,14 @@ import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "event" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [
|
||||
# this script.
|
||||
ITEMS = [
|
||||
'wxEvtHandler',
|
||||
'wxEventBlocker',
|
||||
'wxPropagationDisabler',
|
||||
@@ -62,14 +62,14 @@ ITEMS = [
|
||||
'wxUpdateUIEvent',
|
||||
'wxWindowCreateEvent',
|
||||
'wxWindowDestroyEvent',
|
||||
|
||||
#'wxThreadEvent',
|
||||
|
||||
]
|
||||
|
||||
|
||||
OTHERDEPS = [ 'src/event_ex.py',
|
||||
'src/event_ex.cpp',
|
||||
#'wxThreadEvent',
|
||||
|
||||
]
|
||||
|
||||
|
||||
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
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addCppCode("""
|
||||
#if !wxUSE_HOTKEY
|
||||
#define wxEVT_HOTKEY 0
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
# C macros that need to be ignored
|
||||
module.find('wx__DECLARE_EVT0').ignore()
|
||||
module.find('wx__DECLARE_EVT1').ignore()
|
||||
@@ -97,7 +97,7 @@ def run():
|
||||
module.find('wxDECLARE_EXPORTED_EVENT').ignore()
|
||||
module.find('wxDECLARE_EVENT').ignore()
|
||||
module.find('wxDEFINE_EVENT').ignore()
|
||||
|
||||
|
||||
|
||||
module.addPyClass('PyEventBinder', ['object'],
|
||||
doc="""\
|
||||
@@ -109,20 +109,20 @@ def run():
|
||||
if expectedIDs not in [0, 1, 2]:
|
||||
raise ValueError("Invalid number of expectedIDs")
|
||||
self.expectedIDs = expectedIDs
|
||||
|
||||
|
||||
if isinstance(evtType, (list, tuple)):
|
||||
self.evtType = list(evtType)
|
||||
else:
|
||||
self.evtType = [evtType]
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('Bind', '(self, target, id1, id2, function)',
|
||||
doc="""Bind this set of event types to target using its Connect() method.""",
|
||||
body="""\
|
||||
for et in self.evtType:
|
||||
target.Connect(id1, id2, et, function)
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('Unbind', '(self, target, id1, id2, handler=None)',
|
||||
doc="""Remove an event binding.""",
|
||||
body="""\
|
||||
@@ -131,16 +131,16 @@ def run():
|
||||
success += target.Disconnect(id1, id2, et, handler)
|
||||
return success != 0
|
||||
"""),
|
||||
|
||||
|
||||
PyFunctionDef('_getEvtType', '(self)',
|
||||
doc="""\
|
||||
Make it easy to get to the default wxEventType typeID for this
|
||||
event binder.
|
||||
""",
|
||||
body="""return self.evtType[0]"""),
|
||||
|
||||
|
||||
PyPropertyDef('typeId', '_getEvtType'),
|
||||
|
||||
|
||||
PyFunctionDef('__call__', '(self, *args)',
|
||||
deprecated="Use :meth:`EvtHandler.Bind` instead.",
|
||||
doc="""\
|
||||
@@ -165,14 +165,14 @@ def run():
|
||||
func = args[3]
|
||||
else:
|
||||
raise ValueError("Unexpected number of IDs")
|
||||
|
||||
|
||||
self.Bind(target, id1, id2, func)
|
||||
""")
|
||||
])
|
||||
|
||||
|
||||
|
||||
module.includePyCode('src/event_ex.py')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxEvtHandler
|
||||
c = module.find('wxEvtHandler')
|
||||
@@ -180,13 +180,13 @@ def run():
|
||||
c.addPublic()
|
||||
|
||||
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():
|
||||
if item.name in ['Connect', 'Disconnect', 'Bind', 'Unbind']:
|
||||
item.ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
# it is time to handle the event.
|
||||
@@ -214,7 +214,7 @@ def run():
|
||||
c.addCppMethod(
|
||||
'bool', 'Disconnect', '(int id, int lastId=-1, '
|
||||
'wxEventType eventType=wxEVT_NULL, '
|
||||
'PyObject* func=NULL)',
|
||||
'PyObject* func=NULL)',
|
||||
doc="Remove an event binding by removing its entry in the dynamic event table.",
|
||||
body="""\
|
||||
if (func && func != Py_None) {
|
||||
@@ -239,7 +239,7 @@ def run():
|
||||
self->GetDynamicEventTable()->Erase(node);
|
||||
delete entry;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
# the template, probably using PyObject* args.
|
||||
for m in c.find('CallAfter').all():
|
||||
m.ignore()
|
||||
|
||||
|
||||
# wxEventTable is not documented so we have to ignore SearchEventTable.
|
||||
# TODO: Should wxEventTable be available to language bindings?
|
||||
c.find('SearchEventTable').ignore()
|
||||
|
||||
c.find('QueueEvent.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
|
||||
# tracking then enable these....
|
||||
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)',
|
||||
doc="""\
|
||||
Bind an event to an event handler.
|
||||
|
||||
|
||||
:param event: One of the ``EVT_*`` event binder objects that
|
||||
specifies the type of event to bind.
|
||||
|
||||
|
||||
:param handler: A callable object to be invoked when the
|
||||
event is delivered to self. Pass ``None`` to
|
||||
disconnect an event handler.
|
||||
|
||||
|
||||
:param source: Sometimes the event originates from a
|
||||
different window than self, but you still
|
||||
want to catch it in self. (For example, a
|
||||
@@ -308,10 +308,10 @@ def run():
|
||||
handling system is able to differentiate
|
||||
between the same event type from different
|
||||
controls.
|
||||
|
||||
|
||||
:param id: Used to spcify the event source by ID instead
|
||||
of instance.
|
||||
|
||||
|
||||
:param id2: Used when it is desirable to bind a handler
|
||||
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')
|
||||
if source is not None:
|
||||
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)',
|
||||
doc="""\
|
||||
Disconnects the event handler binding for event from `self`.
|
||||
@@ -333,7 +333,7 @@ def run():
|
||||
body="""\
|
||||
if source is not None:
|
||||
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.")')
|
||||
@@ -345,40 +345,40 @@ def run():
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
c.find('Clone').factory = True
|
||||
|
||||
|
||||
c.addProperty('EventObject GetEventObject SetEventObject')
|
||||
c.addProperty('EventType GetEventType SetEventType')
|
||||
c.addProperty('Id GetId SetId')
|
||||
c.addProperty('Skipped GetSkipped')
|
||||
c.addProperty('Timestamp GetTimestamp SetTimestamp')
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxCommandEvent
|
||||
c = module.find('wxCommandEvent')
|
||||
|
||||
|
||||
c.find('GetClientData').ignore()
|
||||
c.find('SetClientData').ignore()
|
||||
|
||||
c.addPyCode("""\
|
||||
CommandEvent.GetClientData = CommandEvent.GetClientObject
|
||||
CommandEvent.SetClientData = CommandEvent.SetClientObject""")
|
||||
|
||||
|
||||
c.addProperty('ClientObject GetClientObject SetClientObject')
|
||||
c.addPyCode('CommandEvent.ClientData = CommandEvent.ClientObject')
|
||||
c.addProperty('ExtraLong GetExtraLong SetExtraLong')
|
||||
c.addProperty('Int GetInt SetInt')
|
||||
c.addProperty('Selection GetSelection')
|
||||
c.addProperty('String GetString SetString')
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxKeyEvent
|
||||
c = module.find('wxKeyEvent')
|
||||
|
||||
|
||||
c.find('GetPosition').findOverload('wxCoord').ignore()
|
||||
c.find('GetUnicodeKey').type = 'int'
|
||||
|
||||
|
||||
c.addProperty('X GetX')
|
||||
c.addProperty('Y GetY')
|
||||
c.addProperty('KeyCode GetKeyCode')
|
||||
@@ -386,19 +386,19 @@ def run():
|
||||
c.addProperty('RawKeyCode GetRawKeyCode')
|
||||
c.addProperty('RawKeyFlags GetRawKeyFlags')
|
||||
c.addProperty('UnicodeKey GetUnicodeKey')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxScrollEvent
|
||||
c = module.find('wxScrollEvent')
|
||||
c.addProperty('Orientation GetOrientation SetOrientation')
|
||||
c.addProperty('Position GetPosition SetPosition')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxScrollWinEvent
|
||||
c = module.find('wxScrollWinEvent')
|
||||
c.addProperty('Orientation GetOrientation SetOrientation')
|
||||
c.addProperty('Position GetPosition SetPosition')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxMouseEvent
|
||||
c = module.find('wxMouseEvent')
|
||||
@@ -406,59 +406,59 @@ def run():
|
||||
c.addProperty('LogicalPosition GetLogicalPosition')
|
||||
c.addProperty('WheelDelta GetWheelDelta')
|
||||
c.addProperty('WheelRotation GetWheelRotation')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxSetCursorEvent
|
||||
c = module.find('wxSetCursorEvent')
|
||||
c.addProperty('Cursor GetCursor SetCursor')
|
||||
c.addProperty('X GetX')
|
||||
c.addProperty('Y GetY')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxSizeEvent
|
||||
c = module.find('wxSizeEvent')
|
||||
c.addProperty('Rect GetRect SetRect')
|
||||
c.addProperty('Size GetSize SetSize')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxMoveEvent
|
||||
c = module.find('wxMoveEvent')
|
||||
c.addProperty('Rect GetRect SetRect')
|
||||
c.addProperty('Position GetPosition SetPosition')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxEraseEvent
|
||||
c = module.find('wxEraseEvent')
|
||||
c.addProperty('DC GetDC')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxFocusEvent
|
||||
c = module.find('wxFocusEvent')
|
||||
c.addProperty('Window GetWindow SetWindow')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxChildFocusEvent
|
||||
c = module.find('wxChildFocusEvent')
|
||||
c.addProperty('Window GetWindow')
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxActivateEvent
|
||||
c = module.find('wxActivateEvent')
|
||||
c.addProperty('Active GetActive')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxMenuEvent
|
||||
c = module.find('wxMenuEvent')
|
||||
c.addProperty('Menu GetMenu')
|
||||
c.addProperty('MenuId GetMenuId')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxShowEvent
|
||||
c = module.find('wxShowEvent')
|
||||
c.find('GetShow').ignore() # deprecated
|
||||
c.addProperty('Show IsShown SetShow')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# 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
|
||||
# object, so it will get garbage collected later.
|
||||
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.addHeaderCode('#include "arrayholder.h"')
|
||||
c.find('wxDropFilesEvent').setCppCode_sip("""\
|
||||
if (files) {
|
||||
wxStringCArrayHolder* holder = new wxStringCArrayHolder;
|
||||
holder->m_array = files;
|
||||
holder->m_array = files;
|
||||
// Make a PyObject for the holder, and transfer its ownership to self.
|
||||
PyObject* pyHolder = sipConvertFromNewType(
|
||||
(void*)holder, sipType_wxStringCArrayHolder, (PyObject*)sipSelf);
|
||||
Py_DECREF(pyHolder);
|
||||
sipCpp = new sipwxDropFilesEvent(id,(int)noFiles, holder->m_array);
|
||||
sipCpp = new sipwxDropFilesEvent(id,(int)noFiles, holder->m_array);
|
||||
}
|
||||
else
|
||||
sipCpp = new sipwxDropFilesEvent(id);
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c.find('GetFiles').type = 'PyObject*'
|
||||
c.find('GetFiles').setCppCode("""\
|
||||
int count = self->GetNumberOfFiles();
|
||||
@@ -505,13 +505,13 @@ def run():
|
||||
PyObject* s = wx2PyString(files[i]);
|
||||
PyList_SET_ITEM(list, i, s);
|
||||
}
|
||||
return list;
|
||||
return list;
|
||||
""")
|
||||
|
||||
|
||||
c.addProperty('Files GetFiles')
|
||||
c.addProperty('NumberOfFiles GetNumberOfFiles')
|
||||
c.addProperty('Position GetPosition')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxUpdateUIEvent
|
||||
c = module.find('wxUpdateUIEvent')
|
||||
@@ -519,49 +519,49 @@ def run():
|
||||
c.addProperty('Enabled GetEnabled Enable')
|
||||
c.addProperty('Shown GetShown Show')
|
||||
c.addProperty('Text GetText SetText')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxMouseCaptureChangedEvent
|
||||
c = module.find('wxMouseCaptureChangedEvent')
|
||||
c.addProperty('CapturedWindow GetCapturedWindow')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxPaletteChangedEvent
|
||||
c = module.find('wxPaletteChangedEvent')
|
||||
c.addProperty('ChangedWindow GetChangedWindow SetChangedWindow')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxQueryNewPaletteEvent
|
||||
c = module.find('wxQueryNewPaletteEvent')
|
||||
c.addProperty('PaletteRealized GetPaletteRealized SetPaletteRealized')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxNavigationKeyEvent
|
||||
c = module.find('wxNavigationKeyEvent')
|
||||
c.addProperty('CurrentFocus GetCurrentFocus SetCurrentFocus')
|
||||
c.addProperty('Direction GetDirection SetDirection')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxWindowCreateEvent
|
||||
c = module.find('wxWindowCreateEvent')
|
||||
c.addProperty('Window GetWindow')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxWindowDestroyEvent
|
||||
c = module.find('wxWindowDestroyEvent')
|
||||
c.addProperty('Window GetWindow')
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxContextMenuEvent
|
||||
c = module.find('wxContextMenuEvent')
|
||||
c.addProperty('Position GetPosition SetPosition')
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxIconizeEvent
|
||||
module.find('wxIconizeEvent.Iconized').deprecated = True
|
||||
|
||||
|
||||
|
||||
|
||||
# Apply common fixups for all the event classes
|
||||
for name in [n for n in ITEMS if n.endswith('Event')]:
|
||||
c = module.find(name)
|
||||
@@ -586,13 +586,13 @@ def run():
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "eventfilter" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ "wxEventFilter" ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ "wxEventFilter" ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
@@ -26,20 +26,20 @@ def run():
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
|
||||
check4unittest=False)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxEventFilter')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.noDefCtor = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,24 +10,24 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "evtloop" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxEventLoopBase',
|
||||
'wxEventLoopActivator',
|
||||
'wxGUIEventLoop',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
|
||||
check4unittest=False # wxEventLoop is well tested in
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
|
||||
check4unittest=False # wxEventLoop is well tested in
|
||||
# myYield used by other tests...
|
||||
)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
@@ -35,7 +35,7 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxEventLoopBase')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
@@ -43,21 +43,21 @@ def run():
|
||||
c.find('Yield').releaseGIL()
|
||||
c.find('YieldFor').releaseGIL()
|
||||
c.find('OnExit').ignore(False)
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxEventLoopActivator')
|
||||
c.addPrivateAssignOp()
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
# context manager methods
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxGUIEventLoop')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
# Add declaration of the base class pure virtuals so sip knows they have
|
||||
# implementations here
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
@@ -71,7 +71,7 @@ def run():
|
||||
virtual void WakeUp();
|
||||
virtual bool YieldFor(long eventsToProcess);
|
||||
"""))
|
||||
|
||||
|
||||
module.addPyCode("""\
|
||||
@wx.deprecatedMsg('Use GUIEventLoop instead.')
|
||||
class EventLoop(GUIEventLoop):
|
||||
@@ -79,13 +79,13 @@ def run():
|
||||
def __init__(self):
|
||||
GUIEventLoop.__init__(self)
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,40 +10,40 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "fdrepdlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFindDialogEvent",
|
||||
"wxFindReplaceData",
|
||||
"wxFindReplaceDialog",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFindDialogEvent')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixEventClass(c)
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
EVT_FIND = wx.PyEventBinder( wxEVT_FIND, 1 )
|
||||
EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_FIND_NEXT, 1 )
|
||||
EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_FIND_REPLACE, 1 )
|
||||
EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_FIND_REPLACE_ALL, 1 )
|
||||
EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_FIND_CLOSE, 1 )
|
||||
|
||||
|
||||
# deprecated wxEVT aliases
|
||||
wxEVT_COMMAND_FIND = wxEVT_FIND
|
||||
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_CLOSE = wxEVT_FIND_CLOSE
|
||||
""")
|
||||
|
||||
|
||||
c = module.find('wxFindReplaceDialog')
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,51 +10,51 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "filectrl" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFileCtrl",
|
||||
"wxFileCtrlEvent",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/filectrl.h>')
|
||||
|
||||
|
||||
c = module.find('wxFileCtrl')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
module.addGlobalStr('wxFileCtrlNameStr', c)
|
||||
|
||||
|
||||
c.find('GetFilenames').ignore()
|
||||
c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\
|
||||
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.""",
|
||||
body="""\
|
||||
wxArrayString* arr = new wxArrayString;
|
||||
self->GetFilenames(*arr);
|
||||
return arr;""",
|
||||
factory=True)
|
||||
|
||||
|
||||
c.find('GetPaths').ignore()
|
||||
c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\
|
||||
Returns a list of the full paths (directory and filename) of the files
|
||||
chosen. This function should only be used with controlss which have
|
||||
Returns a list of the full paths (directory and filename) of the files
|
||||
chosen. This function should only be used with controlss which have
|
||||
the wx.FC_MULTIPLE style, use GetPath for the others.
|
||||
""",
|
||||
body="""\
|
||||
@@ -62,9 +62,9 @@ def run():
|
||||
self->GetPaths(*arr);
|
||||
return arr;""",
|
||||
factory=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxFileCtrlEvent')
|
||||
tools.fixEventClass(c)
|
||||
c.addPyCode("""\
|
||||
@@ -73,12 +73,12 @@ def run():
|
||||
EVT_FILECTRL_FOLDERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FOLDERCHANGED, 1)
|
||||
EVT_FILECTRL_FILTERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FILTERCHANGED, 1)
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,26 +17,26 @@ NAME = "filedlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxFileDialog' ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFileDialog')
|
||||
isinstance(c, etgtools.ClassDef)
|
||||
module.addGlobalStr('wxFileDialogNameStr', c)
|
||||
module.find('wxFileSelectorDefaultWildcardStr').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO: add this back. We'll need a way to pass it a callable that can be
|
||||
# called from a C ExtraControlCreatorFunction function
|
||||
c.find('SetExtraControlCreator').ignore()
|
||||
@@ -46,18 +46,18 @@ def run():
|
||||
c.find('GetFilenames').ignore()
|
||||
c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\
|
||||
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.""",
|
||||
body="""\
|
||||
wxArrayString* arr = new wxArrayString;
|
||||
self->GetFilenames(*arr);
|
||||
return arr;""",
|
||||
factory=True)
|
||||
|
||||
|
||||
c.find('GetPaths').ignore()
|
||||
c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\
|
||||
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
|
||||
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
|
||||
GetPath for the others.
|
||||
""",
|
||||
body="""\
|
||||
@@ -65,15 +65,15 @@ def run():
|
||||
self->GetPaths(*arr);
|
||||
return arr;""",
|
||||
factory=True)
|
||||
|
||||
|
||||
|
||||
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,43 +10,43 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "filehistory" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFileHistory",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFileHistory')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
# There is already a wxMenuList class so we have to name this one something else.
|
||||
module.addItem(
|
||||
tools.wxListWrapperTemplate('wxList', 'wxMenu', module,
|
||||
fakeListClassName='wxFileHistoryMenuList'))
|
||||
tools.wxListWrapperTemplate('wxList', 'wxMenu', module,
|
||||
fakeListClassName='wxFileHistoryMenuList'))
|
||||
c.find('GetMenus').type = 'const wxFileHistoryMenuList&'
|
||||
c.find('GetMenus').noCopy = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "filesys" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFileSystem",
|
||||
"wxFSFile",
|
||||
"wxFileSystemHandler",
|
||||
@@ -24,19 +24,19 @@ ITEMS = [ "wxFileSystem",
|
||||
"wxArchiveFSHandler",
|
||||
"wxFilterFSHandler",
|
||||
"wxInternetFSHandler",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFileSystem')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
@@ -61,15 +61,15 @@ def run():
|
||||
c.addPrivateCopyCtor()
|
||||
module.addPyCode('ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")')
|
||||
_fixHandlerClass(c)
|
||||
|
||||
|
||||
c = module.find('wxFSFile')
|
||||
c.addPrivateCopyCtor()
|
||||
_fixHandlerClass(c)
|
||||
|
||||
|
||||
c = module.find('wxFilterFSHandler')
|
||||
c.addPrivateCopyCtor()
|
||||
_fixHandlerClass(c)
|
||||
|
||||
|
||||
c = module.find('wxInternetFSHandler')
|
||||
c.addPrivateCopyCtor()
|
||||
_fixHandlerClass(c)
|
||||
@@ -103,8 +103,8 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
48
etg/font.py
48
etg/font.py
@@ -10,35 +10,35 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "font" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxFontInfo',
|
||||
'wxFont',
|
||||
'wxFontList',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
c = module.find('wxFont')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
|
||||
# FFont factory function for backwards compatibility
|
||||
module.addCppFunction('wxFont*', 'FFont',
|
||||
module.addCppFunction('wxFont*', 'FFont',
|
||||
"""(int pointSize,
|
||||
wxFontFamily family,
|
||||
int flags = wxFONTFLAG_DEFAULT,
|
||||
@@ -49,10 +49,10 @@ def run():
|
||||
wxFont* font = wxFont::New(pointSize, family, flags, *faceName, encoding);
|
||||
return font;
|
||||
""", factory=True)
|
||||
|
||||
|
||||
for item in c.findAll('New'):
|
||||
item.factory = True
|
||||
|
||||
|
||||
c.addProperty('Encoding GetEncoding SetEncoding')
|
||||
c.addProperty('FaceName GetFaceName SetFaceName')
|
||||
c.addProperty('Family GetFamily SetFamily')
|
||||
@@ -72,7 +72,7 @@ def run():
|
||||
return self->IsOk();
|
||||
""")
|
||||
|
||||
c.addCppMethod('void*', 'GetHFONT', '()',
|
||||
c.addCppMethod('void*', 'GetHFONT', '()',
|
||||
doc="Returns the font's native handle.",
|
||||
body="""\
|
||||
#ifdef __WXMSW__
|
||||
@@ -81,8 +81,8 @@ def run():
|
||||
return 0;
|
||||
#endif
|
||||
""")
|
||||
|
||||
c.addCppMethod('void*', 'OSXGetCGFont', '()',
|
||||
|
||||
c.addCppMethod('void*', 'OSXGetCGFont', '()',
|
||||
doc="Returns the font's native handle.",
|
||||
body="""\
|
||||
#ifdef __WXMAC__
|
||||
@@ -92,7 +92,7 @@ def run():
|
||||
#endif
|
||||
""")
|
||||
|
||||
c.addCppMethod('void*', 'GetPangoFontDescription', '()',
|
||||
c.addCppMethod('void*', 'GetPangoFontDescription', '()',
|
||||
doc="Returns the font's native handle.",
|
||||
body="""\
|
||||
#ifdef __WXGTK__
|
||||
@@ -101,9 +101,9 @@ def run():
|
||||
return 0;
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# uninitialized fonts in a block of Python code, that will then be
|
||||
# initialized later when the wx.App is created.
|
||||
c.addCppMethod('void', '_copyFrom', '(const wxFont* other)',
|
||||
c.addCppMethod('void', '_copyFrom', '(const wxFont* other)',
|
||||
"*self = *other;",
|
||||
briefDoc="For internal use only.") # ??
|
||||
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.LIGHT = int(wx.FONTWEIGHT_LIGHT)
|
||||
wx.BOLD = int(wx.FONTWEIGHT_BOLD)
|
||||
|
||||
|
||||
wx.NORMAL = int(wx.FONTSTYLE_NORMAL)
|
||||
wx.ITALIC = int(wx.FONTSTYLE_ITALIC)
|
||||
wx.SLANT = int(wx.FONTSTYLE_SLANT)
|
||||
""")
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,42 +10,42 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "fontdlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFontData",
|
||||
"wxFontDialog",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/fontdlg.h>')
|
||||
|
||||
|
||||
c = module.find('wxFontDialog')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
|
||||
# there are two of these, ignore one of them
|
||||
c.find('GetFontData').ignore()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,36 +10,36 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "fontenum" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFontEnumerator",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFontEnumerator')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,42 +10,42 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "fontmap" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFontMapper",
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFontMapper')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c.find('GetAltForEncoding').findOverload('wxNativeEncodingInfo').ignore()
|
||||
c.find('GetAltForEncoding.alt_encoding').out = True
|
||||
|
||||
|
||||
|
||||
|
||||
c.find('GetAllEncodingNames').ignore()
|
||||
c.addCppMethod('wxArrayString*', 'GetAllEncodingNames', '(wxFontEncoding encoding)',
|
||||
isStatic=True,
|
||||
doc="""\
|
||||
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,
|
||||
i.e. the same string as returned by GetEncodingName()
|
||||
i.e. the same string as returned by GetEncodingName()
|
||||
""",
|
||||
body="""\
|
||||
wxArrayString* sArr = new wxArrayString;
|
||||
@@ -53,16 +53,16 @@ def run():
|
||||
if (cArr) {
|
||||
for (int idx=0; cArr[idx]; idx+=1)
|
||||
sArr->Add(cArr[idx]);
|
||||
}
|
||||
}
|
||||
return sArr;
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "fontutil" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxNativeFontInfo',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
c = module.find('wxNativeFontInfo')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addCppMethod('wxString*', '__str__', '()', """\
|
||||
@@ -40,16 +40,16 @@ def run():
|
||||
# linker errors on all but MSW...
|
||||
c.find('GetPixelSize').ignore()
|
||||
c.find('SetPixelSize').ignore()
|
||||
|
||||
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
32
etg/frame.py
32
etg/frame.py
@@ -10,34 +10,34 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "frame" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxFrame' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxFrame' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxFrame')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
c.find('wxFrame.title').default = 'wxEmptyString'
|
||||
c.find('Create.title').default = 'wxEmptyString'
|
||||
|
||||
c.find('Create.title').default = 'wxEmptyString'
|
||||
|
||||
c.find('SetMenuBar.menuBar').transfer = True
|
||||
|
||||
|
||||
# We already have a MappedType for wxArrayInt, so just tweak the
|
||||
# interface to use that instead of an array size and a const int pointer.
|
||||
m = c.find('SetStatusWidths')
|
||||
@@ -49,25 +49,25 @@ def run():
|
||||
const int* ptr = &widths->front();
|
||||
self->SetStatusWidths(widths->size(), ptr);
|
||||
""")
|
||||
|
||||
|
||||
c.addProperty('MenuBar GetMenuBar SetMenuBar')
|
||||
c.addProperty('StatusBar GetStatusBar SetStatusBar')
|
||||
c.addProperty('StatusBarPane GetStatusBarPane SetStatusBarPane')
|
||||
c.addProperty('ToolBar GetToolBar SetToolBar')
|
||||
|
||||
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
|
||||
# Add back the virtual flag for these methods.
|
||||
# TODO: maybe these should go into a tools.addFrameVirtuals function?
|
||||
c.find('OnCreateStatusBar').isVirtual = True
|
||||
c.find('OnCreateToolBar').isVirtual = True
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "fswatcher" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxFileSystemWatcher",
|
||||
"wxFileSystemWatcherEvent",
|
||||
]
|
||||
@@ -27,34 +27,34 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("""
|
||||
#include <wx/fswatcher.h>
|
||||
#ifndef wxHAS_INOTIFY
|
||||
#define wxFSW_EVENT_UNMOUNT 0x2000
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
c = module.find('wxFileSystemWatcher')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxFileSystemWatcherEvent')
|
||||
tools.fixEventClass(c)
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER)
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
16
etg/gauge.py
16
etg/gauge.py
@@ -16,33 +16,33 @@ NAME = "gauge" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxGauge' ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxGauge')
|
||||
c.find('wxGauge.range').default = '100'
|
||||
c.find('Create.range').default = '100'
|
||||
|
||||
|
||||
module.addGlobalStr('wxGaugeNameStr', c)
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "gbsizer" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ "wxGBPosition",
|
||||
"wxGBSpan",
|
||||
"wxGBSizerItem",
|
||||
"wxGridBagSizer",
|
||||
]
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -29,28 +29,28 @@ def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
c = module.find('wxGBPosition')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
|
||||
# allow a 2 element sequence to be auto converted
|
||||
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBPosition')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol());
|
||||
""",
|
||||
""",
|
||||
pyArgsString="() -> (row, col)",
|
||||
briefDoc="Return the row and col properties as a tuple.")
|
||||
c.addCppMethod('void', 'Set', '(int row=0, int col=0)', """\
|
||||
self->SetRow(row);
|
||||
self->SetCol(col);
|
||||
""",
|
||||
""",
|
||||
briefDoc="Set both the row and column properties.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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
|
||||
elif idx == 1: self.Col = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('GBPosition.__safe_for_unpickling__ = True')
|
||||
|
||||
# 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
|
||||
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBSpan')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(ii)", self->GetRowspan(), self->GetColspan());
|
||||
""",
|
||||
""",
|
||||
pyArgsString="() -> (rowspan, colspan)",
|
||||
briefDoc="Return the rowspan and colspan properties as a tuple.")
|
||||
c.addCppMethod('void', 'Set', '(int rowspan=0, int colspan=0)', """\
|
||||
self->SetRowspan(rowspan);
|
||||
self->SetColspan(colspan);
|
||||
""",
|
||||
""",
|
||||
briefDoc="Set both the rowspan and colspan properties.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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
|
||||
elif idx == 1: self.Colspan = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('GBSpan.__safe_for_unpickling__ = True')
|
||||
|
||||
# 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
|
||||
c.find('wxGBSizerItem.sizer').transfer = True
|
||||
|
||||
|
||||
# deal with userData args in the ctors
|
||||
for m in c.find('wxGBSizerItem').all():
|
||||
if isinstance(m, etgtools.MethodDef) and m.findItem('userData'):
|
||||
m.find('userData').transfer = True
|
||||
m.find('userData').type = 'wxPyUserData*'
|
||||
|
||||
|
||||
# ignore some overloads that would be ambiguous from Python
|
||||
c.find('GetPos').findOverload('row').ignore()
|
||||
c.find('GetSpan').findOverload('rowspan').ignore()
|
||||
|
||||
|
||||
c.find('GetEndPos.row').out = True
|
||||
c.find('GetEndPos.col').out = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridBagSizer')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
|
||||
tools.fixSizerClass(c)
|
||||
|
||||
|
||||
for func in c.findAll('Add'):
|
||||
if func.findItem('sizer'):
|
||||
func.find('sizer').transfer = True
|
||||
@@ -160,20 +160,19 @@ def run():
|
||||
|
||||
c.addPyCode(
|
||||
"GridBagSizer.CheckForIntersectionPos = wx.deprecated(GridBagSizer.CheckForIntersection, 'Use CheckForIntersection instead.')")
|
||||
|
||||
|
||||
# TODO: In Classic we had GetChildren return a list of wxGBSizerItems (in
|
||||
# a faked out way). Figure out how to do that here too....
|
||||
|
||||
|
||||
#module.addItem(
|
||||
# tools.wxListWrapperTemplate('wxGBSizerItemList', 'wxGBSizerItem', module, 'wxSizerItem'))
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
140
etg/gdicmn.py
140
etg/gdicmn.py
@@ -16,79 +16,79 @@ NAME = "gdicmn"
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxPoint',
|
||||
'wxSize',
|
||||
'wxRect',
|
||||
'wxRealPoint',
|
||||
'wxColourDatabase',
|
||||
]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
# ignore some of these enum values
|
||||
e = module.find('wxBitmapType')
|
||||
for i in e:
|
||||
if i.name.endswith('_RESOURCE'):
|
||||
i.ignore()
|
||||
|
||||
|
||||
module.addCppCode("""\
|
||||
#if !defined(__WXMAC__)
|
||||
#define wxCURSOR_COPY_ARROW wxCURSOR_ARROW
|
||||
#endif
|
||||
""")
|
||||
|
||||
|
||||
# these are X11 only
|
||||
e = module.find('wxStockCursor')
|
||||
e.find('wxCURSOR_BASED_ARROW_DOWN').ignore()
|
||||
e.find('wxCURSOR_BASED_ARROW_UP').ignore()
|
||||
e.find('wxCURSOR_CROSS_REVERSE').ignore()
|
||||
e.find('wxCURSOR_DOUBLE_ARROW').ignore()
|
||||
|
||||
|
||||
module.find('wxClientDisplayRect.x').out = True
|
||||
module.find('wxClientDisplayRect.y').out = True
|
||||
module.find('wxClientDisplayRect.width').out = True
|
||||
module.find('wxClientDisplayRect.height').out = True
|
||||
|
||||
|
||||
module.find('wxDisplaySize.width').out = True
|
||||
module.find('wxDisplaySize.height').out = True
|
||||
module.find('wxDisplaySizeMM.width').out = True
|
||||
module.find('wxDisplaySizeMM.height').out = True
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxPoint tweaks
|
||||
c = module.find('wxPoint')
|
||||
tools.addAutoProperties(c)
|
||||
|
||||
|
||||
# Some operators are documented within the class that shouldn't be, so just
|
||||
# ignore them all.
|
||||
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
|
||||
for f in c.find('operator+=').all() + c.find('operator-=').all():
|
||||
f.ignore(False)
|
||||
|
||||
|
||||
# Add some method declarations for operators that really do exist. Note
|
||||
# that these actually use C++ global operator functions, but we treat
|
||||
# them as methods to help disambiguate implementations due to how
|
||||
# multiple classes can be converted automatically to/from 2-element
|
||||
# sequences.
|
||||
# sequences.
|
||||
c.addCppMethod('bool', '__eq__', '(const wxPoint& other)',
|
||||
body="return *self == *other;")
|
||||
c.addCppMethod('bool', '__ne__', '(const wxPoint& other)',
|
||||
body="return *self != *other;")
|
||||
|
||||
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
wxPoint operator+(const wxPoint& other);
|
||||
wxPoint operator-();
|
||||
@@ -96,17 +96,17 @@ def run():
|
||||
wxPoint operator*(int i);
|
||||
wxPoint operator/(int i);
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
|
||||
# wxPoint typemap
|
||||
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxPoint')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(ii)", self->x, self->y);
|
||||
""",
|
||||
""",
|
||||
pyArgsString="() -> (x,y)",
|
||||
briefDoc="Return the x and y properties as a tuple.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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
|
||||
elif idx == 1: self.y = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('Point.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
module.addItem(
|
||||
tools.wxListWrapperTemplate('wxPointList', 'wxPoint', module, includeConvertToType=True))
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxSize tweaks
|
||||
c = module.find('wxSize')
|
||||
@@ -135,14 +135,14 @@ def run():
|
||||
#c.find('wxSize').findOverload('int width, int height').releaseGIL()
|
||||
#c.find('DecBy').findOverload('int dx, int dy').releaseGIL()
|
||||
#c.find('IncBy').findOverload('int dx, int dy').releaseGIL()
|
||||
|
||||
|
||||
c.addProperty("width GetWidth SetWidth")
|
||||
c.addProperty("height GetHeight SetHeight")
|
||||
|
||||
# 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("y GetHeight SetHeight")
|
||||
|
||||
|
||||
# Take care of the same issues as wxPoint
|
||||
tools.ignoreAllOperators(c)
|
||||
for f in c.find('operator+=').all() + \
|
||||
@@ -150,12 +150,12 @@ def run():
|
||||
c.find('operator*=').all() + \
|
||||
c.find('operator/=').all():
|
||||
f.ignore(False)
|
||||
|
||||
|
||||
c.addCppMethod('bool', '__eq__', '(const wxSize& other)',
|
||||
body="return *self == *other;")
|
||||
c.addCppMethod('bool', '__ne__', '(const wxSize& other)',
|
||||
body="return *self != *other;")
|
||||
|
||||
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
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);
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
|
||||
# wxSize typemap
|
||||
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxSize')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(ii)", self->GetWidth(), self->GetHeight());
|
||||
""",
|
||||
pyArgsString="() -> (width, height)",
|
||||
briefDoc="Return the width and height properties as a tuple.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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
|
||||
elif idx == 1: self.height = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('Size.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxRect tweaks
|
||||
c = module.find('wxRect')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.addAutoProperties(c)
|
||||
|
||||
|
||||
c.addProperty("left GetLeft SetLeft")
|
||||
c.addProperty("top GetTop SetTop")
|
||||
c.addProperty("right GetRight SetRight")
|
||||
c.addProperty("bottom GetBottom SetBottom")
|
||||
|
||||
|
||||
c.addProperty("bottomLeft GetBottomLeft SetBottomLeft")
|
||||
c.addProperty("bottomRight GetBottomRight SetBottomRight")
|
||||
c.addProperty("topLeft GetTopLeft SetTopLeft")
|
||||
c.addProperty("topRight GetTopRight SetTopRight")
|
||||
|
||||
|
||||
# take care of the same issues as wxPoint
|
||||
tools.ignoreAllOperators(c)
|
||||
for f in c.find('operator+=').all() + \
|
||||
c.find('operator*=').all():
|
||||
f.ignore(False)
|
||||
|
||||
|
||||
c.addCppMethod('bool', '__eq__', '(const wxRect& other)',
|
||||
body="return *self == *other;")
|
||||
c.addCppMethod('bool', '__ne__', '(const wxRect& other)',
|
||||
body="return *self != *other;")
|
||||
|
||||
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
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
|
||||
# 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
|
||||
@@ -238,24 +238,24 @@ def run():
|
||||
mo = m.findOverload('topLeft')
|
||||
del m.overloads[m.overloads.index(mo)]
|
||||
m.overloads.append(mo)
|
||||
|
||||
|
||||
# These methods have some overloads that will end up with the same signature
|
||||
# in Python, so we have to remove one.
|
||||
module.find('wxRect.Deflate').findOverload(') const').ignore()
|
||||
module.find('wxRect.Inflate').findOverload(') const').ignore()
|
||||
module.find('wxRect.Union').findOverload(') const').ignore()
|
||||
module.find('wxRect.Intersect').findOverload(') const').ignore()
|
||||
|
||||
|
||||
# wxRect typemap
|
||||
c.convertFromPyObject = tools.convertFourIntegersTemplate('wxRect')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(iiii)",
|
||||
return sipBuildResult(0, "(iiii)",
|
||||
self->x, self->y, self->width, self->height);
|
||||
""",
|
||||
""",
|
||||
pyArgsString="() -> (x, y, width, height)",
|
||||
briefDoc="Return the rectangle's properties as a tuple.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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 == 3: self.height = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('Rect.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxRealPoint tweaks
|
||||
c = module.find('wxRealPoint')
|
||||
tools.addAutoProperties(c)
|
||||
|
||||
|
||||
# take care of the same issues as wxPoint
|
||||
tools.ignoreAllOperators(c)
|
||||
for f in c.find('operator+=').all() + \
|
||||
c.find('operator-=').all():
|
||||
f.ignore(False)
|
||||
|
||||
|
||||
c.addCppMethod('bool', '__eq__', '(const wxRealPoint& other)',
|
||||
body="return *self == *other;")
|
||||
c.addCppMethod('bool', '__ne__', '(const wxRealPoint& other)',
|
||||
body="return *self != *other;")
|
||||
|
||||
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
wxRealPoint operator+(const wxRealPoint& other);
|
||||
wxRealPoint operator-(const wxRealPoint& other);
|
||||
@@ -298,16 +298,16 @@ def run():
|
||||
wxRealPoint operator/(int i);
|
||||
"""))
|
||||
|
||||
|
||||
|
||||
# wxRealPoint typemap
|
||||
c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxRealPoint')
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(dd)", self->x, self->y);
|
||||
""",
|
||||
""",
|
||||
pyArgsString="() -> (x, y)",
|
||||
briefDoc="Return the point's properties as a tuple.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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
|
||||
elif idx == 1: self.y = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('RealPoint.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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.addCppFunction('PyObject*', 'IntersectRect', '(wxRect* r1, wxRect* r2)',
|
||||
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.""",
|
||||
body="""\
|
||||
wxRegion reg1(*r1);
|
||||
@@ -360,9 +360,9 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Name: etg/gdiobj.py
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created:
|
||||
# Created:
|
||||
# Copyright: (c) 2013 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -10,15 +10,15 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "gdiobj" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxGDIObject' ]
|
||||
|
||||
# this script.
|
||||
ITEMS = [ 'wxGDIObject' ]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
@@ -26,22 +26,22 @@ def run():
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING,
|
||||
check4unittest=False)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
|
||||
module.find('wxGDIObject').abstract = True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -16,55 +16,55 @@ NAME = "geometry"
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [
|
||||
# this script.
|
||||
ITEMS = [
|
||||
'wxPoint2DDouble',
|
||||
'wxRect2DDouble',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/wx.h>')
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------
|
||||
# wxPoint2D and wxRect2D tweaks
|
||||
|
||||
|
||||
c = module.find('wxPoint2DDouble')
|
||||
c.renameClass('Point2D')
|
||||
c.find('wxPoint2DDouble').findOverload('wxPoint2DInt').ignore()
|
||||
|
||||
|
||||
c.find('m_x').pyName = 'x'
|
||||
c.find('m_y').pyName = 'y'
|
||||
c.find('GetFloor.x').out = True
|
||||
c.find('GetFloor.y').out = True
|
||||
c.find('GetRounded.x').out = True
|
||||
c.find('GetRounded.y').out = True
|
||||
|
||||
|
||||
# these have link errors
|
||||
c.find('SetPolarCoordinates').ignore()
|
||||
c.find('operator/=').findOverload('wxDouble').ignore()
|
||||
c.find('operator*=').findOverload('wxDouble').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxPoint2DDouble')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(dd)", self->m_x, self->m_y);
|
||||
""",
|
||||
""",
|
||||
briefDoc="""\
|
||||
Get() -> (x,y)\n
|
||||
Get() -> (x,y)\n
|
||||
Return the x and y properties as a tuple.""")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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
|
||||
elif idx == 1: self.y = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('Point2D.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
|
||||
|
||||
# ignore these operator methods, since we are not wrapping the Int version
|
||||
c.find('operator*=').findOverload('wxInt32').ignore()
|
||||
c.find('operator/=').findOverload('wxInt32').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
# ignore all the global operators too, there is no equivallent in Python
|
||||
for item in module:
|
||||
if isinstance(item, etgtools.FunctionDef) and item.name.startswith('operator'):
|
||||
for f in item.all():
|
||||
f.ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxRect2DDouble')
|
||||
c.renameClass('Rect2D')
|
||||
c.find('m_x').pyName = 'x'
|
||||
c.find('m_y').pyName = 'y'
|
||||
c.find('m_width').pyName = 'width'
|
||||
c.find('m_height').pyName = 'height'
|
||||
|
||||
|
||||
c.convertFromPyObject = tools.convertFourDoublesTemplate('wxRect2DDouble')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(dddd)",
|
||||
return sipBuildResult(0, "(dddd)",
|
||||
self->m_x, self->m_y, self->m_width, self->m_height);
|
||||
""",
|
||||
""",
|
||||
briefDoc="""\
|
||||
Get() -> (x, y, width, height)\n
|
||||
Get() -> (x, y, width, height)\n
|
||||
Return the rectangle's properties as a tuple.""")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return 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 == 3: self.height = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('Rect2D.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,8 +17,8 @@ NAME = "graphics" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [
|
||||
# this script.
|
||||
ITEMS = [
|
||||
'wxGraphicsObject',
|
||||
'wxGraphicsBitmap',
|
||||
'wxGraphicsBrush',
|
||||
@@ -31,7 +31,7 @@ ITEMS = [
|
||||
'wxGraphicsPath',
|
||||
'wxGraphicsRenderer',
|
||||
]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
@@ -44,7 +44,7 @@ def run():
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/gdicmn.h>')
|
||||
|
||||
|
||||
def markFactories(klass):
|
||||
for func in klass.allItems():
|
||||
if isinstance(func, etgtools.FunctionDef) \
|
||||
@@ -74,8 +74,8 @@ def run():
|
||||
for p in m.items:
|
||||
if 'DC' in p.name or p.name == 'image':
|
||||
p.keepReference = True
|
||||
|
||||
|
||||
|
||||
|
||||
# FIXME: Handle wxEnhMetaFileDC?
|
||||
c.find('Create').findOverload('wxEnhMetaFileDC').ignore()
|
||||
|
||||
@@ -83,7 +83,7 @@ def run():
|
||||
c.find('GetSize.height').out = True
|
||||
c.find('GetDPI.dpiX').out = True
|
||||
c.find('GetDPI.dpiY').out = True
|
||||
|
||||
|
||||
m = c.find('GetPartialTextExtents')
|
||||
m.find('widths').ignore()
|
||||
m.type = 'wxArrayDouble*'
|
||||
@@ -93,15 +93,15 @@ def run():
|
||||
self->GetPartialTextExtents(*text, rval);
|
||||
return new wxArrayDouble(rval);
|
||||
""")
|
||||
|
||||
|
||||
m = c.find('GetTextExtent')
|
||||
m.pyName = 'GetFullTextExtent'
|
||||
m.find('width').out = True
|
||||
m.find('height').out = True
|
||||
m.find('descent').out = True
|
||||
m.find('externalLeading').out = True
|
||||
|
||||
c.addCppMethod('PyObject*', 'GetTextExtent', '(const wxString& text)',
|
||||
m.find('externalLeading').out = True
|
||||
|
||||
c.addCppMethod('PyObject*', 'GetTextExtent', '(const wxString& text)',
|
||||
pyArgsString="(text) -> (width, height)",
|
||||
doc="Gets the dimensions of the string using the currently selected font.",
|
||||
body="""\
|
||||
@@ -112,13 +112,13 @@ def run():
|
||||
|
||||
c.addPyCode("GraphicsContext.DrawRotatedText = wx.deprecated(GraphicsContext.DrawText, 'Use DrawText instead.')")
|
||||
|
||||
|
||||
|
||||
c.addCppCode(tools.ObjArrayHelperTemplate('wxPoint2D', 'sipType_wxPoint2DDouble',
|
||||
"Expected a sequence of length-2 sequences or wx.Point2D objects."))
|
||||
|
||||
# we'll reimplement this overload as StrokeLineSegments
|
||||
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)",
|
||||
doc="Stroke disconnected lines from begin to end points.",
|
||||
body="""\
|
||||
@@ -137,7 +137,7 @@ def run():
|
||||
# Also reimplement the main StrokeLines method to reuse the same helper
|
||||
# function as StrokLineSegments
|
||||
m = c.find('StrokeLines').findOverload('points').ignore()
|
||||
c.addCppMethod('void', 'StrokeLines', '(PyObject* points)',
|
||||
c.addCppMethod('void', 'StrokeLines', '(PyObject* points)',
|
||||
pyArgsString="(point2Ds)",
|
||||
doc="Stroke lines conencting all the points.",
|
||||
body="""\
|
||||
@@ -152,7 +152,7 @@ def run():
|
||||
|
||||
# and once more for DrawLines
|
||||
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)",
|
||||
doc="Draws a polygon.",
|
||||
body="""\
|
||||
@@ -164,51 +164,51 @@ def run():
|
||||
delete [] ptsArray;
|
||||
}
|
||||
""")
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
c = module.find('wxGraphicsPath')
|
||||
tools.removeVirtuals(c)
|
||||
c.find('GetBox').findOverload('wxDouble *x, wxDouble *y').ignore()
|
||||
c.find('GetCurrentPoint').findOverload('wxDouble *x, wxDouble *y').ignore()
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
c = module.find('wxGraphicsRenderer')
|
||||
tools.removeVirtuals(c)
|
||||
markFactories(c)
|
||||
c.abstract = True
|
||||
|
||||
|
||||
for m in c.find('CreateContext').all():
|
||||
for p in m.items:
|
||||
if 'DC' in p.name or p.name == 'image':
|
||||
p.keepReference = True
|
||||
c.find('CreateContextFromImage.image').keepReference = True
|
||||
|
||||
|
||||
# FIXME: Handle wxEnhMetaFileDC?
|
||||
c.find('CreateContext').findOverload('wxEnhMetaFileDC').ignore()
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
c = module.find('wxGraphicsMatrix')
|
||||
tools.removeVirtuals(c)
|
||||
|
||||
c.find('Concat').overloads = []
|
||||
c.find('IsEqual').overloads = []
|
||||
|
||||
|
||||
c.find('Get.a').out = True
|
||||
c.find('Get.b').out = True
|
||||
c.find('Get.c').out = True
|
||||
c.find('Get.d').out = True
|
||||
c.find('Get.tx').out = True
|
||||
c.find('Get.ty').out = True
|
||||
|
||||
|
||||
c.find('TransformDistance.dx').inOut = True
|
||||
c.find('TransformDistance.dy').inOut = True
|
||||
|
||||
c.find('TransformPoint.x').inOut = True
|
||||
c.find('TransformPoint.y').inOut = True
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
c = module.find('wxGraphicsGradientStops')
|
||||
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));",
|
||||
factory=True)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
# Use the pyNames we set for these classes in geometry.py so the old
|
||||
# names do not show up in the docstrings, etc.
|
||||
tools.changeTypeNames(module, 'wxPoint2DDouble', 'wxPoint2D')
|
||||
tools.changeTypeNames(module, 'wxRect2DDouble', 'wxRect2D')
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
150
etg/grid.py
150
etg/grid.py
@@ -10,15 +10,15 @@
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_grid"
|
||||
NAME = "grid" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxGridCellCoords',
|
||||
|
||||
|
||||
'wxGridCellRenderer',
|
||||
'wxGridCellAutoWrapStringRenderer',
|
||||
'wxGridCellBoolRenderer',
|
||||
@@ -27,7 +27,7 @@ ITEMS = [ 'wxGridCellCoords',
|
||||
'wxGridCellFloatRenderer',
|
||||
'wxGridCellNumberRenderer',
|
||||
'wxGridCellStringRenderer',
|
||||
|
||||
|
||||
'wxGridCellEditor',
|
||||
'wxGridCellAutoWrapStringEditor',
|
||||
'wxGridCellBoolEditor',
|
||||
@@ -36,9 +36,9 @@ ITEMS = [ 'wxGridCellCoords',
|
||||
'wxGridCellTextEditor',
|
||||
'wxGridCellFloatEditor',
|
||||
'wxGridCellNumberEditor',
|
||||
|
||||
|
||||
'wxGridCellAttr',
|
||||
|
||||
|
||||
'wxGridCornerHeaderRenderer',
|
||||
'wxGridHeaderLabelsRenderer',
|
||||
'wxGridRowHeaderRenderer',
|
||||
@@ -46,35 +46,35 @@ ITEMS = [ 'wxGridCellCoords',
|
||||
'wxGridRowHeaderRendererDefault',
|
||||
'wxGridColumnHeaderRendererDefault',
|
||||
'wxGridCornerHeaderRendererDefault',
|
||||
|
||||
|
||||
'wxGridCellAttrProvider',
|
||||
'wxGridTableBase',
|
||||
'wxGridTableMessage',
|
||||
'wxGridStringTable',
|
||||
'wxGridSizesInfo',
|
||||
|
||||
|
||||
'wxGrid',
|
||||
'wxGridUpdateLocker',
|
||||
|
||||
|
||||
'wxGridEvent',
|
||||
'wxGridSizeEvent',
|
||||
'wxGridRangeSelectEvent',
|
||||
'wxGridEditorCreatedEvent',
|
||||
|
||||
]
|
||||
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addGlobalStr('wxGridNameStr', module.items[0])
|
||||
|
||||
module.addGlobalStr('wxGridNameStr', module.items[0])
|
||||
module.addPyCode("""\
|
||||
GRID_VALUE_STRING = "string"
|
||||
GRID_VALUE_BOOL = "bool"
|
||||
@@ -86,23 +86,23 @@ def run():
|
||||
GRID_VALUE_CHOICEINT = "choiceint"
|
||||
GRID_VALUE_DATETIME = "datetime"
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridCellCoords')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.addAutoProperties(c)
|
||||
c.find('operator!').ignore()
|
||||
c.find('operator=').ignore()
|
||||
|
||||
|
||||
# Add a typemap for 2 element sequences
|
||||
c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGridCellCoords')
|
||||
|
||||
|
||||
c.addCppMethod('PyObject*', 'Get', '()', """\
|
||||
return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol());
|
||||
""",
|
||||
""",
|
||||
pyArgsString="() -> (row,col)",
|
||||
briefDoc="Return the row and col properties as a tuple.")
|
||||
|
||||
|
||||
# Add sequence protocol methods and other goodies
|
||||
c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
|
||||
c.addPyMethod('__repr__', '(self)', 'return "GridCellCoords"+str(self.Get())')
|
||||
@@ -115,24 +115,24 @@ def run():
|
||||
if idx == 0: self.Row = val
|
||||
elif idx == 1: self.Col = val
|
||||
else: raise IndexError
|
||||
""")
|
||||
""")
|
||||
c.addPyCode('GridCellCoords.__safe_for_unpickling__ = True')
|
||||
|
||||
|
||||
module.addItem(
|
||||
tools.wxArrayWrapperTemplate('wxGridCellCoordsArray', 'wxGridCellCoords', module))
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridSizesInfo')
|
||||
c.find('m_customSizes').ignore() # TODO: Add support for wxUnsignedToIntHashMap??
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
def fixRendererClass(name):
|
||||
klass = module.find(name)
|
||||
assert isinstance(klass, etgtools.ClassDef)
|
||||
tools.addAutoProperties(klass)
|
||||
|
||||
|
||||
methods = [
|
||||
('Clone', "virtual wxGridCellRenderer* Clone() const /Factory/;"),
|
||||
('Draw', "virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, "
|
||||
@@ -143,20 +143,20 @@ def run():
|
||||
for method, code in methods:
|
||||
if not klass.findItem(method):
|
||||
klass.addItem(etgtools.WigCode(code))
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxGridCellRenderer')
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('~wxGridCellRenderer').ignore(False)
|
||||
c.find('Clone').factory = True
|
||||
|
||||
|
||||
for name in ITEMS:
|
||||
if 'Cell' in name and 'Renderer' in name:
|
||||
fixRendererClass(name)
|
||||
|
||||
fixRendererClass(name)
|
||||
|
||||
module.addPyCode("PyGridCellRenderer = wx.deprecated(GridCellRenderer, 'Use GridCellRenderer instead.')")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
def fixEditorClass(name):
|
||||
klass = module.find(name)
|
||||
@@ -176,13 +176,13 @@ def run():
|
||||
if not klass.findItem(method):
|
||||
klass.addItem(etgtools.WigCode(code))
|
||||
|
||||
|
||||
|
||||
# Fix up EndEdit so it returns newval on success or None on failure
|
||||
pureVirtual = False
|
||||
if klass.findItem('EndEdit'):
|
||||
klass.find('EndEdit').ignore()
|
||||
pureVirtual = True
|
||||
|
||||
|
||||
# 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++ 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)',
|
||||
cppSignature='bool (int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval)',
|
||||
pyArgsString='(row, col, grid, oldval)',
|
||||
isVirtual=True,
|
||||
isVirtual=True,
|
||||
isPureVirtual=pureVirtual,
|
||||
doc="""\
|
||||
End editing the cell.
|
||||
|
||||
|
||||
This function must check if the current value of the editing cell
|
||||
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
|
||||
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.
|
||||
|
||||
Notice that this method shoiuld not modify the grid as the
|
||||
change could still be vetoed.
|
||||
|
||||
Notice that this method shoiuld not modify the grid as the
|
||||
change could still be vetoed.
|
||||
""",
|
||||
|
||||
|
||||
# Code for Python --> C++ calls. Make it return newval or None.
|
||||
body="""\
|
||||
bool rv;
|
||||
@@ -219,7 +219,7 @@ def run():
|
||||
return Py_None;
|
||||
}
|
||||
""",
|
||||
|
||||
|
||||
# Code for C++ --> Python calls. This is used when a C++ method
|
||||
# call needs to be reflected to a call to the overridden Python
|
||||
# method, so we need to translate between the real C++ siganture
|
||||
@@ -232,7 +232,7 @@ def run():
|
||||
new wxString(oldval),sipType_wxString,NULL);
|
||||
if (result == Py_None) {
|
||||
sipRes = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sipRes = true;
|
||||
*newval = Py2wxString(result);
|
||||
@@ -240,8 +240,8 @@ def run():
|
||||
Py_DECREF(result);
|
||||
""" if pureVirtual else "", # only used with the base class
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
c = module.find('wxGridCellEditor')
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('~wxGridCellEditor').ignore(False)
|
||||
@@ -249,13 +249,13 @@ def run():
|
||||
|
||||
c = module.find('wxGridCellChoiceEditor')
|
||||
c.find('wxGridCellChoiceEditor').findOverload('count').ignore()
|
||||
|
||||
|
||||
for name in ITEMS:
|
||||
if 'Cell' in name and 'Editor' in name:
|
||||
fixEditorClass(name)
|
||||
|
||||
fixEditorClass(name)
|
||||
|
||||
module.addPyCode("PyGridCellEditor = wx.deprecated(GridCellEditor, 'Use GridCellEditor instead.')")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridCellAttr')
|
||||
c.addPrivateCopyCtor()
|
||||
@@ -272,15 +272,15 @@ def run():
|
||||
c.find('SetEditor.editor').transfer = True
|
||||
c.find('SetRenderer.renderer').transfer = True
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# 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
|
||||
# this case because they are abstract.
|
||||
|
||||
c = module.find('wxGridCornerHeaderRenderer')
|
||||
c.instanceCode = 'sipCpp = new wxGridCornerHeaderRendererDefault;'
|
||||
|
||||
|
||||
c = module.find('wxGridRowHeaderRenderer')
|
||||
c.instanceCode = 'sipCpp = new wxGridRowHeaderRendererDefault;'
|
||||
|
||||
@@ -288,22 +288,22 @@ def run():
|
||||
c.instanceCode = 'sipCpp = new wxGridColumnHeaderRendererDefault;'
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridCellAttrProvider')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c.find('SetAttr.attr').transfer = True
|
||||
c.find('SetRowAttr.attr').transfer = True
|
||||
c.find('SetColAttr.attr').transfer = True
|
||||
|
||||
|
||||
module.addPyCode("PyGridCellAttrProvider = wx.deprecated(GridCellAttrProvider, 'Use GridCellAttrProvider instead.')")
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridTableBase')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
c.find('SetAttr.attr').transfer = True
|
||||
c.find('SetRowAttr.attr').transfer = True
|
||||
c.find('SetColAttr.attr').transfer = True
|
||||
@@ -314,7 +314,7 @@ def run():
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridTableMessage')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGrid')
|
||||
@@ -342,14 +342,14 @@ def run():
|
||||
|
||||
# This overload is deprecated, so don't generate code for it.
|
||||
c.find('SetCellValue').findOverload('wxString &val').ignore()
|
||||
|
||||
|
||||
c.find('SetDefaultEditor.editor').transfer = True
|
||||
c.find('SetDefaultRenderer.renderer').transfer = True
|
||||
|
||||
|
||||
for n in ['GetColGridLinePen', 'GetDefaultGridLinePen', 'GetRowGridLinePen']:
|
||||
c.find(n).isVirtual = True
|
||||
|
||||
|
||||
|
||||
# The SetTable method can optionally pass ownership of the table
|
||||
# object to the grid, so we need to optionally update the
|
||||
# ownership of the Python proxy object to match.
|
||||
@@ -363,7 +363,7 @@ def run():
|
||||
wx.siplib.transferto(table, self)
|
||||
return val
|
||||
""")
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
@@ -372,17 +372,17 @@ def run():
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
|
||||
""", protection='private'))
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
c = module.find('wxGridUpdateLocker')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
# context manager methods
|
||||
c.addPyMethod('__enter__', '(self)', 'return self')
|
||||
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
for name in ['wxGridSizeEvent',
|
||||
@@ -392,7 +392,7 @@ def run():
|
||||
]:
|
||||
c = module.find(name)
|
||||
tools.fixEventClass(c)
|
||||
|
||||
|
||||
|
||||
c.addPyCode("""\
|
||||
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_TABBING = wx.PyEventBinder( wxEVT_GRID_TABBING, 1 )
|
||||
""")
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
@@ -17,29 +17,29 @@ NAME = "headercol" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
# this script.
|
||||
ITEMS = [ 'wxHeaderColumn', 'wxSettableHeaderColumn', 'wxHeaderColumnSimple', ]
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode('#include <wx/headercol.h>')
|
||||
|
||||
|
||||
c = module.find('wxHeaderColumn')
|
||||
isinstance(c, etgtools.ClassDef)
|
||||
#c.abstract = True
|
||||
c.addAutoProperties()
|
||||
|
||||
c.instanceCode = 'sipCpp = new wxHeaderColumnSimple("");'
|
||||
|
||||
|
||||
# addAutoProperties doesn't recognize 'IsFoo' as a getter, but it still
|
||||
# makes sense to use these, so add them manually.
|
||||
c.addProperty('Resizeable', 'IsResizeable')
|
||||
@@ -54,7 +54,7 @@ def run():
|
||||
c = module.find('wxSettableHeaderColumn')
|
||||
#c.abstract = True
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
# 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
|
||||
# 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('Reorderable', 'HeaderColumn.IsReorderable', 'SetReorderable')
|
||||
c.addPyProperty('Hidden', 'HeaderColumn.IsHidden', 'SetHidden')
|
||||
|
||||
|
||||
|
||||
c = module.find('wxHeaderColumnSimple')
|
||||
c.addAutoProperties()
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user