Example #1
0
 def _makePriceBlock(self, price, currencySetting, neededValue = None, oldPrice = None, percent = 0):
     needFormatted = ''
     oldPriceText = ''
     hasAction = percent != 0
     settings = getCurrencySetting(currencySetting)
     if settings is None:
         return
     else:
         valueFormatted = settings.textStyle(_int(price))
         icon = settings.icon
         if neededValue is not None:
             needFormatted = settings.textStyle(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icon, settings.textStyle(_int(oldPrice)))
         neededText = ''
         if neededValue is not None:
             neededText = text_styles.concatStylesToSingleLine(text_styles.main('('), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(')'))
         text = text_styles.concatStylesWithSpace(text_styles.main(settings.text), neededText)
         if hasAction:
             actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText))
             text = text_styles.concatStylesToMultiLine(text, actionText)
             if settings.frame == ICON_TEXT_FRAMES.GOLD:
                 newPrice = (0, price)
             else:
                 newPrice = (price, 0)
             return formatters.packSaleTextParameterBlockData(name=text, saleData={'newPrice': newPrice,
              'valuePadding': -8}, actionStyle='alignTop', padding=formatters.packPadding(left=92))
         return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=settings.frame, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))
         return
Example #2
0
def getEfficiencyVO(currentSeasonEfficiency, currentSeasonEfficiencyDiff):
    delta = ''
    if currentSeasonEfficiencyDiff is not None:
        if currentSeasonEfficiencyDiff > 0:
            delta = text_styles.concatStylesToSingleLine(
                icons.makeImageTag(
                    backport.image(R.images.gui.maps.icons.rankedBattles.
                                   league.delta_plus()), 11, 16, -3),
                text_styles.bonusAppliedText(
                    ranked_formatters.getFloatPercentStrStat(
                        currentSeasonEfficiencyDiff)))
        if currentSeasonEfficiencyDiff < 0:
            delta = text_styles.concatStylesToSingleLine(
                icons.makeImageTag(
                    backport.image(R.images.gui.maps.icons.rankedBattles.
                                   league.delta_minus()), 11, 16, -3),
                text_styles.error(
                    ranked_formatters.getFloatPercentStrStat(
                        currentSeasonEfficiencyDiff)))
    return {
        'icon': 'efficiency',
        'label': '',
        'value':
        ranked_formatters.getFloatPercentStrStat(currentSeasonEfficiency),
        'delta': delta
    }
def formatPingStatus(csisStatus,
                     isColorBlind,
                     isSelected,
                     pingStatus,
                     pingValue,
                     useBigSize=False):
    if pingStatus == PING_STATUSES.REQUESTED:
        return None
    else:
        if csisStatus != HOST_AVAILABILITY.NOT_AVAILABLE and pingStatus != PING_STATUSES.UNDEFINED:
            if pingStatus == PING_STATUSES.LOW:
                formattedPing = text_styles.goodPing(pingValue)
            else:
                formattedPing = text_styles.main(
                    pingValue) if isSelected else text_styles.standartPing(
                        pingValue)
        else:
            pingValue = _UNAVAILABLE_DATA_PLACEHOLDER
            pingStatus = PING_STATUSES.UNDEFINED
            formattedPing = text_styles.standard(pingValue)
        colorBlindName = ''
        if isColorBlind and pingStatus == PING_STATUSES.HIGH:
            colorBlindName = '_color_blind'
        pingStatusIcon = makePingStatusIcon(pingStatus, colorBlindName)
        return text_styles.concatStylesToSingleLine(
            text_styles.main(' '), formattedPing, pingStatusIcon
        ) if useBigSize else text_styles.concatStylesToSingleLine(
            formattedPing, '', pingStatusIcon)
