Пример #1
0
 def __init__(self,
              vehicle,
              item,
              itemType,
              slotIdx,
              install=True,
              conflictedEqs=None,
              plugs=tuple(),
              skipConfirm=False):
     opType = 'apply' if install else 'remove'
     conflictedEqs = conflictedEqs or tuple()
     ModuleProcessor.__init__(self, item=item, opType=opType, plugs=plugs)
     VehicleItemProcessor.__init__(self,
                                   vehicle=vehicle,
                                   module=item,
                                   allowableTypes=itemType)
     addPlugins = []
     if install:
         addPlugins += (plugins.CompatibilityInstallValidator(
             vehicle, item, slotIdx),
                        plugins.MessageConfirmator(
                            'removeIncompatibleEqs',
                            ctx={
                                'name':
                                "', '".join(
                                    [eq.userName for eq in conflictedEqs])
                            },
                            isEnabled=bool(conflictedEqs)
                            and not skipConfirm))
     else:
         addPlugins += (plugins.CompatibilityRemoveValidator(vehicle,
                                                             item), )
     self.install = install
     self.slotIdx = slotIdx
     self.addPlugins(addPlugins)
Пример #2
0
 def __init__(self,
              vehicle,
              item,
              itemType,
              slotIdx,
              install=True,
              conflictedEqs=None,
              plugs=tuple()):
     """
     Ctor.
     
     @param vehicle: vehicle
     @param item: module to install
     @param slotIdx: vehicle equipment slot index to install
     @param itemType: item type
     @param install: flag to designated process
     @param conflictedEqs: conflicted items
     @param plugs: plugins list
     """
     opType = 'apply' if install else 'remove'
     if not conflictedEqs:
         conflictedEqs = tuple()
         ModuleProcessor.__init__(self,
                                  item=item,
                                  opType=opType,
                                  plugs=plugs)
         VehicleItemProcessor.__init__(self,
                                       vehicle=vehicle,
                                       module=item,
                                       allowableTypes=itemType)
         addPlugins = []
         install and addPlugins += (plugins.CompatibilityInstallValidator(
             vehicle, item, slotIdx),
                                    plugins.MessageConfirmator(
                                        'removeIncompatibleEqs',
                                        ctx={
                                            'name':
                                            "', '".join([
                                                VehicleItem(
                                                    descriptor=eq).name
                                                for eq in conflictedEqs
                                            ])
                                        },
                                        isEnabled=bool(conflictedEqs)))
     else:
         addPlugins += (plugins.CompatibilityRemoveValidator(vehicle,
                                                             item), )
     self.install = install
     self.slotIdx = slotIdx
     self.addPlugins(addPlugins)