Changes in / [ff50c51:20eeb00] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/data_processor.py
rc85b0ae r56e99f9 85 85 self.SetupScrolling() 86 86 87 88 class GridCellEditor(sheet.CCellEditor):89 """ Custom cell editor """90 def __init__(self, grid):91 super(GridCellEditor, self).__init__(grid)92 93 def EndEdit(self, row, col, grid, previous):94 """95 Commit editing the current cell. Returns True if the value has changed.96 @param previous: previous value in the cell97 """98 changed = False # Assume value not changed99 val = self._tc.GetValue() # Get value in edit control100 if val != self._startValue: # Compare101 changed = True # If different then changed is True102 grid.GetTable().SetValue(row, col, val) # Update the table103 self._startValue = '' # Clear the class' start value104 self._tc.SetValue('') # Clear contents of the edit control105 return changed106 107 108 87 class GridPage(sheet.CSheet): 109 88 """ … … 112 91 """ 113 92 """ 114 #sheet.CSheet.__init__(self, parent) 115 116 # The following is the __init__ from CSheet. ########################## 117 # We re-write it here because the class is broken in wx 3.0, 118 # such that the cell editor is not able to receive the right 119 # number of parameters when it is called. The only way to 120 # pick a different cell editor is apparently to re-write the __init__. 121 wx.grid.Grid.__init__(self, parent, -1) 122 123 # Init variables 124 self._lastCol = -1 # Init last cell column clicked 125 self._lastRow = -1 # Init last cell row clicked 126 self._selected = None # Init range currently selected 127 # Map string datatype to default renderer/editor 128 self.RegisterDataType(wx.grid.GRID_VALUE_STRING, 129 wx.grid.GridCellStringRenderer(), 130 GridCellEditor(self)) 131 132 self.CreateGrid(4, 3) # By default start with a 4 x 3 grid 133 self.SetColLabelSize(18) # Default sizes and alignment 134 self.SetRowLabelSize(50) 135 self.SetRowLabelAlignment(wx.ALIGN_RIGHT, wx.ALIGN_BOTTOM) 136 self.SetColSize(0, 75) # Default column sizes 137 self.SetColSize(1, 75) 138 self.SetColSize(2, 75) 139 140 # Sink events 141 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick) 142 self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightClick) 143 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnLeftDoubleClick) 144 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect) 145 self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize) 146 self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.OnColSize) 147 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange) 148 self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnGridSelectCell) 149 # This ends the __init__ section for CSheet. ########################## 93 sheet.CSheet.__init__(self, parent) 150 94 151 95 self.AdjustScrollbars()
Note: See TracChangeset
for help on using the changeset viewer.