From: Robin Dunn Date: Thu, 17 Jun 2004 19:23:35 +0000 (+0000) Subject: in unicode mode the return value of gridtable.GetValue must be a X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8826712ea06f78efcb652a21cc54eaa43f2e82a2?ds=inline in unicode mode the return value of gridtable.GetValue must be a string or a unicode object, as the coerce to unicode function used can only convert strings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index eca71b764a..399ad37622 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -904,7 +904,7 @@ IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue) class wxPyGridCellEditor : public wxGridCellEditor { public: %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)" - + wxPyGridCellEditor(); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -1008,7 +1008,7 @@ public: self->SetClientObject(new wxPyOORClientData(_self)); } } - + %pythonAppend wxGridCellAttr "self._setOORInfo(self)" wxGridCellAttr(wxGridCellAttr *attrDefault = NULL); @@ -1045,7 +1045,7 @@ public: DocDeclA( void, GetAlignment(int *OUTPUT, int *OUTPUT) const, "GetAlignment() -> (hAlign, vAlign)"); - + DocDeclA( void, GetSize(int *OUTPUT, int *OUTPUT) const, "GetSize() -> (num_rows, num_cols)"); @@ -1226,6 +1226,11 @@ public: PyObject* ro; ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col)); if (ro) { + if (!PyString_Check(ro) && !PyUnicode_Check(ro)) { + PyObject* old = ro; + ro = PyObject_Str(ro); + Py_DECREF(old); + } rval = Py2wxString(ro); Py_DECREF(ro); } @@ -1449,7 +1454,7 @@ bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) { bool wxGridCellCoords_typecheck(PyObject* source) { void* ptr; - + if (wxPySwigInstance_Check(source) && wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords"))) return True; @@ -1457,7 +1462,7 @@ bool wxGridCellCoords_typecheck(PyObject* source) { PyErr_Clear(); if (PySequence_Check(source) && PySequence_Length(source) == 2) return True; - + return False; } %} @@ -1563,8 +1568,8 @@ public: const wxString& name = wxPyPanelNameStr); %name(PreGrid) wxGrid(); - - + + bool Create( wxWindow *parent, wxWindowID id=-1, const wxPoint& pos = wxDefaultPosition, @@ -1572,7 +1577,7 @@ public: long style = wxWANTS_CHARS, const wxString& name = wxPyPanelNameStr ); - + enum wxGridSelectionModes { wxGridSelectCells, wxGridSelectRows, @@ -1730,7 +1735,7 @@ public: DocDeclA( void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ), "GetRowLabelAlignment() -> (horiz, vert)"); - + DocDeclA( void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ), "GetColLabelAlignment() -> (horiz, vert)"); @@ -1800,7 +1805,7 @@ public: DocDeclA( void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ), "GetDefaultCellAlignment() -> (horiz, vert)"); - + DocDeclA( void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ), "GetCellAlignment() -> (horiz, vert)");