mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-09 05:20:08 +01:00
* Enable the use of the KeepReference annotation
* Use keepReference=True for the dc and buffer args in the buffered DCs to ensure that the target DC and the buffer are not GC's before the buffered DC is. * Change #defines to output a "const int NAME" instead of an enum. It looks lots better, and is closer to the truth. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -18,8 +18,8 @@ DOCSTRING = ""
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ 'wxBufferedDC',
|
||||
'wxAutoBufferedPaintDC',
|
||||
'wxBufferedPaintDC',
|
||||
'wxAutoBufferedPaintDC',
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -33,17 +33,24 @@ def run():
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
module.addHeaderCode("#include <wx/dcbuffer.h>")
|
||||
|
||||
c = module.find('wxBufferedDC')
|
||||
c.addPrivateCopyCtor()
|
||||
for m in c.find('wxBufferedDC').all() + c.find('Init').all():
|
||||
if m.findItem('dc'):
|
||||
m.findItem('dc').keepReference = True
|
||||
if m.findItem('buffer'):
|
||||
m.findItem('buffer').keepReference = True
|
||||
|
||||
|
||||
c = module.find('wxBufferedPaintDC')
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('wxBufferedPaintDC').findOverload('wxBitmap').find('buffer').keepReference = True
|
||||
|
||||
c = module.find('wxAutoBufferedPaintDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
c = module.find('wxBufferedPaintDC')
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
|
||||
@@ -410,6 +410,7 @@ class ParamDef(BaseDef):
|
||||
self.transfer = False # transfer ownership of arg to C++?
|
||||
self.transferBack = False # transfer ownership of arg from C++ to Python?
|
||||
self.transferThis = False # ownership of 'this' pointer transfered to this arg
|
||||
self.keepReference = False # an extra reference to the arg is held
|
||||
self.__dict__.update(kw)
|
||||
if element is not None:
|
||||
self.extract(element)
|
||||
@@ -767,7 +768,7 @@ class DefineDef(BaseDef):
|
||||
def __init__(self, element, **kw):
|
||||
super(DefineDef, self).__init__()
|
||||
self.name = element.find('name').text
|
||||
self.value = element.find('initializer').text
|
||||
self.value = flattenNode(element.find('initializer'))
|
||||
self.__dict__.update(kw)
|
||||
|
||||
|
||||
@@ -972,10 +973,13 @@ class ModuleDef(BaseDef):
|
||||
|
||||
elif kind == 'define':
|
||||
# if it doesn't have a value, it must be a macro.
|
||||
value = element.findtext("initializer")
|
||||
value = flattenNode(element.find("initializer"))
|
||||
if not value:
|
||||
skippingMsg(kind, element)
|
||||
else:
|
||||
# NOTE: This assumes that the #defines are numeric values.
|
||||
# There will have to be some tweaking done for items that are
|
||||
# not numeric...
|
||||
extractingMsg(kind, element)
|
||||
item = DefineDef(element)
|
||||
self.items.append(item)
|
||||
|
||||
@@ -231,7 +231,9 @@ from %s import *
|
||||
assert isinstance(define, extractors.DefineDef)
|
||||
if define.ignored:
|
||||
return
|
||||
stream.write('enum { %s };\n' % define.name)
|
||||
# We're assuming that the #define is an integer value, tell sip that it is
|
||||
#stream.write('enum { %s };\n' % define.name)
|
||||
stream.write('const int %s;\n' % define.name)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
@@ -603,6 +605,8 @@ from %s import *
|
||||
annotations.append('Array')
|
||||
if item.arraySize:
|
||||
annotations.append('ArraySize')
|
||||
if item.keepReference:
|
||||
annotations.append('KeepReference')
|
||||
|
||||
if isinstance(item, (extractors.ParamDef, extractors.FunctionDef)):
|
||||
if item.transfer:
|
||||
|
||||
Reference in New Issue
Block a user