Changeset 4312

Show
Ignore:
Timestamp:
07/11/07 14:13:23 (6 years ago)
Author:
DrewCormier
Message:

added code that should write the get props stuff in the configure method. need to check for typos

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • WaveDev/trunk/WaveDev/wavedev/generate/templates/py_comp/genStructure.py

    r4310 r4312  
    220220  #------------------------------------------------------------------------------------- 
    221221  def writeReadProps(self,output,comp): 
    222     #TODO: support this method 
    223     ts = "" 
    224     output.write(ts) 
     222    '''write teh code that will read propeties from the prf file''' 
     223    simpleCount = 0 
     224    simplesequenceCount = 0 
     225 
     226    # check to make sure there are properties 
     227    # TODO: use a more efficient method 
     228    props_present = False 
     229    for p in comp.properties: 
     230        props_present = True 
     231 
     232    # if there are properties present, open up a for loop to cycle through them 
     233    if props_present: 
     234        ts = " "*8 + "for property in props:\n" 
     235        output.write(ts) 
     236 
     237    for p in comp.properties: 
     238        if p.elementType == "Simple": 
     239            ts = " "*12 + "if property not in self.propertySet:\n"; output.write(ts) 
     240            ts = " "*16 + "self.propertySet.append(property)\n"; output.write(ts) 
     241            ts = " "*12 + "if property.id == '" +  p.id + "':\n"; output.write(ts) 
     242            # TODO: find out if int() type casting is needed 
     243            ts = " "*16 + "simpleProperty" + str(simpleCount) + " = int(property.value.value())\n"; output.write(ts)  
     244            simpleCount = simpleCount + 1 
     245 
     246        elif p.elementType == "SimpleSequence": 
     247            ts = " "*12 + "if property not in self.propertySet:\n"; output.write(ts) 
     248            ts = " "*16 + "self.propertySet.append(property)\n"; output.write(ts) 
     249            ts = " "*12 + "if property.id == '" +  p.id + "':\n"; output.write(ts) 
     250            ts = " "*16 + "simpleSequenceProperty" + str(simplesequenceCount) + " = []\n"; output.write(ts) 
     251            # TODO: find out if int() type casting is needed 
     252            ts = " "*16 + "simpleSequenceProperty" + str(simplesequenceCount) + ".extend(int([val for val in property.values.value()))\n"; output.write(ts)  
     253            simplesequenceCount = simplesequenceCount + 1 
     254 
     255        else: 
     256            print "Element types other than simple and simple sequence not supported in writeReadProps in generate/templates/py_comp/genStructure.py" 
     257            return 
     258 
     259 
     260 
    225261  #------------------------------------------------------------------------------------- 
    226262