Changeset 49ad00b in sasview


Ignore:
Timestamp:
Sep 1, 2011 5:05:08 PM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
dc51a7f
Parents:
7022fdc
Message:

working on data processor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/data_processor.py

    r9680906d r49ad00b  
    3232        col_with = 30 
    3333        row_height = 20 
     34        self.axis_value = [] 
     35        self.axis_label = "" 
     36        self.selected_cells = [] 
     37        self.selected_cols = [] 
    3438        self.SetColMinimalAcceptableWidth(col_with) 
    3539        self.SetRowMinimalAcceptableHeight(row_height) 
    3640        self.SetNumberRows(self._cols) 
    3741        self.SetNumberCols(self._rows) 
     42        self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
    3843        self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
    39         self.axis_value = [] 
    40         self.axis_label = "" 
     44        self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.on_selected_cell) 
     45         
    4146        
     47    def on_selected_cell(self, event): 
     48        """ 
     49        Handler catching cell selection 
     50        """ 
     51        flag = event.CmdDown() or event.ControlDown() 
     52        cell = (event.GetRow(), event.GetCol()) 
     53        if not flag: 
     54            self.selected_cells = [] 
     55        if cell in self.selected_cells: 
     56            self.selected_cells.remove(cell) 
     57        else: 
     58            self.selected_cells.append(cell) 
     59        event.Skip() 
     60       
     61    def on_left_click(self, event): 
     62        """ 
     63        Catch the left click on label mouse event 
     64        """ 
     65        flag = event.CmdDown() or event.ControlDown() 
     66        col = event.GetCol() 
     67        if not flag: 
     68            self.selected_cols  = [] 
     69        if col not in self.selected_cols: 
     70            self.selected_cols.append(col) 
     71        event.Skip() 
     72         
    4273    def on_right_click(self, event): 
    4374        """ 
     
    158189        pos = self.GetSelection() 
    159190        grid = self.GetPage(pos) 
    160         print "selected column",grid.GetSelectedCols(), grid.GetSelectionMode() 
    161  
    162         print "selected cell", grid.GetSelectedCells() 
    163          
    164         print "notebook on_edit_axis()" 
     191        if len(grid.selected_cols) > 1: 
     192            msg = "Edit axis doesn't understand this selection.\n" 
     193            msg += "Please select only one column" 
     194            raise ValueError, msg 
     195        list_of_cells = [] 
     196        if len(grid.selected_cols) == 1: 
     197            col = grid.selected_cols[0] 
     198            for row in range(grid.GetNumberRows()): 
     199                list_of_cells.append((row, col)) 
     200                 
     201        print "selected cell",  grid.selected_cells.sort(), grid.selected_cells 
     202   
    165203         
    166204    def on_close_page(self, event): 
     
    272310        new_plot.yaxis(self.y_axis_label.GetValue(), self.y_axis_unit.GetValue()) 
    273311        wx.PostEvent(self.parent.parent,  
    274                              NewPlotEvent(plot=new_plot, group_id=str(new_plot.group_id), title ="batch"))     
     312                             NewPlotEvent(plot=new_plot,  
     313                        group_id=str(new_plot.group_id), title ="batch"))     
    275314    def layout_grid(self): 
    276315        """ 
Note: See TracChangeset for help on using the changeset viewer.