mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 19:40:12 +01:00
Remove the MappedType for wxPGAttributeStorage
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user