mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 03:50:06 +01:00
Just convert wxPGAttributeStorage to a dictionary
This commit is contained in:
@@ -24,6 +24,7 @@ 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',
|
||||
|
||||
@@ -22,7 +22,6 @@ ITEMS = [ 'wxPGPaintData',
|
||||
'wxPGDefaultRenderer',
|
||||
'wxPGCellData',
|
||||
'wxPGCell',
|
||||
'wxPGAttributeStorage',
|
||||
|
||||
'wxPGProperty',
|
||||
'wxPropertyCategory',
|
||||
@@ -51,13 +50,6 @@ def run():
|
||||
c.bases = ['wxRefCounter']
|
||||
|
||||
|
||||
c = module.find('wxPGAttributeStorage')
|
||||
# TODO: Add methods to add a Python iterator using these methods
|
||||
c.find('StartIteration').ignore()
|
||||
c.find('GetNext').ignore()
|
||||
c.find('const_iterator').ignore()
|
||||
|
||||
|
||||
c = module.find('wxPGProperty')
|
||||
tools.ignoreConstOverloads(c)
|
||||
c.find('StringToValue.variant').out = True
|
||||
|
||||
46
src/pgattributestorage.sip
Normal file
46
src/pgattributestorage.sip
Normal file
@@ -0,0 +1,46 @@
|
||||
//--------------------------------------------------------------------------
|
||||
// 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