def __init__(self, vehsItems, itemTypeIDs = None):
     super(VehsSuitableCriteria, self).__init__(PredicateCondition(self._checkItem))
     itemTypeIDs = itemTypeIDs or GUI_ITEM_TYPE.VEHICLE_MODULES
     self.suitableCompDescrs = set()
     for vehicle in vehsItems:
         for itemTypeID in itemTypeIDs:
             for descr in getVehicleSuitablesByType(vehicle.descriptor, itemTypeID)[0]:
                 self.suitableCompDescrs.add(descr['compactDescr'])
    def __init__(self, vehsItems, itemTypeIDs=None):
        itemTypeIDs = itemTypeIDs or GUI_ITEM_TYPE.VEHICLE_MODULES
        suitableCompDescrs = set()
        for vehicle in vehsItems:
            for itemTypeID in itemTypeIDs:
                for descr in getVehicleSuitablesByType(vehicle.descriptor, itemTypeID)[0]:
                    suitableCompDescrs.add(descr.compactDescr)

        super(VehsSuitableCriteria, self).__init__(PredicateCondition(lambda item: item.intCD in suitableCompDescrs))
Beispiel #3
0
 def __init__(self, vehsItems, itemTypeIDs=None):
     super(VehsSuitableCriteria,
           self).__init__(PredicateCondition(self._checkItem))
     itemTypeIDs = itemTypeIDs or GUI_ITEM_TYPE.VEHICLE_MODULES
     self.suitableCompDescrs = set()
     for vehicle in vehsItems:
         for itemTypeID in itemTypeIDs:
             for descr in getVehicleSuitablesByType(vehicle.descriptor,
                                                    itemTypeID)[0]:
                 self.suitableCompDescrs.add(descr['compactDescr'])
Beispiel #4
0
    def __getComponentVehiclesNames(self, typeCompactDescr):
        from gui.shared.gui_items import getVehicleSuitablesByType
        itemTypeIdx, nationIdx, typeIdx = vehicles.parseIntCompactDescr(typeCompactDescr)
        result = list()
        for vDescr in self.__getItems(vehicles._VEHICLE, nationIdx):
            components, _ = getVehicleSuitablesByType(vDescr, itemTypeIdx)
            filtered = filter(lambda item: item['compactDescr'] == typeCompactDescr, components)
            if len(filtered):
                result.append(vDescr.type.userString)

        return result
    def __getComponentVehiclesNames(self, typeCompactDescr):
        from gui.shared.gui_items import getVehicleSuitablesByType
        itemTypeIdx, nationIdx, typeIdx = vehicles.parseIntCompactDescr(typeCompactDescr)
        result = list()
        for vDescr in self.__getItems(vehicles._VEHICLE, nationIdx):
            components, _ = getVehicleSuitablesByType(vDescr, itemTypeIdx)
            filtered = filter(lambda item: item['compactDescr'] == typeCompactDescr, components)
            if len(filtered):
                result.append(vDescr.type.userString)

        return result