Example #1
0
    def _getInitialFilterVO(self, contexts):
        filters = self.filter.getFilters(self._usedFilters)
        filtersVO = {
            'mainBtn': {
                'value': getButtonsAssetPath('params'),
                'tooltip': TANK_CAROUSEL_FILTER.TOOLTIP_PARAMS
            },
            'hotFilters': [],
            'isVisible': self._getFiltersVisible()
        }
        for entry in self._usedFilters:
            filterCtx = contexts.get(entry, FilterSetupContext())
            filtersVO['hotFilters'].append({
                'id':
                entry,
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'selected':
                filters[entry],
                'enabled':
                True,
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry),
                        **filterCtx.ctx))
            })

        return filtersVO
Example #2
0
    def __getInitialFilterVO(self, contexts):
        filters = self.filter.getFilters(self._usedFilters)
        filtersVO = {
            'counterCloseTooltip':
            makeTooltip('#tooltips:tanksFilter/counter/close/header',
                        '#tooltips:tanksFilter/counter/close/body'),
            'mainBtn': {
                'value':
                getButtonsAssetPath('params'),
                'tooltip':
                makeTooltip('#tank_carousel_filter:tooltip/params/header',
                            '#tank_carousel_filter:tooltip/params/body')
            },
            'hotFilters': []
        }
        for entry in self._usedFilters:
            filterCtx = contexts.get(entry, FilterSetupContext())
            filtersVO['hotFilters'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'selected':
                filters[entry],
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry),
                        **filterCtx.ctx))
            })

        return filtersVO
Example #3
0
 def _getInitialFilterVO(self):
     filters = self.filter.getFilters(self._usedFilters)
     xpRateStr = 'x{}'.format(self._itemsCache.items.shop.dailyXPFactor)
     return {'counterCloseTooltip': makeTooltip('#tooltips:tanksFilter/counter/close/header', '#tooltips:tanksFilter/counter/close/body'),
      'mainBtn': {'value': getButtonsAssetPath('params'),
                  'tooltip': makeTooltip('#tank_carousel_filter:filter/paramsFilter/header', '#tank_carousel_filter:filter/paramsFilter/body')},
      'hotFilters': [{'value': getButtonsAssetPath('bonus_{}'.format(xpRateStr)),
                      'selected': filters['bonus'],
                      'tooltip': makeTooltip('#tank_carousel_filter:filter/bonusFilter/header', i18n.makeString('#tank_carousel_filter:filter/bonusFilter/body', bonus=xpRateStr))}, {'value': getButtonsAssetPath('favorite'),
                      'selected': filters['favorite'],
                      'tooltip': makeTooltip('#tank_carousel_filter:filter/favoriteFilter/header', '#tank_carousel_filter:filter/favoriteFilter/body')}]}
Example #4
0
 def _initializeFilters(self):
     xpRate = 'x%d' % g_itemsCache.items.shop.dailyXPFactor
     falloutBattleType = i18n.makeString('#menu:headerButtons/battle/menu/fallout/{0}'.format(getFalloutCtrl().getBattleType()))
     self.as_initCarouselFilterS({'counterCloseTooltip': makeTooltip(TOOLTIPS.TANKSFILTER_COUNTER_CLOSE_HEADER, TOOLTIPS.TANKSFILTER_COUNTER_CLOSE_BODY),
      'paramsFilter': {'icon': getButtonsAssetPath('params'),
                       'tooltip': makeTooltip('#tank_carousel_filter:filter/paramsFilter/header', '#tank_carousel_filter:filter/paramsFilter/body')},
      'favoriteFilter': {'icon': getButtonsAssetPath('favorite'),
                         'tooltip': makeTooltip('#tank_carousel_filter:filter/favoriteFilter/header', '#tank_carousel_filter:filter/favoriteFilter/body')},
      'gameModeFilter': {'icon': getButtonsAssetPath('game_mode'),
                         'tooltip': makeTooltip('#tank_carousel_filter:filter/gameModeFilter/header', i18n.makeString('#tank_carousel_filter:filter/gameModeFilter/body', type=falloutBattleType))},
      'bonusFilter': {'icon': getButtonsAssetPath('bonus_%s' % xpRate),
                      'tooltip': makeTooltip('#tank_carousel_filter:filter/bonusFilter/header', i18n.makeString('#tank_carousel_filter:filter/bonusFilter/body', bonus=xpRate))}})
