def __update(self, timeLeft=0):
     timeLeftStr = time_utils.getTillTimeString(
         timeLeft, RANKED_BATTLES.STATUS_TIMELEFT)
     statusText = text_styles.vehicleStatusCriticalText(
         _ms(RANKED_BATTLES.PRIMETIMEALERTMESSAGEBLOCK_MESSAGE,
             time=timeLeftStr))
     self.as_setDataS({
         'alertIcon':
         RES_ICONS.MAPS_ICONS_LIBRARY_ALERTBIGICON,
         'buttonIcon':
         RES_ICONS.MAPS_ICONS_BUTTONS_CALENDAR,
         'buttonLabel':
         '',
         'buttonVisible':
         True,
         'buttonTooltip':
         makeTooltip(
             RANKED_BATTLES.
             RANKEDBATTLEVIEW_STATUSBLOCK_CALENDARBTNTOOLTIP_HEADER,
             RANKED_BATTLES.
             RANKEDBATTLEVIEW_STATUSBLOCK_CALENDARBTNTOOLTIP_BODY),
         'statusText':
         statusText,
         'popoverAlias':
         RANKEDBATTLES_ALIASES.RANKED_BATTLES_CALENDAR_POPOVER,
         'bgVisible':
         True,
         'shadowFilterVisible':
         True
     })
Пример #2
0
def getUnreachableVO(season, minLevel, maxLevel):
    levelsStr = __formatUnreachableLevels(minLevel, maxLevel)
    return {
        'bottomRules':
        __formatBottomItems(),
        'header':
        getRankedMainSeasonOnHeader(season, None),
        'centerText':
        text_styles.vehicleStatusCriticalText(
            backport.text(R.strings.ranked_battles.
                          rankedBattlesUnreachableView.unreachableText(),
                          levels=levelsStr)),
        'bottomText':
        text_styles.highTitle(
            backport.text(R.strings.ranked_battles.
                          rankedBattlesUnreachableView.bottomText(),
                          levels=levelsStr)),
        'closeBtnLabel':
        backport.text(R.strings.ranked_battles.rankedBattlesUnreachableView.
                      closeBtnLabel()),
        'closeBtnTooltip':
        '',
        'bgImage':
        backport.image(R.images.gui.maps.icons.rankedBattles.bg.main()),
        'centerImg':
        backport.image(R.images.gui.maps.icons.rankedBattles.XlessView.
                       ranked_battle_locked_sm()),
        'centerImgBig':
        backport.image(R.images.gui.maps.icons.rankedBattles.XlessView.
                       ranked_battle_locked_big())
    }
