diff --git a/utils/wxPython/demo/GridCustTable.py b/utils/wxPython/demo/GridCustTable.py new file mode 100644 index 0000000000..caf4ecf508 --- /dev/null +++ b/utils/wxPython/demo/GridCustTable.py @@ -0,0 +1,155 @@ +from wxPython.wx import * +from wxPython.grid import * + +import string + +#--------------------------------------------------------------------------- + +class CustomDataTable(wxPyGridTableBase): + """ + """ + + def __init__(self, log): + wxPyGridTableBase.__init__(self) + self.log = log + + self.colLabels = ['ID', 'Description', 'Severity', 'Priority', 'Platform', + 'Opened?', 'Fixed?', 'Tested?'] + + self.dataTypes = [wxGRID_VALUE_NUMBER, + wxGRID_VALUE_STRING, + wxGRID_VALUE_CHOICE + ':only in a million years!,wish list,minor,normal,major,critical', + wxGRID_VALUE_NUMBER + ':1,5', + wxGRID_VALUE_CHOICE + ':all,MSW,GTK,other', + wxGRID_VALUE_BOOL, + wxGRID_VALUE_BOOL, + wxGRID_VALUE_BOOL] + + self.data = [ + [1010, "The foo doesn't bar", "major", 1, 'MSW', 1, 1, 1], + [1011, "I've got a wicket in my wocket", "wish list", 2, 'other', 0, 0, 0], + [1012, "Rectangle() returns a triangle", "critical", 5, 'all', 0, 0, 0] + + ] + + + #-------------------------------------------------- + # required methods for the wxPyGridTableBase interface + + def GetNumberRows(self): + return len(self.data) + 1 + + def GetNumberCols(self): + return len(self.data[0]) + + def IsEmptyCell(self, row, col): + return not self.data[row][col] + + # Get/Set values in the table. The Python version of these + # methods can handle any data-type, (as long as the Editor and + # Renderer understands the type too,) not just strings as in the + # C++ version. + def GetValue(self, row, col): + try: + return self.data[row][col] + except IndexError: + return '' + + def SetValue(self, row, col, value): + try: + self.data[row][col] = value + except IndexError: + # add a new row + self.data.append([''] * self.GetNumberCols()) + self.SetValue(row, col, value) + + # tell the grid we've added a row + msg = wxGridTableMessage(self, # The table + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it + 1) # how many + + self.GetView().ProcessTableMessage(msg) + + + #-------------------------------------------------- + # optional methods + + # Called when the grid needs to display labels + def GetColLabelValue(self, col): + return self.colLabels[col] + + # Called to determine the kind of editor/renderer to use by + # default, doesn't necessarily have to be the same type used + # nativly by the editor/renderer if they know how to convert. + def GetTypeName(self, row, col): + return self.dataTypes[col] + + # Called to determine how the data can be fetched and stored by the + # editor and renderer. This allows you to enforce some type-safety + # in the grid. + def CanGetValueAs(self, row, col, typeName): + colType = string.split(self.dataTypes[col], ':')[0] + if typeName == colType: + return true + else: + return false + + def CanSetValueAs(self, row, col, typeName): + return self.CanGetValueAs(row, col, typeName) + + + + + + + +#--------------------------------------------------------------------------- + + + +class CustTableGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + + table = CustomDataTable(log) + + # The second parameter means that the grid is to take ownership of the + # table and will destroy it when done. Otherwise you would need to keep + # a reference to it and call it's Destroy method later. + self.SetTable(table, true) + + self.SetRowLabelSize(0) + self.SetMargins(0,0) + self.AutoSizeColumns(false) + + EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick) + + + + # I do this because I don't like the default behaviour of not starting the + # cell editor on double clicks, but only a second click. + def OnLeftDClick(self, evt): + if self.CanEnableCellControl(): + self.EnableCellEditControl() + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Custom Table, data driven Grid Demo", size=(640,480)) + grid = CustTableGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/utils/wxPython/demo/GridHugeTable.py b/utils/wxPython/demo/GridHugeTable.py new file mode 100644 index 0000000000..69e3aed48b --- /dev/null +++ b/utils/wxPython/demo/GridHugeTable.py @@ -0,0 +1,71 @@ +from wxPython.wx import * +from wxPython.grid import * + +#--------------------------------------------------------------------------- + +class HugeTable(wxPyGridTableBase): + + """ + This is all it takes to make a custom data table to plug into a + wxGrid. There are many more methods that can be overridden, but + the ones shown below are the required ones. This table simply + provides strings containing the row and column values. + """ + + def __init__(self, log): + wxPyGridTableBase.__init__(self) + self.log = log + + def GetNumberRows(self): + return 10000 + + def GetNumberCols(self): + return 10000 + + def IsEmptyCell(self, row, col): + return false + + def GetValue(self, row, col): + return str( (row, col) ) + + def SetValue(self, row, col, value): + self.log.write('SetValue(%d, %d, "%s") ignored.\n' % (row, col, value)) + + +#--------------------------------------------------------------------------- + + + +class HugeTableGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + + table = HugeTable(log) + + # The second parameter means that the grid is to take ownership of the + # table and will destroy it when done. Otherwise you would need to keep + # a reference to it and call it's Destroy method later. + self.SetTable(table, true) + + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Huge (virtual) Table Demo", size=(640,480)) + grid = HugeTableGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/utils/wxPython/demo/GridSimple.py b/utils/wxPython/demo/GridSimple.py index 4bedf0278d..5f23c26dc8 100644 --- a/utils/wxPython/demo/GridSimple.py +++ b/utils/wxPython/demo/GridSimple.py @@ -8,7 +8,9 @@ class SimpleGrid(wxGrid): wxGrid.__init__(self, parent, -1) self.log = log - self.CreateGrid(16, 16) + self.CreateGrid(25, 25) + + # simple cell formatting self.SetColSize(3, 200) self.SetRowSize(4, 45) self.SetCellValue(0, 0, "First cell") @@ -18,6 +20,16 @@ class SimpleGrid(wxGrid): self.SetCellTextColour(1, 1, wxRED) self.SetCellBackgroundColour(2, 2, wxCYAN) + # attribute objects let you keep a set of formatting values + # in one spot, and reuse them if needed + attr = wxGridCellAttr() + attr.SetTextColour(wxBLACK) + attr.SetBackgroundColour(wxRED) + attr.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD)) + + # you can set cell attributes for the whole row (or column) + self.SetRowAttr(5, attr) + # test all the events EVT_GRID_CELL_LEFT_CLICK(self, self.OnCellLeftClick) diff --git a/utils/wxPython/demo/GridStdEdRend.py b/utils/wxPython/demo/GridStdEdRend.py new file mode 100644 index 0000000000..31ea963fa8 --- /dev/null +++ b/utils/wxPython/demo/GridStdEdRend.py @@ -0,0 +1,179 @@ +from wxPython.wx import * +from wxPython.grid import * + +import string, random + +#--------------------------------------------------------------------------- + +class MyCustomRenderer(wxPyGridCellRenderer): + def __init__(self): + wxPyGridCellRenderer.__init__(self) + + def Draw(self, grid, attr, dc, rect, row, col, isSelected): + dc.SetBackgroundMode(wxSOLID) + dc.SetBrush(wxBrush(wxBLACK, wxSOLID)) + dc.SetPen(wxTRANSPARENT_PEN) + dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height) + + dc.SetBackgroundMode(wxTRANSPARENT) + dc.SetFont(attr.GetFont()) + + text = grid.GetCellValue(row, col) + colors = [wxRED, wxWHITE, wxCYAN] + x = rect.x + 1 + y = rect.y + 1 + for ch in text: + dc.SetTextForeground(random.choice(colors)) + dc.DrawText(ch, x, y) + w, h = dc.GetTextExtent(ch) + x = x + w + if x > rect.right - 5: + break + + + def GetBestSize(self, grid, attr, dc, row, col): + text = grid.GetCellValue(row, col) + dc.SetFont(attr.GetFont()) + w, h = dc.GetTextExtent(text) + return wxSize(w, h) + + + def Clone(self): + return MyCustomRenderer + + +#--------------------------------------------------------------------------- + +rendererDemoData = [ + ('wxGridCellStringRenderer\n(the default)', 'this is a text value', wxGridCellStringRenderer, ()), + ('wxGridCellNumberRenderer', '12345', wxGridCellNumberRenderer, ()), + ('wxGridCellFloatRenderer', '1234.5678', wxGridCellFloatRenderer, (6,2)), + ('wxGridCellBoolRenderer', '1', wxGridCellBoolRenderer, ()), + ('MyCustomRenderer', 'This is my renderer', MyCustomRenderer, ()), + ] + +editorDemoData = [ + ('wxGridCellTextEditor\n(the default)', 'Here is some more text', wxGridCellTextEditor, ()), + ('wxGridCellNumberEditor\nwith min,max', '101', wxGridCellNumberEditor, (5, 10005)), + ('wxGridCellNumberEditor\nwithout bounds', '101', wxGridCellNumberEditor, ()), + ('wxGridCellFloatEditor', '1234.5678', wxGridCellFloatEditor, ()), + ('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()), + ('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four', + 'kick', 'Microsoft', 'out the', + 'door'], false)), + ] + + +comboDemoData = [ + ('wxGridCellNumberRenderer\nwxGridCellNumberEditor', '20792', wxGridCellNumberRenderer, wxGridCellNumberEditor), + ('wxGridCellBoolRenderer\nwxGridCellBoolEditor', '1', wxGridCellBoolRenderer, wxGridCellBoolEditor), + ] + + +class EditorsAndRenderersGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + self.log = log + + self.CreateGrid(25, 8) + renCol = 1 + edCol = 4 + + + self.SetCellValue(0, renCol, '''\ +Cell Renderers are used to draw +the contents of the cell when they +need to be refreshed. Different +types of Renderers can be plugged in +to different cells in the grid, it can +even be automatically determined based +on the type of data in the cell. +''') + + self.SetCellValue(0, edCol, '''\ +Cell Editors are used when the +value of the cell is edited by +the user. An editor class is +wrapped around a an object +derived from wxControl and it +implements some methods required +to integrate with the grid. +''') + + self.SetCellValue(16, renCol, '''\ +Here are some combinations of Editors and +Renderers used together. +''') + + row = 2 + for label, value, renderClass, args in rendererDemoData: + renderer = apply(renderClass, args) + self.SetCellValue(row, renCol, label) + self.SetCellValue(row, renCol+1, value) + self.SetCellRenderer(row, renCol+1, renderer) + row = row + 2 + + + row = 2 + for label, value, editorClass, args in editorDemoData: + editor = apply(editorClass, args) + self.SetCellValue(row, edCol, label) + self.SetCellValue(row, edCol+1, value) + self.SetCellEditor(row, edCol+1, editor) + row = row + 2 + + + row = 18 + for label, value, renClass, edClass in comboDemoData: + self.SetCellValue(row, renCol, label) + self.SetCellValue(row, renCol+1, value) + editor = apply(edClass, ()) #args) + renderer = apply(renClass, ()) #args) + self.SetCellEditor(row, renCol+1, editor) + self.SetCellRenderer(row, renCol+1, renderer) + row = row + 2 + + + font = self.GetFont() + font.SetWeight(wxBOLD) + attr = wxGridCellAttr() + attr.SetFont(font) + attr.SetBackgroundColour(wxLIGHT_GREY) + attr.SetReadOnly(true) + attr.SetAlignment(wxRIGHT, -1) + self.SetColAttr(renCol, attr) + self.SetColAttr(edCol, attr) + + self.AutoSizeColumns(true) + self.AutoSizeRows(true) + + EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick) + + + # I do this because I don't like the default behaviour of not starting the + # cell editor on double clicks, but only a second click. + def OnLeftDClick(self, evt): + if self.CanEnableCellControl(): + self.EnableCellEditControl() + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Editors and Renderers Demo", size=(640,480)) + grid = EditorsAndRenderersGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/utils/wxPython/demo/wxGrid.py b/utils/wxPython/demo/wxGrid.py index 6d96358866..f4baf69d71 100644 --- a/utils/wxPython/demo/wxGrid.py +++ b/utils/wxPython/demo/wxGrid.py @@ -5,9 +5,9 @@ from wxPython.wx import * buttonDefs = { 814 : ('GridSimple', 'Simple wxGrid, catching all events'), - 815 : ('GridCustEdRend', 'wxGrid showing custom Editors and Renderers'), - 816 : ('GridCustTable', 'wxGrid using a custom Table'), - 817 : ('GridHugeTable', 'A wxGrid with a HUGE table (100M cells!)'), + 815 : ('GridStdEdRend', 'wxGrid showing Editors and Renderers'), + 818 : ('GridHugeTable', 'A wxGrid with a HUGE table (100 MILLION cells!)'), + 817 : ('GridCustTable', 'wxGrid using a custom Table, with non-string data'), } diff --git a/utils/wxPython/demo/wxNotebook.py b/utils/wxPython/demo/wxNotebook.py index fb18f41b9a..00d2f5b9d0 100644 --- a/utils/wxPython/demo/wxNotebook.py +++ b/utils/wxPython/demo/wxNotebook.py @@ -2,7 +2,7 @@ from wxPython.wx import * import ColorPanel -import wxGrid +import GridSimple import wxListCtrl import wxScrolledWindow @@ -31,7 +31,7 @@ class TestNB(wxNotebook): win = ColorPanel.ColoredPanel(self, wxGREEN) self.AddPage(win, "Green") - win = wxGrid.TestGrid(self, log) + win = GridSimple.SimpleGrid(self, log) self.AddPage(win, "Grid") win = wxListCtrl.TestListCtrlPanel(self, log) diff --git a/utils/wxPython/distrib/build.py b/utils/wxPython/distrib/build.py index 3cfe2aae2c..68f83c0722 100755 --- a/utils/wxPython/distrib/build.py +++ b/utils/wxPython/distrib/build.py @@ -275,7 +275,7 @@ class BuildConfig: self.TARGET = '$(MODULE)module$(SO)' self.OBJEXT = '.o' self.HELPERLIB = 'wxPyHelpers' - self.HELPERLIBDIR = '/usr/local/lib' + self.HELPERLIBDIR = '$(EXECPREFIX)/lib' self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\ '`$(WXCONFIG) --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\ '-I$(WXPSRCDIR)' diff --git a/utils/wxPython/lib/grids.py b/utils/wxPython/lib/grids.py index 0632acb750..8387190002 100644 --- a/utils/wxPython/lib/grids.py +++ b/utils/wxPython/lib/grids.py @@ -13,10 +13,24 @@ """ In this module you will find wxGridSizer and wxFlexGridSizer. -wxGridSizer arrainges its items in a grid in which all the widths and -heights are the same. wxFlexGridSizer allows different widths and -heights, and you can also specify rows and/or columns that are -growable. See the demo for a couple examples for how to use them. + +wxGridSizer: Sizes and positions items such that all rows are the same +height and all columns are the same width. You can specify a gap in +pixels to be used between the rows and/or the columns. When you +create the sizer you specify the number of rows or the number of +columns and then as you add items it figures out the other dimension +automatically. Like other sizers, items can be set to fill their +available space, or to be aligned on a side, in a corner, or in the +center of the space. When the sizer is resized, all the items are +resized the same amount so all rows and all columns remain the same +size. + +wxFlexGridSizer: Derives from wxGridSizer and adds the ability for +particular rows and/or columns to be marked as growable. This means +that when the sizer changes size, the growable rows and colums are the +ones that stretch. The others remain at their initial size. + +See the demo for a couple examples for how to use them. """ diff --git a/utils/wxPython/src/clip_dnd.i b/utils/wxPython/src/clip_dnd.i index 05ef3f5081..a9ff1f6f94 100644 --- a/utils/wxPython/src/clip_dnd.i +++ b/utils/wxPython/src/clip_dnd.i @@ -183,8 +183,8 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) { class wxPyDataObjectSimple : public wxDataObjectSimple { public: wxPyDataObjectSimple(const wxDataFormat& format = wxPyFormatInvalid); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDataObjectSimple)" }; //---------------------------------------------------------------------- @@ -235,8 +235,8 @@ IMP_PYCALLBACK__STRING(wxPyTextDataObject, wxTextDataObject, SetText); class wxPyTextDataObject : public wxTextDataObject { public: wxPyTextDataObject(const wxString& text = wxEmptyString); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyTextDataObject)" }; //---------------------------------------------------------------------- @@ -295,8 +295,8 @@ void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { class wxPyBitmapDataObject : public wxBitmapDataObject { public: wxPyBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyBitmapDataObject)" }; @@ -441,8 +441,8 @@ public: const wxIcon &go = wxNullIcon); #endif - void _setSelf(PyObject* self, int incref); - %pragma(python) addtomethod = "__init__:self._setSelf(self, 0)" + void _setSelf(PyObject* self, PyObject* _class, int incref); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxDropSource, 0)" ~wxPyDropSource(); void SetData(wxDataObject& data); @@ -496,8 +496,8 @@ class wxPyDropTarget : public wxDropTarget { public: wxPyDropTarget(wxDataObject *dataObject = NULL); %pragma(python) addtomethod = "__init__:if _args:_args[0].thisown = 0" - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDropTarget)" ~wxPyDropTarget(); @@ -550,8 +550,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop); %name(wxTextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget { public: wxPyTextDropTarget(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxTextDropTarget)" //bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); @@ -609,8 +609,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyFileDropTarget, wxFileDropTarget, OnDrop); { public: wxPyFileDropTarget(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFileDropTarget)" // bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) = 0; wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); diff --git a/utils/wxPython/src/grid.i b/utils/wxPython/src/grid.i index 6dca5509f8..ee9cc3af9b 100644 --- a/utils/wxPython/src/grid.i +++ b/utils/wxPython/src/grid.i @@ -58,7 +58,7 @@ } \ } \ else \ - return PCLASS::CBNAME(a, b); \ + rval = PCLASS::CBNAME(a, b); \ wxPySaveThread(doSave); \ return rval; \ } \ @@ -317,7 +317,7 @@ wxPySaveThread(doSave); \ return rval; \ } \ - wxString base_##CBNAME(int a) { \ + wxString base_##CBNAME(int a) { \ return PCLASS::CBNAME(a); \ } @@ -545,8 +545,8 @@ IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters) class wxPyGridCellRenderer : public wxGridCellRenderer { public: wxPyGridCellRenderer(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellRenderer)" void base_SetParameters(const wxString& params); }; @@ -596,8 +596,8 @@ class wxGridCellEditor { public: bool IsCreated(); - wxControl* GetControl() { return m_control; } - void SetControl(wxControl* control) { m_control = control; } + wxControl* GetControl(); + void SetControl(wxControl* control); void SetParameters(const wxString& params); @@ -740,8 +740,8 @@ IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy); class wxPyGridCellEditor : public wxGridCellEditor { public: wxPyGridCellEditor(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellEditor)" void base_SetSize(const wxRect& rect); void base_Show(bool show, wxGridCellAttr *attr = NULL); @@ -766,7 +766,7 @@ public: class wxGridCellNumberEditor : public wxGridCellTextEditor { public: - wxGridCellNumberEditor(); + wxGridCellNumberEditor(int min = -1, int max = -1); }; @@ -787,7 +787,9 @@ public: class wxGridCellChoiceEditor : public wxGridCellEditor { public: - wxGridCellChoiceEditor(); + wxGridCellChoiceEditor(int LCOUNT = 0, + const wxString* choices = NULL, + bool allowOthers = FALSE); }; @@ -870,8 +872,8 @@ class wxPyGridCellAttrProvider : public wxGridCellAttrProvider { public: wxPyGridCellAttrProvider(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellAttrProvider)" wxGridCellAttr *base_GetAttr(int row, int col); void base_SetAttr(wxGridCellAttr *attr, int row, int col); @@ -889,7 +891,7 @@ class wxGridTableBase { public: // wxGridTableBase(); This is an ABC - ~wxGridTableBase(); + //~wxGridTableBase(); void SetAttrProvider(wxGridCellAttrProvider *attrProvider); wxGridCellAttrProvider *GetAttrProvider() const; @@ -956,18 +958,17 @@ public: PYCALLBACK_INT__pure(GetNumberRows); PYCALLBACK_INT__pure(GetNumberCols); PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell); - PYCALLBACK_STRING_INTINT_pure(GetValue); - PYCALLBACK__INTINTSTRING_pure(SetValue); - + //PYCALLBACK_STRING_INTINT_pure(GetValue); + //PYCALLBACK__INTINTSTRING_pure(SetValue); PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName); PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs); PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs); - PYCALLBACK_LONG_INTINT(wxGridTableBase, GetValueAsLong); - PYCALLBACK_DOUBLE_INTINT(wxGridTableBase, GetValueAsDouble); - PYCALLBACK_BOOL_INTINT(wxGridTableBase, GetValueAsBool); - PYCALLBACK__INTINTLONG(wxGridTableBase, SetValueAsLong); - PYCALLBACK__INTINTDOUBLE(wxGridTableBase, SetValueAsDouble); - PYCALLBACK__INTINTBOOL(wxGridTableBase, SetValueAsBool); + //PYCALLBACK_LONG_INTINT(wxGridTableBase, GetValueAsLong); + //PYCALLBACK_DOUBLE_INTINT(wxGridTableBase, GetValueAsDouble); + //PYCALLBACK_BOOL_INTINT(wxGridTableBase, GetValueAsBool); + //PYCALLBACK__INTINTLONG(wxGridTableBase, SetValueAsLong); + //PYCALLBACK__INTINTDOUBLE(wxGridTableBase, SetValueAsDouble); + //PYCALLBACK__INTINTBOOL(wxGridTableBase, SetValueAsBool); PYCALLBACK__(wxGridTableBase, Clear); PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows); PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows); @@ -988,12 +989,104 @@ public: PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr); + + wxString GetValue(int row, int col) { + bool doSave = wxPyRestoreThread(); + wxString rval; + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col)); + if (ro) { + rval = PyString_AsString(PyObject_Str(ro)); + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + void SetValue(int row, int col, const wxString& val) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) + m_myInst.callCallback(Py_BuildValue("(iis)",row,col,val.c_str())); + wxPySaveThread(doSave); + } + + + // Map the Get/Set methods for the standard non-string types to + // the GetValue and SetValue python methods. + long GetValueAsLong( int row, int col ) { + long rval = 0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Int(ro); + if (num) { + rval = PyInt_AsLong(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + double GetValueAsDouble( int row, int col ) { + double rval = 0.0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Float(ro); + if (num) { + rval = PyFloat_AsDouble(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + bool GetValueAsBool( int row, int col ) { + return (bool)GetValueAsLong(row, col); + } + + void SetValueAsLong( int row, int col, long value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iii)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsDouble( int row, int col, double value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iid)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsBool( int row, int col, bool value ) { + SetValueAsLong( row, col, (long)value ); + } + + + //TODO: void* GetValueAsCustom( int row, int col, const wxString& typeName ); //TODO: void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); // - // It would be nice to SetValue/GetValue in the Python code to beable to work with - // any python objects and auto-convert to the various types for the C++ code. - // Figure it out. + // It would be nice to SetValue/GetValue in the Python code to be able to + // work with any python objects and auto-convert to the various types for + // the C++ code. Figure it out. PYPRIVATE; }; @@ -1005,19 +1098,20 @@ class wxPyGridTableBase : public wxGridTableBase { public: wxPyGridTableBase(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridTableBase)" + %addmethods { void Destroy() { delete self; } } wxString base_GetTypeName( int row, int col ); bool base_CanGetValueAs( int row, int col, const wxString& typeName ); bool base_CanSetValueAs( int row, int col, const wxString& typeName ); - long base_GetValueAsLong( int row, int col ); - double base_GetValueAsDouble( int row, int col ); - bool base_GetValueAsBool( int row, int col ); - void base_SetValueAsLong( int row, int col, long value ); - void base_SetValueAsDouble( int row, int col, double value ); - void base_SetValueAsBool( int row, int col, bool value ); + //long base_GetValueAsLong( int row, int col ); + //double base_GetValueAsDouble( int row, int col ); + //bool base_GetValueAsBool( int row, int col ); + //void base_SetValueAsLong( int row, int col, long value ); + //void base_SetValueAsDouble( int row, int col, double value ); + //void base_SetValueAsBool( int row, int col, bool value ); void base_Clear(); bool base_InsertRows( size_t pos = 0, size_t numRows = 1 ); bool base_AppendRows( size_t numRows = 1 ); @@ -1071,6 +1165,7 @@ public: wxGridTableMessage( wxGridTableBase *table, int id, int comInt1 = -1, int comInt2 = -1 ); + ~wxGridTableMessage(); void SetTableObject( wxGridTableBase *table ); wxGridTableBase * GetTableObject() const; diff --git a/utils/wxPython/src/helpers.cpp b/utils/wxPython/src/helpers.cpp index b8fcb13de2..14ce153771 100644 --- a/utils/wxPython/src/helpers.cpp +++ b/utils/wxPython/src/helpers.cpp @@ -111,7 +111,7 @@ void WXDLLEXPORT wxEntryCleanup(); // This is where we pick up the first part of the wxEntry functionality... -// The rest is in __wxStart and AfterMainLoop. This function is called when +// The rest is in __wxStart and __wxCleanup. This function is called when // wxcmodule is imported. (Before there is a wxApp object.) void __wxPreStart() { @@ -361,6 +361,7 @@ void wxPyCallback::EventThunker(wxEvent& event) { //---------------------------------------------------------------------- wxPyCallbackHelper::wxPyCallbackHelper() { + m_class = NULL; m_self = NULL; m_lastFound = NULL; m_incRef = FALSE; @@ -369,33 +370,52 @@ wxPyCallbackHelper::wxPyCallbackHelper() { wxPyCallbackHelper::~wxPyCallbackHelper() { bool doSave = wxPyRestoreThread(); - if (m_incRef) + if (m_incRef) { Py_XDECREF(m_self); + Py_XDECREF(m_class); + } wxPySaveThread(doSave); } wxPyCallbackHelper::wxPyCallbackHelper(const wxPyCallbackHelper& other) { m_lastFound = NULL; m_self = other.m_self; - if (m_self) + m_class = other.m_class; + if (m_self) { Py_INCREF(m_self); + Py_INCREF(m_class); + } } -void wxPyCallbackHelper::setSelf(PyObject* self, int incref) { +void wxPyCallbackHelper::setSelf(PyObject* self, PyObject* _class, int incref) { m_self = self; + m_class = _class; m_incRef = incref; - if (incref) + if (incref) { Py_INCREF(m_self); + Py_INCREF(m_class); + } } +// If the object (m_self) has an attibute of the given name, and if that +// attribute is a method, and if that method's class is not from a base class, +// then we'll save a pointer to the method so callCallback can call it. bool wxPyCallbackHelper::findCallback(const wxString& name) const { wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const self->m_lastFound = NULL; - if (m_self && PyObject_HasAttrString(m_self, (char*)name.c_str())) - self->m_lastFound = PyObject_GetAttrString(m_self, (char*)name.c_str()); + if (m_self && PyObject_HasAttrString(m_self, (char*)name.c_str())) { + PyObject* method; + method = PyObject_GetAttrString(m_self, (char*)name.c_str()); + if (PyMethod_Check(method) && + ((PyMethod_GET_CLASS(method) == m_class) || + PyClass_IsSubclass(PyMethod_GET_CLASS(method), m_class))) { + + self->m_lastFound = method; + } + } return m_lastFound != NULL; } diff --git a/utils/wxPython/src/helpers.h b/utils/wxPython/src/helpers.h index 72a8a483b6..45e6d1aeaf 100644 --- a/utils/wxPython/src/helpers.h +++ b/utils/wxPython/src/helpers.h @@ -172,7 +172,7 @@ public: wxPyCallbackHelper(const wxPyCallbackHelper& other); - void setSelf(PyObject* self, int incref=TRUE); + void setSelf(PyObject* self, PyObject* _class, int incref=TRUE); bool findCallback(const wxString& name) const; int callCallback(PyObject* argTuple) const; @@ -180,6 +180,7 @@ public: private: PyObject* m_self; + PyObject* m_class; PyObject* m_lastFound; int m_incRef; }; @@ -232,10 +233,10 @@ public: // return type, if any, as well as any parameter types. //--------------------------------------------------------------------------- -#define PYPRIVATE \ - void _setSelf(PyObject* self, int incref=1) { \ - m_myInst.setSelf(self, incref); \ - } \ +#define PYPRIVATE \ + void _setSelf(PyObject* self, PyObject* _class, int incref=1) { \ + m_myInst.setSelf(self, _class, incref); \ + } \ private: wxPyCallbackHelper m_myInst; //--------------------------------------------------------------------------- diff --git a/utils/wxPython/src/misc2.i b/utils/wxPython/src/misc2.i index cc61878322..3759f25d56 100644 --- a/utils/wxPython/src/misc2.i +++ b/utils/wxPython/src/misc2.i @@ -313,8 +313,8 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc public: wxPyFontEnumerator(); ~wxPyFontEnumerator(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFontEnumerator)" bool EnumerateFacenames( wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all diff --git a/utils/wxPython/src/msw/clip_dnd.cpp b/utils/wxPython/src/msw/clip_dnd.cpp index d0cb53ba1a..33cac42728 100644 --- a/utils/wxPython/src/msw/clip_dnd.cpp +++ b/utils/wxPython/src/msw/clip_dnd.cpp @@ -1032,17 +1032,19 @@ static PyObject *_wrap_new_wxPyDataObjectSimple(PyObject *self, PyObject *args, return _resultobj; } -#define wxPyDataObjectSimple__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDataObjectSimple__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDataObjectSimple__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDataObjectSimple * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDataObjectSimple__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDataObjectSimple__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1054,9 +1056,12 @@ static PyObject *_wrap_wxPyDataObjectSimple__setSelf(PyObject *self, PyObject *a { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDataObjectSimple__setSelf(_arg0,_arg1); + wxPyDataObjectSimple__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1351,17 +1356,19 @@ static PyObject *_wrap_new_wxPyTextDataObject(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxPyTextDataObject__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyTextDataObject__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyTextDataObject__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyTextDataObject * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyTextDataObject__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyTextDataObject__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1373,9 +1380,12 @@ static PyObject *_wrap_wxPyTextDataObject__setSelf(PyObject *self, PyObject *arg { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyTextDataObject__setSelf(_arg0,_arg1); + wxPyTextDataObject__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1556,17 +1566,19 @@ static PyObject *_wrap_new_wxPyBitmapDataObject(PyObject *self, PyObject *args, return _resultobj; } -#define wxPyBitmapDataObject__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyBitmapDataObject__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyBitmapDataObject__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyBitmapDataObject * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyBitmapDataObject__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyBitmapDataObject__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1578,9 +1590,12 @@ static PyObject *_wrap_wxPyBitmapDataObject__setSelf(PyObject *self, PyObject *a { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyBitmapDataObject__setSelf(_arg0,_arg1); + wxPyBitmapDataObject__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2238,18 +2253,20 @@ static PyObject *_wrap_new_wxDropSource(PyObject *self, PyObject *args, PyObject return _resultobj; } -#define wxDropSource__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) +#define wxDropSource__setSelf(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->_setSelf(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_wxDropSource__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDropSource * _arg0; PyObject * _arg1; - int _arg2; + PyObject * _arg2; + int _arg3; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self","incref", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class","incref", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxDropSource__setSelf",_kwnames,&_argo0,&_obj1,&_arg2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOi:wxDropSource__setSelf",_kwnames,&_argo0,&_obj1,&_obj2,&_arg3)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2261,9 +2278,12 @@ static PyObject *_wrap_wxDropSource__setSelf(PyObject *self, PyObject *args, PyO { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxDropSource__setSelf(_arg0,_arg1,_arg2); + wxDropSource__setSelf(_arg0,_arg1,_arg2,_arg3); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2503,17 +2523,19 @@ static PyObject *_wrap_new_wxPyDropTarget(PyObject *self, PyObject *args, PyObje return _resultobj; } -#define wxPyDropTarget__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDropTarget__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDropTarget__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDropTarget * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDropTarget__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDropTarget__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2525,9 +2547,12 @@ static PyObject *_wrap_wxPyDropTarget__setSelf(PyObject *self, PyObject *args, P { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDropTarget__setSelf(_arg0,_arg1); + wxPyDropTarget__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2816,17 +2841,19 @@ static PyObject *_wrap_new_wxTextDropTarget(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxTextDropTarget__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxTextDropTarget__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxTextDropTarget__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyTextDropTarget * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTextDropTarget__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTextDropTarget__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2838,9 +2865,12 @@ static PyObject *_wrap_wxTextDropTarget__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxTextDropTarget__setSelf(_arg0,_arg1); + wxTextDropTarget__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3035,17 +3065,19 @@ static PyObject *_wrap_new_wxFileDropTarget(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxFileDropTarget__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxFileDropTarget__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxFileDropTarget__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyFileDropTarget * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxFileDropTarget__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxFileDropTarget__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3057,9 +3089,12 @@ static PyObject *_wrap_wxFileDropTarget__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxFileDropTarget__setSelf(_arg0,_arg1); + wxFileDropTarget__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); diff --git a/utils/wxPython/src/msw/clip_dnd.py b/utils/wxPython/src/msw/clip_dnd.py index 471aecf292..3e9416a13d 100644 --- a/utils/wxPython/src/msw/clip_dnd.py +++ b/utils/wxPython/src/msw/clip_dnd.py @@ -109,7 +109,7 @@ class wxPyDataObjectSimple(wxPyDataObjectSimplePtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxPyDataObjectSimple,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyDataObjectSimple) @@ -168,7 +168,7 @@ class wxPyTextDataObject(wxPyTextDataObjectPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxPyTextDataObject,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyTextDataObject) @@ -207,7 +207,7 @@ class wxPyBitmapDataObject(wxPyBitmapDataObjectPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxPyBitmapDataObject,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyBitmapDataObject) @@ -333,7 +333,7 @@ class wxDropSource(wxDropSourcePtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxDropSource,_args,_kwargs) self.thisown = 1 - self._setSelf(self, 0) + self._setSelf(self, wxDropSource, 0) @@ -391,7 +391,7 @@ class wxPyDropTarget(wxPyDropTargetPtr): self.this = apply(clip_dndc.new_wxPyDropTarget,_args,_kwargs) self.thisown = 1 if _args:_args[0].thisown = 0 - self._setSelf(self) + self._setSelf(self, wxPyDropTarget) @@ -424,7 +424,7 @@ class wxTextDropTarget(wxTextDropTargetPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxTextDropTarget,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxTextDropTarget) @@ -457,7 +457,7 @@ class wxFileDropTarget(wxFileDropTargetPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxFileDropTarget,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxFileDropTarget) diff --git a/utils/wxPython/src/msw/grid.cpp b/utils/wxPython/src/msw/grid.cpp index 5c0f0e7185..f56db9d8e7 100644 --- a/utils/wxPython/src/msw/grid.cpp +++ b/utils/wxPython/src/msw/grid.cpp @@ -120,7 +120,7 @@ static char* wxStringErrorMsg = "string type is required for parameter"; } \ } \ else \ - return PCLASS::CBNAME(a, b); \ + rval = PCLASS::CBNAME(a, b); \ wxPySaveThread(doSave); \ return rval; \ } \ @@ -379,7 +379,7 @@ static char* wxStringErrorMsg = "string type is required for parameter"; wxPySaveThread(doSave); \ return rval; \ } \ - wxString base_##CBNAME(int a) { \ + wxString base_##CBNAME(int a) { \ return PCLASS::CBNAME(a); \ } @@ -686,18 +686,17 @@ public: PYCALLBACK_INT__pure(GetNumberRows); PYCALLBACK_INT__pure(GetNumberCols); PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell); - PYCALLBACK_STRING_INTINT_pure(GetValue); - PYCALLBACK__INTINTSTRING_pure(SetValue); - + //PYCALLBACK_STRING_INTINT_pure(GetValue); + //PYCALLBACK__INTINTSTRING_pure(SetValue); PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName); PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs); PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs); - PYCALLBACK_LONG_INTINT(wxGridTableBase, GetValueAsLong); - PYCALLBACK_DOUBLE_INTINT(wxGridTableBase, GetValueAsDouble); - PYCALLBACK_BOOL_INTINT(wxGridTableBase, GetValueAsBool); - PYCALLBACK__INTINTLONG(wxGridTableBase, SetValueAsLong); - PYCALLBACK__INTINTDOUBLE(wxGridTableBase, SetValueAsDouble); - PYCALLBACK__INTINTBOOL(wxGridTableBase, SetValueAsBool); + //PYCALLBACK_LONG_INTINT(wxGridTableBase, GetValueAsLong); + //PYCALLBACK_DOUBLE_INTINT(wxGridTableBase, GetValueAsDouble); + //PYCALLBACK_BOOL_INTINT(wxGridTableBase, GetValueAsBool); + //PYCALLBACK__INTINTLONG(wxGridTableBase, SetValueAsLong); + //PYCALLBACK__INTINTDOUBLE(wxGridTableBase, SetValueAsDouble); + //PYCALLBACK__INTINTBOOL(wxGridTableBase, SetValueAsBool); PYCALLBACK__(wxGridTableBase, Clear); PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows); PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows); @@ -718,12 +717,104 @@ public: PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr); + + wxString GetValue(int row, int col) { + bool doSave = wxPyRestoreThread(); + wxString rval; + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col)); + if (ro) { + rval = PyString_AsString(PyObject_Str(ro)); + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + void SetValue(int row, int col, const wxString& val) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) + m_myInst.callCallback(Py_BuildValue("(iis)",row,col,val.c_str())); + wxPySaveThread(doSave); + } + + + // Map the Get/Set methods for the standard non-string types to + // the GetValue and SetValue python methods. + long GetValueAsLong( int row, int col ) { + long rval = 0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Int(ro); + if (num) { + rval = PyInt_AsLong(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + double GetValueAsDouble( int row, int col ) { + double rval = 0.0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Float(ro); + if (num) { + rval = PyFloat_AsDouble(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + bool GetValueAsBool( int row, int col ) { + return (bool)GetValueAsLong(row, col); + } + + void SetValueAsLong( int row, int col, long value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iii)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsDouble( int row, int col, double value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iid)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsBool( int row, int col, bool value ) { + SetValueAsLong( row, col, (long)value ); + } + + + //TODO: void* GetValueAsCustom( int row, int col, const wxString& typeName ); //TODO: void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); // - // It would be nice to SetValue/GetValue in the Python code to beable to work with - // any python objects and auto-convert to the various types for the C++ code. - // Figure it out. + // It would be nice to SetValue/GetValue in the Python code to be able to + // work with any python objects and auto-convert to the various types for + // the C++ code. Figure it out. PYPRIVATE; }; @@ -1017,17 +1108,19 @@ static PyObject *_wrap_new_wxPyGridCellRenderer(PyObject *self, PyObject *args, return _resultobj; } -#define wxPyGridCellRenderer__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyGridCellRenderer__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyGridCellRenderer__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyGridCellRenderer * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyGridCellRenderer__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyGridCellRenderer__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1039,9 +1132,12 @@ static PyObject *_wrap_wxPyGridCellRenderer__setSelf(PyObject *self, PyObject *a { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyGridCellRenderer__setSelf(_arg0,_arg1); + wxPyGridCellRenderer__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1946,17 +2042,19 @@ static PyObject *_wrap_new_wxPyGridCellEditor(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxPyGridCellEditor__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyGridCellEditor__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyGridCellEditor__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyGridCellEditor * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyGridCellEditor__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyGridCellEditor__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1968,9 +2066,12 @@ static PyObject *_wrap_wxPyGridCellEditor__setSelf(PyObject *self, PyObject *arg { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyGridCellEditor__setSelf(_arg0,_arg1); + wxPyGridCellEditor__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2311,19 +2412,21 @@ static void *SwigwxGridCellNumberEditorTowxGridCellEditor(void *ptr) { return (void *) dest; } -#define new_wxGridCellNumberEditor() (new wxGridCellNumberEditor()) +#define new_wxGridCellNumberEditor(_swigarg0,_swigarg1) (new wxGridCellNumberEditor(_swigarg0,_swigarg1)) static PyObject *_wrap_new_wxGridCellNumberEditor(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxGridCellNumberEditor * _result; - char *_kwnames[] = { NULL }; + int _arg0 = (int ) -1; + int _arg1 = (int ) -1; + char *_kwnames[] = { "min","max", NULL }; char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxGridCellNumberEditor",_kwnames)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|ii:new_wxGridCellNumberEditor",_kwnames,&_arg0,&_arg1)) return NULL; { wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCellNumberEditor *)new_wxGridCellNumberEditor(); + _result = (wxGridCellNumberEditor *)new_wxGridCellNumberEditor(_arg0,_arg1); wxPy_END_ALLOW_THREADS; } if (_result) { @@ -2418,19 +2521,40 @@ static void *SwigwxGridCellChoiceEditorTowxGridCellEditor(void *ptr) { return (void *) dest; } -#define new_wxGridCellChoiceEditor() (new wxGridCellChoiceEditor()) +#define new_wxGridCellChoiceEditor(_swigarg0,_swigarg1,_swigarg2) (new wxGridCellChoiceEditor(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_new_wxGridCellChoiceEditor(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxGridCellChoiceEditor * _result; - char *_kwnames[] = { NULL }; + int _arg0 = (int ) 0; + wxString * _arg1 = (wxString *) NULL; + bool _arg2 = (bool ) FALSE; + PyObject * _obj1 = 0; + int tempbool2 = (int) FALSE; + char *_kwnames[] = { "choices","allowOthers", NULL }; char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxGridCellChoiceEditor",_kwnames)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|Oi:new_wxGridCellChoiceEditor",_kwnames,&_obj1,&tempbool2)) return NULL; + if (_obj1) +{ + _arg1 = wxString_LIST_helper(_obj1); + if (_arg1 == NULL) { + return NULL; + } +} + _arg2 = (bool ) tempbool2; +{ + if (_obj1) { + _arg0 = PyList_Size(_obj1); + } + else { + _arg0 = 0; + } +} { wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCellChoiceEditor *)new_wxGridCellChoiceEditor(); + _result = (wxGridCellChoiceEditor *)new_wxGridCellChoiceEditor(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } if (_result) { @@ -2440,6 +2564,9 @@ static PyObject *_wrap_new_wxGridCellChoiceEditor(PyObject *self, PyObject *args Py_INCREF(Py_None); _resultobj = Py_None; } +{ + delete [] _arg1; +} return _resultobj; } @@ -3526,17 +3653,19 @@ static PyObject *_wrap_new_wxPyGridCellAttrProvider(PyObject *self, PyObject *ar return _resultobj; } -#define wxPyGridCellAttrProvider__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyGridCellAttrProvider__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyGridCellAttrProvider__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyGridCellAttrProvider * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyGridCellAttrProvider__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyGridCellAttrProvider__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3548,9 +3677,12 @@ static PyObject *_wrap_wxPyGridCellAttrProvider__setSelf(PyObject *self, PyObjec { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyGridCellAttrProvider__setSelf(_arg0,_arg1); + wxPyGridCellAttrProvider__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3706,33 +3838,6 @@ static PyObject *_wrap_wxPyGridCellAttrProvider_base_SetColAttr(PyObject *self, return _resultobj; } -#define delete_wxGridTableBase(_swigobj) (delete _swigobj) -static PyObject *_wrap_delete_wxGridTableBase(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridTableBase * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxGridTableBase",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxGridTableBase. Expected _wxGridTableBase_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - delete_wxGridTableBase(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - #define wxGridTableBase_SetAttrProvider(_swigobj,_swigarg0) (_swigobj->SetAttrProvider(_swigarg0)) static PyObject *_wrap_wxGridTableBase_SetAttrProvider(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -4942,17 +5047,19 @@ static PyObject *_wrap_new_wxPyGridTableBase(PyObject *self, PyObject *args, PyO return _resultobj; } -#define wxPyGridTableBase__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyGridTableBase__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyGridTableBase__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyGridTableBase * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyGridTableBase__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyGridTableBase__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -4964,9 +5071,39 @@ static PyObject *_wrap_wxPyGridTableBase__setSelf(PyObject *self, PyObject *args { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyGridTableBase__setSelf(_arg0,_arg1); + wxPyGridTableBase__setSelf(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static void wxPyGridTableBase_Destroy(wxPyGridTableBase *self) { delete self; } +static PyObject *_wrap_wxPyGridTableBase_Destroy(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyGridTableBase * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxPyGridTableBase_Destroy",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_Destroy. Expected _wxPyGridTableBase_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxPyGridTableBase_Destroy(_arg0); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -5092,185 +5229,6 @@ static PyObject *_wrap_wxPyGridTableBase_base_CanSetValueAs(PyObject *self, PyOb return _resultobj; } -#define wxPyGridTableBase_base_GetValueAsLong(_swigobj,_swigarg0,_swigarg1) (_swigobj->base_GetValueAsLong(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxPyGridTableBase_base_GetValueAsLong(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - long _result; - wxPyGridTableBase * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxPyGridTableBase_base_GetValueAsLong",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_base_GetValueAsLong. Expected _wxPyGridTableBase_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxPyGridTableBase_base_GetValueAsLong(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); - return _resultobj; -} - -#define wxPyGridTableBase_base_GetValueAsDouble(_swigobj,_swigarg0,_swigarg1) (_swigobj->base_GetValueAsDouble(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxPyGridTableBase_base_GetValueAsDouble(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - double _result; - wxPyGridTableBase * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxPyGridTableBase_base_GetValueAsDouble",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_base_GetValueAsDouble. Expected _wxPyGridTableBase_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (double )wxPyGridTableBase_base_GetValueAsDouble(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("d",_result); - return _resultobj; -} - -#define wxPyGridTableBase_base_GetValueAsBool(_swigobj,_swigarg0,_swigarg1) (_swigobj->base_GetValueAsBool(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxPyGridTableBase_base_GetValueAsBool(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxPyGridTableBase * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxPyGridTableBase_base_GetValueAsBool",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_base_GetValueAsBool. Expected _wxPyGridTableBase_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxPyGridTableBase_base_GetValueAsBool(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxPyGridTableBase_base_SetValueAsLong(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->base_SetValueAsLong(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxPyGridTableBase_base_SetValueAsLong(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxPyGridTableBase * _arg0; - int _arg1; - int _arg2; - long _arg3; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiil:wxPyGridTableBase_base_SetValueAsLong",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_base_SetValueAsLong. Expected _wxPyGridTableBase_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxPyGridTableBase_base_SetValueAsLong(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxPyGridTableBase_base_SetValueAsDouble(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->base_SetValueAsDouble(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxPyGridTableBase_base_SetValueAsDouble(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxPyGridTableBase * _arg0; - int _arg1; - int _arg2; - double _arg3; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiid:wxPyGridTableBase_base_SetValueAsDouble",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_base_SetValueAsDouble. Expected _wxPyGridTableBase_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxPyGridTableBase_base_SetValueAsDouble(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxPyGridTableBase_base_SetValueAsBool(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->base_SetValueAsBool(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxPyGridTableBase_base_SetValueAsBool(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxPyGridTableBase * _arg0; - int _arg1; - int _arg2; - bool _arg3; - PyObject * _argo0 = 0; - int tempbool3; - char *_kwnames[] = { "self","row","col","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiii:wxPyGridTableBase_base_SetValueAsBool",_kwnames,&_argo0,&_arg1,&_arg2,&tempbool3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyGridTableBase_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyGridTableBase_base_SetValueAsBool. Expected _wxPyGridTableBase_p."); - return NULL; - } - } - _arg3 = (bool ) tempbool3; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxPyGridTableBase_base_SetValueAsBool(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - #define wxPyGridTableBase_base_Clear(_swigobj) (_swigobj->base_Clear()) static PyObject *_wrap_wxPyGridTableBase_base_Clear(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -12712,15 +12670,10 @@ static PyMethodDef gridcMethods[] = { { "wxPyGridTableBase_base_AppendRows", (PyCFunction) _wrap_wxPyGridTableBase_base_AppendRows, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridTableBase_base_InsertRows", (PyCFunction) _wrap_wxPyGridTableBase_base_InsertRows, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridTableBase_base_Clear", (PyCFunction) _wrap_wxPyGridTableBase_base_Clear, METH_VARARGS | METH_KEYWORDS }, - { "wxPyGridTableBase_base_SetValueAsBool", (PyCFunction) _wrap_wxPyGridTableBase_base_SetValueAsBool, METH_VARARGS | METH_KEYWORDS }, - { "wxPyGridTableBase_base_SetValueAsDouble", (PyCFunction) _wrap_wxPyGridTableBase_base_SetValueAsDouble, METH_VARARGS | METH_KEYWORDS }, - { "wxPyGridTableBase_base_SetValueAsLong", (PyCFunction) _wrap_wxPyGridTableBase_base_SetValueAsLong, METH_VARARGS | METH_KEYWORDS }, - { "wxPyGridTableBase_base_GetValueAsBool", (PyCFunction) _wrap_wxPyGridTableBase_base_GetValueAsBool, METH_VARARGS | METH_KEYWORDS }, - { "wxPyGridTableBase_base_GetValueAsDouble", (PyCFunction) _wrap_wxPyGridTableBase_base_GetValueAsDouble, METH_VARARGS | METH_KEYWORDS }, - { "wxPyGridTableBase_base_GetValueAsLong", (PyCFunction) _wrap_wxPyGridTableBase_base_GetValueAsLong, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridTableBase_base_CanSetValueAs", (PyCFunction) _wrap_wxPyGridTableBase_base_CanSetValueAs, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridTableBase_base_CanGetValueAs", (PyCFunction) _wrap_wxPyGridTableBase_base_CanGetValueAs, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridTableBase_base_GetTypeName", (PyCFunction) _wrap_wxPyGridTableBase_base_GetTypeName, METH_VARARGS | METH_KEYWORDS }, + { "wxPyGridTableBase_Destroy", (PyCFunction) _wrap_wxPyGridTableBase_Destroy, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridTableBase__setSelf", (PyCFunction) _wrap_wxPyGridTableBase__setSelf, METH_VARARGS | METH_KEYWORDS }, { "new_wxPyGridTableBase", (PyCFunction) _wrap_new_wxPyGridTableBase, METH_VARARGS | METH_KEYWORDS }, { "wxGridTableBase_SetColAttr", (PyCFunction) _wrap_wxGridTableBase_SetColAttr, METH_VARARGS | METH_KEYWORDS }, @@ -12759,7 +12712,6 @@ static PyMethodDef gridcMethods[] = { { "wxGridTableBase_SetView", (PyCFunction) _wrap_wxGridTableBase_SetView, METH_VARARGS | METH_KEYWORDS }, { "wxGridTableBase_GetAttrProvider", (PyCFunction) _wrap_wxGridTableBase_GetAttrProvider, METH_VARARGS | METH_KEYWORDS }, { "wxGridTableBase_SetAttrProvider", (PyCFunction) _wrap_wxGridTableBase_SetAttrProvider, METH_VARARGS | METH_KEYWORDS }, - { "delete_wxGridTableBase", (PyCFunction) _wrap_delete_wxGridTableBase, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridCellAttrProvider_base_SetColAttr", (PyCFunction) _wrap_wxPyGridCellAttrProvider_base_SetColAttr, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridCellAttrProvider_base_SetRowAttr", (PyCFunction) _wrap_wxPyGridCellAttrProvider_base_SetRowAttr, METH_VARARGS | METH_KEYWORDS }, { "wxPyGridCellAttrProvider_base_SetAttr", (PyCFunction) _wrap_wxPyGridCellAttrProvider_base_SetAttr, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/grid.py b/utils/wxPython/src/msw/grid.py index 2ed22bd057..dd58c21138 100644 --- a/utils/wxPython/src/msw/grid.py +++ b/utils/wxPython/src/msw/grid.py @@ -103,7 +103,7 @@ class wxPyGridCellRenderer(wxPyGridCellRendererPtr): def __init__(self,*_args,**_kwargs): self.this = apply(gridc.new_wxPyGridCellRenderer,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyGridCellRenderer) @@ -276,7 +276,7 @@ class wxPyGridCellEditor(wxPyGridCellEditorPtr): def __init__(self,*_args,**_kwargs): self.this = apply(gridc.new_wxPyGridCellEditor,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyGridCellEditor) @@ -502,7 +502,7 @@ class wxPyGridCellAttrProvider(wxPyGridCellAttrProviderPtr): def __init__(self,*_args,**_kwargs): self.this = apply(gridc.new_wxPyGridCellAttrProvider,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyGridCellAttrProvider) @@ -511,9 +511,6 @@ class wxGridTableBasePtr : def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,gridc=gridc): - if self.thisown == 1 : - gridc.delete_wxGridTableBase(self) def SetAttrProvider(self, *_args, **_kwargs): val = apply(gridc.wxGridTableBase_SetAttrProvider,(self,) + _args, _kwargs) return val @@ -641,6 +638,9 @@ class wxPyGridTableBasePtr(wxGridTableBasePtr): def _setSelf(self, *_args, **_kwargs): val = apply(gridc.wxPyGridTableBase__setSelf,(self,) + _args, _kwargs) return val + def Destroy(self, *_args, **_kwargs): + val = apply(gridc.wxPyGridTableBase_Destroy,(self,) + _args, _kwargs) + return val def base_GetTypeName(self, *_args, **_kwargs): val = apply(gridc.wxPyGridTableBase_base_GetTypeName,(self,) + _args, _kwargs) return val @@ -650,24 +650,6 @@ class wxPyGridTableBasePtr(wxGridTableBasePtr): def base_CanSetValueAs(self, *_args, **_kwargs): val = apply(gridc.wxPyGridTableBase_base_CanSetValueAs,(self,) + _args, _kwargs) return val - def base_GetValueAsLong(self, *_args, **_kwargs): - val = apply(gridc.wxPyGridTableBase_base_GetValueAsLong,(self,) + _args, _kwargs) - return val - def base_GetValueAsDouble(self, *_args, **_kwargs): - val = apply(gridc.wxPyGridTableBase_base_GetValueAsDouble,(self,) + _args, _kwargs) - return val - def base_GetValueAsBool(self, *_args, **_kwargs): - val = apply(gridc.wxPyGridTableBase_base_GetValueAsBool,(self,) + _args, _kwargs) - return val - def base_SetValueAsLong(self, *_args, **_kwargs): - val = apply(gridc.wxPyGridTableBase_base_SetValueAsLong,(self,) + _args, _kwargs) - return val - def base_SetValueAsDouble(self, *_args, **_kwargs): - val = apply(gridc.wxPyGridTableBase_base_SetValueAsDouble,(self,) + _args, _kwargs) - return val - def base_SetValueAsBool(self, *_args, **_kwargs): - val = apply(gridc.wxPyGridTableBase_base_SetValueAsBool,(self,) + _args, _kwargs) - return val def base_Clear(self, *_args, **_kwargs): val = apply(gridc.wxPyGridTableBase_base_Clear,(self,) + _args, _kwargs) return val @@ -729,7 +711,7 @@ class wxPyGridTableBase(wxPyGridTableBasePtr): def __init__(self,*_args,**_kwargs): self.this = apply(gridc.new_wxPyGridTableBase,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyGridTableBase) diff --git a/utils/wxPython/src/msw/misc2.cpp b/utils/wxPython/src/msw/misc2.cpp index 0fbbc72dbe..18a116a5e9 100644 --- a/utils/wxPython/src/msw/misc2.cpp +++ b/utils/wxPython/src/msw/misc2.cpp @@ -1841,17 +1841,19 @@ static PyObject *_wrap_delete_wxFontEnumerator(PyObject *self, PyObject *args, P return _resultobj; } -#define wxFontEnumerator__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxFontEnumerator__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxFontEnumerator__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyFontEnumerator * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxFontEnumerator__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxFontEnumerator__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1863,9 +1865,12 @@ static PyObject *_wrap_wxFontEnumerator__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxFontEnumerator__setSelf(_arg0,_arg1); + wxFontEnumerator__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); diff --git a/utils/wxPython/src/msw/misc2.py b/utils/wxPython/src/msw/misc2.py index a052bbd796..3d69e0f596 100644 --- a/utils/wxPython/src/msw/misc2.py +++ b/utils/wxPython/src/msw/misc2.py @@ -121,7 +121,7 @@ class wxFontEnumerator(wxFontEnumeratorPtr): def __init__(self,*_args,**_kwargs): self.this = apply(misc2c.new_wxFontEnumerator,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxFontEnumerator) diff --git a/utils/wxPython/src/msw/printfw.cpp b/utils/wxPython/src/msw/printfw.cpp index e99f5599f2..7513cfd305 100644 --- a/utils/wxPython/src/msw/printfw.cpp +++ b/utils/wxPython/src/msw/printfw.cpp @@ -2679,17 +2679,19 @@ static PyObject *_wrap_new_wxPrintout(PyObject *self, PyObject *args, PyObject * return _resultobj; } -#define wxPrintout__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPrintout__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPrintout__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyPrintout * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPrintout__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPrintout__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2701,9 +2703,12 @@ static PyObject *_wrap_wxPrintout__setSelf(PyObject *self, PyObject *args, PyObj { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPrintout__setSelf(_arg0,_arg1); + wxPrintout__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); diff --git a/utils/wxPython/src/msw/printfw.py b/utils/wxPython/src/msw/printfw.py index aced8dc62b..bd253625f1 100644 --- a/utils/wxPython/src/msw/printfw.py +++ b/utils/wxPython/src/msw/printfw.py @@ -386,7 +386,7 @@ class wxPrintout(wxPrintoutPtr): def __init__(self,*_args,**_kwargs): self.this = apply(printfwc.new_wxPrintout,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPrintout) diff --git a/utils/wxPython/src/msw/sizers.cpp b/utils/wxPython/src/msw/sizers.cpp index b0bb009027..214c0a57a7 100644 --- a/utils/wxPython/src/msw/sizers.cpp +++ b/utils/wxPython/src/msw/sizers.cpp @@ -1412,17 +1412,19 @@ static PyObject *_wrap_new_wxPySizer(PyObject *self, PyObject *args, PyObject *k return _resultobj; } -#define wxPySizer__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPySizer__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPySizer__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPySizer * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPySizer__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPySizer__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1434,9 +1436,12 @@ static PyObject *_wrap_wxPySizer__setSelf(PyObject *self, PyObject *args, PyObje { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPySizer__setSelf(_arg0,_arg1); + wxPySizer__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); diff --git a/utils/wxPython/src/msw/sizers.py b/utils/wxPython/src/msw/sizers.py index 897c351e66..213ef77740 100644 --- a/utils/wxPython/src/msw/sizers.py +++ b/utils/wxPython/src/msw/sizers.py @@ -205,7 +205,7 @@ class wxPySizer(wxPySizerPtr): def __init__(self,*_args,**_kwargs): self.this = apply(sizersc.new_wxPySizer,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPySizer) diff --git a/utils/wxPython/src/msw/windows.cpp b/utils/wxPython/src/msw/windows.cpp index bdc4e053e7..fbfaec2b39 100644 --- a/utils/wxPython/src/msw/windows.cpp +++ b/utils/wxPython/src/msw/windows.cpp @@ -834,18 +834,20 @@ static PyObject *_wrap_wxPyValidator_Destroy(PyObject *self, PyObject *args, PyO return _resultobj; } -#define wxPyValidator__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) +#define wxPyValidator__setSelf(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->_setSelf(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_wxPyValidator__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyValidator * _arg0; PyObject * _arg1; - int _arg2 = (int ) TRUE; + PyObject * _arg2; + int _arg3 = (int ) TRUE; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self","incref", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class","incref", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxPyValidator__setSelf",_kwnames,&_argo0,&_obj1,&_arg2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|i:wxPyValidator__setSelf",_kwnames,&_argo0,&_obj1,&_obj2,&_arg3)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -857,9 +859,12 @@ static PyObject *_wrap_wxPyValidator__setSelf(PyObject *self, PyObject *args, Py { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyValidator__setSelf(_arg0,_arg1,_arg2); + wxPyValidator__setSelf(_arg0,_arg1,_arg2,_arg3); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); diff --git a/utils/wxPython/src/msw/windows.py b/utils/wxPython/src/msw/windows.py index 4a4df72ca7..3dbca73cda 100644 --- a/utils/wxPython/src/msw/windows.py +++ b/utils/wxPython/src/msw/windows.py @@ -103,7 +103,7 @@ class wxPyValidator(wxPyValidatorPtr): def __init__(self,*_args,**_kwargs): self.this = apply(windowsc.new_wxPyValidator,_args,_kwargs) self.thisown = 1 - self._setSelf(self, 0) + self._setSelf(self, wxPyValidator, 0) diff --git a/utils/wxPython/src/printfw.i b/utils/wxPython/src/printfw.i index c29b3ae291..a71bd7541e 100644 --- a/utils/wxPython/src/printfw.i +++ b/utils/wxPython/src/printfw.i @@ -265,8 +265,8 @@ IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage); public: wxPyPrintout(const char* title = "Printout"); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPrintout)" %addmethods { void Destroy() { delete self; } diff --git a/utils/wxPython/src/sizers.i b/utils/wxPython/src/sizers.i index 49fe95d4a6..a92fbd8038 100644 --- a/utils/wxPython/src/sizers.i +++ b/utils/wxPython/src/sizers.i @@ -222,8 +222,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxPySizer, wxSizer); class wxPySizer : public wxSizer { public: wxPySizer(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPySizer)" }; diff --git a/utils/wxPython/src/windows.i b/utils/wxPython/src/windows.i index a4c1c52023..139d4f0c4f 100644 --- a/utils/wxPython/src/windows.i +++ b/utils/wxPython/src/windows.i @@ -147,8 +147,8 @@ public: %addmethods { void Destroy() { delete self; } } - void _setSelf(PyObject* self, int incref=TRUE); - %pragma(python) addtomethod = "__init__:self._setSelf(self, 0)" + void _setSelf(PyObject* self, PyObject* _class, int incref=TRUE); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyValidator, 0)" };