Example #5
0
    def __getInitialFilterVO(self, contexts):
        filters = self.filter.getFilters(self._usedFilters)
        filtersVO = {'counterCloseTooltip': makeTooltip('#tooltips:tanksFilter/counter/close/header', '#tooltips:tanksFilter/counter/close/body'),
         'mainBtn': {'value': getButtonsAssetPath('params'),
                     'tooltip': makeTooltip('#tank_carousel_filter:tooltip/params/header', '#tank_carousel_filter:tooltip/params/body')},
         'hotFilters': []}
        for entry in self._usedFilters:
            filterCtx = contexts.get(entry, FilterSetupContext())
            filtersVO['hotFilters'].append({'value': getButtonsAssetPath(filterCtx.asset or entry),
             'selected': filters[entry],
             'tooltip': makeTooltip('#tank_carousel_filter:tooltip/{}/header'.format(entry), _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry), **filterCtx.ctx))})

        return filtersVO
 def _getVehicleDataVO(self, vehicle):
     rentInfoText = RentLeftFormatter(vehicle.rentInfo, vehicle.isPremiumIGR).getRentLeftStr()
     vState, vStateLvl = vehicle.getState()
     smallStatus, largeStatus = _getStatusStrings(vState, vStateLvl, substitute=rentInfoText, ctx={'icon': icons.premiumIgrSmall()})
     if vehicle.dailyXPFactor > 1:
         bonusImage = getButtonsAssetPath('bonus_x{}'.format(vehicle.dailyXPFactor))
     else:
         bonusImage = ''
     label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
     labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
     return {'id': vehicle.invID,
      'infoText': largeStatus,
      'smallInfoText': smallStatus,
      'clanLock': vehicle.clanLock,
      'lockBackground': vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL,
      'icon': vehicle.icon,
      'iconSmall': vehicle.iconSmall,
      'label': labelStyle(label),
      'level': vehicle.level,
      'premium': vehicle.isPremium,
      'favorite': vehicle.isFavorite,
      'nation': vehicle.nationID,
      'xpImgSource': bonusImage,
      'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type,
      'rentLeft': rentInfoText}
Example #7
0
 def _initFilter(self,
                 nation=-1,
                 vehicleType='none',
                 isMain=False,
                 level=-1,
                 compatibleOnly=False):
     filtersData = super(FortVehicleSelectPopover,
                         self)._initFilter(nation, vehicleType, isMain,
                                           level, compatibleOnly)
     filtersData['togglesDP'] = self.__createFilterToggles()
     filtersData['nationTooltip'] = makeTooltip(
         MENU.NATIONS_TITLE, TOOLTIPS.VEHICLESELECTOR_FILTER_NATION)
     if self._showMainBtn:
         entry = 'favorite'
         filtersData['mainBtn'] = {
             'value':
             getButtonsAssetPath(entry),
             'tooltip':
             makeTooltip(
                 '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                 makeString('#tank_carousel_filter:tooltip/{}/body'.format(
                     entry))),
             'selected':
             False
         }
     return filtersData
Example #8
0
 def _getInitialFilterVO(self):
     data = super(FalloutTankCarousel, self)._getInitialFilterVO()
     filters = self.filter.getFilters(self._usedFilters)
     battleTypeStr = i18n.makeString('#menu:headerButtons/battle/menu/fallout/{}'.format(self._falloutCtrl.getBattleType()))
     data['hotFilters'].append({'value': getButtonsAssetPath('game_mode'),
      'selected': filters['gameMode'],
      'tooltip': makeTooltip('#tank_carousel_filter:filter/gameModeFilter/header', i18n.makeString('#tank_carousel_filter:filter/gameModeFilter/body', type=battleTypeStr))})
     return data
