From 7dcb3c3dfb467fa6d619a4e4f7228abbd1935294 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 8 Jun 2013 23:29:16 +0000 Subject: [PATCH] Ignore some overloads which can't be disambiguated by the wrappers. (Typically methods that only differ by constness in C++.) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74132 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- TODO.txt | 6 ++- etg/richtextbuffer.py | 113 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 3 deletions(-) diff --git a/TODO.txt b/TODO.txt index 16541c82..5ae2ffb4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -138,7 +138,11 @@ other dev stuff * Reimplement the classes in the valgen, valnum and valtext headers as Python code, and make them visible in the core wx namespace? - + * It would be nice to have a way to automatically ignore one overload if it + only differs from another overload by constness. See etg/richtextbuffer.py + for why. + + diff --git a/etg/richtextbuffer.py b/etg/richtextbuffer.py index 1cb108a1..514bcc0b 100644 --- a/etg/richtextbuffer.py +++ b/etg/richtextbuffer.py @@ -68,13 +68,122 @@ def run(): # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. + module.addItem( + tools.wxArrayWrapperTemplate('wxRichTextRangeArray', 'wxRichTextRange', module)) + module.addItem( + tools.wxArrayWrapperTemplate('wxRichTextAttrArray', 'wxRichTextAttr', module)) + module.addItem( + tools.wxArrayWrapperTemplate('wxRichTextVariantArray', 'wxVariant', module)) + + + module.find('wxRICHTEXT_ALL').ignore() + module.find('wxRICHTEXT_NONE').ignore() + module.find('wxRICHTEXT_NO_SELECTION').ignore() + module.addPyCode("""\ + RICHTEXT_ALL = RichTextRange(-2, -2) + RICHTEXT_NONE = RichTextRange(-1, -1) + RICHTEXT_NO_SELECTION = RichTextRange(-2, -2) + """) + + + #------------------------------------------------------- c = module.find('wxTextAttrDimension') assert isinstance(c, etgtools.ClassDef) c.find('SetValue').findOverload('units').ignore() - module.addItem( - tools.wxArrayWrapperTemplate('wxRichTextRangeArray', 'wxRichTextRange', module)) + #------------------------------------------------------- + c = module.find('wxTextAttrDimensions') + # There are const and non-const versions of each of these, get rid of one + # of each pair. + c.find('GetLeft').ignore() + c.find('GetRight').ignore() + c.find('GetTop').ignore() + c.find('GetBottom').ignore() + + #------------------------------------------------------- + c = module.find('wxTextAttrSize') + c.find('GetWidth').ignore() + c.find('GetHeight').ignore() + c.find('SetWidth').findOverload('units').ignore() + c.find('SetHeight').findOverload('units').ignore() + + #------------------------------------------------------- + c = module.find('wxTextAttrBorder') + c.find('GetWidth').ignore() + + + #------------------------------------------------------- + c = module.find('wxTextAttrBorders') + c.find('GetLeft').ignore() + c.find('GetRight').ignore() + c.find('GetTop').ignore() + c.find('GetBottom').ignore() + + + #------------------------------------------------------- + c = module.find('wxTextBoxAttr') + c.find('GetMargins').ignore() + c.find('GetLeftMargin').ignore() + c.find('GetRightMargin').ignore() + c.find('GetTopMargin').ignore() + c.find('GetBottomMargin').ignore() + + c.find('GetPosition').ignore() + + c.find('GetLeft').ignore() + c.find('GetRight').ignore() + c.find('GetTop').ignore() + c.find('GetBottom').ignore() + + c.find('GetPadding').ignore() + c.find('GetLeftPadding').ignore() + c.find('GetRightPadding').ignore() + c.find('GetTopPadding').ignore() + c.find('GetBottomPadding').ignore() + + c.find('GetBorder').ignore() + c.find('GetLeftBorder').ignore() + c.find('GetRightBorder').ignore() + c.find('GetTopBorder').ignore() + c.find('GetBottomBorder').ignore() + + c.find('GetOutline').ignore() + c.find('GetLeftOutline').ignore() + c.find('GetRightOutline').ignore() + c.find('GetTopOutline').ignore() + c.find('GetBottomOutline').ignore() + + c.find('GetSize').ignore() + c.find('GetMinSize').ignore() + c.find('GetMaxSize').ignore() + c.find('GetWidth').ignore() + c.find('GetHeight').ignore() + + + #------------------------------------------------------- + c = module.find('wxRichTextAttr') + c.find('GetTextBoxAttr').ignore() + + + #------------------------------------------------------- + c = module.find('wxRichTextProperties') + c.find('operator[]').ignore() + c.find('GetProperties').ignore() + + c.find('SetProperty').findOverload('bool').ignore() + + + #------------------------------------------------------- + c = module.find('wxRichTextSelection') + c.find('GetRanges').ignore() + + + #------------------------------------------------------- + #------------------------------------------------------- + #------------------------------------------------------- + + #----------------------------------------------------------------- tools.doCommonTweaks(module)