def _init(self):
     super(VehicleModulesView, self)._init()
     configuratedVehicle = self._container.getCurrentVehicle()
     basketVehCmpData = self._container.getBasketVehCmpData()
     self.__configuredVehModulesIDs = set(
         getInstalledModulesCDs(self._container.getInitialVehicleData()[0]))
     self.__initialize(configuratedVehicle.descriptor.makeCompactDescr(),
                       self.__detectModulesType(configuratedVehicle))
     stockVehicle = Vehicle(basketVehCmpData.getStockVehStrCD())
     self.__modulesInstaller = ModulesInstaller(
         getInstalledModulesCDs(stockVehicle))
     self.as_setInitDataS({
         'title':
         _ms(VEH_COMPARE.MODULESVIEW_TITLE, vehName=stockVehicle.userName),
         'resetBtnLabel':
         VEH_COMPARE.MODULESVIEW_RESETBTNLABEL,
         'cancelBtnLabel':
         VEH_COMPARE.MODULESVIEW_CLOSEBTNLABEL,
         'applyBtnLabel':
         VEH_COMPARE.MODULESVIEW_COMPAREBTNLABEL,
         'resetBtnTooltip':
         VEH_COMPARE.MODULESVIEW_RESETBTNLABEL_TOOLTIP,
         'cancelBtnTooltip':
         VEH_COMPARE.MODULESVIEW_CLOSEBTNLABEL_TOOLTIP,
         'applyBtnTooltip':
         VEH_COMPARE.MODULESVIEW_COMPAREBTNLABEL_TOOLTIP
     })
     self.__isInited = True
 def __detectModulesType(self, targetVeh):
     if self.__configuredVehModulesIDs == set(
             getInstalledModulesCDs(targetVeh)):
         if self._container.getBasketVehCmpData().isInInventory():
             return _MODULES_TYPES.CURRENT
         return _MODULES_TYPES.BASIC
     return _MODULES_TYPES.CUSTOM
 def __initialize(self, strCD, modulesType):
     self.__createVehicleData(strCD)
     self.__updateModulesData()
     self.__initialModulesIDs = set(getInstalledModulesCDs(self.__vehicle))
     self.as_setItemS(AVAILABLE_NAMES[self.__vehicle.nationID],
                      self.__nodes)
     self.__updateModulesType(modulesType)
 def _populate(self):
     super(VehicleModulesWindow, self)._populate()
     basketVehicle = self.comparisonBasket.getVehicleAt(self.__vehIndex)
     self.__initialize(basketVehicle.getVehicleStrCD(),
                       basketVehicle.getModulesType())
     self.as_setAttentionVisibleS(basketVehicle.isInInventory()
                                  and not basketVehicle.isActualModules())
     stockVehicle = Vehicle(basketVehicle.getStockVehStrCD())
     self.__modulesInstaller = _ModulesInstaller(
         getInstalledModulesCDs(stockVehicle))
     self.comparisonBasket.onSwitchChange += self.onWindowClose
     self.as_setInitDataS({
         'windowTitle':
         _ms(VEH_COMPARE.MODULESVIEW_WINDOWTITLE,
             vehName=stockVehicle.userName),
         'description':
         text_styles.main(_ms(VEH_COMPARE.MODULESVIEW_DESCRIPTION)),
         'resetBtnLabel':
         VEH_COMPARE.MODULESVIEW_RESETBTNLABEL,
         'closeBtnLabel':
         VEH_COMPARE.MODULESVIEW_CLOSEBTNLABEL,
         'compareBtnLabel':
         VEH_COMPARE.MODULESVIEW_COMPAREBTNLABEL,
         'resetBtnTooltip':
         VEH_COMPARE.MODULESVIEW_RESETBTNLABEL_TOOLTIP,
         'closeBtnTooltip':
         VEH_COMPARE.MODULESVIEW_CLOSEBTNLABEL_TOOLTIP,
         'compareBtnTooltip':
         VEH_COMPARE.MODULESVIEW_COMPAREBTNLABEL_TOOLTIP
     })
 def __updateModulesType(self, modulesType):
     self.__currentModulesType = modulesType
     basketVehicle = self._container.getBasketVehCmpData()
     if basketVehicle.isInInventory():
         btnEnabled = modulesType != _MODULES_TYPES.CURRENT
     else:
         btnEnabled = modulesType != _MODULES_TYPES.BASIC
     self.as_setResetEnabledS(btnEnabled)
     self.as_setApplyEnabledS(self.__initialModulesIDs != set(
         getInstalledModulesCDs(self.__vehicle)))
示例#6
0
 def __initialize(self, strCD, modulesType):
     self.__vehicle = Vehicle(strCD)
     if self.__nodeDataGenerator is not None:
         self.__nodeDataGenerator.setVehicle(vehicle=self.__vehicle)
     else:
         self.__nodeDataGenerator = _PreviewItemsData(
             dumpers.ResearchBaseDumper(), self.__vehicle)
     self.__updateModulesData()
     self.__initialModulesIDs = set(getInstalledModulesCDs(self.__vehicle))
     self.as_setItemS(AVAILABLE_NAMES[self.__vehicle.nationID],
                      self.__nodes)
     self.__updateModulesType(modulesType)
     return
 def _populate(self):
     super(VehicleModulesWindow, self)._populate()
     basketVehicle = getVehicleComparisonBasketCtrl().getVehicleAt(self.__vehIndex)
     self.__initialize(basketVehicle.getVehicleStrCD(), basketVehicle.getModulesType())
     self.as_setAttentionVisibleS(basketVehicle.isInInventory() and not basketVehicle.isActualModules())
     stockVehicle = Vehicle(basketVehicle.getStockVehStrCD())
     self.__modulesInstaller = _ModulesInstaller(getInstalledModulesCDs(stockVehicle))
     getVehicleComparisonBasketCtrl().onSwitchChange += self.onWindowClose
     self.as_setInitDataS({'windowTitle': _ms(VEH_COMPARE.MODULESVIEW_WINDOWTITLE, vehName=stockVehicle.userName),
      'description': text_styles.main(_ms(VEH_COMPARE.MODULESVIEW_DESCRIPTION)),
      'resetBtnLabel': VEH_COMPARE.MODULESVIEW_RESETBTNLABEL,
      'closeBtnLabel': VEH_COMPARE.MODULESVIEW_CLOSEBTNLABEL,
      'compareBtnLabel': VEH_COMPARE.MODULESVIEW_COMPAREBTNLABEL,
      'resetBtnTooltip': VEH_COMPARE.MODULESVIEW_RESETBTNLABEL_TOOLTIP,
      'closeBtnTooltip': VEH_COMPARE.MODULESVIEW_CLOSEBTNLABEL_TOOLTIP,
      'compareBtnTooltip': VEH_COMPARE.MODULESVIEW_COMPAREBTNLABEL_TOOLTIP})
示例#8
0
 def _setModuleInstaller(cls, vehicleCD):
     stockVehicle = cls._itemsCache.items.getStockVehicle(vehicleCD)
     cls._moduleInstaller = ModuleDependencies(
         getInstalledModulesCDs(stockVehicle))