Skip to content

Commit

Permalink
Merge pull request wxWidgets#396 from RobinD42/fix-issue394
Browse files Browse the repository at this point in the history
Transfer ownership of arg in AddPrivateChild.
  • Loading branch information
RobinD42 authored Jun 15, 2017
2 parents 0df54b7 + 17d110d commit 888e0ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 4 additions & 9 deletions demo/PropertyGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def ValidateValue(self, value, validationInfo):
# 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:
Expand Down Expand Up @@ -147,17 +147,12 @@ def RefreshChildren(self):
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
Expand Down Expand Up @@ -751,7 +746,7 @@ def __init__( self, parent, log ):

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")
Expand Down
3 changes: 3 additions & 0 deletions etg/propgridproperty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 888e0ef

Please sign in to comment.