X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d9de11075ad9523c34d7c8401b8eea9d35e57d0..3af4da323ab401ad41e2eca2c6afbc2c3d632da6:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index d562546189..e7326368ce 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -495,6 +495,8 @@ void wxPyApp::_BootstrapApp() Py_DECREF(argTuple); Py_DECREF(method); if (retval == NULL) + // Don't PyErr_Print here, let the exception in this case go back + // up to the wx.PyApp.__init__ scope. goto error; pyint = PyNumber_Int(retval); @@ -713,7 +715,19 @@ PyObject* __wxPySetDictionary(PyObject* /* self */, PyObject* args) _AddInfoString("wx-assertions-off"); #endif _AddInfoString(wxPy_SWIG_VERSION); - +#ifdef __WXMAC__ + #if wxMAC_USE_CORE_GRAPHICS + _AddInfoString("mac-cg"); + #else + _AddInfoString("mac-qd"); + #endif + #if wxMAC_USE_NATIVE_TOOLBAR + _AddInfoString("mac-native-tb"); + #else + _AddInfoString("mac-no-native-tb"); + #endif +#endif + #undef _AddInfoString PyObject* PlatInfoTuple = PyList_AsTuple(PlatInfo); @@ -2510,7 +2524,7 @@ bool wxColour_helper(PyObject* source, wxColour** obj) { return true; } } - // last chance: 3-tuple of integers is expected + // last chance: 3-tuple or 4-tuple of integers is expected else if (PySequence_Check(source) && PyObject_Length(source) == 3) { PyObject* o1 = PySequence_GetItem(source, 0); PyObject* o2 = PySequence_GetItem(source, 1); @@ -2527,10 +2541,29 @@ bool wxColour_helper(PyObject* source, wxColour** obj) { Py_DECREF(o3); return true; } + else if (PySequence_Check(source) && PyObject_Length(source) == 4) { + PyObject* o1 = PySequence_GetItem(source, 0); + PyObject* o2 = PySequence_GetItem(source, 1); + PyObject* o3 = PySequence_GetItem(source, 2); + PyObject* o4 = PySequence_GetItem(source, 3); + if (!PyNumber_Check(o1) || !PyNumber_Check(o2) || !PyNumber_Check(o3) || !PyNumber_Check(o4)) { + Py_DECREF(o1); + Py_DECREF(o2); + Py_DECREF(o3); + Py_DECREF(o4); + goto error; + } + **obj = wxColour(PyInt_AsLong(o1), PyInt_AsLong(o2), PyInt_AsLong(o3), PyInt_AsLong(o4)); + Py_DECREF(o1); + Py_DECREF(o2); + Py_DECREF(o3); + Py_DECREF(o4); + return true; + } error: PyErr_SetString(PyExc_TypeError, - "Expected a wxColour object or a string containing a colour name or '#RRGGBB'."); + "Expected a wxColour object, a string containing a colour name or '#RRGGBB', or a 3- or 4-tuple of integers."); return false; }