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
This commit is contained in:
Robin Dunn
2004-06-17 19:23:35 +00:00
parent 8ad74db31e
commit 8826712ea0

View File

@@ -904,7 +904,7 @@ IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue)
class wxPyGridCellEditor : public wxGridCellEditor { class wxPyGridCellEditor : public wxGridCellEditor {
public: public:
%pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)" %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)"
wxPyGridCellEditor(); wxPyGridCellEditor();
void _setCallbackInfo(PyObject* self, PyObject* _class); void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -1008,7 +1008,7 @@ public:
self->SetClientObject(new wxPyOORClientData(_self)); self->SetClientObject(new wxPyOORClientData(_self));
} }
} }
%pythonAppend wxGridCellAttr "self._setOORInfo(self)" %pythonAppend wxGridCellAttr "self._setOORInfo(self)"
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL); wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
@@ -1045,7 +1045,7 @@ public:
DocDeclA( DocDeclA(
void, GetAlignment(int *OUTPUT, int *OUTPUT) const, void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
"GetAlignment() -> (hAlign, vAlign)"); "GetAlignment() -> (hAlign, vAlign)");
DocDeclA( DocDeclA(
void, GetSize(int *OUTPUT, int *OUTPUT) const, void, GetSize(int *OUTPUT, int *OUTPUT) const,
"GetSize() -> (num_rows, num_cols)"); "GetSize() -> (num_rows, num_cols)");
@@ -1226,6 +1226,11 @@ public:
PyObject* ro; PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col)); ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
if (ro) { if (ro) {
if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
PyObject* old = ro;
ro = PyObject_Str(ro);
Py_DECREF(old);
}
rval = Py2wxString(ro); rval = Py2wxString(ro);
Py_DECREF(ro); Py_DECREF(ro);
} }
@@ -1449,7 +1454,7 @@ bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
bool wxGridCellCoords_typecheck(PyObject* source) { bool wxGridCellCoords_typecheck(PyObject* source) {
void* ptr; void* ptr;
if (wxPySwigInstance_Check(source) && if (wxPySwigInstance_Check(source) &&
wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords"))) wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
return True; return True;
@@ -1457,7 +1462,7 @@ bool wxGridCellCoords_typecheck(PyObject* source) {
PyErr_Clear(); PyErr_Clear();
if (PySequence_Check(source) && PySequence_Length(source) == 2) if (PySequence_Check(source) && PySequence_Length(source) == 2)
return True; return True;
return False; return False;
} }
%} %}
@@ -1563,8 +1568,8 @@ public:
const wxString& name = wxPyPanelNameStr); const wxString& name = wxPyPanelNameStr);
%name(PreGrid) wxGrid(); %name(PreGrid) wxGrid();
bool Create( wxWindow *parent, bool Create( wxWindow *parent,
wxWindowID id=-1, wxWindowID id=-1,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -1572,7 +1577,7 @@ public:
long style = wxWANTS_CHARS, long style = wxWANTS_CHARS,
const wxString& name = wxPyPanelNameStr ); const wxString& name = wxPyPanelNameStr );
enum wxGridSelectionModes { enum wxGridSelectionModes {
wxGridSelectCells, wxGridSelectCells,
wxGridSelectRows, wxGridSelectRows,
@@ -1730,7 +1735,7 @@ public:
DocDeclA( DocDeclA(
void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ), void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
"GetRowLabelAlignment() -> (horiz, vert)"); "GetRowLabelAlignment() -> (horiz, vert)");
DocDeclA( DocDeclA(
void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ), void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
"GetColLabelAlignment() -> (horiz, vert)"); "GetColLabelAlignment() -> (horiz, vert)");
@@ -1800,7 +1805,7 @@ public:
DocDeclA( DocDeclA(
void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ), void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
"GetDefaultCellAlignment() -> (horiz, vert)"); "GetDefaultCellAlignment() -> (horiz, vert)");
DocDeclA( DocDeclA(
void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ), void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
"GetCellAlignment() -> (horiz, vert)"); "GetCellAlignment() -> (horiz, vert)");