Changeset 9608

Show
Ignore:
Timestamp:
10/02/09 10:46:40 (4 years ago)
Author:
Snyder.Jason
Message:

Added method to compare two components and sorted lists of components, devices, and nodes so they show up as sorted in OEF

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/ComponentProject/PythonSrc/MainFrameGlue.py

    r9385 r9608  
    113113                self.Available_Devices.append(tmpComp) 
    114114 
    115  
     115                 
    116116        nodeList = [] 
    117117        if os.path.isdir(self.installPath + 'nodes'): 
     
    149149                continue 
    150150            self.Available_Nodes.append(tmpNode) 
     151             
     152        sort(self.Available_Components, compareComponents) 
     153        sort(self.Available_Devices, compareComponents) 
     154        sort(self.Available_Nodes, compareComponents)     
    151155        return [MainFrameTreeNode("Components", self.Available_Components), 
    152156                MainFrameTreeNode("Devices", self.Available_Devices), 
     
    269273 
    270274 
     275         
    271276    def errorMsg(self, message): 
    272277        print >>sys.stderr, message 
     
    569574        return returnValues 
    570575 
    571  
    572  
    573  
     576def compareComponents(comp1, comp2) 
     577        if(comp1.name < comp2.name) 
     578                return -1 
     579        else if(comp1.name == comp2.name) 
     580                return 0 
     581        else 
     582                return 1 
     583 
     584