diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index 6d241f2f14..02430ee598 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -1804,8 +1804,8 @@ public: const wxGridCellCoordsArray& GetSelectedCells() const; const wxGridCellCoordsArray& GetSelectionBlockTopLeft() const; const wxGridCellCoordsArray& GetSelectionBlockBottomRight() const; - const wxArrayInt& GetSelectedRows() const; - const wxArrayInt& GetSelectedCols() const; + const wxArrayInt GetSelectedRows() const; + const wxArrayInt GetSelectedCols() const; // This function returns the rectangle that encloses the block of cells diff --git a/wxPython/src/my_typemaps.i b/wxPython/src/my_typemaps.i index 1d04fcaf62..15ef3e573f 100644 --- a/wxPython/src/my_typemaps.i +++ b/wxPython/src/my_typemaps.i @@ -313,7 +313,7 @@ $function } -// Typemap to convert an array of ints to a list +// Typemaps to convert an array of ints to a list %typemap(python, out) wxArrayInt& { $target = PyList_New(0); size_t idx; @@ -324,6 +324,17 @@ $function } } +%typemap(python, out) wxArrayInt { + $target = PyList_New(0); + size_t idx; + for (idx = 0; idx < $source->GetCount(); idx += 1) { + PyObject* val = PyInt_FromLong($source->Item(idx)); + PyList_Append($target, val); + Py_DECREF(val); + } + delete $source; +} + //--------------------------------------------------------------------------- // Map T_OUTPUTs for floats to return ints.