Example #4
0
 def _packProgressStateBlock(self):
     currentLevel = self._item.getLatestOpenedProgressionLevel(
         self.__vehicle)
     if currentLevel == -1 and self._progressionLevel == 1:
         currentLevel = 0
     if self._progressionLevel < 1:
         return None
     else:
         if currentLevel >= self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.checkmark(),
                 text_styles.bonusAppliedText(
                     getProgressionItemStatusText(self._progressionLevel)))
         elif currentLevel + 1 == self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.inProgress(),
                 text_styles.neutral(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.inProgressState())))
         else:
             desc = text_styles.concatStylesToSingleLine(
                 icons.markerBlocked(),
                 text_styles.error(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.title())))
             desc = text_styles.concatStylesToMultiLine(
                 desc,
                 text_styles.main(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.desc())))
         return formatters.packAlignedTextBlockData(
             text=desc, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
Example #5
0
 def _makePriceBlock(self, price, text, currencyType, neededValue = None, oldPrice = None, percent = 0):
     needFormatted = ''
     oldPriceText = ''
     hasAction = percent != 0
     if currencyType == ICON_TEXT_FRAMES.CREDITS:
         valueFormatted = text_styles.credits(_int(price))
         icon = icons.credits()
         if neededValue is not None:
             needFormatted = text_styles.credits(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icons.credits(), text_styles.credits(_int(oldPrice)))
     elif currencyType == ICON_TEXT_FRAMES.GOLD:
         valueFormatted = text_styles.gold(_int(price))
         icon = icons.gold()
         if neededValue is not None:
             needFormatted = text_styles.gold(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icons.gold(), text_styles.gold(_int(oldPrice)))
     elif currencyType == ICON_TEXT_FRAMES.XP:
         valueFormatted = text_styles.expText(_int(price))
         icon = icons.xp()
         if neededValue is not None:
             needFormatted = text_styles.expText(_int(neededValue))
     else:
         LOG_ERROR('Unsupported currency type "' + currencyType + '"!')
         return
     neededText = ''
     if neededValue is not None:
         neededText = text_styles.concatStylesToSingleLine(text_styles.main('( '), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(' )'))
     text = text_styles.concatStylesWithSpace(text_styles.main(text), neededText)
     if hasAction:
         actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText))
         text = text_styles.concatStylesToMultiLine(text, actionText)
     return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=currencyType, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=20))
def makeSuffixBadgeVO(badge):
    stripImg = R.images.gui.maps.icons.library.badges.strips.c_68x28.dyn(
        'strip_{}'.format(badge.badgeID))
    labelDyn = R.strings.badge.suffix.dyn('badge_{}'.format(badge.badgeID))
    labelText = text_styles.main(backport.text(labelDyn())) if labelDyn else ''
    activeLabelText = text_styles.stats(backport.text(
        labelDyn())) if labelDyn else ''
    return {
        'id':
        badge.badgeID,
        'label':
        text_styles.concatStylesToSingleLine(labelText, icons.starYellow(0))
        if badge.isTemporary else labelText,
        'activeLabel':
        text_styles.concatStylesToSingleLine(activeLabelText,
                                             icons.starYellow(0))
        if badge.isTemporary else activeLabelText,
        'tooltip':
        getSuffixBadgeTooltip(badge),
        'stripImg':
        backport.image(stripImg()) if stripImg else '',
        'img':
        badge.getSuffixSmallIcon(),
        'hasFootnoteMark':
        badge.isTemporary
    }
