Changeset 98fdccd in sasview for sansguiframe/src/sans


Ignore:
Timestamp:
Jan 5, 2012 5:40:41 PM (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:
82c11d3
Parents:
011e0e4
Message:

ordered grids by data_name

Location:
sansguiframe/src/sans/guiframe
Files:
2 edited

Legend:

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

    rc668b1b r98fdccd  
    582582                            i_t_c = self.tree_ctrl.AppendItem(d_p_c, 
    583583                                                              process.__str__()) 
    584                 self.append_theory(state_id, theory_list) 
     584                wx.CallAfter(self.append_theory, state_id, theory_list) 
    585585        self.enable_remove() 
    586586        self.enable_import() 
  • sansguiframe/src/sans/guiframe/data_processor.py

    r5531a46 r98fdccd  
    644644        if data_outputs is None or data_outputs == {}: 
    645645            return 
    646          
     646        inputs, outputs = self.get_odered_results(data_inputs, data_outputs) 
    647647        for pos in range(self.GetPageCount()): 
    648648            grid = self.GetPage(pos) 
    649649            if grid.data is None: 
    650650                #Found empty page 
    651                 grid.set_data(data_inputs=data_inputs,  
    652                               data_outputs=data_outputs, 
     651                grid.set_data(data_inputs=inputs,  
     652                              data_outputs=outputs, 
    653653                              details=details, 
    654654                              file_name=file_name)  
     
    657657                 
    658658        grid, pos = self.add_empty_page() 
    659         grid.set_data(data_inputs=data_inputs,  
    660                       data_outputs=data_outputs, 
     659        grid.set_data(data_inputs=inputs,  
     660                      data_outputs=outputs, 
    661661                      file_name=file_name, 
    662662                      details=details) 
     663         
     664    def get_odered_results(self, inputs, outputs=None): 
     665        """ 
     666        Get ordered the results 
     667        """ 
     668        # Let's re-order the data from the keys in 'Data' name. 
     669        if outputs == None: 
     670            return 
     671        to_be_sort = [str(item.label) for item in outputs['Data']] 
     672        inds = numpy.lexsort((to_be_sort, to_be_sort)) 
     673        for key in outputs.keys(): 
     674            key_list = outputs[key] 
     675            temp_key = [item for item in key_list] 
     676            for ind in inds: 
     677                temp_key[ind] = key_list[inds[ind]] 
     678            outputs[key] = temp_key 
     679        for key in inputs.keys(): 
     680            key_list = inputs[key] 
     681            if len(key_list) > 0: 
     682                temp_key = [item for item in key_list] 
     683                for ind in inds: 
     684                    temp_key[ind] = key_list[inds[ind]] 
     685                inputs[key] = temp_key 
     686        return inputs, outputs 
    663687     
    664688    def add_column(self): 
     
    670694        grid.AppendCols(1, True) 
    671695         
    672     
    673  
    674  
    675  
    676696class GridPanel(SPanel): 
    677697    def __init__(self, parent, data_inputs=None, 
     
    706726        self.layout_plotting_area() 
    707727        self.SetSizer(self.vbox) 
    708    
     728 
    709729    def set_xaxis(self, label="", x=None): 
    710730        """ 
     
    10881108        menubar.Append(self.edit, "&Edit") 
    10891109        self.Bind(wx.EVT_CLOSE, self.on_close) 
    1090          
    10911110    def GetLabelText(self, id): 
    10921111        """ 
Note: See TracChangeset for help on using the changeset viewer.