def _getAlertStatusText(timeLeft, hasAvailableServers, connectionMgr=None, epicController=None):
    rAlertMsgBlock = R.strings.epic_battle.widgetAlertMessageBlock
    alertStr = ''
    if hasAvailableServers:
        alertStr = backport.text(rAlertMsgBlock.somePeripheriesHalt(), serverName=connectionMgr.serverUserNameShort)
    else:
        currSeason = epicController.getCurrentSeason()
        currTime = time_utils.getCurrentLocalServerTimestamp()
        primeTime = epicController.getPrimeTimes().get(connectionMgr.peripheryID)
        isCycleNow = currSeason and currSeason.hasActiveCycle(currTime) and primeTime and primeTime.getPeriodsBetween(currTime, currSeason.getCycleEndDate())
        if isCycleNow:
            if connectionMgr.isStandalone():
                key = rAlertMsgBlock.singleModeHalt
            else:
                key = rAlertMsgBlock.allPeripheriesHalt
            timeLeftStr = time_formatters.getTillTimeByResource(timeLeft, R.strings.epic_battle.status.timeLeft, removeLeadingZeros=True)
            alertStr = backport.text(key(), time=timeLeftStr)
        else:
            nextSeason = currSeason or epicController.getNextSeason()
            if nextSeason is not None:
                nextCycle = nextSeason.getNextByTimeCycle(currTime)
                if nextCycle is not None:
                    if nextCycle.announceOnly:
                        alertStr = backport.text(rAlertMsgBlock.announcement())
                    else:
                        timeLeftStr = time_formatters.getTillTimeByResource(nextCycle.startDate - currTime, R.strings.epic_battle.status.timeLeft, removeLeadingZeros=True)
                        alertStr = backport.text(rAlertMsgBlock.startIn(), time=timeLeftStr)
            if not alertStr:
                prevSeason = currSeason or epicController.getPreviousSeason()
                if prevSeason is not None:
                    prevCycle = prevSeason.getLastActiveCycleInfo(currTime)
                    if prevCycle is not None:
                        alertStr = backport.text(rAlertMsgBlock.noCycleMessage())
    return text_styles.vehicleStatusCriticalText(alertStr)
 def __getAlertStatusText(self, timeLeft, unsuitablePeriphery,
                          hasAvailableServers):
     rAlertMsgBlock = R.strings.battle_royale.widgetAlertMessageBlock
     alertStr = ''
     if hasAvailableServers:
         if unsuitablePeriphery:
             alertStr = backport.text(
                 R.strings.battle_royale.alertMessage.unsuitablePeriphery())
         else:
             alertStr = backport.text(
                 rAlertMsgBlock.somePeripheriesHalt(),
                 serverName=self.__connectionMgr.serverUserNameShort)
     else:
         currSeason = self.__battleRoyaleController.getCurrentSeason()
         currTime = time_utils.getCurrentLocalServerTimestamp()
         primeTime = self.__battleRoyaleController.getPrimeTimes().get(
             self.__connectionMgr.peripheryID)
         isCycleNow = currSeason and currSeason.hasActiveCycle(
             currTime) and primeTime and primeTime.getPeriodsBetween(
                 currTime, currSeason.getCycleEndDate())
         if isCycleNow:
             if self.__connectionMgr.isStandalone():
                 key = rAlertMsgBlock.singleModeHalt
             else:
                 key = rAlertMsgBlock.allPeripheriesHalt
             timeLeftStr = time_utils.getTillTimeString(
                 timeLeft,
                 EPIC_BATTLE.STATUS_TIMELEFT,
                 removeLeadingZeros=True)
             alertStr = backport.text(key(), time=timeLeftStr)
         else:
             nextSeason = currSeason or self.__battleRoyaleController.getNextSeason(
             )
             if nextSeason is not None:
                 nextCycle = nextSeason.getNextByTimeCycle(currTime)
                 if nextCycle is not None:
                     cycleNumber = nextCycle.getEpicCycleNumber()
                     timeLeftStr = time_utils.getTillTimeString(
                         nextCycle.startDate - currTime,
                         EPIC_BATTLE.STATUS_TIMELEFT,
                         removeLeadingZeros=True)
                     alertStr = backport.text(
                         rAlertMsgBlock.startIn.single()
                         if nextSeason.isSingleCycleSeason() else
                         rAlertMsgBlock.startIn.multi(),
                         cycle=int2roman(cycleNumber),
                         time=timeLeftStr)
             if not alertStr:
                 prevSeason = currSeason or self.__battleRoyaleController.getPreviousSeason(
                 )
                 if prevSeason is not None:
                     prevCycle = prevSeason.getLastActiveCycleInfo(currTime)
                     if prevCycle is not None:
                         cycleNumber = prevCycle.getEpicCycleNumber()
                         alertStr = backport.text(
                             rAlertMsgBlock.noCycleMessage.single()
                             if prevSeason.isSingleCycleSeason() else
                             rAlertMsgBlock.noCycleMessage.multi(),
                             cycle=int2roman(cycleNumber))
     return text_styles.vehicleStatusCriticalText(alertStr)