Example #7
0
def formatPingStatus(csisStatus, isColorBlind, isSelected, pingStatus, pingValue, useBigSize = False):
    """
    
    :param csisStatus:
    :param isColorBlind:
    :param isSelected:
    :param pingStatus:
    :param pingValue:
    :param useBigSize: If True result str has 14 font size, otherwise - 11 font size
    :return:
    """
    if pingStatus == PING_STATUSES.REQUESTED:
        return None
    else:
        if csisStatus != HOST_AVAILABILITY.NOT_AVAILABLE and pingStatus != PING_STATUSES.UNDEFINED:
            if pingStatus == PING_STATUSES.LOW:
                formattedPing = text_styles.goodPing(pingValue)
            else:
                formattedPing = text_styles.main(pingValue) if isSelected else text_styles.standartPing(pingValue)
        else:
            pingValue = _UNAVAILABLE_DATA_PLACEHOLDER
            pingStatus = PING_STATUSES.UNDEFINED
            formattedPing = text_styles.standard(pingValue)
        colorBlindName = ''
        if isColorBlind and pingStatus == PING_STATUSES.HIGH:
            colorBlindName = '_color_blind'
        pingStatusIcon = formatPingStatusIcon(RES_ICONS.maps_icons_pingstatus_stairs_indicator(str(pingStatus) + colorBlindName + '.png'))
        if useBigSize:
            return text_styles.concatStylesToSingleLine(text_styles.main(' '), formattedPing, pingStatusIcon)
        return text_styles.concatStylesToSingleLine(formattedPing, '', pingStatusIcon)
        return None
 def makeTitleAndDescription(self, allyVehicles):
     isWin = self._reusable.getPersonalTeam(
     ) == self._reusable.common.winnerTeam
     rankState = self.getRankChangeStatus()
     rankInfo = self._reusable.personal.getRankInfo()
     shieldState = rankInfo.shieldState
     title = backport.text(self._TITLE_LABEL_MAP[rankState])
     if rankState == _RCS.NOTHING_CHANGED and isWin:
         title = backport.text(
             R.strings.ranked_battles.battleresult.stageNotEarned())
     if shieldState == RANKEDBATTLES_ALIASES.SHIELD_LOSE:
         title = backport.text(
             R.strings.ranked_battles.battleresult.shieldLose())
     position = self._getPlayerPosition(allyVehicles)
     descriptionIcon = self._getDescriptionIcon(rankState,
                                                rankInfo.stepChanges,
                                                rankInfo.updatedStepChanges)
     topNumber = self._getWinnerBounds(
         position) if isWin else self._getLoserBounds(position)
     position = position + 1 if position is not None else topNumber
     winKey = 'win' if isWin else 'lose'
     topKey = 'inTop' if topNumber >= position else 'notInTop'
     description = backport.text(
         R.strings.ranked_battles.battleresult.dyn(topKey).dyn(winKey)(),
         topNumber=topNumber)
     if topNumber == 1:
         description = backport.text(
             R.strings.ranked_battles.battleresult.first.dyn(topKey).dyn(
                 winKey)())
     if rankState in (_RCS.RANK_UNBURN_PROTECTED, _RCS.QUAL_UNBURN_EARNED):
         description = backport.text(
             R.strings.ranked_battles.battleresult.notInTop.stageSaved())
     if rankInfo.isBonusBattle:
         description = text_styles.concatStylesToSingleLine(
             description,
             backport.text(
                 R.strings.ranked_battles.battleresult.bonusBattlesUsed()))
     if rankState in (_RCS.DIVISION_EARNED, _RCS.LEAGUE_EARNED,
                      _RCS.QUAL_EARNED, _RCS.QUAL_UNBURN_EARNED):
         if rankState == _RCS.LEAGUE_EARNED:
             description = backport.text(
                 R.strings.ranked_battles.battleresult.leagueUnavailable())
         bonusBattlesIncome = getBonusBattlesIncome(
             R.strings.ranked_battles.battleresult.bonusBattlesEarned,
             rankInfo.stepsBonusBattles, rankInfo.efficiencyBonusBattles,
             rankState == _RCS.LEAGUE_EARNED)
         description = text_styles.concatStylesToSingleLine(
             description,
             backport.text(R.strings.ranked_battles.battleresult.
                           bonusBattlesEarned()), bonusBattlesIncome)
     return TitleAndDescription(title, description, descriptionIcon)
 def wrapVO(items):
     result = {}
     if items:
         result = {
             'items':
             items,
             'isEnabled':
             True,
             'topTitle':
             text_styles.concatStylesToSingleLine(
                 icons.makeImageTag(source=backport.image(
                     R.images.gui.maps.icons.library.icon_gift()),
                                    width=17,
                                    height=15,
                                    vSpace=0),
                 text_styles.vehicleStatusCriticalTextSmall(
                     VEHICLE_PREVIEW.BUYINGPANEL_PRESENT)),
             'topTitleSmall':
             icons.makeImageTag(source=backport.image(
                 R.images.gui.maps.icons.library.icon_gift()),
                                width=17,
                                height=15,
                                vSpace=0)
         }
     return result
 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(
                 ('  ', ' '))), icons.xpCost(),
         text_styles.expText(backport.getIntegralFormat(xpValue)))
     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 getDataVO(vehicle, freeExp, exitEvent):
    baseVO = getBaseDataVO(vehicle)
    progressionAvailability = vehicle.postProgressionAvailability()
    showDemountAllPairs = len(vehicle.postProgression.getInstalledMultiIds()
                              [0]) >= _DEMOUNT_VISIBILITY_COUNT
    demountIcon = backport.image(
        R.images.gui.maps.icons.library.destroy_hummer())
    baseVO.update({
        'showDemountAllPairsBtn':
        progressionAvailability.result and showDemountAllPairs,
        'showExpBlock':
        progressionAvailability.result,
        'vehicleButton':
        _getButtonsVO(vehicle),
        'vehicleInfo': {
            'isElite': vehicle.isElite,
            'freeExp': freeExp,
            'earnedXP': vehicle.xp
        },
        'backBtnLabel':
        backport.text(R.strings.menu.viewHeader.backBtn.label()),
        'backBtnDescrLabel':
        getBackBtnDescription(exitEvent, exitEvent.name,
                              vehicle.shortUserName),
        'demountAllButtonLabel':
        text_styles.concatStylesToSingleLine(
            icons.makeImageTag(demountIcon, width=24, height=24, vSpace=-6),
            backport.text(R.strings.veh_post_progression.
                          vehPostProgressionView.button.demountAllPairs()))
    })
    return baseVO
 def _populate(self):
     super(PersonalMissionFirstEntryView, self)._populate()
     infoBlocks = [
         self.__makeTileData(cardIndex)
         for cardIndex in xrange(0, self.__cardsLen)
     ]
     firstEntry = not self.__settingsCore.serverSettings.getUIStorage().get(
         PM_TUTOR_FIELDS.GREETING_SCREEN_SHOWN)
     self.as_setInitDataS({
         'titleLabel':
         PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_TITLE,
         'bigBtnLabel':
         PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ACKNOWLEDGEBTN,
         'playVideoBtnLabel':
         text_styles.concatStylesToSingleLine(
             icons.makeImageTag(
                 RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_PLAYICON,
                 width=14,
                 height=15,
                 vSpace=-2),
             i18n.makeString(PERSONAL_MISSIONS.
                             PERSONALMISSIONFIRSTENTRYVIEW_VIDEOBTNLABEL)),
         'playVideoBtnVisible':
         self.__settings.get('isEnabled', False),
         'bgSource':
         RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_INFOSCREENBG,
         'infoBlocks':
         infoBlocks,
         'backBtnLabel':
         PERSONAL_MISSIONS.HEADER_BACKBTN_LABEL,
         'isFirstEntry':
         firstEntry
     })
     self.soundManager.setRTPC(SOUNDS.RTCP_OVERLAY,
                               SOUNDS.MAX_MISSIONS_ZOOM)
 def _packBonusBlock(self, bonus, camo, isApplied):
     blocks = []
     vehicle = g_currentVehicle.item
     bonusPercent = bonus.getFormattedValue(vehicle)
     blocks.append(
         formatters.packImageTextBlockData(
             title=text_styles.bonusLocalInfoTipText(
                 text_styles.concatStylesToSingleLine('+', bonusPercent)),
             img=RES_ICONS.MAPS_ICONS_LIBRARY_QUALIFIERS_48X48_CAMOUFLAGE,
             imgPadding=formatters.packPadding(top=-8, left=12),
             txtPadding=formatters.packPadding(top=-4),
             txtOffset=69))
     blocks.append(
         formatters.packTextBlockData(
             text=text_styles.main(self.bonusDescription),
             padding=formatters.packPadding(top=-46, left=110)))
     stockVehicle = self.itemsCache.items.getStockVehicle(vehicle.intCD)
     comparator = params_helper.camouflageComparator(stockVehicle, camo)
     stockParams = params_helper.getParameters(stockVehicle)
     padding = formatters.packPadding(left=105, top=2, bottom=-6)
     simplifiedBlocks = SimplifiedStatsBlockConstructor(
         stockParams, comparator, padding).construct()
     if simplifiedBlocks and not isApplied:
         blocks.extend(simplifiedBlocks)
     return formatters.packBuildUpBlockData(
         blocks,
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
     )
