From: Alex T. <ale...@us...> - 2004-09-06 01:16:39
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13199/components Modified Files: grid.py Log Message: Wrap grid events. Adjust simpleGrid accordingly. Index: grid.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/grid.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** grid.py 13 May 2004 02:40:24 -0000 1.10 --- grid.py 6 Sep 2004 01:16:30 -0000 1.11 *************** *** 9,25 **** from PythonCard import event, widget class GridSpec(widget.WidgetSpec): def __init__(self): ! events = [] ! """ ! self.events.extend([event.SelectEvent, ! event.ItemActivatedEvent, ! event.ItemExpandedEvent, ! event.ItemExpandingEvent, ! event.SelectionChangedEvent, ! event.SelectionChangingEvent, ! event.KeyDownEvent ! ]) ! """ attributes = { 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, --- 9,124 ---- from PythonCard import event, widget + + + class GridEvent(event.Event): + def decorate(self, aWxEvent, source): + aWxEvent = event.Event.decorate(self, aWxEvent, source) + # aWxEvent.item = aWxEvent.GetItem() + return aWxEvent + + class GridMouseClickEvent(GridEvent): + name = 'mouseClick' + binding = wx.grid.EVT_GRID_CELL_LEFT_CLICK + id = wx.grid.wxEVT_GRID_CELL_LEFT_CLICK + + class GridMouseRightClickEvent(GridEvent): + name = 'mouseRightClick' + binding = wx.grid.EVT_GRID_CELL_RIGHT_CLICK + id = wx.grid.wxEVT_GRID_CELL_RIGHT_CLICK + + class GridMouseDoubleClickEvent(GridEvent): + name = 'mouseDoubleClick' + binding = wx.grid.EVT_GRID_CELL_LEFT_DCLICK + id = wx.grid.wxEVT_GRID_CELL_LEFT_DCLICK + + class GridMouseRightDoubleClickEvent(GridEvent): + name = 'mouseRightDoubleClick' + binding = wx.grid.EVT_GRID_CELL_RIGHT_DCLICK + id = wx.grid.wxEVT_GRID_CELL_RIGHT_DCLICK + + class GridLabelClickEvent(GridEvent): + name = 'labelClick' + binding = wx.grid.EVT_GRID_LABEL_LEFT_CLICK + id = wx.grid.wxEVT_GRID_LABEL_LEFT_CLICK + + class GridLabelRightClickEvent(GridEvent): + name = 'labelRightClick' + binding = wx.grid.EVT_GRID_LABEL_RIGHT_CLICK + id = wx.grid.wxEVT_GRID_LABEL_RIGHT_CLICK + + class GridLabelDoubleClickEvent(GridEvent): + name = 'labelDoubleClick' + binding = wx.grid.EVT_GRID_LABEL_LEFT_DCLICK + id = wx.grid.wxEVT_GRID_LABEL_LEFT_DCLICK + + class GridLabelRightDoubleClickEvent(GridEvent): + name = 'labelRightDoubleClick' + binding = wx.grid.EVT_GRID_LABEL_RIGHT_DCLICK + id = wx.grid.wxEVT_GRID_LABEL_RIGHT_DCLICK + + class GridRowSizeEvent(GridEvent): + name = 'rowSize' + binding = wx.grid.EVT_GRID_ROW_SIZE + id = wx.grid.wxEVT_GRID_ROW_SIZE + + class GridColSizeEvent(GridEvent): + name = 'colSize' + binding = wx.grid.EVT_GRID_COL_SIZE + id = wx.grid.wxEVT_GRID_COL_SIZE + + class GridRangeSelectEvent(GridEvent): + name = 'rangeSelect' + binding = wx.grid.EVT_GRID_RANGE_SELECT + id = wx.grid.wxEVT_GRID_RANGE_SELECT + + class GridCellChangeEvent(GridEvent): + name = 'cellChange' + binding = wx.grid.EVT_GRID_CELL_CHANGE + id = wx.grid.wxEVT_GRID_CELL_CHANGE + + class GridSelectCellEvent(GridEvent): + name = 'selectCell' + binding = wx.grid.EVT_GRID_SELECT_CELL + id = wx.grid.wxEVT_GRID_SELECT_CELL + + class GridEditorShownEvent(GridEvent): + name = 'editorShown' + binding = wx.grid.EVT_GRID_EDITOR_SHOWN + id = wx.grid.wxEVT_GRID_EDITOR_SHOWN + + class GridEditorHiddenEvent(GridEvent): + name = 'editorHidden' + binding = wx.grid.EVT_GRID_EDITOR_HIDDEN + id = wx.grid.wxEVT_GRID_EDITOR_HIDDEN + + class GridEditorCreatedEvent(GridEvent): + name = 'editorCreated' + binding = wx.grid.EVT_GRID_EDITOR_CREATED + id = wx.grid.wxEVT_GRID_EDITOR_CREATED + + + GridEvents = (#GridSelectEvent, + GridMouseClickEvent, + GridMouseRightClickEvent, + GridMouseDoubleClickEvent, + GridMouseRightDoubleClickEvent, + GridLabelClickEvent, + GridLabelRightClickEvent, + GridLabelDoubleClickEvent, + GridLabelRightDoubleClickEvent, + GridRowSizeEvent, + GridColSizeEvent, + GridRangeSelectEvent, + GridCellChangeEvent, + GridSelectCellEvent, + GridEditorShownEvent, + GridEditorHiddenEvent, + GridEditorCreatedEvent, + ) + class GridSpec(widget.WidgetSpec): def __init__(self): ! events = list(GridEvents) ! attributes = { 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, *************** *** 51,55 **** widget.Widget.__init__(self, aParent, aResource) ! self._bindEvents(event.WIDGET_EVENTS) --- 150,155 ---- widget.Widget.__init__(self, aParent, aResource) ! ## self._bindEvents(event.WIDGET_EVENTS) ! self._bindEvents(self._spec._events) |