예제 #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
예제 #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
예제 #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]
예제 #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]