Example #14
0
 def _updateHeaderState(self):
     freePlaces = self.clanInfo.getFreePlaces()
     freePlacesInClanText = text_styles.concatStylesToSingleLine(
         text_styles.standard(
             _ms(CLANS.CLANINVITESWINDOW_HEADER_FREEPLACESINCLAN,
                 count=text_styles.main(
                     formatField(getter=self.clanInfo.getFreePlaces)))))
     if freePlaces == 0:
         inviteButtonEnabled = False
         inviteButtonTooltip = _ms(
             CLANS.CLANINVITESWINDOW_HEADER_TOOLTIPS_NOPLACES)
         freePlacesInClanText = gui.makeHtmlString(
             'html_templates:lobby/research', 'warningMessage',
             {'text': freePlacesInClanText})
     else:
         inviteButtonEnabled = True
         inviteButtonTooltip = _ms(
             CLANS.CLANINVITESWINDOW_TOOLTIPS_HEADER_INVITEBUTTON)
     self.as_setHeaderStateS({
         'inviteButtonEnabled':
         inviteButtonEnabled,
         'inviteButtonText':
         CLANS.CLANINVITESWINDOW_HEADER_INVITEINCLAN,
         'inviteButtonTooltip':
         makeTooltip(body=inviteButtonTooltip),
         'freePlacesInClanText':
         freePlacesInClanText
     })
