[dia/dia-0-97] Bug 586303 - Parenting information not exposed to the python API
- From: Hans Breuer <hans src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dia/dia-0-97] Bug 586303 - Parenting information not exposed to the python API
- Date: Sun, 8 Nov 2009 12:08:21 +0000 (UTC)
commit 532723bd914f2f35d56e8acce0d704353276e4f7
Author: Hans Breuer <hans breuer org>
Date: Sun Nov 8 12:59:26 2009 +0100
Bug 586303 - Parenting information not exposed to the python API
exposing DiaObject::parent in lack of a better API idea;)
(cherry picked from commit 91e71c7e9d1b27c7e4e79970c3c9be2fb44fdcc5)
plug-ins/python/pydia-object.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/python/pydia-object.c b/plug-ins/python/pydia-object.c
index ab3334c..e99f886 100644
--- a/plug-ins/python/pydia-object.c
+++ b/plug-ins/python/pydia-object.c
@@ -183,7 +183,7 @@ PyDiaObject_GetAttr(PyDiaObject *self, gchar *attr)
{
if (!strcmp(attr, "__members__"))
return Py_BuildValue("[sssss]", "bounding_box", "connections",
- "handles", "properties", "type");
+ "handles", "parent", "properties", "type");
else if (!strcmp(attr, "type"))
return PyDiaObjectType_New(self->object->type);
else if (!strcmp(attr, "bounding_box"))
@@ -205,6 +205,13 @@ PyDiaObject_GetAttr(PyDiaObject *self, gchar *attr)
return ret;
} else if (!strcmp(attr, "properties")) {
return PyDiaProperties_New(self->object);
+ } else if (!strcmp(attr, "parent")) {
+ if (!self->object->parent) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ } else {
+ return PyDiaObject_New(self->object->parent);
+ }
}
return Py_FindMethod(PyDiaObject_Methods, (PyObject *)self, attr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]