X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f4a1fed4506d8a03c848f9c8e2e85a1dd249880..f62262aacfac8b03ad7b8aca946c4fd5717b6c2e:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index dfafce7dc5..a99061c732 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -297,6 +297,17 @@ void wxPyApp::MacOpenFile(const wxString &fileName) wxPyEndBlockThreads(blocked); } +void wxPyApp::MacOpenURL(const wxString &url) +{ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + if (wxPyCBH_findCallback(m_myInst, "MacOpenURL")) { + PyObject* s = wx2PyString(url); + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); + Py_DECREF(s); + } + wxPyEndBlockThreads(blocked); +} + void wxPyApp::MacPrintFile(const wxString &fileName) { wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -831,6 +842,7 @@ void wxPyOORClientData_dtor(wxPyOORClientData* self) { //Py_INCREF(deadObjectClass); Py_DECREF(klass); Py_DECREF(name); + Py_DECREF(dict); } } @@ -1260,7 +1272,7 @@ wxPyCBInputStream::wxPyCBInputStream(const wxPyCBInputStream& other) wxPyCBInputStream::~wxPyCBInputStream() { - wxPyBlock_t blocked; + wxPyBlock_t blocked = wxPyBlock_t_default; if (m_block) blocked = wxPyBeginBlockThreads(); Py_XDECREF(m_read); Py_XDECREF(m_seek); @@ -1270,7 +1282,7 @@ wxPyCBInputStream::~wxPyCBInputStream() { wxPyCBInputStream* wxPyCBInputStream::create(PyObject *py, bool block) { - wxPyBlock_t blocked; + wxPyBlock_t blocked = wxPyBlock_t_default; if (block) blocked = wxPyBeginBlockThreads(); PyObject* read = getMethod(py, "read"); @@ -1873,8 +1885,7 @@ wxString* wxString_in_helper(PyObject* source) { target = new wxString(); size_t len = PyUnicode_GET_SIZE(uni); if (len) { - PyUnicode_AsWideChar((PyUnicodeObject*)uni, target->GetWriteBuf(len), len); - target->UngetWriteBuf(len); + PyUnicode_AsWideChar((PyUnicodeObject*)uni, wxStringBuffer(*target, len), len); } if (PyString_Check(source)) @@ -1916,8 +1927,7 @@ wxString Py2wxString(PyObject* source) } size_t len = PyUnicode_GET_SIZE(uni); if (len) { - PyUnicode_AsWideChar((PyUnicodeObject*)uni, target.GetWriteBuf(len), len); - target.UngetWriteBuf(); + PyUnicode_AsWideChar((PyUnicodeObject*)uni, wxStringBuffer(target, len), len); } if (!PyUnicode_Check(source)) @@ -2526,6 +2536,17 @@ bool wxPoint_helper(PyObject* source, wxPoint** obj) +bool wxPosition_helper(PyObject* source, wxPosition** obj) +{ + if (source == Py_None) { + **obj = wxPosition(-1,-1); + return true; + } + return wxPyTwoIntItem_helper(source, obj, wxT("wxPosition")); +} + + + bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj) { if (source == Py_None) {