Пример #5
0
 def _getStatusBlock(self, operation):
     _, postpone = missions_helper.getPostponedOperationState(
         operation.getID())
     return formatters.packBuildUpBlockData([
         formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.markerBlocked(-2),
                 text_styles.error(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE)),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5)),
         formatters.
         packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(
             text_styles.main(
                 TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_POSTPONED
             ),
             icons.makeImageTag(RES_ICONS.getPersonalMissionOperationState(
                 PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE),
                                width=24,
                                height=24,
                                vSpace=-9),
             text_styles.vehicleStatusCriticalText(postpone)),
                                  align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                                  padding=formatters.packPadding(bottom=14))
     ])
 def __getData(self):
     bottomItems = self.__getBottomItems()
     centerTextStr = RANKED_BATTLES.RANKEDBATTLESUNREACHABLEVIEW_UNREACHABLETEXT
     centerTextStr = text_styles.vehicleStatusCriticalText(centerTextStr)
     bottomTextStr = text_styles.highTitle(
         RANKED_BATTLES.RANKEDBATTLESUNREACHABLEVIEW_BOTTOMTEXT)
     return {
         'bottomRules':
         bottomItems,
         'headerText':
         text_styles.superPromoTitle(
             RANKED_BATTLES.RANKEDBATTLESUNREACHABLEVIEW_HEADERTEXT),
         'centerText':
         self.__formatUnreachableLevels(centerTextStr),
         'bottomText':
         self.__formatUnreachableLevels(bottomTextStr),
         'closeBtnLabel':
         RANKED_BATTLES.RANKEDBATTLESUNREACHABLEVIEW_CLOSEBTNLABEL,
         'closeBtnTooltip':
         '',
         'bgImage':
         RES_ICONS.MAPS_ICONS_RANKEDBATTLES_XLESSVIEW_BG_PIC_RANK_LOCK,
         'centerImg':
         RES_ICONS.
         MAPS_ICONS_RANKEDBATTLES_XLESSVIEW_RANKED_BATTLE_LOCKED_SM,
         'centerImgBig':
         RES_ICONS.
         MAPS_ICONS_RANKEDBATTLES_XLESSVIEW_RANKED_BATTLE_LOCKED_BIG
     }
Пример #7
0
 def atReturn(self, cd):
     original_return_value = cd.returned
     original_args = cd.args
     if not self.__vehicle_is_available(original_args[0]):
         state = _ms('#menu:tankCarousel/vehicleStates/%s' % Vehicle.VEHICLE_STATE.UNAVAILABLE)
         original_return_value['infoText'] = text_styles.vehicleStatusCriticalText(state)
         original_return_value['smallInfoText'] = text_styles.critical(state)
     return original_return_value
Пример #8
0
 def atReturn(self, cd):
     original_return_value = cd.returned
     original_args = cd.args
     if not self.__vehicle_is_available(original_args[0]):
         state = _ms('#menu:tankCarousel/vehicleStates/%s' % Vehicle.VEHICLE_STATE.UNAVAILABLE)
         original_return_value['infoText'] = text_styles.vehicleStatusCriticalText(state)
         original_return_value['smallInfoText'] = text_styles.critical(state)
     return original_return_value
def _getStatusString(vState, vStateLvl):
    if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
        status = i18n.makeString('#menu:tankCarousel/vehicleStates/{}'.format(vState), icon=icons.premiumIgrSmall())
    else:
        status = i18n.makeString('#menu:tankCarousel/vehicleStates/{}'.format(vState))
    if not status:
        return status
    elif vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL:
        return text_styles.vehicleStatusCriticalText(status)
    else:
        return text_styles.vehicleStatusInfoText(status)
Пример #10
0
 def construct(cls, periodInfo, serverShortName):
     isPrimeAlert = periodInfo.periodType in cls._PERIOD_TYPES_PRIME_ALERT
     return cls(alertIcon=backport.image(
         R.images.gui.maps.icons.library.alertBigIcon())
                if isPrimeAlert else None,
                buttonLabel=backport.text(
                    cls._RES_ROOT.button.changeServer()),
                buttonVisible=periodInfo.periodType
                in cls._PERIOD_TYPES_WITH_BUTTON,
                statusText=text_styles.vehicleStatusCriticalText(
                    cls._getAlertLabel(periodInfo, serverShortName)),
                shadowFilterVisible=isPrimeAlert,
                tooltip=cls._getTooltip(periodInfo))
Пример #11
0
 def __getStatusInfo(self, item):
     isCritLvl = self._getItemStatusLevel(item) == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL
     statusMessage, disabled = self._getStatusParams(item)
     if statusMessage:
         statusImgSrc = self._getStatusImg(item)
         styledStatus = text_styles.vehicleStatusCriticalText(statusMessage) if isCritLvl else text_styles.vehicleStatusInfoText(statusMessage)
     else:
         statusImgSrc = ''
         styledStatus = ''
     return (styledStatus,
      disabled,
      statusImgSrc,
      isCritLvl)
