mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
We can now use PyObject* instead of SIP_PYOBJECT
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -453,9 +453,13 @@ from %s import *
|
||||
pnames = ', '.join(pnames)
|
||||
if pnames:
|
||||
pnames = ', ' + pnames
|
||||
# convert PyObject* to SIP_PYOBJECT in the return type and param types
|
||||
typ = method.type.replace('PyObject*', 'SIP_PYOBJECT')
|
||||
argsString = method.argsString.replace('PyObject*', 'SIP_PYOBJECT')
|
||||
if False:
|
||||
# convert PyObject* to SIP_PYOBJECT in the return type and param types
|
||||
typ = method.type.replace('PyObject*', 'SIP_PYOBJECT')
|
||||
argsString = method.argsString.replace('PyObject*', 'SIP_PYOBJECT')
|
||||
else:
|
||||
typ = method.type
|
||||
argsString = method.argsString
|
||||
# spit it all out
|
||||
if method.isCtor:
|
||||
stream.write('%s%s%s%s;\n' %
|
||||
|
||||
@@ -16,6 +16,7 @@ import extractors
|
||||
import sys, os
|
||||
|
||||
|
||||
|
||||
def removeWxPrefixes(node):
|
||||
"""
|
||||
Rename items with a 'wx' prefix to not have the prefix. If the back-end
|
||||
@@ -36,7 +37,12 @@ def removeWxPrefixes(node):
|
||||
item.pyName = item.name
|
||||
|
||||
|
||||
|
||||
def removeWxPrefix(name):
|
||||
if name.startswith('wx') and not name.startswith('wxEVT_'):
|
||||
name = name[2:]
|
||||
return name
|
||||
|
||||
|
||||
def ignoreAssignmentOperators(node):
|
||||
"""
|
||||
Set the ignored flag for all class methods that are assignment operators
|
||||
@@ -423,7 +429,8 @@ def convertFourDoublesTemplate(CLASS):
|
||||
def wxListWrapperTemplate(ListClass, ItemClass, RealItemClass=None):
|
||||
if RealItemClass is None:
|
||||
RealItemClass = ItemClass
|
||||
|
||||
ListClass_noPrefix = removeWxPrefix(ListClass)
|
||||
|
||||
# *** TODO: This can probably be done in a way that is not SIP-specfic. Try
|
||||
# creating extractor objects from scratch and attach cppMethods to them.
|
||||
|
||||
@@ -499,10 +506,10 @@ public:
|
||||
}};
|
||||
|
||||
%Extract(id=pycode)
|
||||
def _{ListClass}___repr__(self):
|
||||
def _{ListClass_noPrefix}___repr__(self):
|
||||
return "{ListClass}: " + repr(list(self))
|
||||
{ListClass}.__repr__ = _{ListClass}___repr__
|
||||
del _{ListClass}___repr__
|
||||
{ListClass_noPrefix}.__repr__ = _{ListClass_noPrefix}___repr__
|
||||
del _{ListClass_noPrefix}___repr__
|
||||
%End
|
||||
'''.format(**locals()))
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
};
|
||||
|
||||
class wxPyApp;
|
||||
wxPyApp* wxGetApp();
|
||||
wxPyApp* wxGetApp();
|
||||
|
||||
%End
|
||||
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
return sipBuildResult(&_isErr, "(iii)", red, green, blue);
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get(bool includeAlpha=true);
|
||||
PyObject* Get(bool includeAlpha=true);
|
||||
%MethodCode
|
||||
sipRes = _wxColour_Get(sipCpp, sipIsErr, includeAlpha);
|
||||
%End
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
}
|
||||
}
|
||||
%End
|
||||
void Connect(int id, int lastId, wxEventType eventType, SIP_PYOBJECT func);
|
||||
void Connect(int id, int lastId, wxEventType eventType, PyObject* func);
|
||||
%MethodCode
|
||||
_wxEvtHandler_Connect(sipCpp, sipIsErr, id, lastId, eventType, func);
|
||||
%End
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
}
|
||||
}
|
||||
%End
|
||||
bool Disconnect(int id, int lastId=-1, wxEventType eventType=wxEVT_NULL, SIP_PYOBJECT func=NULL);
|
||||
bool Disconnect(int id, int lastId=-1, wxEventType eventType=wxEVT_NULL, PyObject* func=NULL);
|
||||
%MethodCode
|
||||
sipRes = _wxEvtHandler_Disconnect(sipCpp, sipIsErr, id, lastId, eventType, func);
|
||||
%End
|
||||
@@ -425,7 +425,7 @@ public:
|
||||
}
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT GetClientData();
|
||||
PyObject* GetClientData();
|
||||
%MethodCode
|
||||
sipRes = _wxCommandEvent_GetClientData(sipCpp, sipIsErr);
|
||||
%End
|
||||
@@ -437,7 +437,7 @@ public:
|
||||
self->SetClientObject(data);
|
||||
}
|
||||
%End
|
||||
void SetClientData(SIP_PYOBJECT clientData);
|
||||
void SetClientData(PyObject* clientData);
|
||||
%MethodCode
|
||||
_wxCommandEvent_SetClientData(sipCpp, sipIsErr, clientData);
|
||||
%End
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
return sipBuildResult(&_isErr, "(ii)", self->x, self->y);
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get();
|
||||
PyObject* Get();
|
||||
%MethodCode
|
||||
sipRes = _wxPoint_Get(sipCpp, sipIsErr);
|
||||
%End
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
return sipBuildResult(&_isErr, "(ii)", self->GetWidth(), self->GetHeight());
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get();
|
||||
PyObject* Get();
|
||||
%MethodCode
|
||||
sipRes = _wxSize_Get(sipCpp, sipIsErr);
|
||||
%End
|
||||
@@ -587,7 +587,7 @@ public:
|
||||
self->x, self->y, self->width, self->height);
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get();
|
||||
PyObject* Get();
|
||||
%MethodCode
|
||||
sipRes = _wxRect_Get(sipCpp, sipIsErr);
|
||||
%End
|
||||
@@ -750,7 +750,7 @@ public:
|
||||
return sipBuildResult(&_isErr, "(dd)", self->x, self->y);
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get();
|
||||
PyObject* Get();
|
||||
%MethodCode
|
||||
sipRes = _wxRealPoint_Get(sipCpp, sipIsErr);
|
||||
%End
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
return sipBuildResult(&_isErr, "(dd)", self->m_x, self->m_y);
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get();
|
||||
PyObject* Get();
|
||||
%MethodCode
|
||||
sipRes = _wxPoint2DDouble_Get(sipCpp, sipIsErr);
|
||||
%End
|
||||
@@ -445,7 +445,7 @@ public:
|
||||
self->m_x, self->m_y, self->m_width, self->m_height);
|
||||
}
|
||||
%End
|
||||
SIP_PYOBJECT Get();
|
||||
PyObject* Get();
|
||||
%MethodCode
|
||||
sipRes = _wxRect2DDouble_Get(sipCpp, sipIsErr);
|
||||
%End
|
||||
|
||||
@@ -1227,10 +1227,10 @@ public:
|
||||
};
|
||||
|
||||
%Extract(id=pycode)
|
||||
def _wxWindowList___repr__(self):
|
||||
def _WindowList___repr__(self):
|
||||
return "wxWindowList: " + repr(list(self))
|
||||
wxWindowList.__repr__ = _wxWindowList___repr__
|
||||
del _wxWindowList___repr__
|
||||
WindowList.__repr__ = _WindowList___repr__
|
||||
del _WindowList___repr__
|
||||
%End
|
||||
|
||||
|
||||
|
||||
@@ -20,8 +20,11 @@
|
||||
// transport those attributes over to the clone when wx needs to make a copy
|
||||
// of the event instance.
|
||||
|
||||
// NOTE: This class is intentionally not exposed to SIP (see wxPyEvent
|
||||
// and wxPyCommandEvent)
|
||||
// NOTE: This class is intentionally not exposed to SIP as there is no
|
||||
// need for it in Python code. Intead we just tell SIP that the __*attr__
|
||||
// methods are in the event classes. (See wxPyEvent and wxPyCommandEvent
|
||||
// below.)
|
||||
|
||||
class wxPyEvtDict
|
||||
{
|
||||
public:
|
||||
@@ -43,7 +46,7 @@
|
||||
wxPyEndBlockThreads(blocked);
|
||||
}
|
||||
|
||||
PyObject* _getDict()
|
||||
PyObject* _getAttrDict()
|
||||
{
|
||||
Py_INCREF(m_dict);
|
||||
return m_dict;
|
||||
@@ -119,21 +122,23 @@ implement the Clone method in your derived classes.
|
||||
public:
|
||||
wxPyEvent(int id=0, wxEventType eventType = wxEVT_NULL );
|
||||
virtual wxEvent* Clone() const /Factory/;
|
||||
PyObject* _getAttrDict();
|
||||
|
||||
SIP_PYOBJECT __getattr__(SIP_PYOBJECT name);
|
||||
PyObject* __getattr__(PyObject* name);
|
||||
%MethodCode
|
||||
sipRes = sipCpp->__getattr__(name);
|
||||
%End
|
||||
|
||||
void __setattr__(SIP_PYOBJECT name, SIP_PYOBJECT value);
|
||||
void __setattr__(PyObject* name, PyObject* value);
|
||||
%MethodCode
|
||||
sipCpp->__setattr__(name, value);
|
||||
%End
|
||||
|
||||
void __delattr__(SIP_PYOBJECT name);
|
||||
void __delattr__(PyObject* name);
|
||||
%MethodCode
|
||||
sipCpp->__delattr__(name);
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -168,19 +173,19 @@ implement the Clone method in your derived classes.
|
||||
public:
|
||||
wxPyCommandEvent(wxEventType eventType = wxEVT_NULL, int id=0);
|
||||
virtual wxEvent* Clone() const /Factory/;
|
||||
SIP_PYOBJECT _getDict();
|
||||
PyObject* _getAttrDict();
|
||||
|
||||
SIP_PYOBJECT __getattr__(SIP_PYOBJECT name);
|
||||
PyObject* __getattr__(PyObject* name);
|
||||
%MethodCode
|
||||
sipRes = sipCpp->__getattr__(name);
|
||||
%End
|
||||
|
||||
void __setattr__(SIP_PYOBJECT name, SIP_PYOBJECT value);
|
||||
void __setattr__(PyObject* name, PyObject* value);
|
||||
%MethodCode
|
||||
sipCpp->__setattr__(name, value);
|
||||
%End
|
||||
|
||||
void __delattr__(SIP_PYOBJECT name);
|
||||
void __delattr__(PyObject* name);
|
||||
%MethodCode
|
||||
sipCpp->__delattr__(name);
|
||||
%End
|
||||
|
||||
Reference in New Issue
Block a user