From ad00674de2e307ad346bd70727d02c8c99be7250 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 14 Jan 2014 02:34:41 +0000 Subject: [PATCH] Fix virtual catcher for EndEdit. Fix ownership transfer for wxGridCellAttr.SetEditor and SetRenderer. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/grid.py | 9 ++++++++- unittests/test_grid.py | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/etg/grid.py b/etg/grid.py index 4138affb..01553b45 100644 --- a/etg/grid.py +++ b/etg/grid.py @@ -182,6 +182,10 @@ def run(): klass.find('EndEdit').ignore() pureVirtual = True + # The Python version of EndEdit has a different signature than the + # C++ version, so we need to take care of mapping between them so the + # C++ compiler still recognizes this as a match for the virtual + # method in the base class. klass.addCppMethod('PyObject*', 'EndEdit', '(int row, int col, const wxGrid* grid, const wxString& oldval)', cppSignature='bool (int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval)', pyArgsString='(row, col, grid, oldval)', @@ -223,7 +227,8 @@ def run(): // VirtualCatcherCode for wx.grid.GridCellEditor.EndEdit PyObject *result; result = sipCallMethod(0, sipMethod, "iiDN", row, col, - const_cast(grid),sipType_wxGrid,NULL); + const_cast(grid),sipType_wxGrid,NULL, + new wxString(oldval),sipType_wxString,NULL); if (result == Py_None) { sipRes = false; } @@ -259,6 +264,8 @@ def run(): c.find('GetNonDefaultAlignment.hAlign').out = True c.find('GetNonDefaultAlignment.vAlign').out = True + c.find('SetEditor.editor').transfer = True + c.find('SetRenderer.renderer').transfer = True #----------------------------------------------------------------- diff --git a/unittests/test_grid.py b/unittests/test_grid.py index 45ba189f..d79f12ca 100644 --- a/unittests/test_grid.py +++ b/unittests/test_grid.py @@ -89,8 +89,12 @@ class grid_Tests(wtc.WidgetTestCase): def GetValue(self): return "" e = MyEditor() - - + return e + + def test_grid17a(self): + e = self.test_grid17() + e.GetControl + e.SetControl def test_grid18(self):