Changeset 1590
- Timestamp:
- Dec 1, 2014 4:08:22 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r1583 r1590 2288 2288 self._tc.SetSelection(0, self._tc.GetLastPosition()) 2289 2289 2290 def EndEdit(self, row, col, grid ):2290 def EndEdit(self, row, col, grid, oldVal=None): 2291 2291 changed = False 2292 2292 2293 self.nextval = self.startValue 2293 2294 val = self._tc.GetValue().lower() 2294 2295 2295 if val != self.startValue: 2296 2296 changed = True … … 2311 2311 val = 'cosd('+val.strip('c')+')' 2312 2312 try: 2313 val = float(eval(val))2314 except (SyntaxError,NameError ):2313 self.nextval = val = float(eval(val)) 2314 except (SyntaxError,NameError,ZeroDivisionError): 2315 2315 val = self.startValue 2316 grid.GetTable().SetValue(row, col, val) # update the table 2316 return None 2317 2318 if oldVal is None: # this arg appears in 2.9+; before, we should go ahead & change the table 2319 grid.GetTable().SetValue(row, col, val) # update the table 2320 # otherwise self.ApplyEdit gets called 2317 2321 2318 2322 self.startValue = '' 2319 2323 self._tc.SetValue('') 2320 2324 return changed 2325 2326 def ApplyEdit(self, row, col, grid): 2327 """ Called only in wx >= 2.9 2328 Save the value of the control into the grid if EndEdit() returns as True 2329 """ 2330 grid.GetTable().SetValue(row, col, self.nextval) # update the table 2321 2331 2322 2332 def Reset(self): -
trunk/GSASIIphsGUI.py
r1589 r1590 1292 1292 attr.SetEditor(G2gd.GridFractionEditor(Atoms)) 1293 1293 for c in range(colX,colX+3): 1294 attr = wx.grid.GridCellAttr() 1295 attr.IncRef() #fix from Jim Hester 1296 attr.SetEditor(G2gd.GridFractionEditor(Atoms)) 1294 1297 Atoms.SetColAttr(c, attr) 1295 1298 for i in range(colU11-1,colU11+6):
Note: See TracChangeset
for help on using the changeset viewer.