From 17d110da9607b0add874c507c08f40822e7d92e5 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 14 Jun 2017 18:45:31 -0700 Subject: [PATCH] Transfer ownership of arg in AddPrivateChild. --- demo/PropertyGrid.py | 13 ++++--------- etg/propgridproperty.py | 3 +++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/demo/PropertyGrid.py b/demo/PropertyGrid.py index e9946e4a..d3c03b37 100644 --- a/demo/PropertyGrid.py +++ b/demo/PropertyGrid.py @@ -111,7 +111,7 @@ class IntProperty2(wxpg.PGProperty): # wxPGVFBFlags work properly. oldvfb__ = validationInfo.GetFailureBehavior() - # Mark the cell if validaton failred + # Mark the cell if validation failed validationInfo.SetFailureBehavior(wxpg.PG_VFB_MARK_CELL) if value < -10000 or value > 10000: @@ -147,17 +147,12 @@ class SizeProperty(wxpg.PGProperty): def _ConvertValue(self, value): """ Utility convert arbitrary value to a real wx.Size. """ - from operator import isSequenceType - if isinstance(value, wx.Point): - value = wx.Size(value.x, value.y) - elif isSequenceType(value): + import collections + if isinstance(value, collections.Sequence) or hasattr(value, '__getitem__'): value = wx.Size(*value) return value 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) if childIndex == 0: size.x = childValue @@ -751,7 +746,7 @@ class TestPanel( wx.Panel ): pg.Append( wxpg.PropertyCategory("4 - Additional Properties") ) #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.IntProperty("IntWithSpin",value=256) ) pg.SetPropertyEditor("IntWithSpin","SpinCtrl") diff --git a/etg/propgridproperty.py b/etg/propgridproperty.py index 256d773d..eb7e99df 100644 --- a/etg/propgridproperty.py +++ b/etg/propgridproperty.py @@ -90,6 +90,9 @@ def run(): self.SetAttribute(name, value) """) + c.find('AddPrivateChild.prop').transfer = True + c.find('AddChild.prop').transfer = True + c = module.find('wxPGChoicesData') tools.ignoreConstOverloads(c)