Changeset 0b705915 in sasview for sansguiframe


Ignore:
Timestamp:
Jan 24, 2012 2:27:26 PM (13 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:
52e0f2d
Parents:
053f983
Message:

sorted tree control

File:
1 edited

Legend:

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

    r356d2d3 r0b705915  
    9595                    CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds) 
    9696        self.root = self.AddRoot("Available Data") 
     97                    
     98    def OnCompareItems(self, item1, item2): 
     99        """  
     100        Overrides OnCompareItems in wx.TreeCtrl.  
     101        Used by the SortChildren method.  
     102        """ 
     103        # Get the item data 
     104        data1 = self.GetItemText(item1) 
     105        data2 = self.GetItemText(item2) 
     106        # Compare the item data 
     107        if data1 < data2: 
     108            return -1 
     109        elif data1 > data2: 
     110            return 1 
     111        else: 
     112            return 0 
    97113         
    98114class DataPanel(ScrolledPanel, PanelBase): 
     
    628644                                                              process.__str__()) 
    629645                wx.CallAfter(self.append_theory, state_id, theory_list) 
     646            # Sort by data name 
     647            if self.tree_ctrl.root: 
     648                self.tree_ctrl.SortChildren(self.tree_ctrl.root)     
    630649        self.enable_remove() 
    631650        self.enable_import() 
Note: See TracChangeset for help on using the changeset viewer.