Changeset 9353
- Timestamp:
- 05/14/09 12:41:47 (4 years ago)
- Location:
- ossiedev/branches/0.7.x/tools/wavedash/src
- Files:
-
- 2 modified
-
ComponentModel.py (modified) (6 diffs)
-
WavedashController.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/0.7.x/tools/wavedash/src/ComponentModel.py
r9211 r9353 3 3 from PropertyModel import Property 4 4 from PropertyWidgets import WidgetContainer 5 import sys 5 6 6 7 class ComponentEvent: … … 33 34 components' attributes and methods """ 34 35 35 def __init__(self, parent, id, name, pos, spd_file, controller, visib ility= True):36 def __init__(self, parent, id, name, pos, spd_file, controller, visible = True): 36 37 self.id = id 37 38 self.parent = parent … … 40 41 self.spdFile = str(spd_file) 41 42 self.controller = controller 42 self.visib ility = visibility43 self.visible = visible 43 44 self.properties = [] 44 45 self.buildProperties(controller) … … 60 61 61 62 def hide(self): 62 self.visib ility= False63 self.visible = False 63 64 64 65 def show(self): 65 self.visib ility= True66 self.visible = True 66 67 67 68 def isVisible(self): 68 return self.visib ility69 return self.visible 69 70 70 71 def getParent(self): … … 102 103 if newPrpList is None: 103 104 return 104 105 106 105 for newprp in newPrpList: 107 106 prp = self.findPropertyByID(newprp.id) 108 prp.setValue(newprp.value._v) 107 if (prp is not None): 108 prp.setValue(newprp.value._v) 109 109 110 111 110 # print newPrpList 112 111 return … … 154 153 prpList = prpNode.childNodes 155 154 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) 161 198 162 id = prp.attributes['id'].value163 name = prp.attributes['name'].value164 type = (str(prp.tagName), str(prp.attributes['type'].value))165 mode = prp.attributes['mode'].value166 167 desc = ''168 value = None169 range = (0,0)170 actionType = ''171 kindType = ''172 173 #Iterate through children of <simple> tag to update desc, value and kindType174 for child in prp.childNodes:175 if (child.nodeType == Node.ELEMENT_NODE):176 if (child.tagName == 'description'):177 desc = child.firstChild.data178 elif (child.tagName == 'value'):179 value = child.firstChild.data180 elif (child.tagName == 'kind'):181 kindType = child.attributes['kindtype'].value182 elif (child.tagName == 'range'):183 min = child.childNodes[1].firstChild.data184 max = child.childNodes[3].firstChild.data185 range = (min, max)186 elif (child.tagName == 'action'):187 actionType = child.attributes['type'].value188 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 195 199 def changePropWidget(self, property, newWidgetType): 196 200 prpRef = self.findPropertyByName(property) -
ossiedev/branches/0.7.x/tools/wavedash/src/WavedashController.py
r9211 r9353 21 21 import os 22 22 import wx 23 import sys 23 24 import xml.dom.minidom as minidom 24 25 from WavedashModel import WavedashModel … … 50 51 sadFileList = self.getFileList(SDR_WAVEFORMS_DIR, SAD_XML) #list holding sad files of all the system waveforms 51 52 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 52 60 self.model.buildWaveforms(sadFileList, dasFileList) 53 61 … … 97 105 abs_file_path = dirpath + "/" + fname 98 106 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) 100 110 101 111 if not fileFound: … … 124 134 instanceName = instance[instance.find("::") + 2 :] 125 135 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 131 137 else: 132 138 utils.showMessage("Unable to find applications", utils.NON_FATAL) … … 167 173 ctrlr.CORBAutils.init_CORBA() 168 174 ctrlr.buildModel() 169 170 175 ctrlr.MainLoop() 171 172 176 173 177 if __name__ == '__main__':