Ejemplo n.º 1
0
 def getUnits(self):
     units = []
     for unit in self.units:
         for part in self.parts:
             if part.contains(unit.rect):
                 units.append(unitMap[part.color]())
     return units
Ejemplo n.º 2
0
 def getUnits(self):
     units = []
     for unit in self.units:
         for part in self.parts:
             if part.contains(unit.rect):
                 units.append(unitMap[part.color]())
     return units
Ejemplo n.º 3
0
 def ValueList(self, typeId, value):
     # Given a numberic value in the default unit, returns a list
     # containing the same values in all different units
     baseValue = self.ConvertFromDefaultToBase(typeId, value)
     results = []
     units = []
     for unitSetName in self.myUnitSystem.GetSetNames():
         us = self.myUnitSystem.GetUnitSet(unitSetName)
         unitItem = self.myUnitSystem.GetUnit(us, typeId)
         if not unitItem.name in units:
             units.append(unitItem.name)
             results.append(unitItem.ConvertFromBase(baseValue))
     return [results, units]
Ejemplo n.º 4
0
 def ValueList(self, typeId, value):
     # Given a numberic value in the default unit, returns a list
     # containing the same values in all different units
     baseValue = self.ConvertFromDefaultToBase(typeId, value)
     results = []
     units = []
     for unitSetName in self.myUnitSystem.GetSetNames():
         us = self.myUnitSystem.GetUnitSet(unitSetName)
         unitItem = self.myUnitSystem.GetUnit(us, typeId)
         if not unitItem.name in units:
             units.append(unitItem.name)
             results.append(unitItem.ConvertFromBase(baseValue))
     return [results, units]