@@ -228,6 +228,7 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||||
228 | PyObject* dict = PyBaseObject_Type.tp_getattro(obj, name); |
|
228 | PyObject* dict = PyBaseObject_Type.tp_getattro(obj, name); | |
229 | dict = PyDict_Copy(dict); |
|
229 | dict = PyDict_Copy(dict); | |
230 |
|
230 | |||
|
231 | if (wrapper->_obj) { | |||
231 | // only the properties are missing, the rest is already available from |
|
232 | // only the properties are missing, the rest is already available from | |
232 | // PythonQtClassWrapper... |
|
233 | // PythonQtClassWrapper... | |
233 | QStringList l = wrapper->classInfo()->propertyList(); |
|
234 | QStringList l = wrapper->classInfo()->propertyList(); | |
@@ -240,6 +241,7 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||||
240 | std::cerr << "PythonQtInstanceWrapper: something is wrong, could not get attribute " << name.toLatin1().data(); |
|
241 | std::cerr << "PythonQtInstanceWrapper: something is wrong, could not get attribute " << name.toLatin1().data(); | |
241 | } |
|
242 | } | |
242 | } |
|
243 | } | |
|
244 | } | |||
243 | // Note: we do not put children into the dict, is would look confusing?! |
|
245 | // Note: we do not put children into the dict, is would look confusing?! | |
244 | return dict; |
|
246 | return dict; | |
245 | } |
|
247 | } | |
@@ -251,12 +253,6 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||||
251 | } |
|
253 | } | |
252 | PyErr_Clear(); |
|
254 | PyErr_Clear(); | |
253 |
|
255 | |||
254 | if (!wrapper->_obj && !wrapper->_wrappedPtr) { |
|
|||
255 | QString error = QString("Trying to read attribute '") + attributeName + "' from a destroyed " + wrapper->classInfo()->className() + " object"; |
|
|||
256 | PyErr_SetString(PyExc_ValueError, error.toLatin1().data()); |
|
|||
257 | return NULL; |
|
|||
258 | } |
|
|||
259 |
|
||||
260 | // mlabDebugConst("Python","get " << attributeName); |
|
256 | // mlabDebugConst("Python","get " << attributeName); | |
261 |
|
257 | |||
262 | // TODO: dynamic properties are missing |
|
258 | // TODO: dynamic properties are missing | |
@@ -271,6 +267,10 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||||
271 | Py_INCREF(Py_None); |
|
267 | Py_INCREF(Py_None); | |
272 | return Py_None; |
|
268 | return Py_None; | |
273 | } |
|
269 | } | |
|
270 | } else { | |||
|
271 | QString error = QString("Trying to read property '") + attributeName + "' from a destroyed " + wrapper->classInfo()->className() + " object"; | |||
|
272 | PyErr_SetString(PyExc_ValueError, error.toLatin1().data()); | |||
|
273 | return NULL; | |||
274 | } |
|
274 | } | |
275 | break; |
|
275 | break; | |
276 | case PythonQtMemberInfo::Slot: |
|
276 | case PythonQtMemberInfo::Slot: | |
@@ -295,7 +295,7 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||||
295 | break; |
|
295 | break; | |
296 | } |
|
296 | } | |
297 |
|
297 | |||
298 | // look for the interal methods (className(), help()) |
|
298 | // look for the internal methods (className(), help()) | |
299 | PyObject* internalMethod = Py_FindMethod( PythonQtInstanceWrapper_methods, obj, (char*)attributeName); |
|
299 | PyObject* internalMethod = Py_FindMethod( PythonQtInstanceWrapper_methods, obj, (char*)attributeName); | |
300 | if (internalMethod) { |
|
300 | if (internalMethod) { | |
301 | return internalMethod; |
|
301 | return internalMethod; |
General Comments 0
You need to be logged in to leave comments.
Login now