Changeset c85b0ae in sasview
- Timestamp:
- Jun 16, 2015 3:04:12 PM (9 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 66f21cd
- Parents:
- c2ee2b1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/data_processor.py
r56e99f9 rc85b0ae 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 cell 97 """ 98 changed = False # Assume value not changed 99 val = self._tc.GetValue() # Get value in edit control 100 if val != self._startValue: # Compare 101 changed = True # If different then changed is True 102 grid.GetTable().SetValue(row, col, val) # Update the table 103 self._startValue = '' # Clear the class' start value 104 self._tc.SetValue('') # Clear contents of the edit control 105 return changed 106 107 87 108 class GridPage(sheet.CSheet): 88 109 """ … … 91 112 """ 92 113 """ 93 sheet.CSheet.__init__(self, parent) 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. ########################## 94 150 95 151 self.AdjustScrollbars()
Note: See TracChangeset
for help on using the changeset viewer.