Example #15
0
 def _getStatusBlock(self, operation):
     _, postpone = missions_helper.getPostponedOperationState(
         operation.getID())
     return formatters.packBuildUpBlockData([
         formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.markerBlocked(-2),
                 text_styles.error(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE)),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5)),
         formatters.
         packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(
             text_styles.main(
                 TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_POSTPONED
             ),
             icons.makeImageTag(RES_ICONS.getPersonalMissionOperationState(
                 PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE),
                                width=24,
                                height=24,
                                vSpace=-9),
             text_styles.vehicleStatusCriticalText(postpone)),
                                  align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                                  padding=formatters.packPadding(bottom=14))
     ])
Example #16
0
def _getMissionsCountLabel(completed, total):
    completed = text_styles.stats(completed)
    total = text_styles.standard(total)
    return text_styles.concatStylesToSingleLine(
        text_styles.standard(
            QUESTS.MISSIONS_TAB_CATEGORY_HEADER_PERFORMEDTASKS),
        text_styles.disabled('  %s / %s' % (completed, total)))
 def _packTitleBlock(self):
     if self._item.isAllSeason():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_ANY
     elif self._item.isSummer():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_SUMMER
     elif self._item.isWinter():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_WINTER
     elif self._item.isDesert():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_DESERT
     else:
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_EMPTYSLOT
     desc = _ms(
         VEHICLE_CUSTOMIZATION.CUSTOMIZATION_INFOTYPE_DESCRIPTION_MAP,
         mapType=text_styles.stats(mapType))
     if self._item.groupUserName:
         desc = text_styles.concatStylesToSingleLine(
             desc,
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_INFOTYPE_DESCRIPTION_TYPE,
                 elementType=text_styles.stats(self._item.groupUserName)))
     return formatters.packItemTitleDescBlockData(
         title=text_styles.highTitle(self._item.userName),
         desc=text_styles.main(desc),
         highlightPath=RES_ICONS.MAPS_ICONS_CUSTOMIZATION_CORNER_RARE,
         img=RES_ICONS.MAPS_ICONS_CUSTOMIZATION_BRUSH_RARE,
         imgPadding=formatters.packPadding(top=15, left=8),
         padding=formatters.packPadding(top=-20, left=-19, bottom=-7),
         txtPadding=formatters.packPadding(top=20, left=-8),
         descPadding=formatters.packPadding(top=-25, left=17)
     ) if self._item.isRare() else formatters.packTitleDescBlock(
         title=text_styles.highTitle(self._item.userName),
         desc=text_styles.main(desc),
         descPadding=formatters.packPadding(top=-5))
 def _getDailyResetStatusLabel(self):
     dailyStr = self._getDailyResetStatus(QUESTS.MISSIONDETAILS_RESETDATE,
                                          text_styles.main)
     if dailyStr:
         clockIcon = icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_RENT_ICO_BIG, 19, 19, -4, 8)
         return text_styles.concatStylesToSingleLine(clockIcon, dailyStr)
     return dailyStr
