From 447048aca9276b89673bf2ef2c40b82824231a8a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sun, 18 Sep 2011 04:58:42 +0000 Subject: [PATCH] Ignore the wxIMAGE_OPTION_* defines since they are all strings. Add assignments to a block of pycode instead. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/image.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/etg/image.py b/etg/image.py index fe70fff2..38a70a02 100644 --- a/etg/image.py +++ b/etg/image.py @@ -102,6 +102,24 @@ def run(): module.find('wxIMAGE_ALPHA_TRANSPARENT').pyInt = True module.find('wxIMAGE_ALPHA_OPAQUE').pyInt = True + # These are defines for string objects, not integers, so we can't generate + # code for them the same way as integer values. Since they are #defines we + # can't just tell SIP that they are global wxString objects because it will + # then end up taking the address of temporary values when it makes the + # getters for them. So instead we'll just make some python code to add the + # .py module and hope that the interface file always has the correct + # values of these options. + pycode = "" + for item in module: + if 'IMAGE_OPTION' in item.name and isinstance(item, etgtools.DefineDef): + item.ignore() + name = tools.removeWxPrefix(item.name) + value = item.value + for txt in ['wxString(', 'wxT(', ')']: + value = value.replace(txt, '') + + pycode += '%s = %s\n' % (name, value) + module.addPyCode(pycode) #----------------------------------------------------------------- tools.doCommonTweaks(module)