Example #9
0
 def _setCarouselFilters(self):
     filters = self.filter.getFilters(self._usedFilters)
     self.as_initCarouselFilterS({'isVisible': True,
      'mainBtn': {'value': getButtonsAssetPath('params'),
                  'tooltip': '#tank_carousel_filter:tooltip/params'},
      'hotFilters': [{'value': QUESTS.QUESTS_TABLE_INHANGAR,
                      'tooltip': '#tank_carousel_filter:tooltip/inventory',
                      'selected': filters['inventory']}]})
Example #10
0
 def _initializeFilters(self):
     xpRate = 'x%d' % g_itemsCache.items.shop.dailyXPFactor
     falloutBattleType = i18n.makeString(
         '#menu:headerButtons/battle/menu/fallout/{0}'.format(
             getFalloutCtrl().getBattleType()))
     self.as_initCarouselFilterS({
         'counterCloseTooltip':
         makeTooltip(TOOLTIPS.TANKSFILTER_COUNTER_CLOSE_HEADER,
                     TOOLTIPS.TANKSFILTER_COUNTER_CLOSE_BODY),
         'paramsFilter': {
             'icon':
             getButtonsAssetPath('params'),
             'tooltip':
             makeTooltip('#tank_carousel_filter:filter/paramsFilter/header',
                         '#tank_carousel_filter:filter/paramsFilter/body')
         },
         'favoriteFilter': {
             'icon':
             getButtonsAssetPath('favorite'),
             'tooltip':
             makeTooltip(
                 '#tank_carousel_filter:filter/favoriteFilter/header',
                 '#tank_carousel_filter:filter/favoriteFilter/body')
         },
         'gameModeFilter': {
             'icon':
             getButtonsAssetPath('game_mode'),
             'tooltip':
             makeTooltip(
                 '#tank_carousel_filter:filter/gameModeFilter/header',
                 i18n.makeString(
                     '#tank_carousel_filter:filter/gameModeFilter/body',
                     type=falloutBattleType))
         },
         'bonusFilter': {
             'icon':
             getButtonsAssetPath('bonus_%s' % xpRate),
             'tooltip':
             makeTooltip(
                 '#tank_carousel_filter:filter/bonusFilter/header',
                 i18n.makeString(
                     '#tank_carousel_filter:filter/bonusFilter/body',
                     bonus=xpRate))
         }
     })
    def _getInitialFilterVO(self, contexts):
        filters = self.filter.getFilters(self._usedFilters)
        filtersVO = {'mainBtn': {'value': getButtonsAssetPath('params'),
                     'tooltip': '#tank_carousel_filter:tooltip/params'},
         'hotFilters': [],
         'isVisible': self._getFiltersVisible()}
        for entry in self._usedFilters:
            filterCtx = contexts.get(entry, FilterSetupContext())
            filtersVO['hotFilters'].append({'id': entry,
             'value': getButtonsAssetPath(filterCtx.asset or entry),
             'selected': filters[entry],
             'enabled': True,
             'tooltip': makeTooltip('#tank_carousel_filter:tooltip/{}/header'.format(entry), _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry), **filterCtx.ctx))})

        length = len(filtersVO['hotFilters'])
        for id_ in range(0, length):
            entry = filtersVO['hotFilters'][id_]
            if entry['id'] in _DISABLED_FILTERS:
                entry['enabled'] = False
                entry['selected'] = False

        return filtersVO
 def _getVehicleDataVO(self, vehicle):
     rentInfoText = RentLeftFormatter(
         vehicle.rentInfo, vehicle.isPremiumIGR).getRentLeftStr()
     vState, vStateLvl = vehicle.getState()
     smallStatus, largeStatus = _getStatusStrings(
         vState,
         vStateLvl,
         substitute=rentInfoText,
         ctx={'icon': icons.premiumIgrSmall()})
     if vehicle.dailyXPFactor > 1:
         bonusImage = getButtonsAssetPath('bonus_x{}'.format(
             vehicle.dailyXPFactor))
     else:
         bonusImage = ''
     label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
     labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
     return {
         'id':
         vehicle.invID,
         'infoText':
         largeStatus,
         'smallInfoText':
         smallStatus,
         'clanLock':
         vehicle.clanLock,
         'lockBackground':
         vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL,
         'icon':
         vehicle.icon,
         'iconSmall':
         vehicle.iconSmall,
         'label':
         labelStyle(label),
         'level':
         vehicle.level,
         'premium':
         vehicle.isPremium,
         'favorite':
         vehicle.isFavorite,
         'nation':
         vehicle.nationID,
         'xpImgSource':
         bonusImage,
         'tankType':
         '{}_elite'.format(vehicle.type)
         if vehicle.isElite else vehicle.type,
         'rentLeft':
         rentInfoText
     }