Example #19
0
def _makeServerString(serverInfo, isServerNameShort=False):
    server = text_styles.neutral(
        text_styles.concatStylesToSingleLine(
            serverInfo.getShortName()
            if isServerNameShort else serverInfo.getName(), ' (',
            text_styles.neutral(serverInfo.getPingValue()),
            makePingStatusIcon(serverInfo.getPingStatus()), ')'))
    return backport.text(R.strings.menu.primeTime.server(), server=server)
def getScheduleLabel():
    """
    Gets formatted schedule label
    """
    text = text_styles.main(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLEBYTIME)
    clockIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_RENT_ICO_BIG,
                                   19, 19, -4, 8)
    return text_styles.concatStylesToSingleLine(clockIcon, text)
Example #21
0
def getBonusBattlesIncome(resRoot, stepsCount, efficiencyCount, isStepsDaily):
    forEfficiencyStr = ''
    if efficiencyCount > 0:
        forEfficiencyStr = backport.text(resRoot.efficiency(), amount=text_styles.neutral(efficiencyCount))
    forStepsStr = ''
    stepsKey = 'daily' if isStepsDaily else 'persistent'
    if stepsCount > 0:
        forStepsStr = backport.text(resRoot.steps.dyn(stepsKey)(), amount=text_styles.neutral(stepsCount))
    return text_styles.concatStylesToSingleLine(forEfficiencyStr, forStepsStr) if forEfficiencyStr or forStepsStr else ''
Example #22
0
 def __getStatusData(self, selectedQuest):
     status = MISSIONS_STATES.IN_PROGRESS
     icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_INPROGRESSICON, 16, 16, -2, 8)
     text = text_styles.neutral(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_INPROGRESS)
     if selectedQuest.isMainCompleted():
         text = text_styles.neutral(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_INCREASERESULT)
     statusLabel = text_styles.concatStylesToSingleLine(icon, text)
     return {'statusLabel': statusLabel,
      'status': status}
Example #23
0
 def getFormattedStats(self):
     """ Get stats formatted as a single string with applied style.
     """
     clusterUsers, regionUsers, tooltipType = self.getStats()
     if tooltipType == STATS_TYPE.CLUSTER:
         statsStr = clusterUsers
     else:
         statsStr = text_styles.concatStylesToSingleLine(text_styles.stats(clusterUsers), text_styles.main(MENU.ONLINECOUNTER_DELIMITER), text_styles.main(regionUsers))
     return (statsStr, tooltipType)
 def __createEffectString(self, item):
     itemR = R.strings.artefacts.dyn(item.descriptor.groupName)
     effectR = itemR.dyn('effect') if itemR else None
     effectsList = [backport.text(effect())
                    for effect in effectR.values()] if effectR else []
     return text_styles.concatStylesToSingleLine(
         icons.lightning(),
         backport.text(R.strings.storage.optDevice.hover.effect()),
         effectsList[0]).format(
             **self.KPI_HTML_TEMPLATE.source) if effectsList else ''
 def __updateTimer(self):
     self.__timerCallback = None
     self.__timerCallback = BigWorld.callback(1, self.__updateTimer)
     textLabel = text_styles.main(makeString(MENU.PREBATTLE_TIMERLABEL))
     timeLabel = '%d:%02d' % divmod(self.__createTime, 60)
     if self.__provider.needAdditionalInfo():
         timeLabel = text_styles.concatStylesToSingleLine(timeLabel, '*')
     self.as_setTimerS(textLabel, timeLabel)
     self.__createTime += 1
     return
