Remove the MappedType for wxPGAttributeStorage

This commit is contained in:
Robin Dunn
2017-03-13 19:59:54 -07:00
parent 775d6da37a
commit 3d0fb1927e
3 changed files with 9 additions and 47 deletions

View File

@@ -24,7 +24,6 @@ ITEMS = [ ]
# included as part of this module. These should all be items that are put in
# the wxWidgets "propgrid" library in a multi-lib build.
INCLUDES = [ 'pgvariant',
'pgattributestorage',
'propgriddefs',
'propgridproperty',
'propgrideditors',

View File

@@ -80,6 +80,15 @@ def run():
return dict;
""")
# SetAttributes uses wxPGAttributeStorage too, but we'll just replace it
# with a simple Python method.
c.find('SetAttributes').ignore()
c.addPyMethod('SetAttributes', '(self, attributes)',
doc="Set the property's attributes from a Python dictionary.",
body="""\
for name,value in attributes.items():
self.SetAttribute(name, value)
""")
c = module.find('wxPGChoicesData')

View File

@@ -1,46 +0,0 @@
//--------------------------------------------------------------------------
// Name: pgattributestorage.sip
// Purpose: MappedType for wxPGAttributeStorage
//
// Author: Robin Dunn
//
// Created: 11-March-2017
// Copyright: (c) 2017 by Total Control Software
// Licence: wxWindows license
//--------------------------------------------------------------------------
%MappedType wxPGAttributeStorage
{
%ConvertToTypeCode
// Code to test a PyObject for compatibility.
if (!sipIsErr) {
// Currently this is output only, so just reject everything
return FALSE;
}
// Code to create a new wxVariant from the PyObject
// ...
return sipGetState(sipTransferObj);
%End
%ConvertFromTypeCode
// Code to convert to a PyObject.
wxPGAttributeStorage::const_iterator it = sipCpp->StartIteration();
wxVariant v;
PyObject* dict = PyDict_New();
if ( !dict ) return dict;
while ( sipCpp->GetNext( it, v ) ) {
const wxString& name = v.GetName();
PyObject* pyStr = wx2PyString(name);
PyObject* pyVal = wxPGVariant_out_helper(v);
int res = PyDict_SetItem( dict, pyStr, pyVal );
}
return dict;
%End
};