def _buildFrontSupplyItems(self):
     self._frontSupplyItems = []
     if not self._wotPlusVehicles and self._isWotPlusRentEnabled() or self._isTelecomRentalsEnabled() and not self._telecomRentals.getAvailableRentCount() == 0:
         text = MENU.TANKCAROUSEL_WOTPLUSSELECTIONAVAILABLE
         if self._telecomRentals.getRentsPending():
             text = MENU.TANKCAROUSEL_WOTPLUSSELECTIONPENDING
         self._frontSupplyItems.append({'isWotPlusSlot': True,
          'infoText': text_styles.vehicleStatusInfoText(text),
          'infoHoverText': text_styles.vehicleStatusInfoText(text),
          'smallInfoText': text_styles.vehicleStatusSimpleText(text),
          'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK,
          'extraImage': RES_ICONS.MAPS_ICONS_LIBRARY_RENT_ICO_BIG,
          'tooltip': TOOLTIPS.TANKS_CAROUSEL_WOT_PLUS_SLOT})
def getStorageVehicleVo(vehicle):
    name = getVehicleName(vehicle)
    description = _getVehicleDescription(vehicle)
    imageSmall = func_utils.makeFlashPath(
        vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL))
    stateIcon, stateText = _getVehicleInfo(vehicle)
    if not imageSmall and not stateText:
        stateText = text_styles.vehicleStatusInfoText(
            _ms(STORAGE.INHANGAR_NOIMAGE))
    vo = createStorageDefVO(
        vehicle.intCD,
        name,
        description,
        vehicle.inventoryCount,
        getItemPricesVO(vehicle.getSellPrice())[0],
        imageSmall,
        RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL, 'empty_tank'),
        itemType=vehicle.getHighlightType(),
        nationFlagIcon=RES_SHOP.getNationFlagIcon(
            nations.NAMES[vehicle.nationID]),
        contextMenuId=CONTEXT_MENU_HANDLER_TYPE.STORAGE_VEHICLES_REGULAR_ITEM)
    vo.update({'infoImgSrc': stateIcon, 'infoText': stateText})
    if vehicle.canTradeOff:
        vo.update(
            {'tradeOffPrice': {
                'price': getMoneyVO(vehicle.tradeOffPrice)
            }})
    return vo
 def _getVehicleDataVO(self, vehicle):
     vehicleData = super(FalloutCarouselDataProvider,
                         self)._getVehicleDataVO(vehicle)
     if not self._falloutCtrl.isSuitableVeh(vehicle):
         infoText = i18n.makeString(
             '#menu:tankCarousel/vehicleStates/{}'.format(
                 Vehicle.VEHICLE_STATE.NOT_SUITABLE))
         vehicleData.update(
             {'infoText': text_styles.vehicleStatusInfoText(infoText)})
     if vehicle.isFalloutSelected:
         selectButtonLabel = FALLOUT.TANKCAROUSELSLOT_DEACTIVATEBUTTON
         selected = True
         selectable = True
         visible = True
         enabled = True
     else:
         selectButtonLabel = FALLOUT.TANKCAROUSELSLOT_ACTIVATEBUTTON
         selected = False
         selectable = vehicle.isFalloutAvailable and not vehicle.isDisabledInPremIGR
         visible = bool(self._falloutCtrl.getEmptySlots(
         )) and self._falloutCtrl.getConfig().hasRequiredVehicles()
         enabled = self._falloutCtrl.canSelectVehicle(vehicle)
     vehicleData.update({
         'falloutCanBeSelected':
         selectable and visible,
         'falloutSelected':
         selected,
         'falloutButtonDisabled':
         not enabled,
         'selectButtonLabel':
         selectButtonLabel,
         'selectButtonTooltip':
         self._falloutCtrl.carouselSelectionButtonTooltip()
     })
     return vehicleData
