Changeset 1c86a37 in sasview for sansguiframe
- Timestamp:
- Oct 6, 2011 11:55:30 AM (13 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:
- a4964b8e
- Parents:
- 3dcbe99
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/data_processor.py
r18a6556 r1c86a37 13 13 import wx.aui 14 14 from wx.aui import AuiNotebook as nb 15 import wx.lib.sheet as sheet 15 16 from sans.guiframe.panel_base import PanelBase 16 import wx.lib.sheet as sheet 17 17 from sans.guiframe.utils import format_number 18 18 from sans.guiframe.events import NewPlotEvent 19 19 from sans.guiframe.events import StatusEvent … … 103 103 self.last_selected_row = -1 104 104 self.last_selected_col = -1 105 col_with = 30106 row_height = 20105 self.col_width = 30 106 self.row_height = 20 107 107 self.max_row_touse = 0 108 108 self.axis_value = [] … … 113 113 self.plottable_cells = [] 114 114 self.plottable_flag = False 115 self.SetColMinimalAcceptableWidth( col_with)116 self.SetRowMinimalAcceptableHeight( row_height)115 self.SetColMinimalAcceptableWidth(self.col_width) 116 self.SetRowMinimalAcceptableHeight(self.row_height) 117 117 self.SetNumberRows(self._cols) 118 118 self.SetNumberCols(self._rows) 119 119 self.AutoSize() 120 self.default_col_width = 75 121 if self.GetNumberCols() > 0: 122 self.default_col_width = self.GetColSize(0) 120 123 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 121 124 self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 122 125 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.on_selected_cell) 123 126 self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGE, self.on_edit_cell) 124 127 128 125 129 def on_edit_cell(self, event): 126 130 """ … … 192 196 self.axis_label = self.GetCellValue(0, col) 193 197 194 195 196 197 198 199 200 198 def on_right_click(self, event): 201 199 """ … … 209 207 slicerpop = wx.Menu() 210 208 col_label_menu = wx.Menu() 209 c_name = self.GetCellValue(0, col) 210 label = "Insert column before %s " % str(c_name) 211 211 slicerpop.AppendSubMenu(col_label_menu , 212 '& Insert Column', 'Insert Column')212 '&%s' % str(label), str(label)) 213 213 col_name = [self.GetCellValue(0, c) 214 214 for c in range(self.GetNumberCols())] … … 361 361 if issubclass(value.__class__, BatchCell): 362 362 label = value.label 363 self.SetCellValue(cell_row, cell_col, str(label)) 363 try: 364 float(label) 365 label = format_number(label) 366 except: 367 label = str(label) 368 self.SetCellValue(cell_row, cell_col, label) 369 self.AutoSizeColumn(cell_col, True) 370 width = self.GetColSize(cell_col) 371 if width < self.default_col_width: 372 self.SetColSize(cell_col, self.default_col_width) 373 364 374 cell_row += 1 365 375 cell_col += 1 366 376 if cell_row > self.max_row_touse: 367 377 self.max_row_touse = cell_row 368 378 self.ForceRefresh() 379 369 380 def get_grid_view(self): 370 381 """ … … 696 707 StatusEvent(status=msg, 697 708 info="error")) 698 return 699 709 return 700 710 wx.PostEvent(self.parent.parent, 701 711 NewPlotEvent(plot=new_plot, … … 725 735 #evalue x 726 736 sentence = self.x_axis_label.GetValue() 727 if sentence.strip() == "": 728 msg = "select value for x axis" 729 raise ValueError, msg 737 try: 738 if sentence.strip() == "": 739 msg = "select value for x axis and y axis" 740 raise ValueError, msg 741 except: 742 wx.PostEvent(self.parent.parent, 743 StatusEvent(status=msg, info="error")) 744 return 745 746 730 747 dict = parse_string(sentence, column_names.keys()) 731 748 for tok, (col_name, list) in dict.iteritems(): … … 762 779 title = self.notebook.GetPageText(pos) 763 780 new_plot.name = title 781 new_plot.xtransform = "x" 782 new_plot.ytransform = "y" 764 783 wx.PostEvent(self.parent.parent, 765 784 NewPlotEvent(plot=new_plot, … … 794 813 self.x_axis_unit = wx.TextCtrl(self, -1) 795 814 self.y_axis_unit = wx.TextCtrl(self, -1) 796 self.view_button = wx.Button(self, -1, "View ")815 self.view_button = wx.Button(self, -1, "View Results") 797 816 wx.EVT_BUTTON(self, self.view_button.GetId(), self.on_view) 798 817 self.plot_button = wx.Button(self, -1, "Plot")
Note: See TracChangeset
for help on using the changeset viewer.