Files
Phoenix/etg/ctrlsub.py
Robin Dunn 4219e02440 * move wxPen to etg/pen.py
* move wxBrush to etg/brush.py
* move wxBookCtrlBase and wxBookCtrlEvent to etg/bookctrl.py
* move wxBitmapButton to etg/bmpbuttn.py
* move wxArrayString MappedType and add wxArrayInt plus some unittests
* add checking for default values for pos and size parameters in fixWindowClass
* set out parameter flags for wxImageHistogram.FindFirstUnusedColour
* Restore layout constraints classes and related methods
* Create a MappedType for wxClientData
* update used of wxClientData in wx.CommandEvent
* Move wxControlWithItems, wxItemContainer and wxControlWithItems to etg/ctrlsub.py
* enable some Append, Insert and Set overloads in wxControlWithItems
* addGetterSetterProps: don't make setter-only properties
* addGetterSetterProps: ensure that the getter can be called with zero args
* addGetterSetterProps: ensure that the setter can be called with just 1 arg
* restore version checking code
* moved DC classes to other etg files to match interface file names.
* allow both overloads for wx.DC.GetTextExtent and GetMultiLineTextExtent by renaming 1
* add wx.DC.GetPartialTextExtents
* and some other stuff

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@68975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-09-03 01:42:42 +00:00

89 lines
3.1 KiB
Python

#---------------------------------------------------------------------------
# Name: etg/strlsub.py
# Author: Robin Dunn
#
# Created: 2-Sept-2011
# Copyright: (c) 2011 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
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', ]
#---------------------------------------------------------------------------
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('wxItemContainerImmutable')
c.abstract = True
c = module.find('wxItemContainer')
assert isinstance(c, etgtools.ClassDef)
c.abstract = True
# Ignore the Append and Insert method overloads that we don't want to
# support. This will keep the ones that take a wxString or an
# wxArrayString, and wxClientData.
def pickOverloads(m):
assert isinstance(m, etgtools.MethodDef)
if 'void *' in m.argsString or \
'wxClientData **' in m.argsString or \
'wxString *' in m.argsString:
m.ignore()
for m in c.findAll('Append'):
pickOverloads(m)
for m in c.findAll('Insert'):
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
# aliases for ClientObjects. From the Python programmer's perspective they
# woiuld be virtually the same anyway.
c.find('GetClientData').ignore()
c.find('SetClientData').ignore()
c.addPyCode("""\
ItemContainer.GetClientData = ItemContainer.GetClientObject
ItemContainer.SetClientData = ItemContainer.SetClientObject""")
# 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
c = module.find('wxControlWithItems')
c.abstract = True
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()