Example #13
0
 def _setCarouselFilters(self):
     filters = self.filter.getFilters(self._usedFilters)
     self.as_initCarouselFilterS({
         'isVisible':
         True,
         'mainBtn': {
             'value': getButtonsAssetPath('params'),
             'tooltip': TANK_CAROUSEL_FILTER.TOOLTIP_PARAMS
         },
         'hotFilters': [{
             'value': QUESTS.QUESTS_TABLE_INHANGAR,
             'tooltip': TANK_CAROUSEL_FILTER.TOOLTIP_INVENTORY,
             'selected': filters['inventory']
         }]
     })
 def _populate(self):
     super(VehicleSelectorCarousel, self)._populate()
     self.app.loaderManager.onViewLoaded += self.__onViewLoaded
     filters = self.filter.getFilters(self._usedFilters)
     self.as_initCarouselFilterS({
         'mainBtn': {
             'value': getButtonsAssetPath('params'),
             'tooltip': '#tank_carousel_filter:tooltip/params'
         },
         'hotFilters': [{
             'value': QUESTS.QUESTS_TABLE_INHANGAR,
             'tooltip': '#tank_carousel_filter:tooltip/inventory',
             'selected': filters['inventory']
         }]
     })
Example #15
0
 def _getInitialFilterVO(self):
     data = super(FalloutTankCarousel, self)._getInitialFilterVO()
     filters = self.filter.getFilters(self._usedFilters)
     battleTypeStr = i18n.makeString(
         '#menu:headerButtons/battle/menu/fallout/{}'.format(
             self._falloutCtrl.getBattleType()))
     data['hotFilters'].append({
         'value':
         getButtonsAssetPath('game_mode'),
         'selected':
         filters['gameMode'],
         'tooltip':
         makeTooltip(
             '#tank_carousel_filter:filter/gameModeFilter/header',
             i18n.makeString(
                 '#tank_carousel_filter:filter/gameModeFilter/body',
                 type=battleTypeStr))
     })
     return data
def getVehicleDataVO(vehicle):
    rentInfoText = RentLeftFormatter(vehicle.rentInfo, vehicle.isPremiumIGR).getRentLeftStr()
    vState, vStateLvl = vehicle.getState()
    if vehicle.isRotationApplied():
        if vState in (Vehicle.VEHICLE_STATE.AMMO_NOT_FULL, Vehicle.VEHICLE_STATE.LOCKED):
            vState = Vehicle.VEHICLE_STATE.ROTATION_GROUP_UNLOCKED
    smallStatus, largeStatus = getStatusStrings(vState, vStateLvl, substitute=rentInfoText, ctx={'icon': icons.premiumIgrSmall(),
     'battlesLeft': getBattlesLeft(vehicle)})
    if vehicle.dailyXPFactor > 1:
        bonusImage = getButtonsAssetPath('bonus_x{}'.format(vehicle.dailyXPFactor))
    else:
        bonusImage = ''
    label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
    labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
    return {'id': vehicle.invID,
     'intCD': vehicle.intCD,
     'infoText': largeStatus,
     'smallInfoText': smallStatus,
     'clanLock': vehicle.clanLock,
     'lockBackground': _isLockedBackground(vState, vStateLvl),
     'icon': vehicle.icon,
     'iconAlt': getIconPath('noImage'),
     'iconSmall': vehicle.iconSmall,
     'iconSmallAlt': getSmallIconPath('noImage'),
     'label': labelStyle(label),
     'level': vehicle.level,
     'premium': vehicle.isPremium,
     'favorite': vehicle.isFavorite,
     'nation': vehicle.nationID,
     'xpImgSource': bonusImage,
     'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type,
     'rentLeft': rentInfoText,
     'clickEnabled': vehicle.isInInventory,
     'alpha': 1,
     'infoImgSrc': getVehicleStateIcon(vState),
     'isCritInfo': vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL}
