Changeset 5251ec6 in sasview for src/sas/sasgui/guiframe/data_processor.py
- Timestamp:
- Oct 11, 2018 12:20:56 PM (5 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1249
- Children:
- 98b9f32
- Parents:
- 67ed543
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/data_processor.py
r20fa5fe r5251ec6 234 234 # overriden in this subclassn - actually we have currently 235 235 # disabled the on_context_menu that would override the OnRightClick 236 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange) 236 try: 237 EVT_GRID_CELL_CHANGED = wx.grid.EVT_GRID_CELL_CHANGED 238 except AttributeError: 239 # CRUFT: wx 3.x uses CHANGE rather than CHANGING/CHANGED 240 EVT_GRID_CELL_CHANGED = wx.grid.EVT_GRID_CELL_CHANGE 241 self.Bind(EVT_GRID_CELL_CHANGED, self.OnCellChange) 237 242 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick) 238 243 self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightClick) … … 561 566 value = self.GetCellValue(row, col) 562 567 self.data[col_name].append(value) 563 for k, value_list in self.data.ite ritems():568 for k, value_list in self.data.items(): 564 569 if k != col_name: 565 570 length = len(value_list) … … 621 626 if col_name.strip() != "Empty": 622 627 self.SetCellValue(row, col, str(col_name.strip())) 623 if col_name in self.data .keys():628 if col_name in self.data: 624 629 value_list = self.data[col_name] 625 630 cell_row = 1 … … 674 679 self._cols = self.GetNumberCols() 675 680 self._rows = self.GetNumberRows() 676 self.col_names = self.data_outputs.keys()681 self.col_names = list(self.data_outputs.keys()) 677 682 self.col_names.sort() 678 683 nbr_user_cols = len(self.col_names) … … 682 687 self.AppendCols(new_col_nbr, True) 683 688 #Add more rows to the grid if necessary 684 nbr_user_row = len( self.data_outputs.values()[0])689 nbr_user_row = len(list(self.data_outputs.values())[0]) 685 690 if nbr_user_row > self._rows + 1: 686 691 new_row_nbr = nbr_user_row - self._rows + 1 … … 909 914 msg = "Edit axis doesn't understand this selection.\n" 910 915 msg += "Please select only one column" 911 raise ValueError , msg916 raise ValueError(msg) 912 917 for (_, cell_col) in grid.selected_cells: 913 918 if cell_col != col: … … 915 920 msg += "this operation.\n" 916 921 msg += "Please select elements of the same col.\n" 917 raise ValueError , msg922 raise ValueError(msg) 918 923 919 924 # Finally check the highlighted cell if any cells missing … … 922 927 msg = "No item selected.\n" 923 928 msg += "Please select only one column or one cell" 924 raise ValueError , msg929 raise ValueError(msg) 925 930 return grid.selected_cells 926 931 … … 1326 1331 if sentence.strip() == "": 1327 1332 msg = "Select column values for x axis" 1328 raise ValueError , msg1333 raise ValueError(msg) 1329 1334 except: 1330 1335 msg = "X axis value error." … … 1345 1350 if sentence.strip() == "": 1346 1351 msg = "select value for y axis" 1347 raise ValueError , msg1352 raise ValueError(msg) 1348 1353 except: 1349 1354 msg = "Y axis value error." … … 1440 1445 """ 1441 1446 1442 for tok, (col_name, list) in dict.ite ritems():1447 for tok, (col_name, list) in dict.items(): 1443 1448 col = column_names[col_name] 1444 1449 axis = self.get_plot_axis(col, list) … … 1446 1451 return None 1447 1452 sentence = sentence.replace(tok, "numpy.array(%s)" % str(axis)) 1448 for key, value in FUNC_DICT.ite ritems():1453 for key, value in FUNC_DICT.items(): 1449 1454 sentence = sentence.replace(key.lower(), value) 1450 1455 return sentence … … 1546 1551 cell_list = self.notebook.on_edit_axis() 1547 1552 label, title = self.create_axis_label(cell_list) 1548 except :1549 msg = str( sys.exc_value)1553 except Exception as exc: 1554 msg = str(exc) 1550 1555 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 1551 1556 return … … 2036 2041 frame = GridFrame(data_outputs=data, data_inputs=data_input) 2037 2042 frame.Show(True) 2038 except :2039 print( sys.exc_value)2043 except Exception as exc: 2044 print(exc) 2040 2045 2041 2046 app.MainLoop()
Note: See TracChangeset
for help on using the changeset viewer.