Changeset 9353

Show
Ignore:
Timestamp:
05/14/09 12:41:47 (4 years ago)
Author:
deepanns
Message:

merging rev 9352(duplicate SAD/DAS file and PRF read error)

Location:
ossiedev/branches/0.7.x/tools/wavedash/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/0.7.x/tools/wavedash/src/ComponentModel.py

    r9211 r9353  
    33from PropertyModel import Property 
    44from PropertyWidgets import WidgetContainer 
     5import sys 
    56 
    67class ComponentEvent: 
     
    3334    components' attributes and methods """ 
    3435      
    35     def __init__(self, parent, id, name, pos, spd_file, controller, visibility = True): 
     36    def __init__(self, parent, id, name, pos, spd_file, controller, visible = True): 
    3637        self.id = id 
    3738        self.parent = parent 
     
    4041        self.spdFile = str(spd_file) 
    4142        self.controller = controller 
    42         self.visibility = visibility 
     43        self.visible = visible 
    4344        self.properties = [] 
    4445        self.buildProperties(controller) 
     
    6061     
    6162    def hide(self): 
    62         self.visibility = False 
     63        self.visible = False 
    6364     
    6465    def show(self): 
    65       self.visibility = True 
     66      self.visible = True 
    6667     
    6768    def isVisible(self): 
    68         return self.visibility 
     69        return self.visible 
    6970     
    7071    def getParent(self): 
     
    102103        if newPrpList is None: 
    103104            return 
    104          
    105          
    106105        for newprp in newPrpList: 
    107106            prp = self.findPropertyByID(newprp.id) 
    108             prp.setValue(newprp.value._v) 
     107            if (prp is not None): 
     108                prp.setValue(newprp.value._v) 
    109109             
    110          
    111110       # print newPrpList 
    112111        return 
     
    154153        prpList = prpNode.childNodes 
    155154         
    156          
    157         for prp in prpList: 
    158             if ( prp.nodeType != Node.ELEMENT_NODE ): 
    159                 continue 
    160             #populate property fields and create the property object 
     155        try: 
     156            for prp in prpList: 
     157                if ( prp.nodeType != Node.ELEMENT_NODE ): 
     158                    continue 
     159                #populate property fields and create the property object 
     160                 
     161                id = prp.attributes['id'].value 
     162                name = prp.attributes['name'].value 
     163                type = (str(prp.tagName), str(prp.attributes['type'].value)) 
     164                mode = prp.attributes['mode'].value 
     165                 
     166                desc = '' 
     167                value = None 
     168                range = (0,10000) 
     169                actionType = '' 
     170                kindType = '' 
     171                 
     172                #Iterate through children of <simple> tag to update desc, value and kindType 
     173                for child in prp.childNodes: 
     174                    if (child.nodeType == Node.ELEMENT_NODE): 
     175                        if (child.tagName == 'description'): 
     176                            desc = child.firstChild.data 
     177                        elif (child.tagName == 'value'): 
     178                            value = child.firstChild.data 
     179                        elif (child.tagName == 'kind'): 
     180                            kindType = child.attributes['kindtype'].value 
     181                        elif (child.tagName == 'range'): 
     182                            min = child.childNodes[1].firstChild.data 
     183                            max = child.childNodes[3].firstChild.data 
     184                            range = (min, max) 
     185                        elif (child.tagName == 'action'): 
     186                            actionType = child.attributes['type'].value 
     187                 
     188                 
     189                widget = controller.getDefaultWidget(type)  
     190                newProp = Property(self, id, name, type, mode, desc, value,  
     191                                   range, kindType, actionType, widget, prf_file) 
     192                self.properties.append(newProp) 
     193        except: 
     194            print "Error in reading PRF files for ", self.parent.getName(), "/", self.name 
     195            errorMsg = sys.exc_info() 
     196            print errorMsg 
     197            sys.exit(-1) 
    161198             
    162             id = prp.attributes['id'].value 
    163             name = prp.attributes['name'].value 
    164             type = (str(prp.tagName), str(prp.attributes['type'].value)) 
    165             mode = prp.attributes['mode'].value 
    166              
    167             desc = '' 
    168             value = None 
    169             range = (0,0) 
    170             actionType = '' 
    171             kindType = '' 
    172              
    173             #Iterate through children of <simple> tag to update desc, value and kindType 
    174             for child in prp.childNodes: 
    175                 if (child.nodeType == Node.ELEMENT_NODE): 
    176                     if (child.tagName == 'description'): 
    177                         desc = child.firstChild.data 
    178                     elif (child.tagName == 'value'): 
    179                         value = child.firstChild.data 
    180                     elif (child.tagName == 'kind'): 
    181                         kindType = child.attributes['kindtype'].value 
    182                     elif (child.tagName == 'range'): 
    183                         min = child.childNodes[1].firstChild.data 
    184                         max = child.childNodes[3].firstChild.data 
    185                         range = (min, max) 
    186                     elif (child.tagName == 'action'): 
    187                         actionType = child.attributes['type'].value 
    188              
    189              
    190             widget = controller.getDefaultWidget(type)  
    191             newProp = Property(self, id, name, type, mode, desc, value,  
    192                                range, kindType, actionType, widget, prf_file) 
    193             self.properties.append(newProp) 
    194      
    195199    def changePropWidget(self, property, newWidgetType): 
    196200        prpRef = self.findPropertyByName(property) 
  • ossiedev/branches/0.7.x/tools/wavedash/src/WavedashController.py

    r9211 r9353  
    2121import os 
    2222import wx 
     23import sys 
    2324import xml.dom.minidom as minidom 
    2425from WavedashModel import WavedashModel 
     
    5051        sadFileList = self.getFileList(SDR_WAVEFORMS_DIR, SAD_XML) #list holding sad files of all the system waveforms            
    5152        dasFileList = self.getFileList(SDR_WAVEFORMS_DIR, DAS_XML) 
     53        if (sadFileList is None): 
     54            print "buildModel(): Error in reading sad files" 
     55            sys.exit(-1) 
     56        if (dasFileList is None): 
     57            print "buildModel(): Error in reading das files" 
     58            sys.exit(-1) 
     59              
    5260        self.model.buildWaveforms(sadFileList, dasFileList) 
    5361         
     
    97105                        abs_file_path = dirpath + "/" + fname 
    98106                
    99                     fileList.append(abs_file_path) 
     107                    #do not add duplicate entries to the list 
     108                    if (abs_file_path not in fileList): 
     109                        fileList.append(abs_file_path) 
    100110                 
    101111        if not fileFound: 
     
    124134                instanceName = instance[instance.find("::") + 2 :] 
    125135                self.model.addInstanceWaveform(wformName, instanceName, start) 
    126 #                wformRef = self.model.getWaveform(instanceName, WaveformModel.INSTANCE_WAVEFORM) 
    127 #                if start: 
    128 #                    wformRef.isRunning = True 
    129 #                else: 
    130 #                    wformRef.isRunning = False 
     136 
    131137            else: 
    132138                utils.showMessage("Unable to find applications", utils.NON_FATAL) 
     
    167173    ctrlr.CORBAutils.init_CORBA() 
    168174    ctrlr.buildModel() 
    169      
    170175    ctrlr.MainLoop() 
    171      
    172176         
    173177if __name__ == '__main__':