Changeset ed2d86e in sasview


Ignore:
Timestamp:
Mar 14, 2012 7:33:51 AM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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:
25b7bf9
Parents:
bd26a85
Message:

fixed putting new # of rows

File:
1 edited

Legend:

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

    r23a1747 red2d86e  
    421421            #Add more columns to the grid if necessary 
    422422            if nbr_user_cols > self._cols: 
    423                 new_col_nbr = nbr_user_cols -  self._cols  
     423                new_col_nbr = nbr_user_cols -  self._cols + 1 
    424424                self.AppendCols(new_col_nbr, True) 
    425425            #Add more rows to the grid if necessary   
    426             nbr_user_row = len(self.data_outputs.values()) 
     426            nbr_user_row = len(self.data_outputs.values()[0]) 
    427427            if nbr_user_row > self._rows + 1: 
    428                 new_row_nbr =  nbr_user_row - self._rows  
     428                new_row_nbr =  nbr_user_row - self._rows + 1 
    429429                self.AppendRows(new_row_nbr, True) 
    430430            # add data to the grid     
    431             row = 0 
    432             col = 0 
    433             cell_col = 0 
    434             for col_name in  self.col_names: 
    435                 # use the first row of the grid to add user defined labels 
    436                 self.SetCellValue(row, col, str(col_name)) 
    437                 col += 1 
    438                 cell_row =  1 
    439                 value_list = self.data_outputs[col_name] 
     431            wx.CallAfter(self.set_grid_values) 
     432        self.ForceRefresh() 
     433     
     434    def set_grid_values(self): 
     435        """ 
     436        Set the values in grids 
     437        """ 
     438        # add data to the grid     
     439        row = 0 
     440        col = 0 
     441        cell_col = 0 
     442        for col_name in  self.col_names: 
     443            # use the first row of the grid to add user defined labels 
     444            self.SetCellValue(row, col, str(col_name)) 
     445            col += 1 
     446            cell_row =  1 
     447            value_list = self.data_outputs[col_name] 
     448             
     449            for value in value_list: 
     450                label = value 
     451                if issubclass(value.__class__, BatchCell): 
     452                    label = value.label 
     453                try: 
     454                    float(label) 
     455                    label = str(label)#format_number(label, high=True) 
     456                except: 
     457                    label = str(label) 
     458                self.SetCellValue(cell_row, cell_col, label) 
     459                self.AutoSizeColumn(cell_col, True) 
     460                width = self.GetColSize(cell_col) 
     461                if width < self.default_col_width: 
     462                   self.SetColSize(cell_col, self.default_col_width) 
    440463                 
    441                 for value in value_list: 
    442                     label = value 
    443                     if issubclass(value.__class__, BatchCell): 
    444                         label = value.label 
    445                     try: 
    446                         float(label) 
    447                         label = str(label)#format_number(label, high=True) 
    448                     except: 
    449                         label = str(label) 
    450                     self.SetCellValue(cell_row, cell_col, label) 
    451                     self.AutoSizeColumn(cell_col, True) 
    452                     width = self.GetColSize(cell_col) 
    453                     if width < self.default_col_width: 
    454                        self.SetColSize(cell_col, self.default_col_width) 
    455                      
    456                     cell_row += 1 
    457                 cell_col += 1 
    458                 if cell_row > self.max_row_touse: 
    459                     self.max_row_touse = cell_row 
    460         self.ForceRefresh() 
    461          
     464                cell_row += 1 
     465            cell_col += 1 
     466            if cell_row > self.max_row_touse: 
     467                self.max_row_touse = cell_row 
     468                          
    462469    def get_grid_view(self): 
    463470        """ 
Note: See TracChangeset for help on using the changeset viewer.