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
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]