Пример #12
0
def _getStatusString(vState, vStateLvl):
    if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState),
            icon=icons.premiumIgrSmall())
    else:
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState))
    if not status:
        return status
    elif vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL:
        return text_styles.vehicleStatusCriticalText(status)
    else:
        return text_styles.vehicleStatusInfoText(status)
Пример #13
0
 def __getStatusInfo(self, item):
     """
     Returns styled status message, image, critLevel flag
     :param item: item:<FittingItem>
     :return: tuple with values of styledStatus, disabled flag, statusImage icon, isCritLevel flag
     """
     isCritLvl = self._getItemStatusLevel(
         item) == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL
     statusMessage, disabled = self._getStatusParams(item)
     if statusMessage:
         statusImgSrc = self._getStatusImg(item)
         styledStatus = text_styles.vehicleStatusCriticalText(
             statusMessage
         ) if isCritLvl else text_styles.vehicleStatusInfoText(
             statusMessage)
     else:
         statusImgSrc = ''
         styledStatus = ''
     return (styledStatus, disabled, statusImgSrc, isCritLvl)
def getPrimeTimeStatusVO():
    mapboxCtrl = dependency.instance(IMapboxController)
    connectionMgr = dependency.instance(IConnectionManager)
    status, _, _ = mapboxCtrl.getPrimeTimeStatus()
    errorStr = backport.text(R.strings.mapbox.serverAlertMessage(),
                             serverName=connectionMgr.serverUserNameShort)
    showPrimeTimeAlert = status != PrimeTimeStatus.AVAILABLE
    return AlertData(
        alertIcon=backport.image(
            R.images.gui.maps.icons.library.alertBigIcon())
        if showPrimeTimeAlert else None,
        buttonIcon='',
        buttonLabel=backport.text(
            R.strings.mapbox.serverAlertMessage.button()),
        buttonVisible=showPrimeTimeAlert
        and mapboxCtrl.hasAvailablePrimeTimeServers(),
        buttonTooltip=None,
        statusText=text_styles.vehicleStatusCriticalText(errorStr),
        popoverAlias=None,
        bgVisible=True,
        shadowFilterVisible=showPrimeTimeAlert,
        tooltip=TOOLTIPS_CONSTANTS.MAPBOX_SELECTOR_INFO,
        isSimpleTooltip=False)
 def __getAlertStatusText(self, timeLeft):
     timeLeftStr = time_utils.getTillTimeString(
         timeLeft, RANKED_BATTLES.STATUS_TIMELEFT)
     return text_styles.vehicleStatusCriticalText(
         _ms(RANKED_BATTLES.PRIMETIMEALERTMESSAGEBLOCK_MESSAGE,
             time=timeLeftStr))
Пример #16
0
def getAlertStatusVO():
    alertMessage = _getAlertMessage()
    buttonLabelResID = R.strings.ranked_battles.alertMessage.button.moreInfo()
    if alertMessage.alertType == AlertTypes.PRIME:
        buttonLabelResID = R.strings.ranked_battles.alertMessage.button.changeServer()
    return CalendarStatusVO(alertIcon=backport.image(R.images.gui.maps.icons.library.alertBigIcon()) if alertMessage.alertType != AlertTypes.SEASON else None, buttonIcon='', buttonLabel=backport.text(buttonLabelResID), buttonVisible=alertMessage.buttonVisible, buttonTooltip=None, statusText=text_styles.vehicleStatusCriticalText(alertMessage.alertStr), popoverAlias=None, bgVisible=True, shadowFilterVisible=alertMessage.alertType != AlertTypes.SEASON, tooltip=TOOLTIPS_CONSTANTS.RANKED_CALENDAR_DAY_INFO if alertMessage.alertType != AlertTypes.VEHICLE else None)
