From 9afc5d886e2ee530a8913138393fa48e99d32dda Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 22 May 2012 00:17:21 +0000 Subject: [PATCH] Fixes crashes when trying to use the variadic version of the wx.FileTypeInfo ctor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71527 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/mimetype.py | 13 ++++++++++--- etgtools/extractors.py | 1 + unittests/test_mimetype.py | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/etg/mimetype.py b/etg/mimetype.py index cc15b2e0..cb84a8f8 100644 --- a/etg/mimetype.py +++ b/etg/mimetype.py @@ -146,11 +146,18 @@ def run(): #----------------------------------------------------------------- c = module.find('wxFileTypeInfo') - # Ignore the last two args for this ctor as the varargs is causing some - # trouble. TODO: Figure this out... + # Ignore the variadic nature of this ctor ctor = c.find('wxFileTypeInfo').findOverload('extension') ctor.items[-1].ignore() - ctor.items[-2].ignore() + ctor.setCppCode("""\ + wxFileTypeInfo* fti = new wxFileTypeInfo(*mimeType); + fti->SetOpenCommand(*openCmd); + fti->SetPrintCommand(*printCmd); + fti->SetDescription(*description); + fti->AddExtension(*extension); + return fti; + """) + ctor.useDerivedName = False #----------------------------------------------------------------- diff --git a/etgtools/extractors.py b/etgtools/extractors.py index 059d97a9..229c2033 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -1104,6 +1104,7 @@ class CppMethodDef(MethodDef): super(CppMethodDef, self).__init__() self.type = type self.name = name + self.useDerivedName = True self.argsString = argsString self.body = body self.briefDoc = doc diff --git a/unittests/test_mimetype.py b/unittests/test_mimetype.py index 35b1f616..527704d4 100644 --- a/unittests/test_mimetype.py +++ b/unittests/test_mimetype.py @@ -19,8 +19,7 @@ class mimetype_Tests(wtc.WidgetTestCase): ft.GetIcon() def test_mimetype3(self): - fti = wx.FileTypeInfo('mime', 'open', 'print', 'desc') - fti.AddExtension('ext1') + fti = wx.FileTypeInfo('mime', 'open', 'print', 'desc', 'ext1') fti.AddExtension('ext2') fti.AddExtension('ext3') self.assertEqual(fti.GetMimeType(), 'mime')