def _packBlocks(self, *args, **kwargs): items = super(ResearchTreePacker, self)._packBlocks(*args, **kwargs) imgPdg = {'left': 12, 'top': 30} txtGap = 2 blocksGap = 12 items.append(formatters.packBuildUpBlockData([formatters.packImageTextBlockData(title=text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_COMMONTECH_TITLE), desc=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_COMMONTECH_DESCRIPTION), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_COMMONTANK, imgPadding=imgPdg, txtGap=txtGap, imgAtLeft=False), formatters.packImageTextBlockData(title=text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_PREMIUMTECH_TITLE), desc=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_PREMIUMTECH_DESCRIPTION), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_PREMTANK, imgPadding=imgPdg, txtGap=txtGap, imgAtLeft=False)], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) imgPdg = {'left': 12, 'top': 3} txtOffset = 34 txtGap = 0 blocksGap = 2 items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_TITLE)), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_LIGHTTANK), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_LIGHTTANK, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_MEDIUMTANK), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_MEDIUMTANK, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_HEAVYTANK), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_HEAVYTANK, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_AT_SPG), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_AT_SPG, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_SPG), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_SPG, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset)], blocksGap)) imgPdg = {'left': 3, 'top': 2} txtOffset = 82 txtGap = 0 blocksGap = 8 items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_TITLE)), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_RESEARCH), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_RESEARCHBUTTON, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_BUY), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_BUYBUTTON, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset), formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_INHANGAR), img=RES_ICONS.MAPS_ICONS_LIBRARY_COMPLETEDINDICATOR, imgPadding={'left': 3, 'top': -3}, txtGap=txtGap, txtOffset=txtOffset)], blocksGap)) return items
def __prepareDefResInfo(self): result = {} icon = None level = None showAlertIcon = False alertIconTooltip = '' if self._isBaseBuilding: defResTitle = text_styles.middleTitle(i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESINFO_BASEBUILDINGTITLE)) defresDescr = text_styles.main(i18n.makeString(FORT.buildings_defresinfo(self._buildingUID))) else: order = self.fortCtrl.getFort().getOrder(self.__orderID) icon = order.icon level = order.level defResTitle = text_styles.middleTitle(i18n.makeString('#fortifications:General/orderType/%s' % self.getOrderUIDbyID(self.__orderID))) defresDescr = order.description showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order) result['showAlertIcon'] = showAlertIcon result['alertIconTooltip'] = alertIconTooltip result['title'] = defResTitle result['description'] = defresDescr result['iconSource'] = icon result['iconLevel'] = level if self.__orderID in constants.FORT_ORDER_TYPE.CONSUMABLES: result['orderID'] = self.__orderID return result
def __getDescription(self, description, chapter): return { "descTitle": text_styles.middleTitle(QUESTS.BEGINNERQUESTS_DETAILS_DESCRIPTIONTITLE), "descText": text_styles.main(description), "conditionItems": self.__getTopConditions(chapter), "conditionsTitle": text_styles.middleTitle(QUESTS.BEGINNERQUESTS_DETAILS_CONDITIONSTITLE), }
def onBoosterActionBtnClick(self, boosterID, questID): if self.__isReceivedBoostersTab: booster = g_goodiesCache.getBooster(boosterID) activeBooster = self.__getActiveBoosterByType(booster.boosterType) if activeBooster is not None: canActivate = yield DialogsInterface.showDialog( I18nConfirmDialogMeta( BOOSTER_CONSTANTS.BOOSTER_ACTIVATION_CONFORMATION_TEXT_KEY, messageCtx={ "newBoosterName": text_styles.middleTitle(booster.description), "curBoosterName": text_styles.middleTitle(activeBooster.description), }, focusedID=DIALOG_BUTTON_ID.CLOSE, ) ) else: canActivate = True if canActivate: self.__activateBoosterRequest(booster) else: if questID and questID.isdigit(): questID = int(questID) quest = g_eventsCache.getAllQuests(includePotapovQuests=True).get(questID) if quest is not None: quests_events.showEventsWindow(quest.getID(), quest.getType()) elif self.__questsDescriptor and self.__questsDescriptor.getChapter(questID): quests_events.showEventsWindow(questID, constants.EVENT_TYPE.TUTORIAL) return
def _packBlocks(self, paramName): extendedData = self.context.getComparator().getExtendedData(paramName) self.__paramName = extendedData.name title = text_styles.highTitle(MENU.tank_params(paramName)) if param_formatter.isRelativeParameter(paramName): value = param_formatter.colorizedFormatParameter(extendedData, self.context.formatters) title += ' ' + text_styles.warning(_ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value)) else: title += ' ' + text_styles.middleTitle(MEASURE_UNITS.get(paramName, '')) desc = _ms(TOOLTIPS.tank_params_desc(paramName)) possibleBonuses = sorted(extendedData.possibleBonuses, _bonusCmp) if possibleBonuses is not None and len(possibleBonuses) > 0: desc += ' ' + _ms(TOOLTIPS.VEHICLEPARAMS_POSSIBLEBONUSES_DESC) desc += '\n' + self.__createBonusesStr(possibleBonuses) blocks = [formatters.packTitleDescBlock(title, text_styles.main(desc))] bonuses = sorted(extendedData.bonuses, _bonusCmp) if bonuses is not None and len(bonuses) > 0: blocks.append(formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE), text_styles.main(self.__createBonusesStr(bonuses)))) penalties = extendedData.penalties actualPenalties, nullPenaltyTypes = self.__getNumNotNullPenaltyTankman(penalties) penaltiesLen = len(penalties) numNotNullPenaltyTankman = len(actualPenalties) if numNotNullPenaltyTankman > 0: blocks.append(formatters.packTitleDescBlock(text_styles.critical(TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE), text_styles.main(self.__createPenaltiesStr(actualPenalties)))) if penaltiesLen > numNotNullPenaltyTankman: blocks.append(formatters.packImageTextBlockData(self.__createTankmanIsOutStr(nullPenaltyTypes), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding(top=2, left=3, right=6))) return blocks
def _populate(self): super(FortOrderInfoWindow, self)._populate() self.as_setWindowDataS( { "windowTitle": self.__order.userName, "panelTitle": text_styles.middleTitle("#fortifications:fortConsumableOrder/battleParams"), "orderDescrTitle": text_styles.middleTitle("#fortifications:fortConsumableOrder/titleDescr"), "btnLbl": _ms("#fortifications:Orders/orderPopover/closeButton"), "orderDescrBody": text_styles.main(self.__order.getOperationDescription()), } ) fmtLvl = text_styles.main( _ms( "#fortifications:fortConsumableOrder/params/level_lbl", level=fort_formatters.getTextLevel(self.__order.level), ) ) self.as_setDynPropertiesS( { "orderIcon": self.__order.icon, "level": self.__order.level, "orderLevel": fmtLvl, "orderTitle": self.__order.userName, "orderParams": self.__makeParams(), } )
def __setBonusData(self, blData): crewPanelRenderList = self.__createBonusVOList(blData, QUALIFIER_TYPE_INDEX) visibilityPanelRenderList = self.__createBonusVOList(blData, [QUALIFIER_TYPE.CAMOUFLAGE]) self.as_setBonusPanelDataS({'crewPanel': {'bonusTitle': text_styles.middleTitle(VEHICLE_CUSTOMIZATION.CUSTOMIZATIONBONUSPANEL_CREWTITLE), 'bonusRenderersList': crewPanelRenderList}, 'visibilityPanel': {'bonusTitle': text_styles.middleTitle(VEHICLE_CUSTOMIZATION.CUSTOMIZATIONBONUSPANEL_VISIBILITYTITLE), 'bonusRenderersList': visibilityPanelRenderList}})
def _packBlocks(self, *args, **kwargs): items = super(PersonalCaseAdditionalPacker, self)._packBlocks(*args, **kwargs) blocksGap = 10 items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDDESCRIPTION)), formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGDESCRIPTION)), formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSDESCRIPTION)), formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSDESCRIPTION))], blocksGap)) return items
def _packBlocks(self, *args, **kwargs): items = super(CustomizationTypesPacker, self)._packBlocks(*args, **kwargs) imgPdg = {'left': 3, 'right': 8, 'top': -4} txtGap = -4 items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlockSmallTitle(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_CAMOUFLAGEBLOCKTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_CAMOUFLAGEBLOCKDESCRIPTION)), formatters.packBuildUpBlockData([formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_WINTERCAMOUFLAGETITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_WINTERCAMOUFLAGEDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_WINTER, imgPdg, txtGap=txtGap), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_SUMMERCAMOUFLAGETITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_SUMMERCAMOUFLAGEDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_SUMMER, imgPdg, txtGap=txtGap), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_DESERTCAMOUFLAGETITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_DESERTCAMOUFLAGEDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_DESERT, imgPdg, txtGap=txtGap)], gap=5)], gap=13)) items.append(formatters.packTitleDescBlockSmallTitle(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_EMBLEMBLOCKTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_EMBLEMBLOCKDESCRIPTION))) items.append(formatters.packTitleDescBlockSmallTitle(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_LABELSBLOCKTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_CUSTOMIZATION_TYPES_LABELSBLOCKDESCRIPTION))) return items
def __updateNotActivatedView(self): _ms = i18n.makeString titleText = text_styles.promoTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_TITLE)) description = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_DESCRIPTION)) conditionTitle = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONTITLE)) firstConditionIcon = icons.checkmark() secondConditionIcon = icons.checkmark() conditionsText = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS)) fortConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_FORTLEVEL)) defenceConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_DEFENCE)) attackConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_ATTACK)) firstConditionNotReady = "" secondConditionNotReady = "" if not self.__checkBaseLevel(): firstConditionIcon = text_styles.standard("-") firstConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY)) if not self.__checkPlayerCount(): secondConditionIcon = text_styles.standard("-") secondConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY)) firstConditionMsg = text_styles.main( _ms( FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_BASELEVELCONDITION, level=fort_formatters.getTextLevel(g_fortCache.defenceConditions.minRegionLevel), isNotReady=firstConditionNotReady, ) ) secondConditionMsg = text_styles.main( _ms( FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_PLAYERCOUNTCONDITION, membersCount=BigWorld.wg_getNiceNumberFormat(g_fortCache.defenceConditions.minClanMembers), isNotReady=secondConditionNotReady, ) ) fortCondition = firstConditionMsg secondCondition = secondConditionMsg settingsBlockTop = self.__makeSettingsBlockVO(True) settingsBlockBottom = self.__makeSettingsBlockVO(False) result = { "titleText": titleText, "description": description, "conditionTitle": conditionTitle, "firstCondition": fortCondition, "secondCondition": secondCondition, "conditionsText": conditionsText, "fortConditionsText": fortConditionsText, "defenceConditionsText": defenceConditionsText, "attackConditionsText": attackConditionsText, "isBtnEnabled": self.__checkConditions(), "btnToolTipData": self.__getButtonToolTip(), "firstStatus": firstConditionIcon, "secondStatus": secondConditionIcon, "settingsBlockTop": settingsBlockTop, "settingsBlockBottom": settingsBlockBottom, } self.as_setDataForNotActivatedS(result)
def _populate(self): super(FortOrderInfoWindow, self)._populate() self.as_setWindowDataS({'windowTitle': self.__order.userName, 'panelTitle': text_styles.middleTitle('#fortifications:fortConsumableOrder/battleParams'), 'orderDescrTitle': text_styles.middleTitle('#fortifications:fortConsumableOrder/titleDescr'), 'btnLbl': _ms('#fortifications:Orders/orderPopover/closeButton'), 'orderDescrBody': text_styles.main(self.__order.getOperationDescription())}) fmtLvl = text_styles.main(_ms('#fortifications:fortConsumableOrder/params/level_lbl', level=fort_formatters.getTextLevel(self.__order.level))) self.as_setDynPropertiesS({'orderIcon': self.__order.icon, 'level': self.__order.level, 'orderLevel': fmtLvl, 'orderTitle': self.__order.userName, 'orderParams': self.__makeParams()})
def __onClubsFoundListUpdated(self, selectedID, isFullUpdate, isReqInCoolDown, result): if not result: text = '\n'.join([text_styles.middleTitle(CYBERSPORT.WINDOW_UNITLISTVIEW_NOSEARCHRESULTS_HEADER), text_styles.standard(CYBERSPORT.WINDOW_UNITLISTVIEW_NOSEARCHRESULTS_DESCRIPTION)]) self.__onClubsListUpdated(None, True, False, []) self.as_noSearchResultsS(text, True) else: self.__onClubsListUpdated(selectedID, isFullUpdate, isReqInCoolDown, result)
def makeVO(self): """ Makes VO for ConfirmExchangeDialog :return: <obj> """ item = self._items.getItemByCD(self.getTypeCompDescr()) resToExchange = self._getResourceToExchange() extraData = None if item.itemTypeID == GUI_ITEM_TYPE.GUN and item.isClipGun(): extraData = CLIP_ICON_PATH state, stateMsg = self.__getState(resToExchange) return { "title": self.getTitle(), "exchangeBtnText": self.getButtonLabels()[0]["label"], "cancelBtnText": self.getButtonLabels()[1]["label"], "state": state, "lockExchangeMessage": stateMsg, "iconExtraInfo": extraData, "iconModuleType": item.itemTypeName, "icon": self.__getItemIcon(item), "iconType": self.__getItemIconType(item), "itemName": text_styles.middleTitle(item.userName), "needItemsText": self.__getResourceToExchangeTxt(resToExchange), "needGoldText": self.__getGoldToExchangeTxt(resToExchange), "exchangeBlockData": self.__getExchangeBlockData(resToExchange), }
def __packQuestSlot(self, quest = None): ttHeader, ttBody, ttAttention, ttNote = (None, None, None, None) if quest is not None: tile = _getQuestsCache().getTiles()[quest.getTileID()] season = _getQuestsCache().getSeasons()[tile.getSeasonID()] isInProgress = True ttHeader = quest.getUserName() ttBody = quests_fmts.getFullTileUserName(season, tile) if quest.needToGetReward(): icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0) description = text_styles.neutral(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_GETAWARD, icon=icon)) ttAttention = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_MISSIONCOMPLETE_ATTENTION) else: description = text_styles.standard(quests_fmts.getPQFullDescription(quest)) ttNote = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_MISSION_NOTE) title = text_styles.middleTitle(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_TITLE, questName=quest.getUserName())) else: title, isInProgress = '', False description = text_styles.disabled(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_NODATA)) ttHeader = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_HEADER) ttBody = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_BODY) return {'id': quest.getID() if quest else None, 'title': title, 'description': description, 'inProgress': isInProgress, 'completed': quest and quest.needToGetReward(), 'ttHeader': ttHeader, 'ttBody': ttBody, 'ttNote': ttNote, 'ttAttention': ttAttention}
def _getStatusStrings(vState, vStateLvl = Vehicle.VEHICLE_STATE_LEVEL.INFO, substitute = '', style = None, ctx = None): """ Get status string for small and large slots. :param vState: one of VEHICLE_STATE :param vStateLvl: one of VEHICLE_STATE_LEVEL :param substitute: is provided, substitutes status string for small slot (since it's too small to hold multiple strings) :param style: if provided, forces usage of this style :param ctx: keyword arguments for status text :return: tuple (status for small slot, status for large slot) """ ctx = ctx or {} status = _ms('#menu:tankCarousel/vehicleStates/{}'.format(vState), **ctx) if style is None: smallStyle, largeStyle = _getStatusStyles(vStateLvl) else: smallStyle = largeStyle = style if status: return (smallStyle(status), largeStyle(status)) elif substitute: return (text_styles.middleTitle(substitute), status) else: return (status, status) return
def __packLadderData(self, clubs): formations = [] club = self.clubsCtrl.getClub(self._clubDbID) ladderInfo = club.getLadderInfo() if club and ladderInfo.isInLadder(): for clubInfo in sorted(clubs, key=lambda club: club.ladderRank): self.requestClubEmblem32x32(clubInfo.clubDBID, clubInfo.clubEmblemUrl) battlesCount = BigWorld.wg_getNiceNumberFormat(clubInfo.battlesCount) winsPercent = 0 if clubInfo.battlesCount > 0: winsPercent = clubInfo.winsCount / float(clubInfo.battlesCount) * 100 winsPercentStr = BigWorld.wg_getNiceNumberFormat(winsPercent) + '%' clubName = clubInfo.clubName ladderPoints = clubInfo.getRatingPoints(ladderInfo.getDivision()) emblem = self._clubEmblems.get(clubInfo.clubDBID, None) texturePath = self.getMemoryTexturePath(emblem) if emblem else '' formations.append({'formationId': str(clubInfo.clubDBID), 'showProfileBtnText': _ms(CYBERSPORT.STATICFORMATION_LADDERVIEW_SHOWFORMATIONPROFILEBTN_TEXT), 'showProfileBtnTooltip': TOOLTIPS.STATICFORMATIONLADDERVIEW_SHOWFORMATIONPROFILEBTN, 'emblemIconPath': texturePath, 'place': text_styles.standard(str(clubInfo.ladderRank)), 'placeSortValue': clubInfo.ladderRank, 'points': text_styles.middleTitle(str(ladderPoints)), 'pointsSortValue': ladderPoints, 'formationName': text_styles.highTitle(clubName), 'formationNameSortValue': clubName, 'battlesCount': text_styles.stats(battlesCount), 'battlesCountSortValue': clubInfo.battlesCount, 'winPercent': text_styles.stats(winsPercentStr), 'winPercentSortValue': winsPercent, 'isCurrentTeam': self._clubDbID == clubInfo.clubDBID}) return {'formations': formations}
def buildList(self, cartItems): self.clear() elementGroups = [[], [], []] for item in cartItems: element = item['object'] dropdownItem = {'id': element.getID(), 'slotIdx': item['idx'], 'selected': item['isSelected'], 'cType': item['type'], 'itemName': element.getName(), 'imgBonus': element.qualifier.getIcon16x16(), 'price': element.getPrice(item['duration']), 'lblBonus': text_styles.stats('+{0}%{1}'.format(element.qualifier.getValue(), '*' if element.qualifier.getDescription() is not None else '')), 'titleMode': False, 'DDPrice': _getDropdownPriceVO(element), 'selectIndex': DURATION.ALL.index(item['duration']), 'isDuplicatePrice': item['isDuplicate'], 'duplicatePriceText': icons.info() + _ms(VEHICLE_CUSTOMIZATION.BUYWINDOW_BUYTIME_COPY), 'duplicatePriceTooltip': makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_BUYWINDOW_COPY_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_BUYWINDOW_COPY_BODY))} elementGroups[item['type']].append(dropdownItem) for elements, title in zip(elementGroups, _CUSTOMIZATION_TYPE_TITLES): if elements: elements.insert(0, {'titleMode': True, 'titleText': _ms(text_styles.middleTitle(title))}) self._list = list(itertools.chain(*elementGroups)) return
def __setBottomPanelData(self, *args): if self.__isCarouselHidden: occupiedSlotsNum, totalSlotsNum = self.__controller.slots.getSummary() label = text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.TYPESWITCHSCREEN_SLOTSUMMARY, occupiedSlotsNum=occupiedSlotsNum, totalSlotsNum=totalSlotsNum)) else: label = text_styles.middleTitle(_ms('#vehicle_customization:typeSwitchScreen/typeName/plural/{0}'.format(self.__controller.slots.currentType))) totalGold = self.__controller.cart.totalPriceGold totalCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBottomPanelHeaderS({'newHeaderText': label, 'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(self.__controller.cart.items)), 'pricePanel': {'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip}})
def _packAppliedToVehicles(self, data): subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle('#vehicle_customization:customization/tooltip/applied/title'))] allowedVehicles = data['allowedVehicles'] notAllowedVehicles = data['notAllowedVehicles'] allowedNations = data['allowedNations'] notAllowedNations = data['notAllowedNations'] allowedVehicles = map(lambda vId: g_itemsCache.items.getItemByCD(vId), allowedVehicles) notAllowedVehicles = map(lambda vId: g_itemsCache.items.getItemByCD(vId), notAllowedVehicles) allowedVehicles = filter(lambda vehicle: not vehicle.isSecret, allowedVehicles) notAllowedVehicles = filter(lambda vehicle: not vehicle.isSecret, notAllowedVehicles) if data['boundToCurrentVehicle']: description = _ms('#tooltips:customization/questAward/currentVehicle') elif allowedVehicles: description = self._getVehiclesNames(allowedVehicles) else: if allowedNations: if len(allowedNations) > len(notAllowedNations): description = _ms('#vehicle_customization:customization/tooltip/applied/allNations') description += _ms('#vehicle_customization:customization/tooltip/applied/elementsSeparator') description += _ms('#vehicle_customization:customization/tooltip/applied/excludeNations', nations=self._getNationNames(notAllowedNations)) else: description = _ms('#vehicle_customization:customization/tooltip/applied/vehicleNation', nation=self._getNationNames(allowedNations)) elif self._item.getNationID() == ANY_NATION: description = _ms('#vehicle_customization:customization/tooltip/applied/allNations') else: description = _ms('#vehicle_customization:customization/tooltip/applied/vehicleNation', nation=self._getNationNames([self._item.getNationID()])) if notAllowedVehicles: description += _ms('#vehicle_customization:customization/tooltip/applied/elementsSeparator') description += _ms('#vehicle_customization:customization/tooltip/applied/excludeVehicles', vehicles=self._getVehiclesNames(notAllowedVehicles)) subBlocks.append(formatters.packTextBlockData(text_styles.main(description))) return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE)
def _getDivisionText(ladderInfo): if ladderInfo.isInLadder(): leagueStr = text_styles.warning(getLeagueString(ladderInfo.getLeague())) divisionStr = text_styles.warning(getDivisionString(ladderInfo.division)) return text_styles.middleTitle(_ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LEAGUEDIVISION, league=leagueStr, division=divisionStr)) else: return text_styles.alert(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHGAMES_WARNING)
def __showDummyBody(self): self.as_showBodyDummyS({'iconSource': RES_ICONS.MAPS_ICONS_LIBRARY_ALERTBIGICON, 'htmlText': str().join((text_styles.middleTitle(i18n.makeString(CLANS.CLANPROFILE_FORTIFICATIONINFO_DUMMY_HEADER)), clans_fmts.getHtmlLineDivider(3), text_styles.main(i18n.makeString(CLANS.CLANPROFILE_FORTIFICATIONINFO_DUMMY_BODY)))), 'alignCenter': False, 'btnVisible': False, 'btnLabel': '', 'btnTooltip': ''})
def __buildList(self): modulesList = [] typeId = GUI_ITEM_TYPE_INDICES[self._slotType] data = g_itemsCache.items.getItems(typeId, REQ_CRITERIA.VEHICLE.SUITABLE([self._vehicle], [typeId])).values() data.sort(reverse=True) currXp = g_itemsCache.items.stats.vehiclesXPs.get(self._vehicle.intCD, 0) stats = { "money": g_itemsCache.items.stats.money, "exchangeRate": g_itemsCache.items.shop.exchangeRate, "currXP": currXp, "totalXP": currXp + g_itemsCache.items.stats.freeXP, } for idx, module in enumerate(data): isInstalled = module.isInstalled(self._vehicle, self._slotIndex) if isInstalled: self._selectedIdx = idx moduleData = self._buildModuleData(module, isInstalled, stats) if self._slotType == "optionalDevice": moduleData["slotIndex"] = self._slotIndex moduleData["removable"] = module.isRemovable moduleData["desc"] = text_styles.main(module.getShortInfo()) moduleData["name"] = text_styles.stats(module.userName) else: values, names = self.__buildParams(module) moduleData["level"] = module.level moduleData["paramValues"] = values moduleData["paramNames"] = names moduleData["name"] = text_styles.middleTitle(module.userName) if self._slotType == "vehicleGun": if module.isClipGun(self._vehicle.descriptor): moduleData[EXTRA_MODULE_INFO] = CLIP_ICON_PATH modulesList.append(moduleData) return modulesList
def _showDummy(self, header, body = '', icon = None, btnVisible = False, btnLabel = '', btnTooltip = '', alignCenter = True): self.as_showDummyS({'iconSource': icon, 'htmlText': str().join((text_styles.middleTitle(header), clans_fmts.getHtmlLineDivider(3), text_styles.main(body))), 'alignCenter': alignCenter, 'btnVisible': btnVisible, 'btnLabel': btnLabel, 'btnTooltip': btnTooltip})
def __updateFalloutSettings(self, *args): battleType = self.__falloutCtrl.getBattleType() isVisible = self.__falloutCtrl.canChangeBattleType() and self.__falloutCtrl.isSelected() if isVisible: self.as_setDataS({'iconSource': RES_ICONS.MAPS_ICONS_BATTLETYPES_64X64_FALLOUT, 'buttonLabel': FALLOUT.HANGARSWITCH_BTNLBL, 'label': text_styles.middleTitle('#fallout:hangarSwitch/%d' % battleType)}) self.as_setVisibleS(isVisible)
def _packConditionsBlock(self, item): return formatters.packImageTextBlockData( title=text_styles.middleTitle( _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_DESCRIPTION_CONDITIONS_TITLE) ), desc=text_styles.standard("*{0}".format(item["conditional"])), txtGap=8, )
def _packDurationBlock(self): subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle('#vehicle_customization:timeLeft/title'))] if self.__isPermanent: duration = _ms('#vehicle_customization:timeLeft/infinity') else: dimension = _ms('#vehicle_customization:timeLeft/temporal/days') duration = _ms('#vehicle_customization:timeLeft/temporal/used', time=self.__duration / 60 / 60 / 24, dimension=dimension) subBlocks.append(formatters.packTextBlockData(text_styles.main(duration))) return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE)
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 construct(self): block = [] item = self.item block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8))) params = item.getParams() for paramName, paramValue in params: block.append(self.__packParameterBloc(_ms('#menu:moduleInfo/params/' + paramName), paramValue, params_formatters.measureUnitsForParameter(paramName))) return block
def _packBonusBlock(self, customizationTypeData, title): subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms(title)), padding={'bottom': 2})] for bonus in customizationTypeData: bonusPartDescription = text_styles.main(bonus['title']) if bonus['isTemporarily']: bonusPartDescription += '\n' + text_styles.standard('*' + bonus['description']) subBlocks.append(formatters.packTextParameterBlockData(name=bonusPartDescription, value=bonus['power'], padding={'bottom': 8}, valueWidth=45)) return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
def __packStaticData(self): text = text_styles.main(CYBERSPORT.WINDOW_ROSTERSLOTSETTINGS_VEHICLETAB_HEADERTEXT) return {'windowTitle': CYBERSPORT.WINDOW_ROSTERSLOTSETTINGS_TITLE, 'headerText': '%s %s' % (text, icons.info()), 'headerTextTooltip': TOOLTIPS.CYBERSPORT_ROSTERSLOTSETTINGS_HEADERTEXT, 'selectedTxt': text_styles.middleTitle(CYBERSPORT.WINDOW_ROSTERSLOTSETTINGS_BOTTOMRESULT), 'submitBtnLabel': CYBERSPORT.WINDOW_ROSTERSLOTSETTINGS_VEHICLETAB_SUBMITBTN, 'cancelBtnLabel': CYBERSPORT.WINDOW_ROSTERSLOTSETTINGS_VEHICLETAB_CANCELBTN, 'buttonBarItems': self.__packTabsData()}
def _packBattleCondition(cls, preFormattedCondition): return { 'icon': getCondIconBySize(CONDITION_SIZE.NORMAL, preFormattedCondition.iconKey), 'title': formatters.titleFormat(*preFormattedCondition.titleData.args), 'description': text_styles.middleTitle(*preFormattedCondition.descrData.args), 'state': preFormattedCondition.progressType }
def getStatusStrings(vState, vStateLvl=Vehicle.VEHICLE_STATE_LEVEL.INFO, substitute='', style=None, ctx=None): ctx = ctx or {} state = MENU.tankcarousel_vehiclestates(vState) status = ms(state, **ctx) if style is None: smallStyle, largeStyle = getStatusCountStyle(vStateLvl) else: smallStyle = largeStyle = style if status: return (smallStyle(status), largeStyle(status)) else: return (text_styles.middleTitle(substitute), status) if substitute else (status, status)
def __setBonusData(self, blData): crewPanelRenderList = _createBonusVOList(blData, QUALIFIER_TYPE_INDEX) visibilityPanelRenderList = _createBonusVOList( blData, [QUALIFIER_TYPE.CAMOUFLAGE]) self.as_setBonusPanelDataS({ 'crewPanel': { 'bonusTitle': text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATIONBONUSPANEL_CREWTITLE), 'bonusRenderersList': crewPanelRenderList }, 'visibilityPanel': { 'bonusTitle': text_styles.middleTitle( VEHICLE_CUSTOMIZATION. CUSTOMIZATIONBONUSPANEL_VISIBILITYTITLE), 'bonusRenderersList': visibilityPanelRenderList } })
def _packBlocks(self, *args, **kwargs): items = super(PersonalCaseAdditionalPacker, self)._packBlocks(*args, **kwargs) blocksGap = 10 items.append( formatters.packBuildUpBlockData([ formatters.packTitleDescBlock( text_styles.middleTitle( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDTITLE), text_styles.main( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDDESCRIPTION )), formatters.packTitleDescBlock( text_styles.middleTitle( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGTITLE), text_styles.main( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGDESCRIPTION )), formatters.packTitleDescBlock( text_styles.middleTitle( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSTITLE), text_styles.main( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSDESCRIPTION )), formatters.packTitleDescBlock( text_styles.middleTitle( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSTITLE), text_styles.main( TOOLTIPS. HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSDESCRIPTION )) ], blocksGap)) return items
def onBoosterActionBtnClick(self, boosterID, questID): if self._isReceivedBoostersTab: booster = g_goodiesCache.getBooster(boosterID) activeBooster = self.__getActiveBoosterByType(booster.boosterType) if activeBooster is not None: canActivate = yield DialogsInterface.showDialog(I18nConfirmDialogMeta(BOOSTER_CONSTANTS.BOOSTER_ACTIVATION_CONFORMATION_TEXT_KEY, messageCtx={'newBoosterName': text_styles.middleTitle(booster.description), 'curBoosterName': text_styles.middleTitle(activeBooster.description)}, focusedID=DIALOG_BUTTON_ID.CLOSE)) else: canActivate = True if canActivate: self.__activateBoosterRequest(booster) else: quests_events.showEventsWindow(questID, constants.EVENT_TYPE.BATTLE_QUEST)
def __getMultiselectionInfoVO(self): allowedLevels = self._falloutCtrl.getConfig().allowedLevels showSlots, message = self.__getMultiselectionStatus() canDoAction, _ = self.prbDispatcher.canPlayerDoAction() if canDoAction: statusString = text_styles.statInfo('#fallout:multiselectionSlot/groupReady') else: statusString = text_styles.critical('#fallout:multiselectionSlot/groupNotReady') return {'formattedMessage': message, 'showSlots': showSlots, 'indicatorIsEnabled': canDoAction, 'vehicleTypes': text_styles.concatStylesWithSpace(text_styles.middleTitle(i18n.makeString('#fallout:multiselectionSlot/selectionStatus')), text_styles.main(i18n.makeString('#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(allowedLevels, step=1)))), 'statusSrt': statusString}
def __syncUserInfo(self): selectedBages = self.itemsCache.items.getBadges(REQ_CRITERIA.BADGE.SELECTED).values() if selectedBages: badgeIcon = selectedBages[0].getSmallIcon() else: badgeIcon = RES_ICONS.MAPS_ICONS_LIBRARY_BADGES_48X48_BADGE_DEFAULT title = text_styles.middleTitle(MENU.HEADER_ACCOUNT_POPOVER_BOOSTERS_BLOCKTITLE) + ' ' + icons.info() userVO = {'userData': self.__userData, 'isTeamKiller': self.itemsCache.items.stats.isTeamKiller, 'boostersBlockTitle': title, 'boostersBlockTitleTooltip': TOOLTIPS.HEADER_ACCOUNTPOPOVER_BOOSTERSTITLE, 'badgeIcon': badgeIcon} self.as_setDataS(userVO)
def __packDueDate(self, booster): if booster.expiryTime: text = makeString(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_DUEDATE_VALUE, date=booster.getExpiryDate()) else: text = makeString( MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_UNDEFINETIME) return formatters.packBuildUpBlockData([ formatters.packTitleDescBlock( text_styles.middleTitle( TOOLTIPS.BOOSTERSWINDOW_BOOSTER_DUEDATE_TITLE), text_styles.standard(text)) ])
def _makeBodyProgressData(cls, progress): state = progress.getState() if not progress.isCumulative() and state != QUEST_PROGRESS_STATE.COMPLETED: state = QUEST_PROGRESS_STATE.FAILED title = progress.getTitle() tooltip = makeTooltip(title, progress.getDescription()) return {'initData': {'title': text_styles.middleTitle(title), 'iconID': progress.getIconID(), 'progressType': progress.getProgressType(), 'tooltip': tooltip}, 'progressData': {'current': progress.getCurrent(), 'state': state, 'goal': progress.getGoal()}}
def __packFemaleTankmanAward(self): return { 'type': QUESTS_SEASON_AWARDS_TYPES.FEMALE_TANKMAN, 'iconPath': RES_ICONS.MAPS_ICONS_QUESTS_TANKMANFEMALEGRAY, 'title': text_styles.middleTitle( _ms(QUESTS.SEASONAWARDSWINDOW_FEMALETANKMANAWARD_TITLE)), 'description': text_styles.main( _ms(QUESTS.SEASONAWARDSWINDOW_FEMALETANKMANAWARD_DESCRIPTION)) }
def _packBlocks(self, *args, **kwargs): items = super(ResearchModulesPacker, self)._packBlocks(*args, **kwargs) blocksGap = 5 imgPdg = {'left': 15, 'right': 20} txtGap = -4 items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_TYPESTITLE)), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_GUNTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_GUNDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_GUN, imgPdg, txtGap=txtGap), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_TURRETTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_TURRETDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_TOWER, imgPdg, txtGap=txtGap), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_ENGINETITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_ENGINEDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_ENGINE, imgPdg, txtGap=txtGap), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_CHASSISTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_CHASSISDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_CHASSIS, imgPdg, txtGap=txtGap), formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_RADIOSETTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_RADIOSETDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_RADIO, imgPdg, txtGap=txtGap)], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) return items
def __packPersistentCount(self, persistentCount): persistenName = backport.text(R.strings.tooltips.battleTypes.ranked. bonusBattle.persistent.title()) return formatters.packBuildUpBlockData( [ formatters.packTitleDescParameterWithIconBlockData( title=text_styles.middleTitle(persistenName), value=text_styles.promoSubTitle(persistentCount), padding=formatters.packPadding(top=-8, left=48, bottom=-3), titlePadding=formatters.packPadding(top=9, left=34)) ], linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE )
def _getSlotsPanelDataVO(slotsData): slotsDataVO = {'data': []} for cType in CUSTOMIZATION_TYPE.ALL: header = text_styles.middleTitle(_ms('#vehicle_customization:typeSwitchScreen/typeName/{0}'.format(cType))) selectorSlotsData = [] for slotIdx in range(0, len(slotsData[cType])): selectorSlotsData.append(_getSlotVO(slotsData[cType][slotIdx], cType, slotIdx)) slotsDataVO['data'].append({'id': str(cType), 'header': header, 'data': selectorSlotsData}) return slotsDataVO
def __packFemaleTankmanAward(self): return { 'iconPath': RES_ICONS.MAPS_ICONS_QUESTS_TANKMANFEMALEGRAY, 'title': text_styles.middleTitle( _ms(QUESTS.SEASONAWARDSWINDOW_FEMALETANKMANAWARD_TITLE)), 'description': text_styles.main( _ms(QUESTS.SEASONAWARDSWINDOW_FEMALETANKMANAWARD_DESCRIPTION)), 'tooltip': TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_FEMALE_TANKMAN_AWARD }
def _getDivisionText(ladderInfo): if ladderInfo.isInLadder(): leagueStr = text_styles.warning(getLeagueString( ladderInfo.getLeague())) divisionStr = text_styles.warning( getDivisionString(ladderInfo.division)) return text_styles.middleTitle( _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LEAGUEDIVISION, league=leagueStr, division=divisionStr)) else: return text_styles.alert( CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHGAMES_WARNING)
def _packProgressBlock(self): blocks = [] unlockedLevel = self._item.getLatestOpenedProgressionLevel( self.__vehicle) if self._showOnlyProgressBlock: level = self._progressionLevel else: level = unlockedLevel + 1 if level > self._item.getMaxProgressionLevel(): return None else: if level == 1: titleDesc = backport.text( R.strings.vehicle_customization.customization.infotype. progression.achievementConditionFirstItem()) else: titleDesc = backport.text( R.strings.vehicle_customization.customization.infotype. progression.achievementCondition(), level=int2roman(level)) blocks.append( formatters.packTextBlockData( text=text_styles.middleTitle(titleDesc))) conditions = self._item.progressionConditions.get(level, []) if not conditions: return None if unlockedLevel > 0: showCurrentProgress = level == unlockedLevel + 1 else: showCurrentProgress = level == 1 desc = text_styles.concatStylesToMultiLine( '', self.__packProgressDescriptionText( conditions[0], showCurrentProgress=showCurrentProgress)) if not self._showOnlyProgressBlock: blocks.append( formatters.packImageTextBlockData( padding=formatters.packPadding(top=10, bottom=-10), img=self._item.iconByProgressionLevel(level), desc=desc, descPadding=formatters.packPadding(left=15), linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_IMAGE_TEXT_BLOCK_PROGRESSIVE_LINKAGE)) else: blocks.append( formatters.packTextBlockData( padding=formatters.packPadding(top=-19), text=desc)) return formatters.packBuildUpBlockData( blocks, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
def __getCrewData(self): tankmenGoingToBuffer, deletedTankmen = self.__restore.getTankmenDeletedBySelling( *self.__nationGroupVehicles) deletedCount = len(deletedTankmen) if deletedCount > 0: deletedStr = formatDeletedTankmanStr(deletedTankmen[0]) maxCount = self.__restore.getMaxTankmenBufferLength() currCount = len(self.__restore.getDismissedTankmen()) header = backport.text(R.strings.tooltips.vehicleSellDialog.crew. alertIcon.recovery.header()) if deletedCount == 1: crewTooltip = text_styles.concatStylesToMultiLine( text_styles.middleTitle(header), text_styles.main( backport.text( R.strings.tooltips.vehicleSellDialog.crew. alertIcon.recovery.body(), maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr))) else: crewTooltip = text_styles.concatStylesToMultiLine( text_styles.middleTitle(header), text_styles.main( backport.text(R.strings.tooltips.dismissTankmanDialog. bufferIsFullMultiple.body(), deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount))) else: crewTooltip = None if self.__vehicle.isCrewLocked: hasCrew = False else: hasCrew = any([veh.hasCrew for veh in self.__nationGroupVehicles]) return (hasCrew, crewTooltip)
def _makeBoosterVO(self, booster): isBtnEnabled = booster.isReadyToActivate activateBtnLabel = MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_ACTIVATEBTNLABEL btnTooltip = makeTooltip(None, _ms(TOOLTIPS.BOOSTER_ACTIVEBTN_DISABLED_BODY)) if not isBtnEnabled else '' return {'id': booster.boosterID, 'actionBtnEnabled': isBtnEnabled, 'actionBtnTooltip': btnTooltip, 'headerText': text_styles.middleTitle(booster.fullUserName), 'descriptionText': text_styles.main(booster.description), 'addDescriptionText': booster.getExpiryDateStr(), 'actionBtnLabel': _ms(activateBtnLabel), 'tooltip': TOOLTIPS_CONSTANTS.BOOSTERS_BOOSTER_INFO, 'boosterSlotVO': _makeBoosterSlotVO(booster, booster.count), 'rendererState': BOOSTER_CONSTANTS.RENDERER_STATE_DEFAULT}
def __onClubsFoundListUpdated(self, selectedID, isFullUpdate, isReqInCoolDown, result): if not result: text = '\n'.join([ text_styles.middleTitle( CYBERSPORT.WINDOW_UNITLISTVIEW_NOSEARCHRESULTS_HEADER), text_styles.standard( CYBERSPORT.WINDOW_UNITLISTVIEW_NOSEARCHRESULTS_DESCRIPTION) ]) self.__onClubsListUpdated(None, True, False, []) self.as_noSearchResultsS(text, True) else: self.__onClubsListUpdated(selectedID, isFullUpdate, isReqInCoolDown, result)
def construct(self): shell = self.shell configuration = self.configuration block = [] status = None checkBuying = configuration.checkBuying if checkBuying: couldBeBought, reason = shell.mayPurchase(g_itemsCache.items.stats.money) if not couldBeBought: status = '#tooltips:shellFits/%s' % reason statusHeader, statusText = getComplexStatus(status) if statusHeader is not None or statusText is not None: block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(statusHeader if statusHeader is not None else ''), desc=text_styles.main(statusText if statusText is not None else ''))) return block
def construct(self): block = list() module = self.module inventoryVehicles = self.itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY).itervalues() totalInstalledVehicles = map(lambda x: x.shortUserName, module.getInstalledVehicles(inventoryVehicles)) installedVehicles = totalInstalledVehicles[:_MAX_INSTALLED_LIST_LEN] if installedVehicles: tooltipText = ', '.join(installedVehicles) if len(totalInstalledVehicles) > _MAX_INSTALLED_LIST_LEN: hiddenVehicleCount = len(totalInstalledVehicles) - _MAX_INSTALLED_LIST_LEN hiddenTxt = '%s %s' % (text_styles.main(TOOLTIPS.SUITABLEVEHICLE_HIDDENVEHICLECOUNT), text_styles.stats(hiddenVehicleCount)) tooltipText = '%s\n%s' % (tooltipText, hiddenTxt) block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.DEVICEFITS_ALREADY_INSTALLED_HEADER), desc=text_styles.standard(tooltipText))) return block
def _packDescriptionBlock(self): if self._item.isHistorical(): img = None title = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_DESCRIPTION_HISTORIC_TRUE desc = self._item.fullDescription else: img = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_NON_HISTORICAL title = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_DESCRIPTION_HISTORIC_FALSE desc = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_DESCRIPTION_HISTORIC_FALSE_DESCRIPTION blocks = [formatters.packImageTextBlockData(title=text_styles.middleTitle(title), img=img, imgPadding={'left': -3, 'top': -4}), formatters.packTextBlockData(text=text_styles.main(desc))] if not self._item.isHistorical() and self._item.fullDescription: blocks.insert(0, formatters.packTextBlockData(text=text_styles.main(self._item.fullDescription), padding={'bottom': 40})) return formatters.packBuildUpBlockData(blocks, gap=-6 if img is not None else 3, padding={'bottom': -5})
def __getTokensCount(self): tokens = _detailedCardTokenConditionFormatter.getPreformattedConditions( self.event) needCount = 0 gotCount = 0 for tokenData in tokens: tokenNeedCount = tokenData.needCount needCount += tokenNeedCount gotCount += min(tokenData.gotCount, tokenNeedCount) return text_styles.middleTitle( _ms(QUESTS.MISSIONDETAILS_BOTTOMSTATUSTOKENS, count=gotCount, total=needCount)) if needCount or gotCount else ''
def __packSkillsBlock(): def __packSkill(crewRole, skills): skills = cmp_helpers.sortSkills(skills) skillsStr = ' '.join(map(lambda skillType: icons.makeImageTag(getSkillSmallIconPath(skillType), 14, 14, 0, 0), skills)) return formatters.packCrewSkillsBlockData(text_styles.main(ITEM_TYPES.tankman_roles(crewRole)), skillsStr, getRoleWhiteIconPath(crewRole), padding={'left': -10}) blocks = [formatters.packImageTextBlockData(title=text_styles.middleTitle(VEH_COMPARE.VEHCONF_TOOLTIPS_SKILLS_SKILLSLIST), padding={'bottom': 10})] configurator_view = cmp_helpers.getCmpConfiguratorMainView() configured_vehicle = configurator_view.getCurrentVehicle() skills_by_roles = cmp_helpers.getVehicleCrewSkills(configured_vehicle) skills_by_roles.sort(key=lambda (role, skillsSet): Tankman.TANKMEN_ROLES_ORDER[role]) blocks.extend(map(lambda data: __packSkill(*data), skills_by_roles)) return formatters.packBuildUpBlockData(blocks, gap=0, padding={'bottom': -10})
def __packCommendationListsAward(self): return { 'type': QUESTS_SEASON_AWARDS_TYPES.COMMENDATION_LISTS, 'iconPath': RES_ICONS.MAPS_ICONS_QUESTS_TOKEN128, 'title': text_styles.middleTitle( _ms(QUESTS.SEASONAWARDSWINDOW_COMMENDATIONLISTSAWARD_TITLE)), 'description': text_styles.main( _ms(QUESTS. SEASONAWARDSWINDOW_COMMENDATIONLISTSAWARD_DESCRIPTION)) }
def _packBlocks(self, chainID): personalMissions = dependency.instance( IEventsCache).getPersonalMissions() operation = first( personalMissions.getOperationsForBranch( PM_BRANCH.PERSONAL_MISSION_2).values()) blocks = [ formatters.packImageTextBlockData( title=text_styles.highTitle(operation.getChainName(chainID)), desc=text_styles.standard( operation.getChainDescription(chainID)), img=RES_ICONS.getAlliance54x54Icon(chainID), imgPadding=formatters.packPadding(top=3, left=-5), txtOffset=78) ] nations = getNationsForChain(operation, chainID) nationBlocks = [] separator = ' ' for nation in GUI_NATIONS: if nation in nations: icon = icons.makeImageTag(getNationsFilterAssetPath(nation), 26, 16, -4) nationName = text_styles.main(NATIONS.all(nation)) nationBlocks.append( formatters.packTextBlockData( text_styles.concatStylesToSingleLine( icon, separator, nationName))) blocks.append( formatters.packBuildUpBlockData( nationBlocks, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=40))) allianceID = operation.getAllianceID(chainID) blocks.append( formatters.packBuildUpBlockData([ formatters.packTextBlockData( text_styles.middleTitle( PERSONAL_MISSIONS.CHAINTOOLTIPDATA_DESCRIPTION_TITLE), padding=formatters.packPadding(bottom=4)), formatters.packTextBlockData( text_styles.main( PERSONAL_MISSIONS.getAllianceChainTooltipDescr( allianceID)), padding=formatters.packPadding(bottom=7)) ], padding=formatters.packPadding( top=-7, bottom=-3))) return blocks
def buildList(self, purchaseItems): self.clear() elementGroups = {group:[] for group in PURCHASE_GROUPS} elementSets = {group:[] for group in PURCHASE_GROUPS} purchaseItemsCopy = self._purchaseItems[:] while purchaseItemsCopy: element = purchaseItemsCopy[0] if element.isDismantling: purchaseItemsCopy.pop(0) continue def filterItems(otherElement): correctType = otherElement.item.intCD == element.item.intCD correctSeason = otherElement.group == element.group correctAction = otherElement.isFromInventory == element.isFromInventory and otherElement.isDismantling == element.isDismantling return correctSeason and correctType and correctAction matchedItems = filter(filterItems, purchaseItemsCopy) for delItem in matchedItems: purchaseItemsCopy.remove(delItem) quantity = len(matchedItems) if quantity == 1: itemName = element.item.userName else: itemName = '{} x{}'.format(element.item.userName, quantity) priceItem = {'id': element.item.intCD, 'selected': element.selected, 'itemImg': buildCustomizationItemDataVO(element.item, None, True, False, False), 'itemName': itemName, 'titleMode': False, 'compoundPrice': getItemPricesVO(element.price * quantity)[0], 'isFromStorage': element.isFromInventory} group = element.group elementGroups[group].append(priceItem) elementSets[group].append(matchedItems) self._list = [] self._purchaseItemSets = [] for group in PURCHASE_GROUPS: items = elementGroups[group] sets = elementSets[group] if items: title = _CUSTOMIZATION_SEASON_TITLES[group] self._list.append({'titleMode': True, 'titleText': _ms(text_styles.middleTitle(title))}) self._list.extend(items) self._purchaseItemSets.extend(sets) return
def __packGatherDescrBlock(self): titleBlock = formatters.packTextBlockData(text=text_styles.middleTitle( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_GATHERHEADER)) description1Block = formatters.packTextBlockData(text=text_styles.main( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_GATHERDESCRIPTION1)) intelRequired, nationRequired = self.context.getFragmentConvertData( self.__vehicle.level) return formatters.packBuildUpBlockData(blocks=[ titleBlock, description1Block, self._packConversionFormulaBlock(intelRequired, nationRequired, self.__vehicle.nationName, self.__vehicle.intCD) ], gap=4)
def _packDescriptionBlock(self): img = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_NON_HISTORICAL nonHistoricTitle = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMSPOPOVER_HISTORICCHECKBOX_ITEMS nonHistoricDesc = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_DESCRIPTION_HISTORIC_FALSE_DESCRIPTION if self.isCustomStyleMode: seasonName = SEASON_TYPE_TO_NAME.get( self.service.getCtx().currentSeason) mapName = _ms(VEHICLE_CUSTOMIZATION.getMapName(seasonName)) else: mapName = _ms(VEHICLE_CUSTOMIZATION.SEASON_SELECTION_MAPNAME_ALL) title = _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMSPOPOVER_BTN) desc = _ms(VEHICLE_CUSTOMIZATION.SEASON_SELECTION_TOOLTIP, mapName=mapName) blocks = [] if not self.isInfo: blocks.append( formatters.packTextBlockData( text=text_styles.middleTitle(title))) blocks.append( formatters.packTextBlockData(text=text_styles.main(desc), padding={'top': 10})) if self.isNonHistoric: blocks.append( formatters.packImageTextBlockData( title=text_styles.middleTitle(nonHistoricTitle), img=img, imgPadding={ 'left': -3, 'top': -4 }, padding={'top': 20 if not self.isInfo else 0})) blocks.append( formatters.packTextBlockData( text=text_styles.main(nonHistoricDesc))) return formatters.packBuildUpBlockData(blocks, gap=-6, padding={'bottom': -5})
def __setBottomPanelData(self, *args): if self.__isCarouselHidden: occupiedSlotsNum, totalSlotsNum = self.__controller.slots.getSummary( ) label = text_styles.highTitle( _ms(VEHICLE_CUSTOMIZATION.TYPESWITCHSCREEN_SLOTSUMMARY, occupiedSlotsNum=occupiedSlotsNum, totalSlotsNum=totalSlotsNum)) else: label = text_styles.middleTitle( _ms('#vehicle_customization:typeSwitchScreen/typeName/plural/{0}' .format(self.__controller.slots.currentType))) totalGold = self.__controller.cart.totalPriceGold totalCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBottomPanelHeaderS({ 'newHeaderText': label, 'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(self.__controller.cart.items)), 'pricePanel': { 'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip } })