From 0aae3952c7d24a8bd7d7b0fdc6976c35be8c226e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 22 Sep 2003 21:53:33 +0000 Subject: [PATCH] Fixed GetPoints. Since wxRealPoint is not an wxObject I can't use the helper function here. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23829 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/ogl/oglshapes2.cpp | 16 +++++++++++++++- wxPython/contrib/ogl/oglshapes2.i | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/wxPython/contrib/ogl/oglshapes2.cpp b/wxPython/contrib/ogl/oglshapes2.cpp index 52c6257339..738f59de89 100644 --- a/wxPython/contrib/ogl/oglshapes2.cpp +++ b/wxPython/contrib/ogl/oglshapes2.cpp @@ -5635,7 +5635,21 @@ static PyObject *_wrap_wxPyPolygonShape_DeletePolygonPoint(PyObject *self, PyObj static PyObject * wxPyPolygonShape_GetPoints(wxPyPolygonShape *self) { wxList* list = self->GetPoints(); - return wxPy_ConvertList(list, "wxRealPoint"); + PyObject* pyList; + PyObject* pyObj; + wxObject* wxObj; + wxNode* node = list->GetFirst(); + + wxPyBeginBlockThreads(); + pyList = PyList_New(0); + while (node) { + wxObj = node->GetData(); + pyObj = wxPyConstructObject(wxObj, wxT("wxRealPoint"), 0); + PyList_Append(pyList, pyObj); + node = node->GetNext(); + } + wxPyEndBlockThreads(); + return pyList; } static PyObject *_wrap_wxPyPolygonShape_GetPoints(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/contrib/ogl/oglshapes2.i b/wxPython/contrib/ogl/oglshapes2.i index 108a423acd..a5964d7bc2 100644 --- a/wxPython/contrib/ogl/oglshapes2.i +++ b/wxPython/contrib/ogl/oglshapes2.i @@ -303,13 +303,26 @@ public: %addmethods { PyObject* GetPoints() { wxList* list = self->GetPoints(); - return wxPy_ConvertList(list, "wxRealPoint"); + PyObject* pyList; + PyObject* pyObj; + wxObject* wxObj; + wxNode* node = list->GetFirst(); + + wxPyBeginBlockThreads(); + pyList = PyList_New(0); + while (node) { + wxObj = node->GetData(); + pyObj = wxPyConstructObject(wxObj, wxT("wxRealPoint"), 0); + PyList_Append(pyList, pyObj); + node = node->GetNext(); + } + wxPyEndBlockThreads(); + return pyList; } } void UpdateOriginalPoints(); - void base_OnDraw(wxDC& dc); void base_OnDrawContents(wxDC& dc); void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);