Add some __nonzero__ methods.

Fix some parameter names that conflict with Python reserved words.
Etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2013-06-08 23:35:54 +00:00
parent bb9ac44914
commit b1d10157b9
3 changed files with 50 additions and 7 deletions

View File

@@ -85,18 +85,18 @@ def run():
module.addItem(
tools.wxArrayPtrWrapperTemplate('wxRichTextObjectPtrArray', 'wxRichTextObject', module))
module.addItem(
tools.wxArrayWrapperTemplate('wxRichTextObjectPtrArrayArray', 'wxRichTextObjectPtrArray', module))
tools.wxArrayWrapperTemplate('wxRichTextObjectPtrArrayArray', 'wxRichTextObjectPtrArray', module))
module.find('wxRICHTEXT_ALL').ignore()
module.find('wxRICHTEXT_NONE').ignore()
module.find('wxRICHTEXT_NO_SELECTION').ignore()
module.addPyCode("""\
code = etgtools.PyCodeDef("""\
RICHTEXT_ALL = RichTextRange(-2, -2)
RICHTEXT_NONE = RichTextRange(-1, -1)
RICHTEXT_NO_SELECTION = RichTextRange(-2, -2)
""")
module.insertItemAfter(module.find('wxRichTextRange'), code)
module.insertItem(0, etgtools.WigCode("""\
// forward declarations
@@ -108,25 +108,30 @@ def run():
c = module.find('wxTextAttrDimension')
assert isinstance(c, etgtools.ClassDef)
c.find('SetValue').findOverload('units').ignore()
c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();")
#-------------------------------------------------------
c = module.find('wxTextAttrDimensions')
tools.ignoreConstOverloads(c)
c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();")
#-------------------------------------------------------
c = module.find('wxTextAttrSize')
tools.ignoreConstOverloads(c)
c.find('SetWidth').findOverload('units').ignore()
c.find('SetHeight').findOverload('units').ignore()
c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();")
#-------------------------------------------------------
c = module.find('wxTextAttrBorder')
tools.ignoreConstOverloads(c)
c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();")
#-------------------------------------------------------
c = module.find('wxTextAttrBorders')
tools.ignoreConstOverloads(c)
c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();")
#-------------------------------------------------------
@@ -144,11 +149,13 @@ def run():
tools.ignoreConstOverloads(c)
c.find('SetProperty').findOverload('bool').ignore()
c.find('operator[]').ignore()
#-------------------------------------------------------
c = module.find('wxRichTextSelection')
tools.ignoreConstOverloads(c)
c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();")
c.find('operator[]').ignore()
#-------------------------------------------------------
@@ -162,9 +169,18 @@ def run():
tools.ignoreConstOverloads(c)
#-------------------------------------------------------
c = module.find('wxRichTextParagraphLayoutBox')
c.find('MoveAnchoredObjectToParagraph.from').name = 'from_'
c.find('MoveAnchoredObjectToParagraph.to').name = 'to_'
c.find('DoNumberList.def').name = 'styleDef'
c.find('SetListStyle.def').name = 'styleDef'
#-------------------------------------------------------
c = module.find('wxRichTextLine')
tools.ignoreConstOverloads(c)
c.find('SetRange.from').name = 'from_'
c.find('SetRange.to').name = 'to_'
#-------------------------------------------------------

View File

@@ -17,7 +17,8 @@ DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by
# this script.
ITEMS = [ "wxRichTextContextMenuPropertiesInfo",
ITEMS = [ "interface_2wx_2richtext_2richtextctrl_8h.xml",
"wxRichTextContextMenuPropertiesInfo",
"wxRichTextCtrl",
"wxRichTextEvent",
]
@@ -33,6 +34,15 @@ def run():
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
#-----------------------------------------------------------------
# ignore some macros since most of this set are not simple numbers
for item in module.items:
if item.name.startswith('wxRICHTEXT_DEFAULT'):
item.ignore()
#-----------------------------------------------------------------
c = module.find('wxRichTextContextMenuPropertiesInfo')
assert isinstance(c, etgtools.ClassDef)
tools.ignoreConstOverloads(c)
@@ -54,6 +64,18 @@ def run():
c.find('HitTest.row').out = True
c.find('HitTest').renameOverload('row', 'HitTestXY')
c.find('GetRange.from').name = 'from_'
c.find('GetRange.to').name = 'to_'
c.find('Remove.from').name = 'from_'
c.find('Remove.to').name = 'to_'
c.find('Replace.from').name = 'from_'
c.find('Replace.to').name = 'to_'
c.find('SetSelection.from').name = 'from_'
c.find('SetSelection.to').name = 'to_'
c.find('SetListStyle.def').name = 'styleDef'
c.find('ApplyStyle.def').name = 'styleDef'
# Make sure that all the methods from wxTextEntry are included. This is
# needed because we are pretending that this class only derives from

View File

@@ -47,13 +47,14 @@ def run():
c = module.find('wxRichTextStyleListBox')
tools.fixWindowClass(c)
c.piBases = ['wx.html.HtmlListBox']
c.find('OnGetItem').ignore(False)
c.find('CreateHTML.def').name = 'styleDef'
c = module.find('wxRichTextStyleComboCtrl')
tools.fixWindowClass(c)
c = module.find('wxRichTextStyleDefinition')
tools.ignoreConstOverloads(c)
@@ -67,6 +68,10 @@ def run():
c.find('AddParagraphStyle.def').transfer = True
c.find('AddStyle.def').transfer = True
# Change def --> styleDef
for item in c.allItems():
if isinstance(item, etgtools.ParamDef) and item.name == 'def':
item.name = 'styleDef'
#-----------------------------------------------------------------
tools.doCommonTweaks(module)