def _extendByModuleData(targetData, vehicleModule, vehDescr, extenders): moduleType = vehicleModule.itemTypeID values, names = [], [] paramsData = params_helper.getParameters(vehicleModule, vehDescr) paramsList = _PARAMS_LISTS[moduleType] serverSettings = dependency.instance(ISettingsCore).serverSettings for ext in extenders: if ext.check(vehicleModule, vehDescr): paramsList, indexes = ext.extendParamList(paramsList) if ext.highlightCheck(serverSettings) and indexes: targetData['highlightedParameterIdx'] = indexes[0] ext.updatedHighlightSettings(serverSettings) for paramName in paramsList: value = paramsData.get(paramName) if value is not None: values.append(_formatValuesString(formatParameter(paramName, value))) names.append(formatModuleParamName(paramName, vehDescr)) targetData['level'] = vehicleModule.level targetData['paramValues'] = '\n'.join(values) targetData['paramNames'] = '\n'.join(names) targetData['name'] = text_styles.middleTitle(vehicleModule.userName) targetData[EXTRA_MODULE_INFO] = vehicleModule.getExtraIconInfo(vehDescr) return
def __buildParams(self, module): values, names = [], [] paramsData = params_helper.getParameters(module) for paramName in _PARAMS_LISTS[self._slotType]: value = paramsData.get(paramName) values.append(_formatValuesString(baseFormatParameter(paramName, value))) names.append(formatModuleParamName(paramName)) return ('\n'.join(values), '\n'.join(names))
def __buildParams(self, module): values, names = [], [] paramsData = params_helper.getParameters(module) for paramName in _PARAMS_LISTS[self._slotType]: value = paramsData.get(paramName) if value is not None: values.append(_formatValuesString(formatParameter(paramName, value))) names.append(formatModuleParamName(paramName)) return ('\n'.join(values), '\n'.join(names))
def construct(self): module = self.module vehicle = self.configuration.vehicle params = self.configuration.params block = [] vDescr = vehicle.descriptor if vehicle is not None else None moduleParams = params_helper.getParameters(module, vDescr) paramsKeyName = module.itemTypeID if params: reloadingType = None if module.itemTypeID == GUI_ITEM_TYPE.GUN: reloadingType = module.getReloadingType(vehicle.descriptor if vehicle is not None else None) if reloadingType == GUN_CLIP: paramsKeyName = self.CLIP_GUN_MODULE_PARAM paramsList = self.MODULE_PARAMS.get(paramsKeyName, []) if vehicle is not None: if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE: currModule = module else: currModuleDescr, _ = vehicle.descriptor.getComponentsByType(module.itemTypeName) currModule = self.itemsCache.items.getItemByCD(currModuleDescr.compactDescr) comparator = params_helper.itemsComparator(module, currModule, vehicle.descriptor) for paramName in paramsList: if paramName in moduleParams: paramInfo = comparator.getExtendedData(paramName) fmtValue = params_formatters.colorizedFormatParameter(paramInfo, self.__colorScheme) if fmtValue is not None: block.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName(paramName), value=fmtValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))) else: formattedModuleParameters = params_formatters.getFormattedParamsList(module.descriptor, moduleParams) for paramName, paramValue in formattedModuleParameters: if paramName in paramsList and paramValue is not None: block.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName(paramName), value=paramValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))) if block: block.insert(0, formatters.packTextBlockData(text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8))) return block
def construct(self): module = self.module vehicle = self.configuration.vehicle params = self.configuration.params block = [] vDescr = vehicle.descriptor if vehicle is not None else None moduleParams = dict(params_helper.getParameters(module, vDescr)) paramsKeyName = module.itemTypeID if params: reloadingType = None if module.itemTypeID == GUI_ITEM_TYPE.GUN: reloadingType = module.getReloadingType(vehicle.descriptor if vehicle is not None else None) if reloadingType == GUN_CLIP: paramsKeyName = self.CLIP_GUN_MODULE_PARAM paramsList = self.MODULE_PARAMS.get(paramsKeyName, []) if vehicle is not None: if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE: currModule = module else: currModuleDescr, _ = vehicle.descriptor.getComponentsByType(module.itemTypeName) currModule = g_itemsCache.items.getItemByCD(currModuleDescr['compactDescr']) comparator = params_helper.itemsComparator(module, currModule, vehicle.descriptor) for paramName in paramsList: if paramName in moduleParams: paramInfo = comparator.getExtendedData(paramName) fmtValue = params_formatters.colorizedFormatParameter(paramInfo, params_formatters.BASE_FORMATTERS) if fmtValue is not None: block.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName(paramName), value=fmtValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))) else: formattedModuleParameters = params_formatters.getFormattedParamsList(module.descriptor, moduleParams) for paramName, paramValue in formattedModuleParameters: if paramName in paramsList and paramValue is not None: block.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName(paramName), value=paramValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))) if len(block) > 0: block.insert(0, formatters.packTextBlockData(text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8))) return block
def _extendByModuleData(targetData, module, vehDescr): moduleType = module.itemTypeID if not moduleType in GUI_ITEM_TYPE.VEHICLE_MODULES: raise AssertionError values, names = [], [] paramsData = params_helper.getParameters(module) for paramName in _PARAMS_LISTS[moduleType]: value = paramsData.get(paramName) if value is not None: values.append(_formatValuesString(formatParameter(paramName, value))) names.append(formatModuleParamName(paramName)) targetData['level'] = module.level targetData['paramValues'] = '\n'.join(values) targetData['paramNames'] = '\n'.join(names) targetData['name'] = text_styles.middleTitle(module.userName) if moduleType == GUI_ITEM_TYPE.GUN: targetData[EXTRA_MODULE_INFO] = module.isClipGun(vehDescr) and CLIP_ICON_PATH elif moduleType == GUI_ITEM_TYPE.CHASSIS: if module.isHydraulicChassis(): targetData[EXTRA_MODULE_INFO] = HYDRAULIC_ICON_PATH return
def _extendByModuleData(targetData, vehicleModule, vehDescr): moduleType = vehicleModule.itemTypeID values, names = [], [] paramsData = params_helper.getParameters(vehicleModule, vehDescr) paramsList = _PARAMS_LISTS[moduleType] if vehicleModule.itemTypeID == GUI_ITEM_TYPE.GUN and vehicleModule.isAutoReloadable(vehDescr): paramsList = paramsList[:-1] + ('autoReloadTime',) serverSettings = dependency.instance(ISettingsCore).serverSettings if serverSettings.checkAutoReloadHighlights(): targetData['highlightedParameterIdx'] = 2 for paramName in paramsList: value = paramsData.get(paramName) if value is not None: values.append(_formatValuesString(formatParameter(paramName, value))) names.append(formatModuleParamName(paramName)) targetData['level'] = vehicleModule.level targetData['paramValues'] = '\n'.join(values) targetData['paramNames'] = '\n'.join(names) targetData['name'] = text_styles.middleTitle(vehicleModule.userName) targetData[EXTRA_MODULE_INFO] = vehicleModule.getExtraIconInfo(vehDescr) return
def _populate(self): super(View, self)._populate() module = self.itemsCache.items.getItemByCD(self.moduleCompactDescr) description = '' if module.itemTypeID in (GUI_ITEM_TYPE.OPTIONALDEVICE, GUI_ITEM_TYPE.EQUIPMENT): description = stripColorTagDescrTags(module.fullDescription) if module.itemTypeID in (GUI_ITEM_TYPE.OPTIONALDEVICE, GUI_ITEM_TYPE.SHELL, GUI_ITEM_TYPE.EQUIPMENT): icon = module.icon else: icon = module.level extraModuleInfo = '' moduleData = { 'name': module.longUserName, 'windowTitle': ' '.join( [module.longUserName, i18n.makeString(MENU.MODULEINFO_TITLE)]), 'type': module.itemTypeName, 'description': description, 'level': icon, 'params': [], 'compatible': [], 'effects': {}, 'moduleLabel': module.getGUIEmblemID(), 'moduleLevel': module.level } params = params_helper.get(module, self.__vehicleDescr) moduleParameters = params.get('parameters', {}) formattedModuleParameters = formatters.getFormattedParamsList( module.descriptor, moduleParameters) extraParamsInfo = params.get('extras', {}) isGun = module.itemTypeID == GUI_ITEM_TYPE.GUN isShell = module.itemTypeID == GUI_ITEM_TYPE.SHELL isChassis = module.itemTypeID == GUI_ITEM_TYPE.CHASSIS isOptionalDevice = module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE excludedParametersNames = extraParamsInfo.get('excludedParams', tuple()) highlightPossible = False if isGun: if 'maxShotDistance' in moduleParameters: if moduleParameters['maxShotDistance'] >= _DEF_SHOT_DISTANCE: excludedParametersNames += ('maxShotDistance', ) gunReloadingType = extraParamsInfo[GUN_RELOADING_TYPE] if gunReloadingType == GUN_CLIP: description = i18n.makeString(MENU.MODULEINFO_CLIPGUNLABEL) extraModuleInfo = RES_ICONS.MAPS_ICONS_MODULES_MAGAZINEGUNICON elif gunReloadingType == GUN_AUTO_RELOAD: description = i18n.makeString( MENU.MODULEINFO_AUTORELOADGUNLABEL) extraModuleInfo = RES_ICONS.MAPS_ICONS_MODULES_AUTOLOADERGUN self._settingsCore.serverSettings.saveInUIStorage( {UI_STORAGE_KEYS.AUTO_RELOAD_MARK_IS_SHOWN: True}) highlightPossible = self._settingsCore.serverSettings.checkAutoReloadHighlights( increase=True) elif gunReloadingType == GUN_CAN_BE_CLIP: otherParamsInfoList = [] for paramName, paramValue in formattedModuleParameters: if paramName in excludedParametersNames: otherParamsInfoList.append({ 'type': formatters.formatModuleParamName(paramName) + '\n', 'value': text_styles.stats(paramValue) }) moduleData['otherParameters'] = { 'headerText': i18n.makeString( MENU.MODULEINFO_PARAMETERSCLIPGUNLABEL, getAbsoluteUrl( RES_ICONS.MAPS_ICONS_MODULES_MAGAZINEGUNICON)), 'params': otherParamsInfoList } if isChassis: if moduleParameters['isHydraulic']: description = i18n.makeString( MENU.MODULEINFO_HYDRAULICCHASSISLABEL) extraModuleInfo = RES_ICONS.MAPS_ICONS_MODULES_HYDRAULICCHASSISICON moduleData['description'] = description paramsList = [] for paramName, paramValue in formattedModuleParameters: if paramName not in excludedParametersNames: paramRow = { 'type': formatters.formatModuleParamName(paramName) + '\n', 'value': text_styles.stats(paramValue) } if highlightPossible and paramName == AUTO_RELOAD_PROP_NAME: paramRow['highlight'] = True paramsList.append(paramRow) moduleData['parameters'] = { 'headerText': i18n.makeString(MENU.MODULEINFO_PARAMETERSLABEL) if paramsList else '', 'params': paramsList } moduleData[EXTRA_MODULE_INFO] = extraModuleInfo moduleCompatibles = params.get('compatible', tuple()) for paramType, paramValue in moduleCompatibles: compatible = moduleData.get('compatible') compatible.append({ 'type': i18n.makeString(MENU.moduleinfo_compatible(paramType)), 'value': paramValue }) if module.itemTypeID == GUI_ITEM_TYPE.EQUIPMENT: effectsNametemplate = '#artefacts:%s/%s' if self.lobbyContext.getServerSettings( ).spgRedesignFeatures.isStunEnabled(): isRemovingStun = module.isRemovingStun else: isRemovingStun = False onUseStr = 'removingStun/onUse' if isRemovingStun else 'onUse' moduleData['effects'] = { 'effectOnUse': i18n.makeString(effectsNametemplate % (module.name, onUseStr)), 'effectAlways': i18n.makeString(effectsNametemplate % (module.name, 'always')), 'effectRestriction': i18n.makeString(effectsNametemplate % (module.name, 'restriction')) } cooldownSeconds = module.descriptor.cooldownSeconds if cooldownSeconds > 0: moduleData['addParams'] = { 'type': formatters.formatModuleParamName('cooldownSeconds') + '\n', 'value': text_styles.stats(cooldownSeconds) + '\n' } if isShell and self.__isAdditionalInfoShow is not None: moduleData['additionalInfo'] = self.__isAdditionalInfoShow if isOptionalDevice: moduleData[ 'highlightType'] = SLOT_HIGHLIGHT_TYPES.EQUIPMENT_PLUS if module.isDeluxe( ) else SLOT_HIGHLIGHT_TYPES.NO_HIGHLIGHT self.as_setModuleInfoS(moduleData) self._updateActionButton() return
def _packBlocks(self, *args, **kwargs): self.item = self.context.buildItem(*args, **kwargs) items = super(ModuleBlockTooltipData, self)._packBlocks() module = self.item statsConfig = self.context.getStatsConfiguration(module) paramsConfig = self.context.getParamsConfiguration(module) statusConfig = self.context.getStatusConfiguration(module) leftPadding = 20 rightPadding = 20 topPadding = 20 blockTopPadding = -4 blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding) textGap = -2 valueWidth = 110 items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding))) effectsItems = [] replaceItems = [] if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: if module.itemTypeID == GUI_ITEM_TYPE.EQUIPMENT: cooldownSeconds = module.descriptor.cooldownSeconds if cooldownSeconds > 0: items.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName('cooldownSeconds'), value=text_styles.stats(int(cooldownSeconds)), valueWidth=valueWidth, padding=formatters.packPadding(left=leftPadding))) effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if effectsBlock: effectsItems.append(formatters.packBuildUpBlockData(effectsBlock)) if statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle): if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx, True) else: comparator = params_helper.itemOnVehicleComparator(statsConfig.vehicle, module) stockParams = params_helper.getParameters(self.itemsCache.items.getStockVehicle(statsConfig.vehicle.intCD)) currentOptDev = None if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE: if statsConfig.vehicle.descriptor.optionalDevices[statsConfig.slotIdx] is not None: compactDescr = statsConfig.vehicle.descriptor.optionalDevices[statsConfig.slotIdx].compactDescr currentOptDev = self.itemsFactory.createOptionalDevice(compactDescr) if currentOptDev is not None and not module.isSimilarDevice(currentOptDev) or currentOptDev is None and module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE or module.itemTypeID == GUI_ITEM_TYPE.EQUIPMENT: simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if simplifiedBlock: effectsItems.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-3, bottom=1))) if statsConfig.vehicle.optDevices[statsConfig.slotIdx]: if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: if currentOptDev is not None and module.isSimilarDevice(currentOptDev): comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx, False) else: comparator = params_helper.artifactRemovedComparator(statsConfig.vehicle, self.item, statsConfig.slotIdx) simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if simplifiedBlock: replaceBlock = ModuleReplaceBlockConstructor(module, statsConfig, valueWidth, leftPadding).construct() if replaceBlock: replaceItems.append(formatters.packBuildUpBlockData(replaceBlock)) replaceItems.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=2, bottom=1))) if effectsItems: items.append(formatters.packBuildUpBlockData(effectsItems, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, stretchBg=True)) if replaceItems: items.append(formatters.packBuildUpBlockData(replaceItems, gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=blockPadding, stretchBg=True)) priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct() if priceBlock: self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH) items.append(formatters.packBuildUpBlockData(priceBlock, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-1, bottom=-3), gap=textGap)) statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,) if module.itemTypeID in statsModules: commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding, params_formatters.BASE_SCHEME).construct() if commonStatsBlock: items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap)) statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if statusBlock: items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding)) if bonus_helper.isSituationalBonus(module.name): items.append(formatters.packImageTextBlockData(title='', desc=text_styles.standard(TOOLTIPS.VEHICLEPARAMS_BONUS_SITUATIONAL), img=RES_ICONS.MAPS_ICONS_TOOLTIP_ASTERISK_OPTIONAL, imgPadding=formatters.packPadding(left=4, top=3), txtGap=-4, txtOffset=20, padding=formatters.packPadding(left=59, right=20))) if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE and statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle) and module.hasSimilarDevicesInstalled(statsConfig.vehicle): items.append(formatters.packBuildUpBlockData(SimilarOptionalDeviceBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct(), gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=2), stretchBg=False)) return items
def _populate(self): super(View, self)._populate() module = g_itemsCache.items.getItemByCD(self.moduleCompactDescr) description = '' if module.itemTypeName in (ITEM_TYPE_NAMES[9], ITEM_TYPE_NAMES[11]): description = stripShortDescrTags(module.fullDescription) if module.itemTypeName in (ITEM_TYPE_NAMES[9], ITEM_TYPE_NAMES[10], ITEM_TYPE_NAMES[11]): icon = module.icon else: icon = module.level extraModuleInfo = '' moduleData = { 'name': module.longUserName, 'windowTitle': ' '.join( [module.longUserName, i18n.makeString(MENU.MODULEINFO_TITLE)]), 'type': module.itemTypeName, 'description': description, 'level': icon, 'params': [], 'compatible': [], 'effects': {}, 'moduleLabel': module.getGUIEmblemID(), 'moduleLevel': module.level } params = params_helper.get(module, self.__vehicleDescr) moduleParameters = params.get('parameters', {}) formattedModuleParameters = formatters.getFormattedParamsList( module.descriptor, moduleParameters) extraParamsInfo = params.get('extras', {}) isGun = module.itemTypeName == ITEM_TYPE_NAMES[4] isShell = module.itemTypeName == ITEM_TYPE_NAMES[10] isChassis = module.itemTypeName == ITEM_TYPE_NAMES[2] excludedParametersNames = extraParamsInfo.get('excludedParams', tuple()) if isGun: if 'maxShotDistance' in moduleParameters: if moduleParameters['maxShotDistance'] >= _DEF_SHOT_DISTANCE: excludedParametersNames += ('maxShotDistance', ) gunReloadingType = extraParamsInfo[GUN_RELOADING_TYPE] if gunReloadingType == GUN_CLIP: description = i18n.makeString(MENU.MODULEINFO_CLIPGUNLABEL) extraModuleInfo = CLIP_ICON_PATH elif gunReloadingType == GUN_CAN_BE_CLIP: otherParamsInfoList = [] for paramName, paramValue in formattedModuleParameters: if paramName in excludedParametersNames: otherParamsInfoList.append({ 'type': formatters.formatModuleParamName(paramName) + '\n', 'value': text_styles.stats(paramValue) }) imgPathArr = CLIP_ICON_PATH.split('..') imgPath = 'img://gui' + imgPathArr[1] moduleData['otherParameters'] = { 'headerText': i18n.makeString(MENU.MODULEINFO_PARAMETERSCLIPGUNLABEL, imgPath), 'params': otherParamsInfoList } if isChassis: if moduleParameters['isHydraulic']: description = i18n.makeString( MENU.MODULEINFO_HYDRAULICCHASSISLABEL) extraModuleInfo = HYDRAULIC_ICON_PATH moduleData['description'] = description paramsList = [] for paramName, paramValue in formattedModuleParameters: if paramName not in excludedParametersNames: paramsList.append({ 'type': formatters.formatModuleParamName(paramName) + '\n', 'value': text_styles.stats(paramValue) }) moduleData['parameters'] = { 'headerText': i18n.makeString(MENU.MODULEINFO_PARAMETERSLABEL) if len(paramsList) > 0 else '', 'params': paramsList } moduleData[EXTRA_MODULE_INFO] = extraModuleInfo moduleCompatibles = params.get('compatible', tuple()) for paramType, paramValue in moduleCompatibles: compatible = moduleData.get('compatible') compatible.append({ 'type': i18n.makeString(MENU.moduleinfo_compatible(paramType)), 'value': paramValue }) if module.itemTypeName == ITEM_TYPE_NAMES[11]: effectsNametemplate = '#artefacts:%s/%s' moduleData['effects'] = { 'effectOnUse': i18n.makeString(effectsNametemplate % (module.name, 'onUse')), 'effectAlways': i18n.makeString(effectsNametemplate % (module.name, 'always')), 'effectRestriction': i18n.makeString(effectsNametemplate % (module.name, 'restriction')) } if isShell and self.__isAdditionalInfoShow is not None: moduleData['additionalInfo'] = self.__isAdditionalInfoShow self.as_setModuleInfoS(moduleData) self._updateActionButton() return
def _populate(self): super(View, self)._populate() module = g_itemsCache.items.getItemByCD(self.moduleCompactDescr) description = '' if module.itemTypeName in (ITEM_TYPE_NAMES[9], ITEM_TYPE_NAMES[11]): description = stripShortDescrTags(module.fullDescription) if module.itemTypeName in (ITEM_TYPE_NAMES[9], ITEM_TYPE_NAMES[10], ITEM_TYPE_NAMES[11]): icon = module.icon else: icon = module.level extraModuleInfo = '' moduleData = {'name': module.longUserName, 'windowTitle': ' '.join([module.longUserName, i18n.makeString(MENU.MODULEINFO_TITLE)]), 'type': module.itemTypeName, 'description': description, 'level': icon, 'params': [], 'compatible': [], 'effects': {}, 'moduleLabel': module.getGUIEmblemID(), 'moduleLevel': module.level} params = params_helper.get(module, self.__vehicleDescr) moduleParameters = params.get('parameters', {}) formattedModuleParameters = formatters.getFormattedParamsList(module.descriptor, moduleParameters) extraParamsInfo = params.get('extras', {}) isGun = module.itemTypeName == ITEM_TYPE_NAMES[4] isShell = module.itemTypeName == ITEM_TYPE_NAMES[10] excludedParametersNames = extraParamsInfo.get('excludedParams', tuple()) if isGun: if 'maxShotDistance' in moduleParameters: if moduleParameters['maxShotDistance'] >= _DEF_SHOT_DISTANCE: excludedParametersNames += ('maxShotDistance',) gunReloadingType = extraParamsInfo[GUN_RELOADING_TYPE] if gunReloadingType == GUN_CLIP: description = i18n.makeString(MENU.MODULEINFO_CLIPGUNLABEL) extraModuleInfo = CLIP_ICON_PATH elif gunReloadingType == GUN_CAN_BE_CLIP: otherParamsInfoList = [] for paramName, paramValue in formattedModuleParameters: if paramName in excludedParametersNames: otherParamsInfoList.append({'type': formatters.formatModuleParamName(paramName) + '\n', 'value': text_styles.stats(paramValue)}) imgPathArr = CLIP_ICON_PATH.split('..') imgPath = 'img://gui' + imgPathArr[1] moduleData['otherParameters'] = {'headerText': i18n.makeString(MENU.MODULEINFO_PARAMETERSCLIPGUNLABEL, imgPath), 'params': otherParamsInfoList} moduleData['description'] = description paramsList = [] for paramName, paramValue in formattedModuleParameters: if paramName not in excludedParametersNames: paramsList.append({'type': formatters.formatModuleParamName(paramName) + '\n', 'value': text_styles.stats(paramValue)}) moduleData['parameters'] = {'headerText': i18n.makeString(MENU.MODULEINFO_PARAMETERSLABEL) if len(paramsList) > 0 else '', 'params': paramsList} moduleData[EXTRA_MODULE_INFO] = extraModuleInfo moduleCompatibles = params.get('compatible', tuple()) for paramType, paramValue in moduleCompatibles: compatible = moduleData.get('compatible') compatible.append({'type': i18n.makeString(MENU.moduleinfo_compatible(paramType)), 'value': paramValue}) if module.itemTypeName == ITEM_TYPE_NAMES[11]: effectsNametemplate = '#artefacts:%s/%s' moduleData['effects'] = {'effectOnUse': i18n.makeString(effectsNametemplate % (module.name, 'onUse')), 'effectAlways': i18n.makeString(effectsNametemplate % (module.name, 'always')), 'effectRestriction': i18n.makeString(effectsNametemplate % (module.name, 'restriction'))} if isShell and self.__isAdditionalInfoShow is not None: moduleData['additionalInfo'] = self.__isAdditionalInfoShow self.as_setModuleInfoS(moduleData) self._updateActionButton() return