X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33adb15261cec222e829b631f80cc68d71d250a6..3bcdbe527fde583072eefab67de8974c0e17a1e2:/wxPython/src/_pen.i?ds=sidebyside diff --git a/wxPython/src/_pen.i b/wxPython/src/_pen.i index 150417ea1e..fc37c53409 100644 --- a/wxPython/src/_pen.i +++ b/wxPython/src/_pen.i @@ -54,19 +54,44 @@ public: PyObject* GetDashes() { wxDash* dashes; int count = self->GetDashes(&dashes); - wxPyBeginBlockThreads(); + bool blocked = wxPyBeginBlockThreads(); PyObject* retval = PyList_New(0); for (int x=0; xSetDashes(size, (wxDash*)PyString_AS_STRING(strDashes)); + delete [] dashes; + Py_DECREF(strDashes); + wxPyEndBlockThreads(blocked); + } + } + %pythoncode { + def SetDashes(self, dashes): + """ + Associate a list of dash lengths with the Pen. + """ + self._SetDashes(self, dashes) } - - bool operator==(const wxPen& pen) /*const*/; + #ifndef __WXMAC__ -// wxDash* GetDash() const; int GetDashCount() const; #endif @@ -75,42 +100,13 @@ public: void SetStipple(wxBitmap& stipple); #endif - %pythoncode { def __nonzero__(self): return self.Ok() } -}; - - -// The list of ints for the dashes needs to exist for the life of the pen -// so we make it part of the class to save it. See pyclasses.h - -%{ -wxPyPen::~wxPyPen() -{ - if (m_dash) - delete [] m_dash; -} - -void wxPyPen::SetDashes(int nb_dashes, const wxDash *dash) -{ - if (m_dash) - delete [] m_dash; - m_dash = new wxDash[nb_dashes]; - for (int i=0; i