def packMoneyAndXpBlocks(tooltipBlocks, btnType, valueBlocks, alternativeData=None, hideActionBlock=False):
    titleBlocks = list()
    alternativeData = alternativeData or {}
    titleBlocks.append(packTitleDescBlock(text_styles.highTitle(TOOLTIPS.getHeaderBtnTitle(alternativeData.get('title') or btnType)), None, padding=packPadding(bottom=15)))
    tooltipBlocks.append(packBuildUpBlockData(titleBlocks))
    if valueBlocks is not None:
        tooltipBlocks.append(packBuildUpBlockData(valueBlocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
    decsBlocks = list()
    descLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE
    if btnType == CURRENCIES_CONSTANTS.CRYSTAL:
        descLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILD_BLOCK_VIOLET_BIG_LINKAGE
        padding = packPadding(bottom=8)
        decsBlocks.append(packTextBlockData(text_styles.middleTitle(backport.text(R.strings.tooltips.header.buttons.crystal.descriptionTitle())), padding=padding))
        descVehicle = text_styles.vehicleStatusInfoText(backport.text(R.strings.tooltips.header.buttons.crystal.descriptionVehicle()))
        decsBlocks.append(packTextBlockData(text_styles.main(backport.text(R.strings.tooltips.header.buttons.crystal.description0(), vehicle=descVehicle)), padding=padding))
        decsBlocks.append(packTextBlockData(text_styles.main(backport.text(R.strings.tooltips.header.buttons.crystal.description1())), padding=packPadding(bottom=20)))
    elif btnType == CURRENCIES_CONSTANTS.BRCOIN:
        decsBlocks.append(packTextBlockData(text_styles.main(TOOLTIPS.getHeaderBtnDesc(alternativeData.get('btnDesc') or btnType)), padding=packPadding(bottom=-8)))
    else:
        decsBlocks.append(packTextBlockData(text_styles.main(TOOLTIPS.getHeaderBtnDesc(alternativeData.get('btnDesc') or btnType)), padding=packPadding(bottom=15)))
    tooltipBlocks.append(packBuildUpBlockData(decsBlocks, linkage=descLinkage))
    if not hideActionBlock:
        if btnType != CURRENCIES_CONSTANTS.CRYSTAL:
            actionBlocks = list()
            actionBlocks.append(packAlignedTextBlockData(text=text_styles.standard(TOOLTIPS.getHeaderBtnClickDesc(alternativeData.get('btnClickDesc') or btnType)), align=alternativeData.get('btnClickDescAlign') or BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
            tooltipBlocks.append(packBuildUpBlockData(actionBlocks))
    return tooltipBlocks
 def formatToEnd(iconPath, text, dateType, isEndSoon):
     iconPath = icons.makeImageTag(iconPath)
     timeData = event.getFormattedRemainingTime(dateType)
     text = _ms(text, time=formatTimeToEnd(timeData[0], timeData[1]))
     if isEndSoon:
         formatedText = timeEndStyle(text)
     else:
         formatedText = text_styles.vehicleStatusInfoText(text)
     return '{} {}'.format(iconPath, formatedText)
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)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
0
    def getTimerInfo(self):

        def formatToEnd(iconPath, text, dateType, isEndSoon):
            iconPath = icons.makeImageTag(iconPath)
            timeData = event.getFormattedRemainingTime(dateType)
            text = _ms(text, time=formatTimeToEnd(timeData[0], timeData[1]))
            if isEndSoon:
                formatedText = timeEndStyle(text)
            else:
                formatedText = text_styles.vehicleStatusInfoText(text)
            return '{} {}'.format(iconPath, formatedText)

        event = self._event
        sday, smonth, _ = event_boards_timer.getDayMonthYear(event.getStartDate())
        eday, emonth, _ = event_boards_timer.getDayMonthYear(event.getEndDate())
        finished = event.isFinished()
        if not finished:
            icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_DATE_ICON)
            timePeriod = '{} {} {} - {} {} {}'.format(str(sday), _ms(MENU.datetime_months(str(smonth))), event_boards_timer.getShortTimeString(event.getStartDate()), str(eday), _ms(MENU.datetime_months(str(emonth))), event_boards_timer.getShortTimeString(event.getEndDate()))
            result = '{} {}    '.format(icon, text_styles.vehicleStatusInfoText(timePeriod))
            startSoon = event.isStartSoon()
            if startSoon:
                result += formatToEnd(RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON, EVENT_BOARDS.TIME_TIMETO_START, EVENT_DATE_TYPE.START, startSoon)
            elif not self._joined and not event.isRegistrationFinished():
                finishSoon = event.isRegistrationFinishSoon()
                if finishSoon:
                    result += formatToEnd(RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON, EVENT_BOARDS.TIME_TIMETO_ENDREGISTRATION, EVENT_DATE_TYPE.PARTICIPANTS_FREEZE, finishSoon)
                else:
                    result += formatToEnd(RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_ICON_FLAG, EVENT_BOARDS.TIME_TIMETO_ENDREGISTRATION, EVENT_DATE_TYPE.PARTICIPANTS_FREEZE, finishSoon)
            else:
                endSoon = event.isEndSoon()
                if endSoon:
                    result += formatToEnd(RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON, EVENT_BOARDS.TIME_TIMETO_END, EVENT_DATE_TYPE.END, endSoon)
                else:
                    result += formatToEnd(RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_ICON_FLAG, EVENT_BOARDS.TIME_TIMETO_END, EVENT_DATE_TYPE.END, endSoon)
        else:
            date = backport.getLongDateFormat(event.getEndDateTs())
            result = text_styles.main(_ms(EVENT_BOARDS.TIME_EVENTFINISHED, date=date))
        return {'timer': result}
 def _getVehicleDataVO(self, vehicle):
     vehicleData = super(FalloutCarouselDataProvider, self)._getVehicleDataVO(vehicle)
     if not self._falloutCtrl.isSuitableVeh(vehicle):
         infoText = i18n.makeString('#menu:tankCarousel/vehicleStates/{}'.format(Vehicle.VEHICLE_STATE.NOT_SUITABLE))
         vehicleData.update({'showInfoText': True,
          'infoText': text_styles.vehicleStatusInfoText(infoText)})
     if vehicle.isFalloutSelected:
         selectButtonLabel = FALLOUT.TANKCAROUSELSLOT_DEACTIVATEBUTTON
         selected = True
         selectable = True
         visible = True
         enabled = True
     else:
         selectButtonLabel = FALLOUT.TANKCAROUSELSLOT_ACTIVATEBUTTON
         selected = False
         selectable = vehicle.isFalloutAvailable and not vehicle.isDisabledInPremIGR
         visible = bool(self._falloutCtrl.getEmptySlots()) and self._falloutCtrl.getConfig().hasRequiredVehicles()
         enabled = self._falloutCtrl.canSelectVehicle(vehicle)
     vehicleData.update({'falloutCanBeSelected': selectable and visible,
      'falloutSelected': selected,
      'falloutButtonDisabled': not enabled,
      'selectButtonLabel': selectButtonLabel,
      'selectButtonTooltip': self._falloutCtrl.carouselSelectionButtonTooltip()})
     return vehicleData
Beispiel #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)