diff --git a/etg/_propgrid.py b/etg/_propgrid.py index 245577ac..706b2cc9 100644 --- a/etg/_propgrid.py +++ b/etg/_propgrid.py @@ -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', diff --git a/etg/propgridproperty.py b/etg/propgridproperty.py index d7dc2b0e..256d773d 100644 --- a/etg/propgridproperty.py +++ b/etg/propgridproperty.py @@ -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') diff --git a/src/pgattributestorage.sip b/src/pgattributestorage.sip deleted file mode 100644 index d9b00fc0..00000000 --- a/src/pgattributestorage.sip +++ /dev/null @@ -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 -}; -