def getVehicleDataVO(vehicle):
    lowTierMMController = dependency.instance(ILowTierMMController)
    rentInfoText = RentLeftFormatter(vehicle.rentInfo,
                                     vehicle.isPremiumIGR).getRentLeftStr()
    vState, vStateLvl = vehicle.getState()
    if vehicle.isRotationApplied():
        if vState in (Vehicle.VEHICLE_STATE.AMMO_NOT_FULL,
                      Vehicle.VEHICLE_STATE.LOCKED):
            vState = Vehicle.VEHICLE_STATE.ROTATION_GROUP_UNLOCKED
    if not vehicle.activeInNationGroup:
        vState = Vehicle.VEHICLE_STATE.NOT_PRESENT
    customStateExt = ''
    if vState in (Vehicle.VEHICLE_STATE.RENTABLE,
                  Vehicle.VEHICLE_STATE.RENTABLE_AGAIN):
        rentPackagesInfo = vehicle.getRentPackagesInfo
        if rentPackagesInfo.seasonType:
            customStateExt = '/' + SEASON_NAME_BY_TYPE.get(
                rentPackagesInfo.seasonType)
    smallStatus, largeStatus = getStatusStrings(vState + customStateExt,
                                                vStateLvl,
                                                substitute=rentInfoText,
                                                ctx={
                                                    'icon':
                                                    icons.premiumIgrSmall(),
                                                    'battlesLeft':
                                                    getBattlesLeft(vehicle)
                                                })
    smallHoverStatus, largeHoverStatus = smallStatus, largeStatus
    if vState == Vehicle.VEHICLE_STATE.RENTABLE:
        smallHoverStatus, largeHoverStatus = getStatusStrings(
            vState + '/hover',
            vStateLvl,
            substitute=rentInfoText,
            ctx={
                'icon': icons.premiumIgrSmall(),
                'battlesLeft': getBattlesLeft(vehicle)
            })
    if vehicle.dailyXPFactor > 1:
        bonusImage = getButtonsAssetPath('bonus_x{}'.format(
            vehicle.dailyXPFactor))
    else:
        bonusImage = ''
    label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
    labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
    tankType = '{}_elite'.format(
        vehicle.type) if vehicle.isElite else vehicle.type
    current, maximum = vehicle.getCrystalsEarnedInfo()
    isCrystalsLimitReached = current == maximum
    return {
        'id':
        vehicle.invID,
        'intCD':
        vehicle.intCD,
        'infoText':
        largeStatus,
        'infoHoverText':
        largeHoverStatus,
        'smallInfoText':
        smallStatus,
        'smallInfoHoverText':
        smallHoverStatus,
        'clanLock':
        vehicle.clanLock,
        'lockBackground':
        _isLockedBackground(vState, vStateLvl),
        'icon':
        vehicle.icon,
        'iconAlt':
        getIconPath('noImage'),
        'iconSmall':
        vehicle.iconSmall,
        'iconSmallAlt':
        getSmallIconPath('noImage'),
        'label':
        labelStyle(label),
        'level':
        vehicle.level,
        'premium':
        vehicle.isPremium,
        'favorite':
        vehicle.isFavorite,
        'giveaway':
        vehicle.isLowTierEvent and lowTierMMController.isEnabled(),
        'nation':
        vehicle.nationID,
        'xpImgSource':
        bonusImage,
        'tankType':
        tankType,
        'rentLeft':
        rentInfoText,
        'clickEnabled':
        vehicle.isInInventory and vehicle.activeInNationGroup
        or vehicle.isRentPromotion,
        'alpha':
        1,
        'infoImgSrc':
        getVehicleStateIcon(vState),
        'additionalImgSrc':
        getVehicleStateAddIcon(vState),
        'isCritInfo':
        vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL,
        'isRentPromotion':
        vehicle.isRentPromotion and not vehicle.isRented,
        'isNationChangeAvailable':
        vehicle.hasNationGroup,
        'isEarnCrystals':
        vehicle.isEarnCrystals,
        'isCrystalsLimitReached':
        isCrystalsLimitReached,
        'isUseRightBtn':
        True,
        'tooltip':
        TOOLTIPS_CONSTANTS.CAROUSEL_VEHICLE
    }
