Transfer ownership of arg in AddPrivateChild.

This commit is contained in:
Robin Dunn
2017-06-14 18:45:31 -07:00
parent 0df54b74a0
commit 17d110da96
2 changed files with 7 additions and 9 deletions

View File

@@ -111,7 +111,7 @@ class IntProperty2(wxpg.PGProperty):
# wxPGVFBFlags work properly. # wxPGVFBFlags work properly.
oldvfb__ = validationInfo.GetFailureBehavior() oldvfb__ = validationInfo.GetFailureBehavior()
# Mark the cell if validaton failred # Mark the cell if validation failed
validationInfo.SetFailureBehavior(wxpg.PG_VFB_MARK_CELL) validationInfo.SetFailureBehavior(wxpg.PG_VFB_MARK_CELL)
if value < -10000 or value > 10000: if value < -10000 or value > 10000:
@@ -147,17 +147,12 @@ class SizeProperty(wxpg.PGProperty):
def _ConvertValue(self, value): def _ConvertValue(self, value):
""" Utility convert arbitrary value to a real wx.Size. """ Utility convert arbitrary value to a real wx.Size.
""" """
from operator import isSequenceType import collections
if isinstance(value, wx.Point): if isinstance(value, collections.Sequence) or hasattr(value, '__getitem__'):
value = wx.Size(value.x, value.y)
elif isSequenceType(value):
value = wx.Size(*value) value = wx.Size(*value)
return value return value
def ChildChanged(self, thisValue, childIndex, childValue): def ChildChanged(self, thisValue, childIndex, childValue):
# FIXME: This does not work yet. ChildChanged needs be fixed "for"
# wxPython in wxWidgets SVN trunk, and that has to wait for
# 2.9.1, as wxPython 2.9.0 uses WX_2_9_0_BRANCH.
size = self._ConvertValue(self.m_value) size = self._ConvertValue(self.m_value)
if childIndex == 0: if childIndex == 0:
size.x = childValue size.x = childValue
@@ -751,7 +746,7 @@ class TestPanel( wx.Panel ):
pg.Append( wxpg.PropertyCategory("4 - Additional Properties") ) pg.Append( wxpg.PropertyCategory("4 - Additional Properties") )
#pg.Append( wxpg.PointProperty("Point",value=panel.GetPosition()) ) #pg.Append( wxpg.PointProperty("Point",value=panel.GetPosition()) )
#pg.Append( SizeProperty("Size",value=panel.GetSize()) ) pg.Append( SizeProperty("Size", value=panel.GetSize()) )
#pg.Append( wxpg.FontDataProperty("FontData") ) #pg.Append( wxpg.FontDataProperty("FontData") )
pg.Append( wxpg.IntProperty("IntWithSpin",value=256) ) pg.Append( wxpg.IntProperty("IntWithSpin",value=256) )
pg.SetPropertyEditor("IntWithSpin","SpinCtrl") pg.SetPropertyEditor("IntWithSpin","SpinCtrl")

View File

@@ -90,6 +90,9 @@ def run():
self.SetAttribute(name, value) self.SetAttribute(name, value)
""") """)
c.find('AddPrivateChild.prop').transfer = True
c.find('AddChild.prop').transfer = True
c = module.find('wxPGChoicesData') c = module.find('wxPGChoicesData')
tools.ignoreConstOverloads(c) tools.ignoreConstOverloads(c)