Example #26
0
 def __applyRankedOverrides(self, statusId, msg, msgLvl):
     statusOverrideRes = R.strings.ranked_battles.currentVehicleStatus.dyn(statusId)
     if statusOverrideRes:
         msg = backport.text(statusOverrideRes())
     isRole = statusId in (Vehicle.VEHICLE_STATE.UNDAMAGED, Vehicle.VEHICLE_STATE.ROTATION_GROUP_UNLOCKED)
     if isRole and g_currentVehicle.item.actionsGroup:
         actionsGroupLabel = g_currentVehicle.item.actionsGroupLabel
         msg = text_styles.concatStylesToSingleLine(backport.text(R.strings.menu.roleExp.currentVehicleStatus()), ' ', roleActionsGroup(actionsGroupLabel), backport.text(R.strings.menu.roleExp.actionsGroup.dyn(actionsGroupLabel)()))
         msgLvl = Vehicle.VEHICLE_STATE_LEVEL.ACTIONS_GROUP
     return (msg, msgLvl)
 def getFormattedMultiplierValue(self, scope='card'):
     multiplier = self.getMultiplier()
     if multiplier:
         multiplierValue = first(multiplier['task'].values())
         descr = text_styles.main(
             i18n.makeString(PERSONAL_MISSIONS.getMultiplierDescr(
                 multiplier['type'], scope),
                             value=multiplierValue))
         if multiplier['type'] == MULTIPLIER_TYPE.ATTEMPTS:
             return text_styles.concatStylesToSingleLine(
                 text_styles.neutral(
                     i18n.makeString(
                         PERSONAL_MISSIONS.BONUS_MULTIPLIER_ATTEMPTS)), ' ',
                 descr)
         if multiplier['type'] == MULTIPLIER_TYPE.PROGRESS:
             return text_styles.concatStylesToSingleLine(
                 text_styles.neutral(
                     i18n.makeString(
                         PERSONAL_MISSIONS.BONUS_MULTIPLIER_PROGRESS,
                         value=multiplierValue)), ' ', descr)
Example #28
0
 def getFormattedStats(self):
     """ Get stats formatted as a single string with applied style.
     """
     clusterUsers, regionUsers, tooltipType = self.getStats()
     if tooltipType == STATS_TYPE.CLUSTER:
         statsStr = text_styles.stats(clusterUsers)
     elif tooltipType == STATS_TYPE.UNAVAILABLE:
         statsStr = text_styles.main(MENU.ONLINECOUNTER_UNAVAILABLE)
     else:
         statsStr = text_styles.concatStylesToSingleLine(text_styles.stats(clusterUsers), text_styles.main(MENU.ONLINECOUNTER_DELIMITER), text_styles.main(regionUsers))
     return (statsStr, tooltipType)
Example #29
0
 def __packQuestInfo(self, quest):
     title = text_styles.middleTitle(quest.getUserName())
     if self._isQuestCompleted(quest):
         name = text_styles.concatStylesToSingleLine(icons.check(), title)
         selfPadding = formatters.packPadding(top=-3, left=14, right=20)
         descPadding = formatters.packPadding(left=6, top=-6)
     else:
         name = title
         selfPadding = formatters.packPadding(left=20, right=20)
         descPadding = formatters.packPadding(top=-2)
     return formatters.packTitleDescBlock(title=name, desc=text_styles.main(quest.getDescription()), padding=selfPadding, descPadding=descPadding)
Example #30
0
 def __updateTimer(self):
     self.__timerCallback = None
     self.__timerCallback = BigWorld.callback(1, self.__updateTimer)
     textLabel = makeString('#menu:prebattle/timerLabel')
     timeLabel = '%d:%02d' % divmod(self.__createTime, 60)
     result = text_styles.concatStylesWithSpace(text_styles.main(textLabel), timeLabel)
     if self.__provider.needAdditionalInfo():
         result = text_styles.concatStylesToSingleLine(result, text_styles.main('*'))
     self.as_setTimerS(result)
     self.__createTime += 1
     return
