def formatters_formatModuleParamName(base, paramName): builder = text_styles.builder() if weightTooHeavy and paramName == 'weight': builder.addStyledText(text_styles.error, MENU.moduleinfo_params(paramName)) builder.addStyledText(text_styles.error, param_formatter.MEASURE_UNITS.get(paramName, '')) return builder.render() return base (paramName)
def __prepareAndPassVehiclesData(self): values = [] for vehicleCD in g_itemsCache.items.stats.eliteVehicles: try: vehicle = g_itemsCache.items.getItemByCD(vehicleCD) if not vehicle.xp: continue values.append({'id': vehicle.intCD, 'vehicleType': getVehicleTypeAssetPath(vehicle.type), 'vehicleName': vehicle.shortUserName, 'xp': vehicle.xp, 'xpStrValue': BigWorld.wg_getIntegralFormat(vehicle.xp), 'isSelectCandidate': vehicle.isFullyElite, 'vehicleIco': vehicle.iconSmall, 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31)}) except: continue labelBuilder = builder().addStyledText('middleTitle', i18n.makeString(MENU.EXCHANGE_RATE)) if self.__xpForFree is not None: labelBuilder.addStyledText(self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL)) labelBuilder.addStyledText('expText', i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree))) exchangeHeaderData = {'labelText': labelBuilder.render(), 'rateFromIcon': ICON_TEXT_FRAMES.GOLD, 'rateToIcon': ICON_TEXT_FRAMES.ELITE_XP, 'rateFromTextColor': self.app.colorManager.getColorScheme('textColorGold').get('rgb'), 'rateToTextColor': self.app.colorManager.getColorScheme('textColorCredits').get('rgb')} vehicleData = {'isHaveElite': bool(values), 'vehicleList': values, 'tableHeader': self._getTableHeader(), 'xpForFree': self.__xpForFree, 'exchangeHeaderData': exchangeHeaderData} self.as_vehiclesDataChangedS(vehicleData) return
def __prepareAndPassVehiclesData(self): values = [] for vehicleCD in g_itemsCache.items.stats.eliteVehicles: try: vehicle = g_itemsCache.items.getItemByCD(vehicleCD) if not vehicle.xp: continue values.append({'id': vehicle.intCD, 'vehicleType': getVehicleTypeAssetPath(vehicle.type), 'vehicleName': vehicle.shortUserName, 'xp': vehicle.xp, 'isSelectCandidate': vehicle.isFullyElite, 'vehicleIco': vehicle.iconSmall, 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31)}) except: continue labelBuilder = builder().addStyledText('middleTitle', i18n.makeString(MENU.EXCHANGE_RATE)) if self.__xpForFree is not None: labelBuilder.addStyledText(self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL)) labelBuilder.addStyledText('expText', i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree))) vehicleData = {'isHaveElite': bool(values), 'vehicleList': values, 'tableHeader': self._getTableHeader(), 'xpForFree': self.__xpForFree, 'rateLabel': labelBuilder.render(), 'xpAction': g_itemsCache.items.shop.isXPConversionActionActive} self.as_vehiclesDataChangedS(vehicleData) return
def setClanDossier(self, clanDossier): super(ClanProfileSummaryView, self).setClanDossier(clanDossier) self._showWaiting() clanInfo = yield clanDossier.requestClanInfo() ratings = yield clanDossier.requestClanRatings() globalMapStats = yield clanDossier.requestGlobalMapStats() if self.isDisposed(): return self._updateClanInfo(clanInfo) ratingStrBuilder = text_styles.builder(delimiter='\n') ratingStrBuilder.addStyledText(text_styles.promoTitle, formatField(getter=ratings.getEfficiency, formatter=BigWorld.wg_getIntegralFormat)) ratingStrBuilder.addStyledText(text_styles.stats, CLANS.CLANPROFILE_SUMMARYVIEW_TOTALRAGE) motto = clanInfo.getMotto() if motto: description = text_styles.main(motto) else: description = text_styles.standard(CLANS.CLANPROFILE_SUMMARYVIEW_DEFAULTCLANDESCR) hasGlobalMap = globalMapStats.hasGlobalMap() self.as_setDataS({'totalRating': ratingStrBuilder.render(), 'totalRatingTooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_TOTALRATING, 'clanDescription': description, 'isShowFortBtn': True, 'isShowClanNavBtn': hasGlobalMap, 'isShowUrlString': not hasGlobalMap}) self.as_updateGeneralBlockS(self.__makeGeneralBlock(clanInfo, syncUserInfo=True)) if clanDossier.isMyClan(): self.__fortStatsVOReceiver = _MyFortDataReceiver(ratings, clanDossier, self.__updateFortBlock) else: self.__fortStatsVOReceiver = _FortDataReceiver(ratings, clanDossier, self.__updateFortBlock) self.as_updateGlobalMapBlockS(self.__makeGlobalMapBlock(globalMapStats, ratings)) self.__updateStatus() self._hideWaiting()
def __populateSlotsData(self): selectedQuests = _getQuestsCache().getSelectedQuests().values() freeSlotsCount = _getQuestsProgress().getPotapovQuestsFreeSlots() slotIdx, slots = 0, [] for slotIdx, quest in enumerate(selectedQuests): tile = _getQuestsCache().getTiles()[quest.getTileID()] slots.append((tile.getChainSortKey(quest.getChainID()), self.__packQuestSlot(quest))) slots = map(lambda (_, slot): slot, _sortWithQuestType(slots, operator.itemgetter(0))) nextSlotIdx = slotIdx + 1 for slotIdx in xrange(nextSlotIdx, nextSlotIdx + freeSlotsCount): slots.append(self.__packQuestSlot()) self.as_setSlotsDataS({ 'questSlots': slots, 'hasActiveQuests': len(selectedQuests) > 0, 'noActiveQuestsText': text_styles.builder('\n').addStyledText( TEXT_MANAGER_STYLES.MIDDLE_TITLE, QUESTS. PERSONAL_SEASONS_SLOTS_NOACTIVESLOTS_HEADER).addStyledText( TEXT_MANAGER_STYLES.STANDARD_TEXT, QUESTS.PERSONAL_SEASONS_SLOTS_NOACTIVESLOTS_BODY).render() })
def setClanDossier(self, clanDossier): super(ClanProfileSummaryView, self).setClanDossier(clanDossier) self._showWaiting() clanInfo = yield clanDossier.requestClanInfo() if not clanInfo.isValid(): self._dummyMustBeShown = True self._updateDummy() self._hideWaiting() return ratings = yield clanDossier.requestClanRatings() globalMapStats = yield clanDossier.requestGlobalMapStats() if self.isDisposed(): return self._updateClanInfo(clanInfo) ratingStrBuilder = text_styles.builder(delimiter='\n') ratingStrBuilder.addStyledText(text_styles.promoTitle, formatField(getter=ratings.getEfficiency, formatter=BigWorld.wg_getIntegralFormat)) ratingStrBuilder.addStyledText(text_styles.stats, CLANS.CLANPROFILE_SUMMARYVIEW_TOTALRAGE) motto = clanInfo.getMotto() if motto: description = text_styles.main(motto) else: description = text_styles.standard(CLANS.CLANPROFILE_SUMMARYVIEW_DEFAULTCLANDESCR) hasGlobalMap = globalMapStats.hasGlobalMap() self.as_setDataS({'totalRating': ratingStrBuilder.render(), 'totalRatingTooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_TOTALRATING, 'clanDescription': description, 'isShowFortBtn': True, 'isShowClanNavBtn': hasGlobalMap, 'isShowUrlString': not hasGlobalMap}) self.as_updateGeneralBlockS(self.__makeGeneralBlock(clanInfo, syncUserInfo=True)) self.__strongholdStatsVOReceiver = StrongholdDataReceiver(clanDossier, self.__updateStrongholdBlock) self.__strongholdStatsVOReceiver.updateStrongholdStatistics() self.as_updateGlobalMapBlockS(self.__makeGlobalMapBlock(globalMapStats, ratings)) self.__updateStatus() self._hideWaiting()
def setRecord(self, result, _): self.icon = RES_ICONS.MAPS_ICONS_LIBRARY_ALERTICON builder = text_styles.builder(delimiter='\n') builder.addStyledText(text_styles.middleTitle, BATTLE_RESULTS.COMMON_NOINCOME_ALERT_TITLE) builder.addStyledText(text_styles.standard, BATTLE_RESULTS.COMMON_NOINCOME_ALERT_TEXT) self.text = builder.render()
def formatParamNameColonValueUnits(paramName, paramValue): builder = text_styles.builder(delimiter=_NBSP) resource = R.strings.menu.moduleInfo.params paramMsgId = backport.msgid(resource.dyn(paramName)()) if resource.dyn(paramName) else None builder.addStyledText(text_styles.main, '{}{}'.format(makeString(paramMsgId), _COLON)) builder.addStyledText(text_styles.expText, paramValue) builder.addStyledText(text_styles.standard, MEASURE_UNITS_NO_BRACKETS.get(paramName, '')) return builder.render()
def _formatModuleParamName(paramName): builder = text_styles.builder() resource = R.strings.menu.moduleInfo.params paramMsgId = backport.msgid( resource.dyn(paramName)()) if resource.dyn(paramName) else None builder.addStyledText(text_styles.main, paramMsgId) builder.addStyledText(_standardText, MEASURE_UNITS.get(paramName, '')) return builder.render()
def formatVehicleParamName(paramName, showMeasureUnit=True): if isRelativeParameter(paramName): return text_styles.middleTitle(MENU.tank_params(paramName)) else: builder = text_styles.builder(delimiter=_NBSP) builder.addStyledText(text_styles.main, MENU.tank_params(paramName)) if showMeasureUnit: builder.addStyledText(text_styles.standard, MEASURE_UNITS.get(paramName, '')) return builder.render()
def formatVehicleParamName(paramName, showMeasureUnit = True): if isRelativeParameter(paramName): return text_styles.middleTitle(MENU.tank_params(paramName)) else: builder = text_styles.builder() builder.addStyledText(text_styles.main, MENU.tank_params(paramName)) if showMeasureUnit: builder.addStyledText(text_styles.standard, MEASURE_UNITS.get(paramName, '')) return builder.render()
def formatters_formatModuleParamName(base, paramName): builder = text_styles.builder() if weightTooHeavy and paramName == 'weight': builder.addStyledText(text_styles.error, MENU.moduleinfo_params(paramName)) builder.addStyledText(text_styles.error, param_formatter.MEASURE_UNITS.get(paramName, '')) else: builder.addStyledText(text_styles.main, MENU.moduleinfo_params(paramName)) builder.addStyledText(text_styles.standard, param_formatter.MEASURE_UNITS.get(paramName, '')) return builder.render()
def formatModuleParamName(paramName, vDescr=None): builder = text_styles.builder(delimiter=_NBSP) hasBoost = vDescr and vDescr.gun.autoreloadHasBoost titleName = getTitleParamName(vDescr, paramName) resource = R.strings.menu.moduleInfo.params.dyn(titleName) paramMsgId = backport.msgid(resource.dyn('boost')() if hasBoost and resource.dyn('boost') else resource()) builder.addStyledText(text_styles.main, paramMsgId) measureName = getMeasureParamName(vDescr, paramName) builder.addStyledText(text_styles.standard, MEASURE_UNITS.get(measureName, '')) return builder.render()
def __prepareAndPassVehiclesData(self): values = [] for vehicleCD in g_itemsCache.items.stats.eliteVehicles: try: vehicle = g_itemsCache.items.getItemByCD(vehicleCD) if not vehicle.xp: continue values.append({ 'id': vehicle.intCD, 'vehicleType': getVehicleTypeAssetPath(vehicle.type), 'vehicleName': vehicle.shortUserName, 'xp': vehicle.xp, 'isSelectCandidate': vehicle.isFullyElite, 'vehicleIco': vehicle.iconSmall, 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31) }) except: continue labelBuilder = builder().addStyledText( 'middleTitle', i18n.makeString(MENU.EXCHANGE_RATE)) if self.__xpForFree is not None: labelBuilder.addStyledText( self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL)) labelBuilder.addStyledText( 'expText', i18n.makeString( MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree))) vehicleData = { 'isHaveElite': bool(values), 'vehicleList': values, 'tableHeader': self._getTableHeader(), 'xpForFree': self.__xpForFree, 'rateLabel': labelBuilder.render(), 'xpAction': g_itemsCache.items.shop.isXPConversionActionActive } self.as_vehiclesDataChangedS(vehicleData)
def __populateSlotsData(self): selectedQuests = _getQuestsCache().getSelectedQuests().values() freeSlotsCount = _getQuestsProgress().getPotapovQuestsFreeSlots() slotIdx, slots = 0, [] for slotIdx, quest in enumerate(selectedQuests): tile = _getQuestsCache().getTiles()[quest.getTileID()] slots.append((tile.getChainSortKey(quest.getChainID()), self.__packQuestSlot(quest))) slots = map(lambda (_, slot): slot, _sortWithQuestType(slots, operator.itemgetter(0))) nextSlotIdx = slotIdx + 1 for slotIdx in xrange(nextSlotIdx, nextSlotIdx + freeSlotsCount): slots.append(self.__packQuestSlot()) self.as_setSlotsDataS({'questSlots': slots, 'hasActiveQuests': len(selectedQuests) > 0, 'noActiveQuestsText': text_styles.builder('\n').addStyledText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, QUESTS.PERSONAL_SEASONS_SLOTS_NOACTIVESLOTS_HEADER).addStyledText(TEXT_MANAGER_STYLES.STANDARD_TEXT, QUESTS.PERSONAL_SEASONS_SLOTS_NOACTIVESLOTS_BODY).render()})
def __prepareAndPassVehiclesData(self): values = [] for vehicleCD in g_itemsCache.items.stats.eliteVehicles: try: vehicle = g_itemsCache.items.getItemByCD(vehicleCD) if not vehicle.xp: continue values.append( { "id": vehicle.intCD, "vehicleType": getVehicleTypeAssetPath(vehicle.type), "vehicleName": vehicle.shortUserName, "xp": vehicle.xp, "isSelectCandidate": vehicle.isFullyElite, "vehicleIco": vehicle.iconSmall, "nationIco": getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31), } ) except: continue labelBuilder = builder().addStyledText("middleTitle", i18n.makeString(MENU.EXCHANGE_RATE)) if self.__xpForFree is not None: labelBuilder.addStyledText( self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL) ) labelBuilder.addStyledText( "expText", i18n.makeString( MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree), ), ) vehicleData = { "isHaveElite": bool(values), "vehicleList": values, "tableHeader": self._getTableHeader(), "xpForFree": self.__xpForFree, "rateLabel": labelBuilder.render(), } self.as_vehiclesDataChangedS(vehicleData) return
def formatModuleParamName(paramName): builder = text_styles.builder() builder.addStyledText(text_styles.main, MENU.moduleinfo_params(paramName)) builder.addStyledText(text_styles.standard, MEASURE_UNITS.get(paramName, '')) return builder.render()
def formatParamNameColonValueUnits(paramName, paramValue): builder = text_styles.builder(delimiter=_NBSP) builder.addStyledText(text_styles.main, '{}{}'.format(makeString(MENU.moduleinfo_params(paramName)), _COLON)) builder.addStyledText(text_styles.expText, paramValue) builder.addStyledText(text_styles.standard, MEASURE_UNITS_NO_BRACKETS.get(paramName, '')) return builder.render()
def formatNameColonValue(nameStr, valueStr): builder = text_styles.builder(delimiter=_NBSP) builder.addStyledText(text_styles.main, '{}{}'.format(makeString(nameStr), _COLON)) builder.addStyledText(text_styles.expText, makeString(valueStr)) return builder.render()