Example #18
0
    def _getInitialVO(self, filters, xpRateMultiplier):
        mapping = self.__mapping
        dataVO = {
            'nationsSectionId':
            _SECTION.NATIONS,
            'vehicleTypesSectionId':
            _SECTION.VEHICLE_TYPES,
            'levelsSectionId':
            _SECTION.LEVELS,
            'specialSectionId':
            _SECTION.SPECIALS,
            'hiddenSectionId':
            _SECTION.HIDDEN,
            'titleLabel':
            text_styles.highTitle('#tank_carousel_filter:popover/title'),
            'nationsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/nations'),
            'vehicleTypesLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/vehicleTypes'),
            'levelsLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/levels'),
            'specialsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/specials'),
            'hiddenLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/hidden'),
            'searchInputLabel':
            _ms('#tank_carousel_filter:popover/label/searchNameVehicle'),
            'searchInputName':
            filters.get('searchNameVehicle') or '',
            'searchInputTooltip':
            makeTooltip(
                '#tank_carousel_filter:tooltip/searchInput/header',
                _ms('#tank_carousel_filter:tooltip/searchInput/body',
                    count=50)),
            'searchInputMaxChars':
            50,
            'nations': [],
            'vehicleTypes': [],
            'levels': [],
            'specials': [],
            'hidden': [],
            'hiddenSectionVisible':
            True,
            'specialSectionVisible':
            True
        }

        def isSelected(entry):
            return filters.get(entry, False)

        for entry in mapping[_SECTION.NATIONS]:
            dataVO['nations'].append({
                'value':
                getNationsFilterAssetPath(entry),
                'tooltip':
                makeTooltip('#nations:{}'.format(entry),
                            '#tank_carousel_filter:tooltip/nations/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.LEVELS]:
            dataVO['levels'].append({
                'value': getLevelsAssetPath(entry),
                'selected': isSelected(entry)
            })

        for entry in mapping[_SECTION.VEHICLE_TYPES]:
            dataVO['vehicleTypes'].append({
                'value':
                getVehicleTypeAssetPath(entry),
                'tooltip':
                makeTooltip('#menu:carousel_tank_filter/{}'.format(entry),
                            '#tank_carousel_filter:tooltip/vehicleTypes/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.HIDDEN]:
            dataVO['hidden'].append({
                'label':
                text_styles.standard(
                    '#tank_carousel_filter:popover/checkbox/{}'.format(entry)),
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    '#tank_carousel_filter:tooltip/{}/body'.format(entry)),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.SPECIALS]:
            contexts = getFilterPopoverSetupContexts(xpRateMultiplier)
            filterCtx = contexts.get(entry, FilterSetupContext())
            dataVO['specials'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry),
                        **filterCtx.ctx)),
                'selected':
                isSelected(entry)
            })

        if not dataVO['hidden']:
            dataVO['hiddenSectionVisible'] = False
        if not dataVO['specials']:
            dataVO['specialSectionVisible'] = False
        return dataVO
Example #19
0
    def _getInitialVO(self, filters, xpRateMultiplier):
        mapping = self.__mapping
        vehType = self.__getSelectedVehType(filters)
        dataVO = {
            'nationsSectionId':
            _SECTION.NATIONS,
            'vehicleTypesSectionId':
            _SECTION.VEHICLE_TYPES,
            'levelsSectionId':
            _SECTION.LEVELS,
            'specialSectionId':
            _SECTION.SPECIALS,
            'hiddenSectionId':
            _SECTION.HIDDEN,
            'progressionsSectionId':
            _SECTION.PROGRESSIONS,
            'rolesSectionId':
            _SECTION.ROLES_WITH_EXTRA,
            'titleLabel':
            text_styles.highTitle('#tank_carousel_filter:popover/title'),
            'nationsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/nations'),
            'vehicleTypesLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/vehicleTypes'),
            'levelsLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/levels'),
            'specialsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/specials'),
            'hiddenLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/hidden'),
            'progressionsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/progressions'),
            'rolesLabel':
            self.__getRolesLabel(vehType),
            'searchInputLabel':
            backport.text(R.strings.tank_carousel_filter.popover.label.
                          searchNameVehicle()),
            'searchInputName':
            filters.get('searchNameVehicle') or '',
            'searchInputTooltip':
            makeTooltip(
                '#tank_carousel_filter:tooltip/searchInput/header',
                backport.text(
                    R.strings.tank_carousel_filter.tooltip.searchInput.body(),
                    count=50)),
            'searchInputMaxChars':
            50,
            'nations': [],
            'vehicleTypes': [],
            'levels': [],
            'specials': [],
            'hidden': [],
            'progressions': [],
            'roles': {},
            'hiddenSectionVisible':
            True,
            'specialSectionVisible':
            True,
            'tankTierSectionVisible':
            True,
            'searchSectionVisible':
            True,
            'progressionsSectionVisible':
            False,
            'rolesSectionVisible':
            False,
            'changeableArrowDirection':
            False
        }

        def isSelected(entry):
            return filters.get(entry, False)

        for entry in mapping[_SECTION.NATIONS]:
            dataVO['nations'].append({
                'value':
                getNationsFilterAssetPath(entry),
                'tooltip':
                makeTooltip('#nations:{}'.format(entry),
                            '#tank_carousel_filter:tooltip/nations/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.LEVELS]:
            dataVO['levels'].append({
                'value': getLevelsAssetPath(entry),
                'selected': isSelected(entry)
            })

        for entry in mapping[_SECTION.VEHICLE_TYPES]:
            dataVO['vehicleTypes'].append({
                'value':
                getVehicleTypeAssetPath(entry),
                'tooltip':
                makeTooltip('#menu:carousel_tank_filter/{}'.format(entry),
                            '#tank_carousel_filter:tooltip/vehicleTypes/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.HIDDEN]:
            dataVO['hidden'].append({
                'label':
                text_styles.standard(
                    '#tank_carousel_filter:popover/checkbox/{}'.format(entry)),
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    '#tank_carousel_filter:tooltip/{}/body'.format(entry)),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.SPECIALS]:
            contexts = getFilterPopoverSetupContexts(xpRateMultiplier)
            filterCtx = contexts.get(entry, FilterSetupContext())
            tooltipRes = R.strings.tank_carousel_filter.tooltip.dyn(entry)
            dataVO['specials'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'tooltip':
                makeTooltip(
                    backport.text(tooltipRes.header()) if tooltipRes else '',
                    backport.text(tooltipRes.body(), **filterCtx.ctx))
                if tooltipRes else '',
                'selected':
                isSelected(entry),
                'enabled':
                not (entry == 'bonus' and self._isFrontline)
            })

        for entry in mapping[_SECTION.PROGRESSIONS]:
            contexts = getFilterPopoverSetupContexts(xpRateMultiplier)
            filterCtx = contexts.get(entry, FilterSetupContext())
            tooltipRes = R.strings.tank_carousel_filter.tooltip.dyn(entry)
            dataVO['progressions'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'tooltip':
                makeTooltip(
                    backport.text(tooltipRes.header()) if tooltipRes else '',
                    backport.text(tooltipRes.body(), **filterCtx.ctx))
                if tooltipRes else '',
                'selected':
                isSelected(entry)
            })

        for vType in mapping[_SECTION.VEHICLE_TYPES]:
            if vType != VEHICLE_CLASS_NAME.SPG:
                dataVO['roles'][vType] = [
                    self.__getRoleVO(entry, filters)
                    for entry in mapping[_SECTION.ROLES].get(vType, [])
                    if entry is not None
                ]

        if not dataVO['hidden']:
            dataVO['hiddenSectionVisible'] = False
        if not dataVO['specials']:
            dataVO['specialSectionVisible'] = False
        if self._withRoles and vehType is not None and vehType is not VEHICLE_CLASS_NAME.SPG:
            dataVO['rolesSectionVisible'] = True
        return dataVO