Example #31
0
 def __getRootStatusStr(root):
     return text_styles.concatStylesToSingleLine(
         icons.makeImageTag(backport.image(
             R.images.gui.maps.icons.library.ClockIcon_1()),
                            width=38,
                            height=38,
                            vSpace=-14),
         RentLeftFormatter(root.rentInfo).getRentLeftStr(
             strForSpecialTimeFormat=backport.text(
                 R.strings.menu.research.status.rentLeft()))
     ) if root.isRented and not root.rentalIsOver and not root.isTelecom and not root.isPremiumIGR else ''
 def _populate(self):
     super(PersonalMissionFirstEntryView, self)._populate()
     self.as_setInitDataS({'titleLabel': PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_TITLE,
      'subtitleLabel': PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_SUBTITLE,
      'bigBtnLabel': PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ACKNOWLEDGEBTN,
      'playVideoBtnLabel': text_styles.concatStylesToSingleLine(icons.makeImageTag(RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_PLAYICON, width=14, height=15, vSpace=-2), i18n.makeString(PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_VIDEOBTNLABEL)),
      'playVideoBtnVisible': self.__settings.get('isEnabled', False),
      'bgSource': RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_INFOSCREENBG,
      'tileList': [self.__makeTileData(RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_FREE_SHEET_BIG, PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ITEM0_HEADER, PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ITEM0_DESCR), self.__makeTileData(RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_GEAR_BIG, PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ITEM2_HEADER, PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ITEM2_DESCR), self.__makeTileData(RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_BALANCE, PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ITEM1_HEADER, PERSONAL_MISSIONS.PERSONALMISSIONFIRSTENTRYVIEW_ITEM1_DESCR)],
      'backBtnLabel': PERSONAL_MISSIONS.HEADER_BACKBTN_LABEL,
      'isFirstEntry': self.__settingsCore.serverSettings.getPersonalMissionsFirstEntryState() == _FES.NOT_VISITED})
Example #33
0
 def _getBuyingPanelData(self):
     vehiclePrice = self.__eventProgression.getRewardVehiclePrice(
         g_currentPreviewVehicle.item.intCD)
     storedPoints = self.__eventProgression.actualRewardPoints
     haveEnoughPoints = 0 < storedPoints >= vehiclePrice
     if not haveEnoughPoints:
         resID = R.strings.tooltips.vehiclePreview.buyButton.notEnoughPrestigePoints
         buyButtonTooltip = makeTooltip(
             body=backport.text(resID.header(), points=vehiclePrice))
     else:
         buyButtonTooltip = ''
     formatMoney = text_styles.superPromoTitleEm if storedPoints > 0 else text_styles.superPromoTitleErr
     formatPrice = text_styles.superPromoTitleEm if haveEnoughPoints else text_styles.superPromoTitleErr
     tokensIcon = icons.makeImageTag(source=backport.image(
         R.images.gui.maps.icons.epicBattles.rewardPoints.c_32x32()),
                                     width=32,
                                     height=32,
                                     vSpace=-6,
                                     hSpace=3)
     return {
         'title':
         text_styles.superPromoTitle(
             backport.text(
                 R.strings.event_progression.vehicle_preview.title())),
         'money':
         text_styles.concatStylesToSingleLine(
             formatMoney(str(storedPoints)), tokensIcon),
         'price':
         text_styles.concatStylesToSingleLine(
             formatPrice(str(vehiclePrice)), tokensIcon),
         'buyButtonEnabled':
         haveEnoughPoints and not buyButtonTooltip,
         'buyButtonLabel':
         backport.text(
             R.strings.vehicle_preview.buyingPanel.buyBtn.label.buy()),
         'buyButtonTooltip':
         buyButtonTooltip
     }
Example #34
0
 def _updateHeaderState(self):
     freePlaces = self.clanInfo.getFreePlaces()
     freePlacesInClanText = text_styles.concatStylesToSingleLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_HEADER_FREEPLACESINCLAN, count=text_styles.main(formatField(getter=self.clanInfo.getFreePlaces)))))
     if freePlaces == 0:
         inviteButtonEnabled = False
         inviteButtonTooltip = _ms(CLANS.CLANINVITESWINDOW_HEADER_TOOLTIPS_NOPLACES)
         freePlacesInClanText = gui.makeHtmlString('html_templates:lobby/research', 'warningMessage', {'text': freePlacesInClanText})
     else:
         inviteButtonEnabled = True
         inviteButtonTooltip = _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_HEADER_INVITEBUTTON)
     self.as_setHeaderStateS({'inviteButtonEnabled': inviteButtonEnabled,
      'inviteButtonText': CLANS.CLANINVITESWINDOW_HEADER_INVITEINCLAN,
      'inviteButtonTooltip': makeTooltip(body=inviteButtonTooltip),
      'freePlacesInClanText': freePlacesInClanText})