Пример #17
0
    def __update(self, _=None):
        headerData = {
            'title':
            backport.text(R.strings.ranked_battles.rankedBattle.title()),
            'leftSideText':
            backport.text(R.strings.ranked_battles.introPage.description()),
            'rightSideText':
            None,
            'tooltip':
            None
        }
        blocksData = []
        for index in range(BLOCKS_COUNT):
            index += 1
            imgSource = backport.image(
                R.images.gui.maps.icons.rankedBattles.intro.dyn(
                    'block{}'.format(index))())
            title = text_styles.promoSubTitle(
                backport.text(
                    R.strings.ranked_battles.introPage.blocks.dyn(
                        'block{}'.format(index)).title()))
            descr = text_styles.mainBig(
                backport.text(
                    R.strings.ranked_battles.introPage.blocks.dyn(
                        'block{}'.format(index)).description()))
            blocksData.append({
                'imgSource': imgSource,
                'title': title,
                'description': descr
            })

        if not self.__rankedController.isYearRewardEnabled():
            blocksData[-1]['imgSource'] = backport.image(
                R.images.gui.maps.icons.rankedBattles.intro.yearRewardDisabled(
                ))
            blocksData[-1]['description'] = text_styles.mainBig(
                backport.text(R.strings.ranked_battles.introPage.blocks.
                              yearRewardDisabled()))
        url = getRankedBattlesIntroPageUrl()
        self.__state = RANKEDBATTLES_CONSTS.INTRO_STATE_NORMAL
        if self.__rankedController.isFrozen():
            self.__state = RANKEDBATTLES_CONSTS.INTRO_STATE_DISABLED
            if not self.__rankedController.getSeasonPassed(
            ) and not self.__rankedController.getCurrentSeason():
                self.__state = RANKEDBATTLES_CONSTS.INTRO_STATE_BEFORE_SEASON
        if self.__state == RANKEDBATTLES_CONSTS.INTRO_STATE_DISABLED:
            self.as_setAlertMessageBlockDataS({
                'alertIcon':
                backport.image(R.images.gui.maps.icons.library.alertBigIcon()),
                'statusText':
                text_styles.vehicleStatusCriticalText(
                    backport.text(
                        R.strings.ranked_battles.introPage.alert.disabled())),
                'buttonVisible':
                False
            })
        elif self.__state == RANKEDBATTLES_CONSTS.INTRO_STATE_BEFORE_SEASON:
            self.__updateTimer()
        if self.__state != RANKEDBATTLES_CONSTS.INTRO_STATE_NORMAL and self.__rankedController.getRankedWelcomeCallback(
        ) is None:
            self.__rankedController.setRankedWelcomeCallback(lambda: None)
        self.as_setDataS({
            'state': self.__state,
            'hasURL': bool(url),
            'headerData': headerData,
            'blocksData': blocksData
        })
        return
Пример #18
0
 def constructForVehicle(cls, levels, vehicleIsAvailableForBuy, vehicleIsAvailableForRestore):
     minLvl, maxLvl = levels
     levels = toRomanRangeString(range(minLvl, maxLvl + 1))
     reason = R.strings.ranked_battles.rankedBattlesUnreachableView.vehicleUnavailable()
     if vehicleIsAvailableForBuy:
         reason = R.strings.ranked_battles.rankedBattlesUnreachableView.vehicleAvailableForBuy()
     elif vehicleIsAvailableForRestore:
         reason = R.strings.ranked_battles.rankedBattlesUnreachableView.vehicleAvailableForRestore()
     return cls(alertIcon=backport.image(R.images.gui.maps.icons.library.alertBigIcon()), buttonLabel=backport.text(cls._RES_ROOT.button.moreInfo()), buttonVisible=True, statusText=text_styles.vehicleStatusCriticalText(backport.text(cls._RES_ROOT.unsuitableVehicles(), levels=levels)), shadowFilterVisible=True, tooltip=makeTooltip(body=backport.text(reason, levels=levels)), isSimpleTooltip=True)
 def constructNoVehicles(cls):
     return cls(alertIcon=backport.image(R.images.gui.maps.icons.library.alertBigIcon()), buttonLabel=backport.text(cls._RES_ROOT.button.moreInfo()), buttonVisible=True, statusText=text_styles.vehicleStatusCriticalText(backport.text(cls._RES_ROOT.unsuitableVehicles())), shadowFilterVisible=True, tooltip='', isSimpleTooltip=True)