Changeset 75790dc in sasview for sansguiframe/src
- Timestamp:
- Oct 3, 2011 5:31:20 PM (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:
- 18a6556
- Parents:
- 140fad00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/data_processor.py
r63dc6e5 r75790dc 33 33 self.col = -1 34 34 self.row = -1 35 self.object = None35 self.object = [] 36 36 37 37 … … 110 110 self.selected_cells = [] 111 111 self.selected_cols = [] 112 self.selected_row = []113 self.plottable_ list= []112 self.selected_rows = [] 113 self.plottable_cells = [] 114 114 self.plottable_flag = False 115 115 self.SetColMinimalAcceptableWidth(col_with) … … 156 156 self.axis_value.append(self.GetCellValue(cell_row, cell_col)) 157 157 158 def set_plottable_list(self, prev_row, next_row, prev_col, next_col): 159 """ 160 """ 161 if (prev_col == -1 and next_col != -1 and prev_row != -1 ) or \ 162 (prev_row == -1 and next_row !=-1 and prev_col != -1): 163 self.plottable_flag = True 164 if self.plottable_flag: 165 print "special case" 158 166 159 167 160 def on_left_click(self, event): … … 173 166 col = event.GetCol() 174 167 row = event.GetRow() 175 print "on left click", row, col, flag176 177 168 if not flag: 178 169 self.selected_cols = [] 170 self.selected_rows = [] 179 171 self.selected_cells = [] 180 172 self.axis_label = "" 181 173 self.plottable_list = [] 174 self.plottable_cells = [] 182 175 self.plottable_flag = False 183 else: 184 self.set_plottable_list(prev_row=self.last_selected_row, 185 next_row=row, 186 prev_col=self.last_selected_col, 187 next_col=col) 188 176 189 177 self.last_selected_col = col 190 178 self.last_selected_row = row 179 if row != -1 and row not in self.selected_rows: 180 self.selected_rows.append(row) 181 191 182 if col != -1: 192 183 for row in range(1, self.GetNumberRows()+ 1): … … 200 191 self.axis_value.append(self.GetCellValue(cell_row, cell_col)) 201 192 self.axis_label = self.GetCellValue(0, col) 193 194 195 196 197 202 198 203 199 … … 586 582 587 583 self.plotting_sizer = wx.FlexGridSizer(3, 7, 10, 5) 584 self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) 588 585 self.grid_sizer = wx.BoxSizer(wx.HORIZONTAL) 589 586 self.vbox.AddMany([(self.grid_sizer, 1, wx.EXPAND, 0), 590 587 (wx.StaticLine(self, -1), 0, wx.EXPAND, 0), 591 (self.plotting_sizer)]) 588 (self.plotting_sizer), 589 (self.button_sizer)]) 592 590 self.parent = parent 593 591 self._data_inputs = data_inputs … … 601 599 self.x_axis_unit = None 602 600 self.y_axis_unit = None 601 self.view_button = None 603 602 self.plot_button = None 604 603 self.notebook = None … … 645 644 str(col)) 646 645 wx.PostEvent(self.parent.parent, 647 S atusEvent(status=msg, info="error"))646 StatusEvent(status=msg, info="error")) 648 647 else: 649 648 axis.append(None) … … 660 659 details=self.details) 661 660 661 def on_view(self, event): 662 """ 663 Get object represented buy the given cell and plot them. 664 """ 665 pos = self.notebook.GetSelection() 666 grid = self.notebook.GetPage(pos) 667 title = self.notebook.GetPageText(pos) 668 669 670 group_id = wx.NewId() 671 for cell in grid.selected_cells: 672 row, col = cell 673 label_row = 0 674 label = grid.GetCellValue(label_row, col) 675 if label in grid.data: 676 values = grid.data[label] 677 value = values[row -1] 678 if issubclass(value.__class__, BatchCell): 679 for new_plot in value.object: 680 if new_plot is None: 681 msg = "Row %s , " % str(row) 682 msg += "Column %s doesn't have a view" % str(label) 683 #raise ValueError, msg 684 wx.PostEvent(self.parent.parent, 685 StatusEvent(status=msg, info="error")) 686 return 687 if issubclass(new_plot.__class__, Data1D): 688 new_plot.group_id = group_id 689 new_plot.list_group_id .append(group_id) 690 else: 691 if label.lower() == "data": 692 if len(grid.selected_cells) != 1: 693 msg = "Can only view one" 694 msg += " selected data at once" 695 wx.PostEvent(self.parent.parent, 696 StatusEvent(status=msg, 697 info="error")) 698 return 699 700 wx.PostEvent(self.parent.parent, 701 NewPlotEvent(plot=new_plot, 702 group_id=str(new_plot.group_id), 703 title =title)) 704 else: 705 706 msg = "Row %s , " % str(row) 707 msg += "Column %s doesn't have a view" % str(label) 708 #raise ValueError, msg 709 wx.PostEvent(self.parent.parent, 710 StatusEvent(status=msg, info="error")) 711 return 712 713 714 715 662 716 def on_plot(self, event): 663 717 """ … … 713 767 except: 714 768 wx.PostEvent(self.parent.parent, 715 S atusEvent(status=msg, info="error"))769 StatusEvent(status=msg, info="error")) 716 770 717 771 def layout_grid(self): … … 727 781 Draw area containing options to plot 728 782 """ 783 729 784 self.x_axis_title = wx.TextCtrl(self, -1) 730 785 self.y_axis_title = wx.TextCtrl(self, -1) … … 739 794 self.x_axis_unit = wx.TextCtrl(self, -1) 740 795 self.y_axis_unit = wx.TextCtrl(self, -1) 796 self.view_button = wx.Button(self, -1, "View") 797 wx.EVT_BUTTON(self, self.view_button.GetId(), self.on_view) 741 798 self.plot_button = wx.Button(self, -1, "Plot") 799 self.button_sizer.AddMany( [ (500, 30), 800 (self.view_button, 0, wx.RIGHT|wx.BOTTOM, 10), 801 (self.plot_button, 0, wx.RIGHT|wx.BOTTOM, 10)]) 802 742 803 wx.EVT_BUTTON(self, self.plot_button.GetId(), self.on_plot) 743 804 self.plotting_sizer.AddMany([ … … 767 828 (-1, -1), 768 829 (-1, -1), 769 ( self.plot_button, 1, wx.LEFT|wx.BOTTOM, 10)])830 (-1, 1)]) 770 831 771 832 def on_edit_axis(self, event):
Note: See TracChangeset
for help on using the changeset viewer.