def __getStatusTitle(self): currServerName = self._connectionMgr.serverUserNameShort status, timeLeft, _ = self.__rankedController.getPrimeTimeStatus() if status == PrimeTimeStatus.NOT_AVAILABLE: if not timeLeft: currentSeason = self.__rankedController.getCurrentSeason() return text_styles.grandTitle( backport.text(R.strings.ranked_battles.primeTime.status. seasonDisabled(), season=currentSeason.getUserName(), server=currServerName)) if not self._hasAvailableServers(): return text_styles.grandTitle( backport.text(R.strings.ranked_battles.primeTime.status. allServersDisabled())) startTime = formatDate( '%H:%M', time_utils.getCurrentLocalServerTimestamp() + timeLeft) return text_styles.grandTitle( backport.text( R.strings.ranked_battles.primeTime.status.untill(), startTime=startTime, server=currServerName)) return text_styles.grandTitle( backport.text( R.strings.ranked_battles.primeTime.status.disableFirst(), server=currServerName))
def __getStatusTitle(self): currServerName = self._connectionMgr.serverUserNameShort status, timeLeft, _ = self._getController().getPrimeTimeStatus() if not self._hasAvailableServers(): return text_styles.grandTitle( backport.text(R.strings.mapbox.primeTimeView.status. allServersDisabled())) if status == PrimeTimeStatus.NOT_AVAILABLE: if not timeLeft: currentSeason = self._getController().getCurrentSeason() return text_styles.grandTitle( backport.text( R.strings.mapbox.primeTimeView.status.seasonDisabled(), season=currentSeason.getUserName(), server=currServerName)) if timeLeft < time_utils.ONE_DAY: startTime = time_formatters.formatDate( '%H:%M', time_utils.getCurrentLocalServerTimestamp() + timeLeft) else: startTime = time_formatters.formatDate( '%d.%m.%Y', time_utils.getCurrentLocalServerTimestamp() + timeLeft) return text_styles.grandTitle( backport.text(R.strings.mapbox.primeTimeView.status.untill(), startTime=startTime, server=currServerName)) return text_styles.grandTitle( backport.text( R.strings.mapbox.primeTimeView.status.disableFirst(), server=currServerName)) if status in ( PrimeTimeStatus.FROZEN, PrimeTimeStatus.NOT_SET) else text_styles.grandTitle( backport.text(R.strings.mapbox.primeTimeView.status. allServersDisabled()))
def __setQualificationProgress(self, rank): division = rank.getDivision() divisionID = division.getID() total = self.__rankedController.getTotalQualificationBattles() stats = self.__rankedController.getStatsComposer() current = stats.divisionsStats.get(divisionID, {}).get('battles', 0) isCompleted = division.isCompleted() if not isCompleted: progressShortcut = R.strings.ranked_battles.division.status.qualification.progress( ) titleShortcut = R.strings.ranked_battles.division.status.qualification( ) progressSmall = text_styles.superPromoTitle( backport.text(progressShortcut, current=text_styles.superPromoTitleEm(current), total=total)) progressTextSmall = text_styles.superPromoTitle( backport.text(titleShortcut, progress=progressSmall)) progressBig = text_styles.grandTitle( backport.text(progressShortcut, current=text_styles.grandTitleYellow(current), total=total)) progressTextBig = text_styles.grandTitle( backport.text(titleShortcut, progress=progressBig)) else: progressTextSmall = '' progressTextBig = '' qualificationDescr = '' numQualificationQuestBattles = sorted( self.__rankedController.getQualificationQuests().keys()) if numQualificationQuestBattles: numQualificationQuestBattles.append(total) if isCompleted: qualificationDescr = text_styles.concatStylesToSingleLine( icons.check(), text_styles.statInfo( backport.text(R.strings.ranked_battles.division.status. qualificationDescr.complete()))) else: qualificationDescr = text_styles.main( backport.text(R.strings.ranked_battles.division.status. qualificationDescr.progress(), battlesTotal=total, battlesList=', '.join([ str(x) for x in numQualificationQuestBattles ]))) self.as_setQualificationProgressS(progressTextSmall, progressTextBig, isCompleted, qualificationDescr)
def _getActionBannerStr(paramDiscount, paramDate=''): discountStr = text_styles.grandTitle(''.join( ('-', str(paramDiscount), '%'))) return discountStr if not paramDate else text_styles.concatStylesToMultiLine( text_styles.mainBig( backport.text(R.strings.menu.barracks.notRecruitedActivateBefore(), date=paramDate)), discountStr)
def _populate(self): super(HangarVehicleInfo, self)._populate() self.__battleRoyaleController.onUpdated += self.__onBattleRoyaleEnabledChanged self.startGlobalListening() self.as_setDataS({ 'btnCloseLabel': backport.text( R.strings.battle_royale.hangarVehicleInfo.closeBtn()), 'infoIconSource': backport.image(R.images.gui.maps.icons.library.info()), 'infoText': text_styles.highlightText( backport.text( R.strings.battle_royale.hangarVehicleInfo.moduleTreeTip(), key=text_styles.neutral( br_helpers.getHotKeyString( CommandMapping.CMD_UPGRADE_PANEL_SHOW)))), 'vehTitle': text_styles.grandTitle(self.__vehicle.shortUserName), 'vehTypeIcon': getTypeBigIconPath(self.__vehicle.type), 'tutorialText': backport.text( R.strings.battle_royale.hangarVehicleInfo.tutorialText()) })
def _populate(self): super(BadgesPage, self)._populate() userName = BigWorld.player().name self.as_setStaticDataS({ 'header': { 'backBtnLabel': backport.text( R.strings.badge.badgesPage.header.backBtn.label()), 'backBtnDescrLabel': self.__backViewName, 'descrTf': text_styles.main(BADGE.BADGESPAGE_HEADER_DESCR), 'playerText': text_styles.grandTitle( self.lobbyContext.getPlayerFullName(userName)) } }) self.__updateBadges() if self.__tutorStorage is not None: hasNewBadges = self.__checkNewSuffixBadges() if hasNewBadges: self.__tutorStorage.setValue( GLOBAL_FLAG.BADGE_PAGE_HAS_NEW_SUFFIX_BADGE, True) self.badgesController.onUpdated += self.__updateBadges return
def _getHeaderBlockData(self): vehInfo = self.vehicle.name.split(':') tankImage = R.images.gui.maps.icons.vehicle.c_420x307.dyn(self._tankNameToRClassName(vehInfo[1]))() if tankImage == -1: _logger.error('no background image for tooltip for tank %s', str(self._tankNameToRClassName(vehInfo[1]))) tankImage = R.images.gui.maps.icons.vehicle.c_420x307.dyn('tank_empty')() return TankStatsHeaderVO(tankName=text_styles.grandTitle(self.vehicle.userName), isFavorite=self.vehicle.isFavorite, flagImage=backport.image(R.images.gui.maps.icons.flags.c_362x362.dyn(vehInfo[0])()), tankImage=backport.image(tankImage) if tankImage != -1 else '', tankParams=self._getTankParamsVO(True), favoriteText=text_styles.bonusPreviewText(backport.text(R.strings.session_stats.tankInfo.main())), smallSize=True, tankType='{}_elite'.format(self.vehicle.type) if self.vehicle.isElite else self.vehicle.type, tankTier=text_styles.grandTitle(str(int2roman(self.vehicle.level))), tankNameSmall=text_styles.grandTitle(self.vehicle.shortUserName), isElite=self.vehicle.isElite)
def __setTitlesData(self): seasonTitlesText = {season:_ms(_CUSTOMIZATION_SEASON_TITLES[season]) for season in SeasonType.COMMON_SEASONS} if self.__isStyle: item = self.__ctx.getPurchaseItems()[0].item titleTemplate = '{} {}'.format(item.userType, item.userName) bigTitleTemplate = '{}\n{}'.format(item.userType, text_styles.heroTitle(item.userName)) else: totalCount = 0 for season in SeasonType.COMMON_SEASONS: purchase, inventory = self.__counters[season] count = purchase + inventory totalCount += count seasonTitlesText[season] += (text_styles.unavailable(' ({})') if count == 0 else ' ({})').format(count) titleTemplate = '{} ({})'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_BUYWINDOW_TITLE), totalCount) bigTitleTemplate = text_styles.grandTitle(titleTemplate) titleText = text_styles.promoTitle(bigTitleTemplate) titleTextSmall = text_styles.promoTitle(titleTemplate) self.as_setInitDataS({'windowTitle': VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_HEADER, 'isStyle': self.__isStyle, 'titleText': titleText, 'titleTextSmall': titleTextSmall}) self.as_setTitlesS({'summerTitle': seasonTitlesText[SeasonType.SUMMER], 'winterTitle': seasonTitlesText[SeasonType.WINTER], 'desertTitle': seasonTitlesText[SeasonType.DESERT]})
def getBaseTitleVO(vehicle): tankUserName = vehicle.userName return { 'intCD': vehicle.intCD, 'tankNameStr': text_styles.grandTitle(tankUserName), 'tankNameStrSmall': text_styles.promoTitle(tankUserName), 'statusStr': '', 'roleText': getRoleTextWithIcon(vehicle.role, vehicle.roleLabel), 'showInfoIcon': False }
def getTitleVO(vehicle): baseVO = getBaseTitleVO(vehicle) tankUserName = vehicle.userName titleRes = R.strings.veh_post_progression.vehPostProgressionCmpView.title() baseVO.update({ 'tankNameStr': text_styles.grandTitle(backport.text(titleRes, title=tankUserName)), 'tankNameStrSmall': text_styles.promoTitle(backport.text(titleRes, title=tankUserName)) }) return baseVO
def __setQualificationProgress(self, rank): division = rank.getDivision() divisionID = division.getID() total = self.__rankedController.getTotalQualificationBattles() stats = self.__rankedController.getStatsComposer() current = stats.divisionsStats.get(divisionID, {}).get('battles', 0) progressShortcut = R.strings.ranked_battles.division.status.qualification.progress( ) titleShortcut = R.strings.ranked_battles.division.status.qualification( ) progressSmall = text_styles.superPromoTitleEm( backport.text(progressShortcut, current=text_styles.superPromoTitle(current), total=total)) progressTextSmall = text_styles.superPromoTitle( backport.text(titleShortcut, progress=progressSmall)) progressBig = text_styles.grandTitleYellow( backport.text(progressShortcut, current=text_styles.grandTitle(current), total=total)) progressTextBig = text_styles.grandTitle( backport.text(titleShortcut, progress=progressBig)) self.as_setQualificationProgressS(progressTextSmall, progressTextBig, division.isCompleted())
def getTitleVO(vehicle): baseVO = getBaseTitleVO(vehicle) tankTier = int2roman(vehicle.level) baseVO.update({ 'showInfoIcon': True, 'tankTierStr': text_styles.grandTitle(tankTier), 'tankTierStrSmall': text_styles.promoTitle(tankTier), 'typeIconPath': getTypeBigIconPath(vehicle.type, vehicle.isElite), 'isElite': vehicle.isElite }) return baseVO
def _prepareData(self, serverList, serverInfo): isSingleServer = len(serverList) == 1 return { 'warningIconSrc': self._getWarningIcon(), 'status': text_styles.grandTitle(self._getStatusText()), 'serversText': text_styles.expText(self._getServerText(serverList, serverInfo)), 'timeText': text_styles.expText(self._getTimeText(serverInfo)), 'showAlertBG': self._isAlertBGVisible(), 'serversDDEnabled': not isSingleServer, 'serverDDVisible': not isSingleServer }
def _populate(self): super(BadgesPage, self)._populate() userName = BigWorld.player().name self.as_setStaticDataS({ 'header': { 'backBtnLabel': backport.text( R.strings.badge.badgesPage.header.backBtn.label()), 'backBtnDescrLabel': self.__backViewName, 'descrTf': text_styles.main(BADGE.BADGESPAGE_HEADER_DESCR), 'playerText': text_styles.grandTitle( self.lobbyContext.getPlayerFullName(userName)) } }) self.__updateBadges() self.badgesController.onUpdated += self.__updateBadges
def _packSkillViewVO(self): unspentSkillPoints = self.epicMetaGameCtrl.getSkillPoints() showSkillPoint = unspentSkillPoints > 0 data = EpicBattlesSkillViewVO( skillPoints=unspentSkillPoints, skills=[], showSkillPoints=showSkillPoint, header=text_styles.superPromoTitle( EPIC_BATTLE.METAABILITYSCREEN_MANAGE_RESERVES_HEADER), headerBig=text_styles.grandTitle( EPIC_BATTLE.METAABILITYSCREEN_MANAGE_RESERVES_HEADER), skillsLabel=self.__getUnspentPointsStr(showSkillPoint), skillInfo=self._packSkillInfo(), backgroundImageSrc=RES_ICONS. MAPS_ICONS_EPICBATTLES_BACKGROUNDS_META_BLUR_BG)._asdict() skillLvls = self.epicMetaGameCtrl.getSkillLevels() allSkills = self.epicMetaGameCtrl.getSkillInformation() for skillID, skillInfo in allSkills.iteritems(): lvl = skillLvls[skillID] if skillID in skillLvls else 0 icon = RES_ICONS.getEpicBattlesSkillIcon( '176x176', skillInfo.levels[max(1, lvl)].icon) name = skillInfo.levels[max(1, lvl)].name descr = skillInfo.levels[max(1, lvl)].longDescr if lvl == 0: label = text_styles.standard( EPIC_BATTLE.METAABILITYSCREEN_ABILITY_NOT_UNLOCKED) else: label = self._getLevelStr(lvl) data['skills'].append( EpicBattleSkillVO(skillID=skillID, level=lvl, maxLevel=len(skillInfo.levels), title=text_styles.highTitle(name), smallTitle=text_styles.middleTitle(name), desc=descr, label=label, skillLevelLabels=_SKILL_LEVEL_TEXTS, iconUrl=icon)._asdict()) return data
def _getUnlockedBannerStr(param): return text_styles.concatStylesToMultiLine( text_styles.mainBig( backport.text( R.strings.blueprints.blueprintScreen.researchSale.label())), text_styles.grandTitle(''.join(('-', str(param), '%'))))
def _getRentBannerStr(param): return text_styles.concatStylesToMultiLine( text_styles.mainBig( backport.text(R.strings.menu.research.premium.discount())), text_styles.grandTitle(''.join(('-', str(param), '%'))))
def _getRootData(self): root = self.vehicle rootNode = self._data.getRootNode() nodeState = rootNode.getState() bpfProps = rootNode.getBpfProps() isNext2Unlock = NODE_STATE.isNext2Unlock(nodeState) isPremium = NODE_STATE.isCollectibleActionVehicle( nodeState) or NODE_STATE.isPremium(nodeState) comparisonState, comparisonTooltip = resolveStateTooltip( self._cmpBasket, root, enabledTooltip='', fullTooltip=TOOLTIPS.RESEARCHPAGE_VEHICLE_BUTTON_COMPARE_DISABLED) tankTier = int2roman(root.level) tankHasNationGroup = (root.isInInventory or root.isRented) and root.hasNationGroup isNationChangeAvailable = root.isNationChangeAvailable isShownNationChangeTooltip = tankHasNationGroup and not isNationChangeAvailable result = { 'vehicleTitle': { 'intCD': self._data.getRootCD(), 'tankTierStr': text_styles.grandTitle(tankTier), 'tankNameStr': text_styles.grandTitle(root.userName), 'tankTierStrSmall': text_styles.promoTitle(tankTier), 'tankNameStrSmall': text_styles.promoTitle(root.userName), 'typeIconPath': getTypeBigIconPath(root.type, root.isElite), 'isElite': root.isElite, 'statusStr': self.__getRootStatusStr(root), 'roleText': getRoleTextWithIcon(root.role, root.roleLabel) }, 'vehicleButton': { 'shopIconPath': RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_MEDIUM, root.name.split(':')[1]), 'compareBtnVisible': not self.__bootcamp.isInBootcamp(), 'compareBtnEnabled': comparisonState, 'compareBtnLabel': backport.text( R.strings.menu.research.labels.button.addToCompare()), 'compareBtnTooltip': comparisonTooltip, 'previewBtnEnabled': root.isPreviewAllowed(), 'previewBtnLabel': backport.text( R.strings.menu.research.labels.button.vehiclePreview()), 'isPremium': isPremium, 'vehicleId': self._data.getRootCD(), 'vehicleState': nodeState, 'isInInventory': NODE_STATE.inInventory(nodeState), 'previewAlias': VIEW_ALIAS.LOBBY_RESEARCH, 'cmHandlerType': CONTEXT_MENU_HANDLER_TYPE.RESEARCH_VEHICLE }, 'isInteractive': self.__getIsInteractive(root, rootNode), 'buttonLabel': self.__getMainButtonLabel(root, rootNode), 'blueprintLabel': self.__getResearchPageBlueprintLabel(rootNode), 'blueprintProgress': rootNode.getBlueprintProgress(), 'blueprintCanConvert': bpfProps.canConvert if bpfProps is not None else False, 'bpbGlowEnabled': isNext2Unlock, 'itemPrices': rootNode.getItemPrices(), 'discountStr': self.__getDiscountBannerStr(root, rootNode), 'rentBtnLabel': self.__getRentButtonLabel(rootNode), 'changeNationBtnVisibility': tankHasNationGroup, 'isTankNationChangeAvailable': isNationChangeAvailable, 'nationChangeIsNew': not AccountSettings.getSettings(NATION_CHANGE_VIEWED), 'nationChangeTooltip': self.__getNationChangeTooltip(root) if isShownNationChangeTooltip else '' } return result