def _buildVehicleBranch(self): self._verifySlotNotifier() self._startSlotNotifier() self._vehicleBranch = [] freeSlotsCount = len( self._nyController.getVehicleBranch().getFreeVehicleSlots()) tankTreeAvailable = self._nyController.getVehicleBranch( ).hasAvailableSlots() smallNyTankString, nyTankString = getStatusStrings( 'nyTank', style=text_styles.nyVehicleSmallTitle, styleLarge=text_styles.nyVehicleTitle) if freeSlotsCount == 0 and tankTreeAvailable: smallNyStatusSlotsString, nyStatusSlotsString = getStatusStrings( 'nyTankSlotsFull', style=text_styles.nyVehicleSmallMain, styleLarge=text_styles.nyVehicleMain) else: smallNyStatusSlotsString, nyStatusSlotsString = getStatusStrings( 'nyTankEmptyCount', style=text_styles.nyVehicleSmallMain, styleLarge=text_styles.nyVehicleMain, ctx={'count': freeSlotsCount}) infoText = text_styles.concatStylesToMultiLine(nyTankString, nyStatusSlotsString) self._vehicleBranch.append({ 'nySlot': True, 'smallInfoText': text_styles.concatStylesToMultiLine(smallNyTankString, smallNyStatusSlotsString), 'infoText': infoText, 'infoHoverText': infoText, 'icon': backport.image( R.images.gui.maps.icons.newYear.tank_slots.carousel.ny_slot()), 'iconSmall': backport.image(R.images.gui.maps.icons.newYear.tank_slots.carousel. ny_slot_small()), 'tooltip': makeTooltip( header=backport.text( R.strings.tooltips.tankCarusel.newYearSlot.header()), body=backport.text( R.strings.tooltips.tankCarusel.newYearSlot.body())), 'nyBlinkEnabled': freeSlotsCount > 0, 'showBubble': hasNewVehicleLevel(), 'iconHover': backport.image(R.images.gui.maps.icons.newYear.tank_slots.carousel. ny_slot_hover()), 'iconHoverSmall': backport.image(R.images.gui.maps.icons.newYear.tank_slots.carousel. ny_slot_small_hover()), 'additionalImgSrc': '', 'clickEnabled': True })
def _getUnlockDiscountBlock(percentValue, xpValue, title, showPlus=False): if percentValue == 100: discountPadding = 8 if showPlus else 19 elif percentValue < 10: discountPadding = 30 if showPlus else 41 else: discountPadding = 19 if showPlus else 30 percentStr = ''.join(('+' if showPlus else '', str(percentValue), '%')) discountValueStr = text_styles.concatStylesToSingleLine(text_styles.bonusLocalText(percentStr), text_styles.main(i18n.makeString(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR).join((' ', ' '))), text_styles.expText(backport.getIntegralFormat(xpValue)), icons.xpCost()) blockPadding = -discountPadding - (0 if showPlus else -10) imgPadding = -79 - (3 if percentValue < 10 else 0) return formatters.packImageTextBlockData(title=text_styles.main(title), desc=discountValueStr, img=backport.image(R.images.gui.maps.icons.blueprints.blueprintScreen.discountShine()), txtGap=-6, imgPadding=formatters.packPadding(top=0, right=imgPadding), txtPadding=formatters.packPadding(left=discountPadding), padding=formatters.packPadding(top=4, left=blockPadding, bottom=-6), blockWidth=300)
def _getAllianceTextWithIcon(alliance): allianceIcon = icons.makeImageTag(backport.image(R.images.gui.maps.icons.blueprints.fragment.conversion.dyn(alliance)()), width=13, height=16) return text_styles.concatStylesToSingleLine(allianceIcon, text_styles.stats(backport.text(R.strings.blueprints.conversionView.alliance.name.dyn(alliance)())))
def __packAdditionalInfoBlock(self): return formatters.packImageTextBlockData(desc=text_styles.main(backport.text(R.strings.tooltips.blueprint.randomNational.additionalInfo())), img=backport.image(R.images.gui.maps.icons.library.InformationIcon_1()), imgPadding=formatters.packPadding(top=2, right=9, left=4), padding=formatters.packPadding(top=-1, left=40))
def __packRandomFragmentBlocks(self): self._items.append(formatters.packImageTextBlockData(title=text_styles.highTitle(backport.text(R.strings.tooltips.blueprint.randomNational.header())), img=backport.image(R.images.gui.maps.icons.blueprints.fragment.small.randomNational()), imgPadding=formatters.packPadding(top=5), txtPadding=formatters.packPadding(top=5, left=19), descLeading=-1)) descriptionBlock = formatters.packImageTextBlockData(desc=text_styles.main(backport.text(R.strings.tooltips.blueprint.randomNational.description())), img=backport.image(R.images.gui.maps.icons.blueprints.plus()), imgPadding=formatters.packPadding(top=0, right=5), padding=formatters.packPadding(left=40)) self._items.append(formatters.packBuildUpBlockData(blocks=[descriptionBlock, self.__packAdditionalInfoBlock()], gap=3, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(bottom=-3))) self._items.append(formatters.packTextBlockData(text='', padding=formatters.packPadding(bottom=-12)))
def __createUpdateVO(self): _filterBtns = [{ 'value': backport.image(R.images.gui.maps.icons.buttons.non_historical()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. nonHistoricalBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. nonHistoricalBtn.body())), 'selected': self._nonHistoricToggleEnabled }, { 'value': backport.image(R.images.gui.maps.icons.buttons.hist_small()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. historicalBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. historicalBtn.body())), 'selected': self._historicToggleEnabled }, { 'value': backport.image( R.images.gui.maps.icons.customization.storage_icon()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. storageBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. storageBtn.body())), 'selected': self._purchasedToggleEnabled }, { 'value': backport.image(R.images.gui.maps.icons.buttons.equipped_icon()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. equippedBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. equippedBtn.body())), 'selected': self._appliedToggleEnabled }] self.__filterChangeHandlers = [ self.setShowOnlyNonHistoric, self.setShowOnlyHistoric, self.setShowOnlyAcquired, self.setShowOnlyApplied ] if self.__ctx.isProgressiveItemsExist: progressionDecalsBtnTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.progressionDecalsBtn.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.progressionDecalsBtn.body())) _filterBtns.append({ 'value': backport.image(R.images.gui.maps.icons.buttons.progression()), 'tooltip': progressionDecalsBtnTooltip, 'selected': self._showOnlyProgressionDecalsEnabled }) self.__filterChangeHandlers.append( self.setShowOnlyProgressionDecals) if self.__ctx.modeId == CustomizationModes.STYLED: editableStylesBtnTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.editableStylesBtn.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.editableStylesBtn.body())) _filterBtns.append({ 'value': backport.image( R.images.gui.maps.icons.buttons.editable_small()), 'tooltip': editableStylesBtnTooltip, 'selected': self._showOnlyEditableStylesEnabled }) self.__filterChangeHandlers.append(self.setShowOnlyEditableStyles) nonEditableStylesBtnTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.nonEditableStylesBtn.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.nonEditableStylesBtn.body())) _filterBtns.append({ 'value': backport.image(R.images.gui.maps.icons.buttons.non_editable()), 'tooltip': nonEditableStylesBtnTooltip, 'selected': self._showOnlyNonEditableStylesEnabled }) self.__filterChangeHandlers.append( self.setShowOnlyNonEditableStyles) _formsBtns = [{ 'value': self.PROJECTION_DECAL_IMAGE_FORM_TAG[formType], 'selected': value, 'tooltip': makeTooltip( '{} {}'.format( backport.text(R.strings.vehicle_customization.popover. tooltip.form()), PROJECTION_DECAL_TEXT_FORM_TAG[formType]), backport.text( R.strings.vehicle_customization.popover.tooltip.form.body( ), value=backport.text( R.strings.vehicle_customization.form.dyn(formType)()))) } for formType, value in self._formfactorTypes.iteritems()] formsBtnsLbl = '' if self._formfactorTypes: formsBtnsLbl = text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. formfilters.title())) additionalCheckBoxLabel = backport.text( R.strings.vehicle_customization.filter.popover.showonlyfilters. onAnotherVeh()) additionalCheckBoxTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.additionalCheckBox.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.additionalCheckBox.body())) return FiltersPopoverVO( lblTitle=text_styles.highTitle( backport.text( R.strings.vehicle_customization.filter.popover.title())), lblGroups=text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. groups.title())), lblShowOnlyFilters=text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. showonlyfilters.title())), lblAdditional=text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. showonlyfilters.additional())), additionalCheckBoxData={ 'label': additionalCheckBoxLabel, 'tooltip': additionalCheckBoxTooltip, 'selected': self._hideOnAnotherVehEnabled }, btnDefault=backport.text(R.strings.vehicle_customization.filter. popover.getDefaultSettings()), groupType=self._groups if self._groupCount > 1 else None, btnDefaultTooltip=makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.refresh.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.refresh.body())), groupTypeSelectedIndex=self._selectedGroup, filterBtns=_filterBtns, additionalEnabled=self.__ctx.isItemsOnAnotherVeh, formsBtnsLbl=formsBtnsLbl, formsBtns=_formsBtns)
class FilterPopover(CustomizationFiltersPopoverMeta): PROJECTION_DECAL_IMAGE_FORM_TAG = { ProjectionDecalFormTags.SQUARE: backport.image(R.images.gui.maps.icons.customization.icon_form_1_c()), ProjectionDecalFormTags.RECT1X2: backport.image(R.images.gui.maps.icons.customization.icon_form_2_c()), ProjectionDecalFormTags.RECT1X3: backport.image(R.images.gui.maps.icons.customization.icon_form_3_c()), ProjectionDecalFormTags.RECT1X4: backport.image(R.images.gui.maps.icons.customization.icon_form_4_c()), ProjectionDecalFormTags.RECT1X6: backport.image(R.images.gui.maps.icons.customization.icon_form_6()) } service = dependency.descriptor(ICustomizationService) def __init__(self, ctx=None): super(FilterPopover, self).__init__() self.__ctx = None self.__filterChangeHandlers = None data = ctx['data'] self._purchasedToggleEnabled = data.purchasedEnabled self._historicToggleEnabled = data.historicEnabled self._nonHistoricToggleEnabled = data.nonHistoricEnabled self._appliedToggleEnabled = data.appliedEnabled self._groups = data.groups self._selectedGroup = data.selectedGroup self._groupCount = data.groupCount self._hideOnAnotherVehEnabled = data.hideOnAnotherVehEnabled self._showOnlyProgressionDecalsEnabled = data.showOnlyProgressionDecalsEnabled self._showOnlyEditableStylesEnabled = data.showOnlyEditableStylesEnabled self._showOnlyNonEditableStylesEnabled = data.showOnlyNonEditableStylesEnabled self._formfactorTypes = OrderedDict() for i, val in enumerate(data.formfactorGroups): if i <= len(ProjectionDecalFormTags.ALL): self._formfactorTypes[ProjectionDecalFormTags.ALL[i]] = val if hasattr(data, 'isInit'): self._isInit = data.isInit else: self._isInit = False return def onFilterChange(self, index, value): self.__filterChangeHandlers[index](value) def onFormChange(self, index, value): if not self._formfactorTypes: return if index >= len(ProjectionDecalFormTags.ALL): _logger.warning('"index" = %(index)s is not valid', {'index': index}) return formFactor = ProjectionDecalFormTags.ALL[index] if formFactor not in self._formfactorTypes: _logger.warning( '"index" = %(index)s is not valid (self._formfactorTypes = %(formfactorTypes)s)', { 'index': index, 'formfactorTypes': self._formfactorTypes }) return self._formfactorTypes[formFactor] = value self.__ctx.events.onCarouselFiltered( formfactorGroups=self._formfactorTypes) self.updateDefaultButton() def setShowOnlyHistoric(self, value): self._historicToggleEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(historic=value) def setShowOnlyNonHistoric(self, value): self._nonHistoricToggleEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(nonHistoric=value) def setShowOnlyAcquired(self, value): self._purchasedToggleEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(inventory=value) def setHideOnAnotherVeh(self, value): self._hideOnAnotherVehEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(onAnotherVeh=value) def setShowOnlyProgressionDecals(self, value): self._showOnlyProgressionDecalsEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(onlyProgressionDecals=value) def setShowOnlyEditableStyles(self, value): self._showOnlyEditableStylesEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(onlyEditableStyles=value) def setShowOnlyNonEditableStyles(self, value): self._showOnlyNonEditableStylesEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(onlyNonEditableStyles=value) def setShowOnlyApplied(self, value): self._appliedToggleEnabled = value self.updateDefaultButton() self.__ctx.events.onCarouselFiltered(applied=value) def changeGroup(self, filterGroupValue): if not self._isInit: self.__ctx.events.onCarouselFiltered(group=filterGroupValue) self._selectedGroup = filterGroupValue self.updateDefaultButton() else: self._isInit = False def updateDefaultButton(self): defaultGroup = self._selectedGroup == self._groupCount - 1 defaultFormfactorGroups = any(self._formfactorTypes.values()) notDefault = not defaultGroup or defaultFormfactorGroups or self._historicToggleEnabled or self._nonHistoricToggleEnabled or self._purchasedToggleEnabled or self._hideOnAnotherVehEnabled or self._showOnlyProgressionDecalsEnabled or self._showOnlyEditableStylesEnabled or self._showOnlyNonEditableStylesEnabled or self._appliedToggleEnabled self.as_enableDefBtnS(notDefault) def setDefaultFilter(self): self._historicToggleEnabled = False self._nonHistoricToggleEnabled = False self._purchasedToggleEnabled = False self._appliedToggleEnabled = False self._hideOnAnotherVehEnabled = False self._showOnlyProgressionDecalsEnabled = False self._showOnlyEditableStylesEnabled = False self._showOnlyNonEditableStylesEnabled = False self._selectedGroup = self._groupCount - 1 self._formfactorTypes = OrderedDict.fromkeys(self._formfactorTypes, False) self.__updateVO = self.__createUpdateVO() self.as_setDataS(self.__updateVO.asDict()) self.updateDefaultButton() self.__ctx.events.onCarouselFiltered( historic=self._historicToggleEnabled, nonHistoric=self._nonHistoricToggleEnabled, inventory=self._purchasedToggleEnabled, applied=self._appliedToggleEnabled, group=self._selectedGroup, formfactorGroups=self._formfactorTypes, onAnotherVeh=self._hideOnAnotherVehEnabled, onlyProgressionDecals=self._showOnlyProgressionDecalsEnabled, onlyEditableStyles=self._showOnlyEditableStylesEnabled, onlyNonEditableStyles=self._showOnlyNonEditableStylesEnabled) def _populate(self): super(FilterPopover, self)._populate() self.__ctx = self.service.getCtx() self.updateDefaultButton() self.__updateVO = self.__createUpdateVO() self.as_setDataS(self.__updateVO.asDict()) def _dispose(self): if self.__ctx.events is not None: self.__ctx.events.onFilterPopoverClosed() self.__ctx = None self.__filterChangeHandlers = None super(FilterPopover, self)._dispose() return def __createUpdateVO(self): _filterBtns = [{ 'value': backport.image(R.images.gui.maps.icons.buttons.non_historical()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. nonHistoricalBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. nonHistoricalBtn.body())), 'selected': self._nonHistoricToggleEnabled }, { 'value': backport.image(R.images.gui.maps.icons.buttons.hist_small()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. historicalBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. historicalBtn.body())), 'selected': self._historicToggleEnabled }, { 'value': backport.image( R.images.gui.maps.icons.customization.storage_icon()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. storageBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. storageBtn.body())), 'selected': self._purchasedToggleEnabled }, { 'value': backport.image(R.images.gui.maps.icons.buttons.equipped_icon()), 'tooltip': makeTooltip( backport.text(R.strings.vehicle_customization.carousel.filter. equippedBtn.header()), backport.text(R.strings.vehicle_customization.carousel.filter. equippedBtn.body())), 'selected': self._appliedToggleEnabled }] self.__filterChangeHandlers = [ self.setShowOnlyNonHistoric, self.setShowOnlyHistoric, self.setShowOnlyAcquired, self.setShowOnlyApplied ] if self.__ctx.isProgressiveItemsExist: progressionDecalsBtnTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.progressionDecalsBtn.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.progressionDecalsBtn.body())) _filterBtns.append({ 'value': backport.image(R.images.gui.maps.icons.buttons.progression()), 'tooltip': progressionDecalsBtnTooltip, 'selected': self._showOnlyProgressionDecalsEnabled }) self.__filterChangeHandlers.append( self.setShowOnlyProgressionDecals) if self.__ctx.modeId == CustomizationModes.STYLED: editableStylesBtnTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.editableStylesBtn.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.editableStylesBtn.body())) _filterBtns.append({ 'value': backport.image( R.images.gui.maps.icons.buttons.editable_small()), 'tooltip': editableStylesBtnTooltip, 'selected': self._showOnlyEditableStylesEnabled }) self.__filterChangeHandlers.append(self.setShowOnlyEditableStyles) nonEditableStylesBtnTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.nonEditableStylesBtn.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.nonEditableStylesBtn.body())) _filterBtns.append({ 'value': backport.image(R.images.gui.maps.icons.buttons.non_editable()), 'tooltip': nonEditableStylesBtnTooltip, 'selected': self._showOnlyNonEditableStylesEnabled }) self.__filterChangeHandlers.append( self.setShowOnlyNonEditableStyles) _formsBtns = [{ 'value': self.PROJECTION_DECAL_IMAGE_FORM_TAG[formType], 'selected': value, 'tooltip': makeTooltip( '{} {}'.format( backport.text(R.strings.vehicle_customization.popover. tooltip.form()), PROJECTION_DECAL_TEXT_FORM_TAG[formType]), backport.text( R.strings.vehicle_customization.popover.tooltip.form.body( ), value=backport.text( R.strings.vehicle_customization.form.dyn(formType)()))) } for formType, value in self._formfactorTypes.iteritems()] formsBtnsLbl = '' if self._formfactorTypes: formsBtnsLbl = text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. formfilters.title())) additionalCheckBoxLabel = backport.text( R.strings.vehicle_customization.filter.popover.showonlyfilters. onAnotherVeh()) additionalCheckBoxTooltip = makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.additionalCheckBox.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.additionalCheckBox.body())) return FiltersPopoverVO( lblTitle=text_styles.highTitle( backport.text( R.strings.vehicle_customization.filter.popover.title())), lblGroups=text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. groups.title())), lblShowOnlyFilters=text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. showonlyfilters.title())), lblAdditional=text_styles.standard( backport.text(R.strings.vehicle_customization.filter.popover. showonlyfilters.additional())), additionalCheckBoxData={ 'label': additionalCheckBoxLabel, 'tooltip': additionalCheckBoxTooltip, 'selected': self._hideOnAnotherVehEnabled }, btnDefault=backport.text(R.strings.vehicle_customization.filter. popover.getDefaultSettings()), groupType=self._groups if self._groupCount > 1 else None, btnDefaultTooltip=makeTooltip( backport.text(R.strings.vehicle_customization.customization. filterPopover.refresh.header()), backport.text(R.strings.vehicle_customization.customization. filterPopover.refresh.body())), groupTypeSelectedIndex=self._selectedGroup, filterBtns=_filterBtns, additionalEnabled=self.__ctx.isItemsOnAnotherVeh, formsBtnsLbl=formsBtnsLbl, formsBtns=_formsBtns)
GUI_ITEM_TYPE.CAMOUFLAGE, GUI_ITEM_TYPE.PROJECTION_DECAL, GUI_ITEM_TYPE.EMBLEM, GUI_ITEM_TYPE.PERSONAL_NUMBER, GUI_ITEM_TYPE.INSCRIPTION, GUI_ITEM_TYPE.MODIFICATION) _TYPE_FILTER_ITEMS = [{ 'filterValue': _CustomizationFilterBit.STYLE, 'selected': False, 'tooltip': makeTooltip(body=backport.text( R.strings.tooltips.customization.storage.filters.style.title())), 'icon': backport.image(R.images.gui.maps.icons.storage.filters.style()) }, { 'filterValue': _CustomizationFilterBit.PAINT, 'selected': False, 'tooltip': makeTooltip(body=backport.text( R.strings.tooltips.customization.storage.filters.paints.title())), 'icon': backport.image(R.images.gui.maps.icons.storage.filters.paints()) }, { 'filterValue': _CustomizationFilterBit.CAMOUFLAGE, 'selected': False,
def _getVO(self, item, vehicleCD=None): priceVO = getItemPricesVO(item.getSellPrice())[0] title = item.userName tooltipKey = TOOLTIPS.getItemBoxTooltip(item.itemTypeName) if tooltipKey: title = _ms(tooltipKey, group=item.userType, value=item.userName) if item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL: formfactor = item.formfactor else: formfactor = '' icon = item.icon levelIcon = '' customizationSuitableText = backport.text( R.strings.storage.customizationSuitable.label()) if vehicleCD is None: if not item.descriptor.filter or not item.descriptor.filter.include: customizationSuitableText = backport.text( R.strings.storage.customizationSuitableForAll.label()) else: customizationSuitableText += getSuitableText(item) count = item.inventoryCount vehicle = None else: vehicle = self._itemsCache.items.getItemByCD(vehicleCD) customizationSuitableText += vehicle.shortUserName count = item.boundInventoryCount(vehicleCD) if item.isProgressive: if item.isProgressionRewindEnabled: levelIcon = backport.image( R.images.gui.maps.icons.customization.progression_rewind()) level = item.getProgressionLevel(vehicle) if level > 0: icon = item.iconUrlByProgressionLevel(level) else: level = item.getProgressionLevel(vehicle) if level > 0: if item.itemTypeID == GUI_ITEM_TYPE.STYLE: levelIconPath = R.images.gui.maps.icons.customization.progression_styles.icons else: levelIconPath = R.images.gui.maps.icons.customization.progression_icons levelIcon = backport.image( levelIconPath.dyn('level_{}'.format(level))()) if item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL: icon = item.previewIconUrlByProgressionLevel(level) else: icon = item.iconUrlByProgressionLevel(level) isAvailableForSell = isCustomizationAvailableForSell(item, vehicleCD) isPreviewAvailable = item.itemTypeID == GUI_ITEM_TYPE.STYLE vo = createStorageDefVO(itemID=item.intCD, title=title, description=customizationSuitableText, count=count, price=priceVO if isAvailableForSell else None, image=icon, imageAlt='altimage', contextMenuId=CONTEXT_MENU_HANDLER_TYPE. STORAGE_CUSTOMZIZATION_ITEM, enabled=isAvailableForSell) vo.update({ 'previewAvailable': isPreviewAvailable, 'previewTooltip': backport.text(R.strings.storage.stylePreview.tooltip()), 'progressiveLevelIcon': levelIcon, 'formfactor': formfactor, 'vehicleCD': vehicleCD, 'isWideImage': item.isWide(), 'isRentable': item.isRentable }) return vo
def __getBattleRoyaleTableHeader(self): return (self._createTableBtnInfo('nationIndex', 36, 0, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_NATION, 'ascending', iconSource=backport.image(R.images.gui.maps.icons.filters.nations.all()), inverted=True), self._createTableBtnInfo('typeIndex', 34, 1, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_CLASS, 'descending', iconSource=backport.image(R.images.gui.maps.icons.filters.tanks.all())), self._createTableBtnInfo('shortUserName', 171, 7, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_NAME, 'ascending', label=backport.text(R.strings.profile.section.technique.buttonBar.vehicleName()), inverted=True, sortType='string'), self._createTableBtnInfo('battlesCount', 64, 2, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_BATTLESCOUNT, 'descending', iconSource=backport.image(R.images.gui.maps.icons.battleRoyale.achievements.battles())), self._createTableBtnInfo('winsCount', 64, 3, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_WINS, 'descending', iconSource=backport.image(R.images.gui.maps.icons.battleRoyale.achievements.wins())), self._createTableBtnInfo('avgExperience', 64, 4, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_AVGEXP, 'descending', iconSource=backport.image(R.images.gui.maps.icons.battleRoyale.achievements.avgExp())), self._createTableBtnInfo('avgDamage', 64, 5, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_AVGDAMAGE, 'descending', iconSource=backport.image(R.images.gui.maps.icons.battleRoyale.achievements.avgDamage())), self._createTableBtnInfo('avgFrags', 80, 6, PROFILE.SECTION_TECHNIQUE_SORT_TOOLTIP_AVGFRAGS, 'descending', iconSource=backport.image(R.images.gui.maps.icons.battleRoyale.achievements.avgFrags())))
def __update(self, _=None): headerData = { 'title': backport.text(R.strings.ranked_battles.rankedBattle.title()), 'mainDescr': backport.text(R.strings.ranked_battles.introPage.description()), 'extraDescr': None, 'tooltip': None } blocksData = [] for index in range(BLOCKS_COUNT): index += 1 imgSource = backport.image( R.images.gui.maps.icons.rankedBattles.intro.dyn( 'block{}'.format(index))()) title = text_styles.promoSubTitle( backport.text( R.strings.ranked_battles.introPage.blocks.dyn( 'block{}'.format(index)).title())) descr = text_styles.mainBig( backport.text( R.strings.ranked_battles.introPage.blocks.dyn( 'block{}'.format(index)).description())) blocksData.append({ 'imgSource': imgSource, 'title': title, 'description': descr }) if not self.__rankedController.isYearRewardEnabled(): blocksData[-1]['imgSource'] = backport.image( R.images.gui.maps.icons.rankedBattles.intro.yearRewardDisabled( )) blocksData[-1]['description'] = text_styles.mainBig( backport.text(R.strings.ranked_battles.introPage.blocks. yearRewardDisabled())) url = getRankedBattlesIntroPageUrl() self.__state = RANKEDBATTLES_CONSTS.INTRO_STATE_NORMAL if self.__rankedController.isFrozen(): self.__state = RANKEDBATTLES_CONSTS.INTRO_STATE_DISABLED if not self.__rankedController.getSeasonPassed( ) and not self.__rankedController.getCurrentSeason(): self.__state = RANKEDBATTLES_CONSTS.INTRO_STATE_BEFORE_SEASON if self.__state == RANKEDBATTLES_CONSTS.INTRO_STATE_DISABLED: self.as_setAlertMessageBlockDataS({ 'alertIcon': backport.image(R.images.gui.maps.icons.library.alertBigIcon()), 'statusText': text_styles.vehicleStatusCriticalText( backport.text( R.strings.ranked_battles.introPage.alert.disabled())), 'buttonVisible': False }) elif self.__state == RANKEDBATTLES_CONSTS.INTRO_STATE_BEFORE_SEASON: self.__updateTimer() if self.__state != RANKEDBATTLES_CONSTS.INTRO_STATE_NORMAL and self.__rankedController.getRankedWelcomeCallback( ) is None: self.__rankedController.setRankedWelcomeCallback(lambda: None) self.as_setDataS({ 'state': self.__state, 'hasURL': bool(url), 'headerData': headerData, 'blocksData': blocksData }) return
def _setBackground(self): self.as_setBackgroundSourceS( backport.image(R.images.gui.maps.icons.rankedBattles.bg.main()))
def _setBackground(self): self.as_setBackgroundSourceS( backport.image(R.images.gui.maps.icons.battleRoyale.primeTime. prime_time_back_default()))
def getTitle(self): title = backport.text(R.strings.quests.premiumQuests.header.title()) return '{}{}'.format(makeImageTag(backport.image(R.images.gui.maps.icons.premacc.icons.premium_40x40()), 40, 40, -12), title)