Merge branch 'master' into release-prep

This commit is contained in:
Robin Dunn
2017-09-15 08:33:45 -07:00
9 changed files with 61 additions and 27 deletions

View File

@@ -80,7 +80,7 @@ Changes in this release include the following:
* Update SizedControls to do a sanity check on the parent's sizer, as GetSizer
can return None for SizedParent under certain circumstances, such as when
AUI reparents the control during pane movement. (#523)
AUI reparents the control during pane movement. (#523, #537)
* Added Vagrant configs for Fedora 23 and Fedora 26, and dropped Fedora 24.
Wheels built on F23 can also be used on F24 and F25, and F26 adds Python 3.6

View File

@@ -701,20 +701,22 @@ class TestPanel( wx.Panel ):
#
# Add properties
#
# NOTE: in this example the property names are used as variable names
# in one of the tests, so they need to be valid python identifiers.
#
pg.AddPage( "Page 1 - Testing All" )
pg.Append( wxpg.PropertyCategory("1 - Basic Properties") )
pg.Append( wxpg.StringProperty("String",value="Some Text") )
sp = pg.Append( wxpg.StringProperty('StringProperty w/ Password flag', value='ABadPassword') )
sp = pg.Append( wxpg.StringProperty('StringProperty_as_Password', value='ABadPassword') )
sp.SetAttribute('Hint', 'This is a hint')
sp.SetAttribute('Password', True)
pg.Append( wxpg.IntProperty("Int",value=100) )
pg.Append( wxpg.FloatProperty("Float",value=100.0) )
pg.Append( wxpg.BoolProperty("Bool",value=True) )
boolprop = pg.Append( wxpg.BoolProperty("Bool_with_Checkbox",value=True) )
pg.Append( wxpg.IntProperty("Int", value=100) )
self.fprop = pg.Append( wxpg.FloatProperty("Float", value=123.456) )
pg.Append( wxpg.BoolProperty("Bool", value=True) )
boolprop = pg.Append( wxpg.BoolProperty("Bool_with_Checkbox", value=True) )
pg.SetPropertyAttribute(
"Bool_with_Checkbox", # You can find the property by name,
#boolprop, # or give the property object itself.

View File

@@ -110,11 +110,24 @@ def run():
if m.type == 'wxPropertyGridConstIterator':
m.ignore()
c.find('SetPropertyValue').findOverload('int value').ignore()
c.find('SetPropertyValue').findOverload('bool value').ignore()
c.find('SetPropertyValue').findOverload('wxLongLong_t value').ignore()
c.find('SetPropertyValue').findOverload('wxULongLong_t value').ignore()
c.find('SetPropertyValue').findOverload('wxObject *value').ignore()
spv = c.find('SetPropertyValue')
spv.findOverload('int value').ignore()
spv.findOverload('wxLongLong_t value').ignore()
spv.findOverload('wxULongLong_t value').ignore()
spv.findOverload('wxObject *value').ignore()
# Reorder SetPropertyValue overloads so the one taking a long int is not
# first. Mark others that could be auto-converted from int as
# "constrained" so they will only be used for that specific type. This
# should result in SetPropertyValue(id, double) only used for floats and
# not ints, or other things that can convert to int.
spv.findOverload('bool value').find('value').constrained = True
spv.findOverload('double value').find('value').constrained = True
spv_long = spv.findOverload('long value')
spv_long.ignore()
spv.reorderOverloads() # Ensures an ignored item is not first,
spv_long.ignore(False) # and then we can unignore it.
c.find('Append.property').transfer = True
c.find('AppendIn.newProperty').transfer = True

View File

@@ -596,6 +596,7 @@ class ParamDef(BaseDef):
self.transferBack = False # transfer ownership of arg from C++ to Python?
self.transferThis = False # ownership of 'this' pointer transferred to this arg
self.keepReference = False # an extra reference to the arg is held
self.constrained = False # limit auto-conversion of similar types (like float -> int)
self.__dict__.update(kw)
if element is not None:
self.extract(element)

View File

@@ -959,6 +959,8 @@ from .%s import *
annotations.append('ArraySize')
if item.keepReference:
annotations.append('KeepReference')
if item.constrained:
annotations.append('Constrained')
if isinstance(item, (extractors.ParamDef, extractors.FunctionDef)):
if item.transfer:

View File

@@ -16,6 +16,19 @@ class propgridiface_Tests(wtc.WidgetTestCase):
iface = pg.PropertyGridInterface()
def test_propgridiface03(self):
# Ensure SetPropertyValue doesn't truncate floats
pgrid = pg.PropertyGrid(self.frame)
pgrid.Append(pg.FloatProperty('Float', value=123.456))
value = pgrid.GetPropertyValue('Float')
assert type(value) is float
assert value == 123.456
pgrid.SetPropertyValue('Float', 654.321)
value = pgrid.GetPropertyValue('Float')
assert type(value) is float
assert value == 654.321
#---------------------------------------------------------------------------

View File

@@ -1,14 +1,20 @@
import unittest
from unittests import wtc
import wx
import wx.propgrid as pg
#---------------------------------------------------------------------------
class propgridmanager_Tests(wtc.WidgetTestCase):
# TODO: Remove this test and add real ones.
def test_propgridmanager1(self):
self.fail("Unit tests for propgridmanager not implemented yet.")
def test_propgridmanager01(self):
page = pg.PropertyGridPage()
def test_propgridmanager02(self):
mgr = pg.PropertyGridManager(self.frame)
page1 = mgr.AddPage('label')
#---------------------------------------------------------------------------

View File

@@ -48,15 +48,15 @@ class property_Tests(wtc.WidgetTestCase):
c = pg.PGCell()
def test_propgridproperty07(self):
attrs = pg.PGAttributeStorage()
attrs.Set('name', 'value')
attrs.Set('one', 1)
attrs.Set('two.one', 2.1)
attrs.Set('true', True)
assert attrs.GetCount() == 4
assert attrs.FindValue('name') == 'value'
# TODO: Add some iteration tests
# def test_propgridproperty07(self):
# attrs = pg.PGAttributeStorage()
# attrs.Set('name', 'value')
# attrs.Set('one', 1)
# attrs.Set('two.one', 2.1)
# attrs.Set('true', True)
# assert attrs.GetCount() == 4
# assert attrs.FindValue('name') == 'value'
# # TODO: Add some iteration tests
def test_propgridproperty08(self):

View File

@@ -98,7 +98,6 @@ __date__ = "31 March 2009"
import wx
# just for isinstance
import wx.lib.sized_controls as sc
import time
import warnings
@@ -4470,8 +4469,6 @@ class AuiManager(wx.EvtHandler):
if not managed_window:
raise Exception("Specified managed window must be non-null. ")
if isinstance(managed_window, sc.SizedParent):
raise Exception("Do not use wx.lib.sized_control for managed window. ")
self.UnInit()