def __syncUserInfo(self): clanProfile = self.clansCtrl.getAccountProfile() invitesCount = 0 if not clanProfile.isInClan(): invitesCount = clanProfile.getInvitesCount() or 0 if invitesCount == 0: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPEOPENED else: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPE title = text_styles.middleTitle( MENU.HEADER_ACCOUNT_POPOVER_BOOSTERS_BLOCKTITLE ) + ' ' + icons.info() userVO = { 'userData': self.__userData, 'isInClan': clanProfile.isInClan() or not self.clansCtrl.isEnabled(), 'isTeamKiller': g_itemsCache.items.stats.isTeamKiller, 'openInviteBtnIcon': envelopeIcon, 'boostersBlockTitle': title, 'boostersBlockTitleTooltip': TOOLTIPS.HEADER_ACCOUNTPOPOVER_BOOSTERSTITLE } userVO.update(self._getMyInvitesBtnParams()) self.as_setDataS(userVO)
def __makeMainVO(self): result = {} extra = self.prbEntity.getExtra() (_, _, arenaTypeID), _ = self.__currentBuilding unitPermissions = self.prbEntity.getPermissions() activeConsumes = extra.getConsumables() result['mapID'] = arenaTypeID arenaType = ArenaType.g_cache.get(arenaTypeID) canUseEquipments = self.__battle.itemData.canUseEquipments if arenaType is not None: mapName = text_styles.main(arenaType.name) else: mapName = '' infoIcon = icons.info() result['headerDescr'] = text_styles.standard( i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_MAPTITLE, mapName=mapName) + ' ' + infoIcon) result['isOrdersBgVisible'] = bool( not unitPermissions.canChangeConsumables() and len(activeConsumes)) result['mineClanName'] = g_clanCache.clanTag _, enemyClanAbbev, _ = self.__battle.getOpponentClanInfo() result['enemyClanName'] = '[%s]' % enemyClanAbbev if not canUseEquipments and unitPermissions.canChangeConsumables(): result['ordersDisabledMessage'] = icons.alert( ) + ' ' + text_styles.alert( i18n.makeString( FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_ORDERSDISABLED)) result[ 'ordersDisabledTooltip'] = TOOLTIPS.FORTIFICATION_FORTCLANBATTLEROOM_ORDERSDISABLED_DIVISIONMISMATCH self.as_setBattleRoomDataS(result) return
def __setList(self, cartItems): self._list = [] emblemItems = [] camouflageItems = [] inscriptionItems = [] for item in cartItems: dpItem = {'id': item['itemID'], 'slotIdx': item['idx'], 'selected': item['isSelected'], 'cType': item['type'], 'itemName': item['name'], 'imgBonus': item['bonusIcon'], 'price': item['object'].getPrice(item['duration']), 'lblBonus': text_styles.stats('+{0}%{1}'.format(item['bonusValue'], item['isConditional'])), 'titleMode': False, 'DDPrice': self.__getDropdownPriceVO(item), 'selectIndex': DURATION.ALL.index(item['duration']), 'isDuplicatePrice': item['isDuplicate'], 'duplicatePriceText': icons.info() + _ms(CUSTOMIZATION.BUYWINDOW_BUYTIME_COPY), 'duplicatePriceTooltip': makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_BUYWINDOW_COPY_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_BUYWINDOW_COPY_BODY))} if item['type'] == data_aggregator.CUSTOMIZATION_TYPE.CAMOUFLAGE: camouflageItems.append(dpItem) elif item['type'] == data_aggregator.CUSTOMIZATION_TYPE.EMBLEM: emblemItems.append(dpItem) elif item['type'] == data_aggregator.CUSTOMIZATION_TYPE.INSCRIPTION: inscriptionItems.append(dpItem) if camouflageItems: camouflageItems.insert(0, self.__getTitle(CUSTOMIZATION.BUYWINDOW_TITLE_CAMOUFLAGE)) if inscriptionItems: inscriptionItems.insert(0, self.__getTitle(CUSTOMIZATION.BUYWINDOW_TITLE_INSCRIPTION)) if emblemItems: emblemItems.insert(0, self.__getTitle(CUSTOMIZATION.BUYWINDOW_TITLE_EMBLEM)) self._list = camouflageItems + emblemItems + inscriptionItems
def __makeMainVO(self): result = {} extra = self.unitFunctional.getExtra() (_, _, arenaTypeID), _ = self.__currentBuilding unitPermissions = self.unitFunctional.getPermissions() activeConsumes = extra.getConsumables() result["mapID"] = arenaTypeID arenaType = ArenaType.g_cache.get(arenaTypeID) canUseEquipments = self.__battle.itemData.canUseEquipments if arenaType is not None: mapName = text_styles.main(arenaType.name) else: mapName = "" infoIcon = icons.info() result["headerDescr"] = text_styles.standard( i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_MAPTITLE, mapName=mapName) + " " + infoIcon ) result["isOrdersBgVisible"] = bool( not unitPermissions.canChangeConsumables() and len(activeConsumes) and not canUseEquipments ) result["mineClanName"] = g_clanCache.clanTag _, enemyClanAbbev, _ = self.__battle.getOpponentClanInfo() result["enemyClanName"] = "[%s]" % enemyClanAbbev if not canUseEquipments and unitPermissions.canChangeConsumables(): result["ordersDisabledMessage"] = ( icons.alert() + " " + text_styles.alert(i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_ORDERSDISABLED)) ) result["ordersDisabledTooltip"] = TOOLTIPS.FORTIFICATION_FORTCLANBATTLEROOM_ORDERSDISABLED_DIVISIONMISMATCH self.as_setBattleRoomDataS(result)
def _populate(self): super(CyberSportIntroView, self)._populate() self.addListener(CSVehicleSelectEvent.VEHICLE_SELECTED, self.__updateSelectedVehicles) self.as_setTextsS({ 'titleLblText': text_styles.promoTitle(CYBERSPORT.WINDOW_INTRO_TITLE), 'descrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_DESCRIPTION), 'listRoomTitleLblText': text_styles.promoSubTitle(CYBERSPORT.WINDOW_INTRO_SEARCH_TITLE), 'listRoomDescrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_SEARCH_DESCRIPTION), 'listRoomBtnLabel': _ms(CYBERSPORT.WINDOW_INTRO_SEARCH_BTN), 'autoTitleLblText': text_styles.middleTitle(CYBERSPORT.WINDOW_INTRO_AUTO_TITLE), 'autoDescrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_AUTO_DESCRIPTION), 'vehicleBtnTitleTfText': text_styles.standard(CYBERSPORT.BUTTON_CHOOSEVEHICLES_SELECTED), 'regulationsInfoText': '{0}{1}'.format( icons.info(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_INFO)), 'regulationsInfoTooltip': TOOLTIPS_CONSTANTS.LADDER_REGULATIONS }) self.__updateClubData() self.__updateAutoSearchVehicle(self.__getSelectedVehicles()) self.startMyClubListening() self.clubsCtrl.getAvailabilityCtrl( ).onStatusChanged += self.onStatusChanged
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 __makeTableHeader(self): ms = i18n.makeString infoIcon = icons.info() multiplyExpText = text_styles.standard(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_EXPMULTIPLIER)) tableExpText = text_styles.standard(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_EXP)) return (self.__makeSortingButton(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_NICK), 146, TEXT_ALIGN.LEFT), self.__makeSortingButton(ms(tableExpText + ' ' + infoIcon), 143, TEXT_ALIGN.RIGHT, toolTip=TOOLTIPS.REFERRALMANAGEMENTWINDOW_TABLE_EXPERIENCE), self.__makeSortingButton(ms(multiplyExpText + ' ' + infoIcon), 193, TEXT_ALIGN.CENTER, toolTipSpecial='refSysXPMultiplier'), self.__makeSortingButton('', 166, TEXT_ALIGN.CENTER))
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 __setList(self, cartItems): self._list = [] emblemItems = [] camouflageItems = [] inscriptionItems = [] for item in cartItems: dpItem = { 'id': item['itemID'], 'slotIdx': item['idx'], 'selected': item['isSelected'], 'cType': item['type'], 'itemName': item['name'], 'imgBonus': item['bonusIcon'], 'price': item['object'].getPrice(item['duration']), 'lblBonus': text_styles.stats('+{0}%{1}'.format(item['bonusValue'], item['isConditional'])), 'titleMode': False, 'DDPrice': self.__getDropdownPriceVO(item), 'selectIndex': DURATION.ALL.index(item['duration']), 'isDuplicatePrice': item['isDuplicate'], 'duplicatePriceText': icons.info() + _ms(CUSTOMIZATION.BUYWINDOW_BUYTIME_COPY), 'duplicatePriceTooltip': makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_BUYWINDOW_COPY_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_BUYWINDOW_COPY_BODY)) } if item['type'] == data_aggregator.CUSTOMIZATION_TYPE.CAMOUFLAGE: camouflageItems.append(dpItem) elif item['type'] == data_aggregator.CUSTOMIZATION_TYPE.EMBLEM: emblemItems.append(dpItem) elif item[ 'type'] == data_aggregator.CUSTOMIZATION_TYPE.INSCRIPTION: inscriptionItems.append(dpItem) if camouflageItems: camouflageItems.insert( 0, self.__getTitle(CUSTOMIZATION.BUYWINDOW_TITLE_CAMOUFLAGE)) if inscriptionItems: inscriptionItems.insert( 0, self.__getTitle(CUSTOMIZATION.BUYWINDOW_TITLE_INSCRIPTION)) if emblemItems: emblemItems.insert( 0, self.__getTitle(CUSTOMIZATION.BUYWINDOW_TITLE_EMBLEM)) self._list = camouflageItems + emblemItems + inscriptionItems
def __showDismissedTankmen(self, criteria): tankmen = getRestoreController().getDismissedTankmen() tankmenList = list() for tankman in tankmen: if not criteria(tankman): continue skillsList = [] for skill in tankman.skills: skillsList.append({'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive}) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl}) restoreInfo = getTankmenRestoreInfo(tankman) actionBtnTooltip = makeTooltip(TOOLTIPS.BARRACKS_TANKMEN_RECOVERYBTN_HEADER, getRecoveryStatusText(restoreInfo)) tankmanData = _packTankmanData(tankman) tankmanData.update({'isRankNameVisible': False, 'recoveryPeriodText': _makeRecoveryPeriodText(restoreInfo), 'actionBtnLabel': MENU.BARRACKS_BTNRECOVERY, 'actionBtnTooltip': actionBtnTooltip, 'skills': skillsList, 'isSkillsVisible': True}) tankmenList.append(tankmanData) tankmenCountStr = _ms(MENU.BARRACKS_DISMISSEDTANKMENCOUNT, curValue=len(tankmenList), total=len(tankmen)) placeCount = getRestoreController().getMaxTankmenBufferLength() placeCountStr = _ms(MENU.BARRACKS_RECOVERYCOUNT, total=placeCount, info=icons.info()) noInfoData = None hasNoInfoData = len(tankmenList) == 0 if hasNoInfoData: if len(tankmen) == 0: tankmenRestoreConfig = g_itemsCache.items.shop.tankmenRestoreConfig freeDays = tankmenRestoreConfig.freeDuration / time_utils.ONE_DAY creditsDays = tankmenRestoreConfig.creditsDuration / time_utils.ONE_DAY - freeDays noInfoData = {'title': text_styles.highTitle(MENU.BARRACKS_NORECOVERYTANKMEN_TITLE), 'message': text_styles.main(_ms(MENU.BARRACKS_NORECOVERYTANKMEN_MESSAGE, price=moneyWithIcon(tankmenRestoreConfig.cost), totalDays=freeDays + creditsDays, freeDays=freeDays, paidDays=creditsDays))} else: noInfoData = {'message': text_styles.main(MENU.BARRACKS_NOFILTEREDRECOVERYTANKMEN_MESSAGE)} placesCountTooltip = makeTooltip(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_HEADER, _ms(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_BODY, placeCount=placeCount)) self.as_setTankmenS({'tankmenCount': text_styles.playerOnline(tankmenCountStr), 'placesCount': text_styles.playerOnline(placeCountStr), 'placesCountTooltip': placesCountTooltip, 'tankmenData': tankmenList, 'hasNoInfoData': hasNoInfoData, 'noInfoData': noInfoData}) return
def __showDismissedTankmen(self, criteria): tankmen = self.restore.getDismissedTankmen() tankmenList = list() for tankman in tankmen: if not criteria(tankman): continue skillsList = [] for skill in tankman.skills: skillsList.append({'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive}) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl}) restoreInfo = getTankmenRestoreInfo(tankman) actionBtnTooltip = makeTooltip(TOOLTIPS.BARRACKS_TANKMEN_RECOVERYBTN_HEADER, getRecoveryStatusText(restoreInfo)) tankmanData = _packTankmanData(tankman) tankmanData.update({'isRankNameVisible': False, 'recoveryPeriodText': _makeRecoveryPeriodText(restoreInfo), 'actionBtnLabel': MENU.BARRACKS_BTNRECOVERY, 'actionBtnTooltip': actionBtnTooltip, 'skills': skillsList, 'isSkillsVisible': True}) tankmenList.append(tankmanData) tankmenCountStr = _ms(MENU.BARRACKS_DISMISSEDTANKMENCOUNT, curValue=len(tankmenList), total=len(tankmen)) placeCount = self.restore.getMaxTankmenBufferLength() placeCountStr = _ms(MENU.BARRACKS_RECOVERYCOUNT, total=placeCount, info=icons.info()) noInfoData = None hasNoInfoData = len(tankmenList) == 0 if hasNoInfoData: if len(tankmen) == 0: tankmenRestoreConfig = g_itemsCache.items.shop.tankmenRestoreConfig freeDays = tankmenRestoreConfig.freeDuration / time_utils.ONE_DAY creditsDays = tankmenRestoreConfig.creditsDuration / time_utils.ONE_DAY - freeDays noInfoData = {'title': text_styles.highTitle(MENU.BARRACKS_NORECOVERYTANKMEN_TITLE), 'message': text_styles.main(_ms(MENU.BARRACKS_NORECOVERYTANKMEN_MESSAGE, price=moneyWithIcon(tankmenRestoreConfig.cost), totalDays=freeDays + creditsDays, freeDays=freeDays, paidDays=creditsDays))} else: noInfoData = {'message': text_styles.main(MENU.BARRACKS_NOFILTEREDRECOVERYTANKMEN_MESSAGE)} placesCountTooltip = makeTooltip(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_HEADER, _ms(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_BODY, placeCount=placeCount)) self.as_setTankmenS({'tankmenCount': text_styles.playerOnline(tankmenCountStr), 'placesCount': text_styles.playerOnline(placeCountStr), 'placesCountTooltip': placesCountTooltip, 'tankmenData': tankmenList, 'hasNoInfoData': hasNoInfoData, 'noInfoData': noInfoData}) return
def _populate(self): super(CyberSportIntroView, self)._populate() self.addListener(CSVehicleSelectEvent.VEHICLE_SELECTED, self.__updateSelectedVehicles) self.as_setTextsS({'titleLblText': text_styles.promoTitle(CYBERSPORT.WINDOW_INTRO_TITLE), 'descrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_DESCRIPTION), 'listRoomTitleLblText': text_styles.promoSubTitle(CYBERSPORT.WINDOW_INTRO_SEARCH_TITLE), 'listRoomDescrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_SEARCH_DESCRIPTION), 'listRoomBtnLabel': _ms(CYBERSPORT.WINDOW_INTRO_SEARCH_BTN), 'autoTitleLblText': text_styles.middleTitle(CYBERSPORT.WINDOW_INTRO_AUTO_TITLE), 'autoDescrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_AUTO_DESCRIPTION), 'vehicleBtnTitleTfText': text_styles.standard(CYBERSPORT.BUTTON_CHOOSEVEHICLES_SELECTED), 'regulationsInfoText': '{0}{1}'.format(icons.info(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_INFO)), 'regulationsInfoTooltip': TOOLTIPS_CONSTANTS.LADDER_REGULATIONS}) self.__updateClubData() self.__updateAutoSearchVehicle(self.__getSelectedVehicles()) self.startMyClubListening() self.clubsCtrl.getAvailabilityCtrl().onStatusChanged += self.onStatusChanged
def _populate(self): super(_QuestsTileChainsView, self)._populate() g_eventsCache.onProgressUpdated += self._onProgressUpdated vehTypeFilter, qStateFilter = self.__getCurrentFilters() self.as_setHeaderDataS({ 'noTasksText': _ms(QUESTS.TILECHAINSVIEW_NOTASKSLABEL_TEXT), 'header': { 'tileID': self.__tile.getID(), 'titleText': text_styles.promoSubTitle( _ms(QUESTS.TILECHAINSVIEW_TITLE, name=self.__tile.getUserName() + ' ' + icons.info())), 'backBtnText': _ms(QUESTS.TILECHAINSVIEW_BUTTONBACK_TEXT), 'backBtnTooltip': TOOLTIPS.PRIVATEQUESTS_BACKBUTTON, 'backgroundImagePath': self._HEADER_ICON_PATH % self.__tile.getIconID(), 'tasksProgressLabel': text_styles.main(QUESTS.TILECHAINSVIEW_TASKSPROGRESS_TEXT), 'tasksProgressLinkage': self._tasksProgressLinkage, 'tooltipType': self._tooltipType }, 'filters': { 'filtersLabel': _ms(QUESTS.TILECHAINSVIEW_FILTERSLABEL_TEXT), 'showVehicleTypeFilterData': self._showVehicleFilter, 'vehicleTypeFilterData': formatters._packVehicleTypesFilter( _QuestsFilter.VEH_TYPE_DEFAULT), 'taskTypeFilterData': self.__packQuestStatesFilter(), 'defVehicleType': vehTypeFilter, 'defTaskType': qStateFilter } }) self._populateTileData()
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 __syncUserInfo(self): selectedBages = self.itemsCache.items.ranked.badges badge = selectedBages[0] if selectedBages else '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': settings.getBadgeIconPath(settings.BADGES_ICONS.X48, badge) } self.as_setDataS(userVO)
def __showDismissedTankmen(self, criteria): self.__dataProvider.showDismissedTankmen(criteria) placeCount = self.__dataProvider.placeCount filteredCount = self.__dataProvider.filteredCount totalCount = self.__dataProvider.totalCount hasNoInfoData, noInfoData = self.__getNoInfoData( totalCount=totalCount, filteredCount=filteredCount) self.as_setTankmenS({ 'tankmenCount': self.__getTankmenCountStr(tankmenInSlots=filteredCount, totalCount=totalCount), 'placesCount': self.__getPlaceCountStr(free=icons.info(), totalCount=placeCount), 'placesCountTooltip': self.__getPlacesCountTooltip(placeCount=placeCount), 'hasNoInfoData': hasNoInfoData, 'noInfoData': noInfoData })
def _packBlocks(self, *args, **kwargs): items = super(PerfAttentionAdvancedTooltip, self)._packBlocks(*args, **kwargs) header = formatters.packTitleDescBlock( title=text_styles.highTitle( backport.text(R.strings.tooltips.battle_royale.hangar.mainBtn. perf.header())), desc=text_styles.main( backport.text(R.strings.tooltips.battle_royale.hangar.mainBtn. perf.eventDescription()))) items.append( formatters.packBuildUpBlockData( blocks=[header], padding=formatters.packPadding(bottom=-10))) items.append( formatters.packTextBlockData( text_styles.concatStylesWithSpace( icons.info(), text_styles.main( backport.text(R.strings.tooltips.battle_royale.hangar. mainBtn.perf.problemDescription()))))) return items
def __showDismissedTankmen(self, criteria): tankmen = self.restore.getDismissedTankmen() tankmenList = list() for tankman in tankmen: if not criteria(tankman): continue skillsList = [] for skill in tankman.skills: skillsList.append({ 'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive }) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({ 'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl }) restoreInfo = getTankmenRestoreInfo(tankman) actionBtnTooltip = makeTooltip( TOOLTIPS.BARRACKS_TANKMEN_RECOVERYBTN_HEADER, getRecoveryStatusText(restoreInfo)) tankmanData = _packTankmanData(tankman) tankmanData.update({ 'isRankNameVisible': False, 'recoveryPeriodText': _makeRecoveryPeriodText(restoreInfo), 'actionBtnLabel': MENU.BARRACKS_BTNRECOVERY, 'actionBtnTooltip': actionBtnTooltip, 'skills': skillsList, 'isSkillsVisible': True }) tankmenList.append(tankmanData) placeCount = self.restore.getMaxTankmenBufferLength() hasNoInfoData, noInfoData = self.__getNoInfoData( totalCount=len(tankmen), filteredCount=len(tankmenList)) self.as_setTankmenS({ 'tankmenCount': self.__getTankmenCountStr(tankmenInSlots=len(tankmenList), totalCount=len(tankmen)), 'placesCount': self.__getPlaceCountStr(free=icons.info(), totalCount=placeCount), 'placesCountTooltip': self.__getPlacesCountTooltip(placeCount=placeCount), 'tankmenData': tankmenList, 'hasNoInfoData': hasNoInfoData, 'noInfoData': noInfoData })
def __prepareHeaderData(self): fort = self.fortCtrl.getFort() isDefencePeriodActivated = fort.isDefenceHourEnabled() inProcess, _ = fort.getDefenceHourProcessing() isDefenceOn = isDefencePeriodActivated or inProcess buildingIcon = FortViewHelper.getPopoverIconSource( self._buildingUID, self.__buildingLevel, isDefenceOn=isDefenceOn) result = { 'buildingName': i18n.makeString(FORT.buildings_buildingname(self._buildingUID)), 'buildingIcon': buildingIcon } buildLevel = self.__convertBuildLevel(self.__buildingLevel) result['buildLevel'] = i18n.makeString( FORT.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=buildLevel) upgradeBtnVisible = False upgradeBtnEnable = False localTooltip = '' if self._canModernization(self.__buildingDescr): upgradeBtnVisible = upgradeBtnEnable = True localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN if upgradeBtnVisible: if not self._isEnableModernizationBtnByDamaged( self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEBTN_DISABLEDBYDESTROY elif not self._isEnableModernizationBtnByProgress( self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN_DISABLED result['upgradeButtonToolTip'] = localTooltip result['showUpgradeButton'] = upgradeBtnVisible result['enableUpgradeBtn'] = upgradeBtnEnable isVisibleDemountBtn = self._isVisibleDemountBtn(self.__buildingDescr) result['isVisibleDemountBtn'] = isVisibleDemountBtn if isVisibleDemountBtn: result['enableDemountBtn'] = self._isEnableDemountBtn( self.__buildingDescr) result[ 'demountBtnTooltip'] = TOOLTIPS.FORTIFICATION_POPOVER_DEMOUNTBTN header, body, filterColor = self.__makeHeaderStatusMessage() result['titleStatus'] = header result['bodyStatus'] = body result['glowColor'] = int(filterColor, 16) result['isModernization'] = self.__canUpgrade result['canDeleteBuilding'] = self.fortCtrl.getPermissions( ).canDeleteBuilding() if self.__progress is ALIAS.STATE_BUILDING and isDefencePeriodActivated: nextMapTimestamp, nextMapID, curMapID = self.fortCtrl.getFort( ).getBuildingMaps(self._buildingID) isMapsInfoEnabled = nextMapTimestamp > 0 if self.__buildingLevel < fortified_regions.g_cache.defenceConditions.minRegionLevel: mapIcon = icons.alert() mapMsg = text_styles.alert( i18n.makeString(FORT.BUILDINGPOPOVER_MAPINFO_NOBATTLE)) header = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_HEADER ) body = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_BODY ) isToolTipSpecial = False elif isMapsInfoEnabled: currentMapUserName = self.__getMapUserName(curMapID) mapIcon = icons.info() mapMsg = text_styles.main(currentMapUserName) header = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_HEADER, currentMap=currentMapUserName) body = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_BODY, nextMap=self.__getMapUserName(nextMapID), changeDate=BigWorld.wg_getLongDateFormat(nextMapTimestamp), changeTime=BigWorld.wg_getShortTimeFormat( nextMapTimestamp)) isToolTipSpecial = True else: mapIcon = mapMsg = '' isToolTipSpecial = False mapInfo = i18n.makeString(mapIcon + ' ' + mapMsg) result['mapInfo'] = mapInfo result['isToolTipSpecial'] = isToolTipSpecial result['tooltipData'] = { 'mapName': header, 'description': body, 'imageURL': self.__getMapImage(curMapID) } return result
def __prepareHeaderData(self): fort = self.fortCtrl.getFort() isDefencePeriodActivated = fort.isDefenceHourEnabled() inProcess, _ = fort.getDefenceHourProcessing() isDefenceOn = isDefencePeriodActivated or inProcess buildingIcon = FortViewHelper.getPopoverIconSource(self._buildingUID, self.__buildingLevel, isDefenceOn=isDefenceOn) result = {'buildingName': i18n.makeString(FORT.buildings_buildingname(self._buildingUID)), 'buildingIcon': buildingIcon} buildLevel = self.__convertBuildLevel(self.__buildingLevel) result['buildLevel'] = i18n.makeString(FORT.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=buildLevel) upgradeBtnVisible = False upgradeBtnEnable = False localTooltip = '' if self._canModernization(self.__buildingDescr): upgradeBtnVisible = upgradeBtnEnable = True localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN if upgradeBtnVisible: if not self._isEnableModernizationBtnByDamaged(self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEBTN_DISABLEDBYDESTROY elif not self._isEnableModernizationBtnByProgress(self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN_DISABLED result['upgradeButtonToolTip'] = localTooltip result['showUpgradeButton'] = upgradeBtnVisible result['enableUpgradeBtn'] = upgradeBtnEnable isVisibleDemountBtn = self._isVisibleDemountBtn(self.__buildingDescr) result['isVisibleDemountBtn'] = isVisibleDemountBtn if isVisibleDemountBtn: result['enableDemountBtn'] = self._isEnableDemountBtn(self.__buildingDescr) result['demountBtnTooltip'] = TOOLTIPS.FORTIFICATION_POPOVER_DEMOUNTBTN header, body, filterColor = self.__makeHeaderStatusMessage() result['titleStatus'] = header result['bodyStatus'] = body result['glowColor'] = int(filterColor, 16) result['isModernization'] = self.__canUpgrade result['canDeleteBuilding'] = self.fortCtrl.getPermissions().canDeleteBuilding() if self.__progress is ALIAS.STATE_BUILDING and isDefencePeriodActivated: nextMapTimestamp, nextMapID, curMapID = self.fortCtrl.getFort().getBuildingMaps(self._buildingID) isMapsInfoEnabled = nextMapTimestamp > 0 if self.__buildingLevel < fortified_regions.g_cache.defenceConditions.minRegionLevel: mapIcon = icons.alert() mapMsg = text_styles.alert(i18n.makeString(FORT.BUILDINGPOPOVER_MAPINFO_NOBATTLE)) header = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_HEADER) body = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_BODY) isToolTipSpecial = False elif isMapsInfoEnabled: currentMapUserName = self.__getMapUserName(curMapID) mapIcon = icons.info() mapMsg = text_styles.main(currentMapUserName) header = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_HEADER, currentMap=currentMapUserName) body = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_BODY, nextMap=self.__getMapUserName(nextMapID), changeDate=BigWorld.wg_getLongDateFormat(nextMapTimestamp), changeTime=BigWorld.wg_getShortTimeFormat(nextMapTimestamp)) isToolTipSpecial = True else: mapIcon = mapMsg = '' isToolTipSpecial = False mapInfo = i18n.makeString(mapIcon + ' ' + mapMsg) result['mapInfo'] = mapInfo result['isToolTipSpecial'] = isToolTipSpecial result['tooltipData'] = {'mapName': header, 'description': body, 'imageURL': self.__getMapImage(curMapID)} return result
def _populate(self): super(QuestsTileChainsView, self)._populate() g_eventsCache.potapov.onProgressUpdated += self._onProgressUpdated vehTypeFilter, qStateFilter = self.__getCurrentFilters() self.as_setHeaderDataS({'noTasksText': _ms(QUESTS.TILECHAINSVIEW_NOTASKSLABEL_TEXT), 'header': {'tileID': self.__tile.getID(), 'titleText': self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.PROMO_SUB_TITLE, _ms(QUESTS.TILECHAINSVIEW_TITLE, name=self.__tile.getUserName() + ' ' + icons.info())), 'backBtnText': _ms(QUESTS.TILECHAINSVIEW_BUTTONBACK_TEXT), 'backBtnTooltip': TOOLTIPS.PRIVATEQUESTS_BACKBUTTON, 'backgroundImagePath': self._HEADER_ICON_PATH % self.__tile.getIconID()}, 'filters': {'filtersLabel': _ms(QUESTS.TILECHAINSVIEW_FILTERSLABEL_TEXT), 'vehicleTypeFilterData': formatters._packVehicleTypesFilter(_QuestsFilter.VEH_TYPE_DEFAULT), 'taskTypeFilterData': self.__packQuestStatesFilter(), 'defVehicleType': vehTypeFilter, 'defTaskType': qStateFilter}}) self._populateTileData()
def __syncUserInfo(self): clanProfile = self.clansCtrl.getAccountProfile() invitesCount = 0 if not clanProfile.isInClan(): invitesCount = clanProfile.getInvitesCount() or 0 if invitesCount == 0: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPEOPENED else: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPE title = text_styles.middleTitle(MENU.HEADER_ACCOUNT_POPOVER_BOOSTERS_BLOCKTITLE) + ' ' + icons.info() userVO = {'userData': self.__userData, 'isInClan': clanProfile.isInClan() or not self.clansCtrl.isEnabled(), 'isTeamKiller': g_itemsCache.items.stats.isTeamKiller, 'openInviteBtnIcon': envelopeIcon, 'boostersBlockTitle': title, 'boostersBlockTitleTooltip': TOOLTIPS.HEADER_ACCOUNTPOPOVER_BOOSTERSTITLE} userVO.update(self._getMyInvitesBtnParams()) self.as_setDataS(userVO)
def _populate(self): super(_QuestsTileChainsView, self)._populate() g_eventsCache.onProgressUpdated += self._onProgressUpdated vehTypeFilter, qStateFilter = self.__getCurrentFilters() self.as_setHeaderDataS({'noTasksText': _ms(QUESTS.TILECHAINSVIEW_NOTASKSLABEL_TEXT), 'header': {'tileID': self.__tile.getID(), 'titleText': text_styles.promoSubTitle(_ms(QUESTS.TILECHAINSVIEW_TITLE, name=self.__tile.getUserName() + ' ' + icons.info())), 'backBtnText': _ms(QUESTS.TILECHAINSVIEW_BUTTONBACK_TEXT), 'backBtnTooltip': TOOLTIPS.PRIVATEQUESTS_BACKBUTTON, 'backgroundImagePath': self._HEADER_ICON_PATH % self.__tile.getIconID(), 'tasksProgressLabel': text_styles.main(QUESTS.TILECHAINSVIEW_TASKSPROGRESS_TEXT), 'tasksProgressLinkage': self._tasksProgressLinkage, 'tooltipType': self._tooltipType}, 'filters': {'filtersLabel': _ms(QUESTS.TILECHAINSVIEW_FILTERSLABEL_TEXT), 'showVehicleTypeFilterData': self._showVehicleFilter, 'vehicleTypeFilterData': packIntVehicleTypesFilter(_QuestsFilter.VEH_TYPE_DEFAULT), 'taskTypeFilterData': self.__packQuestStatesFilter(), 'defVehicleType': vehTypeFilter, 'defTaskType': qStateFilter}}) self._populateTileData()