コード例 #1
0
ファイル: hangartankcarousel.py プロジェクト: aevitas/wotsdk
    def __getNationsVO(self):
        result = [{'label': '#menu:nations/all',
          'data': -1,
          'icon': getNationsFilterAssetPath('all')}]
        if constants.IS_KOREA:
            result.append({'label': '#menu:carouselFilter/igr',
             'data': IGR_FILTER_ID,
             'icon': getNationsFilterAssetPath('igr')})
        for index, nation in enumerate(GUI_NATIONS):
            result.append({'label': '#menu:nations/%s' % nation,
             'data': index,
             'icon': getNationsFilterAssetPath(nation)})

        return result
コード例 #2
0
def packNationsFilter():
    result = [{
        'label': MENU.NATIONS_ALL,
        'data': -1,
        'icon': getNationsFilterAssetPath('all')
    }]
    for idx, nation in enumerate(GUI_NATIONS):
        result.append({
            'label': MENU.nations(nation),
            'data': idx,
            'icon': getNationsFilterAssetPath(nation)
        })

    return result
コード例 #3
0
 def _makeVO(self, vehicleCD, index):
     vehicle = self.itemsCache.items.getItemByCD(vehicleCD)
     complectation = _ms(
         VEH_COMPARE.cartpopover_configurationtype(
             self.comparisonBasket.getVehicleAt(
                 index).getConfigurationType()))
     iconFunc = RES_ICONS.maps_icons_vehicletypes_elite if vehicle.isPremium else RES_ICONS.maps_icons_vehicletypes
     basketLocked = self.comparisonBasket.isLocked
     return {
         'id':
         vehicleCD,
         'index':
         index,
         'vehicleName':
         text_styles.main(vehicle.shortUserName),
         'complectation':
         complectation,
         'nation':
         getNationsFilterAssetPath(AVAILABLE_NAMES[vehicle.nationID]),
         'level':
         vehicle.level,
         'typeStr':
         iconFunc(vehicle.type + '.png'),
         'smallIconPath':
         vehicle.iconSmall,
         'removeBtnTooltip':
         VEH_COMPARE.CARTPOPOVER_REMOVELOCKEDBTN_TOOLTIP
         if basketLocked else VEH_COMPARE.CARTPOPOVER_REMOVEBTN_TOOLTIP,
         'removeBtnEnabled':
         not basketLocked
     }
コード例 #4
0
def makeVehicleVO(vehicle):
    return {'id': vehicle.intCD,
     'vehicleName': text_styles.main(vehicle.shortUserName),
     'smallVehicleIconPath': vehicle.iconSmall,
     'nationIconPath': getNationsFilterAssetPath(AVAILABLE_NAMES[vehicle.nationID]),
     'typeIconPath': getTypeSmallIconPath(vehicle.type, vehicle.isPremium),
     'level': vehicle.level,
     'isInHangar': vehicle.isInInventory}
コード例 #5
0
def packNationsFilter(nations=GUI_NATIONS):
    if nations is not GUI_NATIONS:
        nations = sorted(nations,
                         key=lambda nation: GUI_NATIONS_ORDER_INDEX[nation])
    result = [{
        'label': MENU.NATIONS_ALL,
        'data': -1,
        'icon': getNationsFilterAssetPath('all')
    }]
    for nation in nations:
        result.append({
            'label': MENU.nations(nation),
            'data': INDICES[nation],
            'icon': getNationsFilterAssetPath(nation)
        })

    return result
コード例 #6
0
 def __packNationsListBlock(self):
     return formatters.packImageListParameterBlockData(
         listIconSrc=[
             formatters.packImageListIconData(getNationsFilterAssetPath(n))
             for n in self._nations
         ],
         columnWidth=32,
         rowHeight=20,
         padding=formatters.packPadding(left=15, bottom=8))
コード例 #7
0
ファイル: hangartankcarousel.py プロジェクト: Difrex/wotsdk
    def __getNationsVO(self):
        result = [{
            'label': '#menu:nations/all',
            'data': -1,
            'icon': getNationsFilterAssetPath('all')
        }]
        if constants.IS_KOREA:
            result.append({
                'label': '#menu:carouselFilter/igr',
                'data': IGR_FILTER_ID,
                'icon': getNationsFilterAssetPath('igr')
            })
        for index, nation in enumerate(GUI_NATIONS):
            result.append({
                'label': '#menu:nations/%s' % nation,
                'data': index,
                'icon': getNationsFilterAssetPath(nation)
            })

        return result
コード例 #8
0
def getChainVehRequirements(operation, chainID, useIcons=False):
    vehs, minLevel, maxLevel = getChainVehTypeAndLevelRestrictions(operation, chainID)
    if useIcons and operation.getBranch() == PM_BRANCH.PERSONAL_MISSION_2:
        nations = getNationsForChain(operation, chainID)
        vehsData = []
        for nation in GUI_NATIONS:
            if nation in nations:
                vehsData.append(icons.makeImageTag(getNationsFilterAssetPath(nation), 26, 16, -4))

        vehs = ' '.join(vehsData)
    return _ms(PERSONAL_MISSIONS.OPERATIONINFO_CHAINVEHREQ, vehs=vehs, minLevel=minLevel, maxLevel=maxLevel)
コード例 #9
0
def _getInitialVO(filters, mapping, xpRateMultiplier):
    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'),
     'defaultButtonLabel': _ms('#tank_carousel_filter:popover/label/defaultButton'),
     'nations': [],
     'vehicleTypes': [],
     'levels': [],
     'specials': [],
     'hidden': [],
     'defaultButtonTooltip': makeTooltip('#tank_carousel_filter:tooltip/defaultButton/header', '#tank_carousel_filter:tooltip/defaultButton/body'),
     'hiddenSectionVisible': True}
    for entry in mapping[_SECTION.NATIONS]:
        dataVO['nations'].append({'value': getNationsFilterAssetPath(entry),
         'tooltip': makeTooltip('#nations:{}'.format(entry), '#tank_carousel_filter:tooltip/nations/body'),
         'selected': filters[entry]})

    for entry in mapping[_SECTION.LEVELS]:
        dataVO['levels'].append({'value': getLevelsAssetPath(entry),
         'selected': filters[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': filters[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': filters[entry]})

    for entry in mapping[_SECTION.SPECIALS]:
        if entry == 'bonus':
            ctx = {'multiplier': xpRateMultiplier}
        else:
            ctx = {}
        dataVO['specials'].append({'label': makeHtmlString('html_templates:lobby/carousel_filter/popover', entry, ctx),
         'tooltip': makeTooltip('#tank_carousel_filter:tooltip/{}/header'.format(entry), _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry), **ctx)),
         'selected': filters[entry]})

    if not dataVO['hidden']:
        dataVO['hiddenSectionVisible'] = False
    return dataVO
コード例 #10
0
    def _packBlocks(self, chainID):
        personalMissions = dependency.instance(
            IEventsCache).getPersonalMissions()
        operation = first(
            personalMissions.getOperationsForBranch(
                PM_BRANCH.PERSONAL_MISSION_2).values())
        blocks = [
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(operation.getChainName(chainID)),
                desc=text_styles.standard(
                    operation.getChainDescription(chainID)),
                img=RES_ICONS.getAlliance54x54Icon(chainID),
                imgPadding=formatters.packPadding(top=3, left=-5),
                txtOffset=78)
        ]
        nations = getNationsForChain(operation, chainID)
        nationBlocks = []
        separator = '   '
        for nation in GUI_NATIONS:
            if nation in nations:
                icon = icons.makeImageTag(getNationsFilterAssetPath(nation),
                                          26, 16, -4)
                nationName = text_styles.main(NATIONS.all(nation))
                nationBlocks.append(
                    formatters.packTextBlockData(
                        text_styles.concatStylesToSingleLine(
                            icon, separator, nationName)))

        blocks.append(
            formatters.packBuildUpBlockData(
                nationBlocks,
                linkage=BLOCKS_TOOLTIP_TYPES.
                TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                padding=formatters.packPadding(left=40)))
        allianceID = operation.getAllianceID(chainID)
        blocks.append(
            formatters.packBuildUpBlockData([
                formatters.packTextBlockData(
                    text_styles.middleTitle(
                        PERSONAL_MISSIONS.CHAINTOOLTIPDATA_DESCRIPTION_TITLE),
                    padding=formatters.packPadding(bottom=4)),
                formatters.packTextBlockData(
                    text_styles.main(
                        PERSONAL_MISSIONS.getAllianceChainTooltipDescr(
                            allianceID)),
                    padding=formatters.packPadding(bottom=7))
            ],
                                            padding=formatters.packPadding(
                                                top=-7, bottom=-3)))
        return blocks
コード例 #11
0
 def _makeVO(self, vehicleCD, index):
     vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
     if vehicle.isPremium:
         moduleType = 'premium'
     else:
         moduleType = self.comparisonBasket.getVehicleAt(index).getModulesType()
     complectation = _ms(VEH_COMPARE.cartpopover_moduletype(moduleType))
     return {'id': vehicleCD,
      'index': index,
      'vehicleName': text_styles.main(vehicle.shortUserName),
      'complectation': complectation,
      'nation': getNationsFilterAssetPath(AVAILABLE_NAMES[vehicle.nationID]),
      'level': vehicle.level,
      'typeStr': vehicle.type,
      'smallIconPath': vehicle.iconSmall,
      'removeBtnTooltip': VEH_COMPARE.CARTPOPOVER_REMOVEBTN_TOOLTIP}
コード例 #12
0
def _getInitialVO(filters, hasRentedVehicles):
    dataVO = {'nationTypeId': _SECTIONS.NATION,
     'vehicleTypeId': _SECTIONS.VEHICLE_TYPE,
     'specialTypesLeftId': _SECTIONS.SPECIAL_LEFT,
     'specialTypesRightId': _SECTIONS.SPECIAL_RIGHT,
     'levelTypesId': _SECTIONS.LEVELS,
     'rentVehicleId': _SECTIONS.RENT_VEHICLE,
     'titleLabel': text_styles.highTitle('#tank_carousel_filter:filter/popover/title'),
     'nationLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/nation'),
     'vehicleTypeLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicle'),
     'vehicleLevelLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleLevel'),
     'vehicleEliteTypeLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleEliteType'),
     'btnDefaultTooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/defaultBtn/header', '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/body'),
     'btnDefaultLabel': _ms('#tank_carousel_filter:filter/popover/label/defaultBtn'),
     'specialTypeLeft': [{'label': text_styles.standard('#tank_carousel_filter:filter/popover/checkBox/Premium'),
                          'tooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/premium/header', '#tank_carousel_filter:filter/popover/tooltip/premium/body'),
                          'selected': filters['premium']}],
     'specialTypeRight': [{'label': text_styles.standard('#tank_carousel_filter:filter/popover/checkBox/Elite'),
                           'tooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/elite/header', '#tank_carousel_filter:filter/popover/tooltip/elite/body'),
                           'selected': filters['elite']}],
     'nationsType': [],
     'vehicleType': [],
     'levelsType': [],
     'hasRentedVehicles': hasRentedVehicles,
     'rentCheckBox': {'label': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleLease'),
                      'selected': filters['hideRented'],
                      'enabled': not filters['igr'] if constants.IS_KOREA else True}}
    if constants.IS_KOREA:
        dataVO['specialTypeLeft'].append({'label': icons.premiumIgrSmall(),
         'selected': filters['igr']})
    for nation in GUI_NATIONS:
        dataVO['nationsType'].append({'value': getNationsFilterAssetPath(nation),
         'tooltip': makeTooltip(_ms('#nations:%s' % nation), _ms('#tank_carousel_filter:filter/popover/tooltip/nation/body')),
         'selected': filters[nation]})

    for level in VEHICLE_LEVELS:
        dataVO['levelsType'].append({'value': getLevelsAssetPath(level),
         'selected': filters['level_%d' % level]})

    for vehicleType in VEHICLE_TYPES_ORDER:
        dataVO['vehicleType'].append({'value': getVehicleTypeAssetPath(vehicleType),
         'tooltip': makeTooltip(_ms('#menu:carousel_tank_filter/%s' % vehicleType), _ms('#tank_carousel_filter:filter/popover/tooltip/vehicleType/body')),
         'selected': filters[vehicleType]})

    return dataVO
コード例 #13
0
    def _packSuitableBlock(self):
        blocks = []
        for node in self._item.descriptor.filter.include:
            conditions = []
            separator = ''.join(['  ', icons.makeImageTag(RES_ICONS.MAPS_ICONS_CUSTOMIZATION_TOOLTIP_SEPARATOR, 3, 21, -6), '  '])
            if node.levels:
                conditions.append(text_styles.main(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TIER))
                for level in node.levels:
                    conditions.append(text_styles.stats(int2roman(level)))
                    conditions.append(text_styles.stats(', '))

                conditions = conditions[:-1]
                conditions.append(separator)
            if node.nations:
                for nation in node.nations:
                    name = nations.NAMES[nation]
                    conditions.append(icons.makeImageTag(getNationsFilterAssetPath(name), 26, 16, -4))
                    conditions.append('  ')

                conditions = conditions[:-1]
                conditions.append(separator)
            if node.tags:
                for vehType in VEHICLE_TYPES_ORDER:
                    if vehType in node.tags:
                        conditions.append(icons.makeImageTag(RES_ICONS.getFilterVehicleType(vehType), 27, 17, -4))

                if VEHICLE_CLASS_TAGS & node.tags:
                    conditions.append(separator)
                if VEHICLE_TAGS.PREMIUM in node.tags:
                    conditions.append(icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_PREM_SMALL_ICON, 20, 17, -4))
                    conditions.append(separator)
                if VEHICLE_TAGS.PREMIUM_IGR in node.tags:
                    conditions.append(icons.premiumIgrSmall())
                    conditions.append(separator)
            if not conditions:
                continue
            icn = text_styles.concatStylesToSingleLine(*conditions[:-1])
            blocks.append(formatters.packTextBlockData(text=icn, padding={'top': -2}))
            blocks.append(formatters.packTextBlockData(text=text_styles.neutral(VEHICLE_CUSTOMIZATION.FILTER_OR), padding={'top': -4}))

        if not blocks:
            return None
        else:
            blocks.insert(0, formatters.packTitleDescBlock(title=text_styles.middleTitle(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE)))
            return formatters.packBuildUpBlockData(blocks=blocks[:-1], padding={'top': -3})
コード例 #14
0
def makeVehicleVO(vehicle):
    icon = RES_ICONS.maps_icons_vehicletypes_elite if vehicle.isPremium else RES_ICONS.maps_icons_vehicletypes
    return {
        'id':
        vehicle.intCD,
        'vehicleName':
        text_styles.main(vehicle.shortUserName),
        'smallVehicleIconPath':
        vehicle.iconSmall,
        'nationIconPath':
        getNationsFilterAssetPath(AVAILABLE_NAMES[vehicle.nationID]),
        'typeIconPath':
        icon(vehicle.type + '.png'),
        'level':
        vehicle.level,
        'isInHangar':
        vehicle.isInInventory
    }
コード例 #15
0
def getSuitableText(item, currentVehicle=None, formatVehicle=True):
    conditions = []
    for node in item.descriptor.filter.include:
        separator = ' '.join(['  ', icons.makeImageTag(RES_ICONS.MAPS_ICONS_CUSTOMIZATION_TOOLTIP_SEPARATOR, 3, 21, -6), '  '])
        if node.nations:
            sortedNations = sorted(node.nations, key=GUI_NATIONS_ORDER_INDICES.get)
            for nation in sortedNations:
                name = nations.NAMES[nation]
                conditions.append(icons.makeImageTag(getNationsFilterAssetPath(name), 26, 16, -4))
                conditions.append('  ')

            conditions = conditions[:-1]
            conditions.append(' ')
        if node.tags:
            for vehType in VEHICLE_TYPES_ORDER:
                if vehType in node.tags:
                    conditions.append(icons.makeImageTag(RES_ICONS.getFilterVehicleType(vehType), 27, 17, -4))

            if VEHICLE_CLASS_TAGS & node.tags:
                conditions.append(separator)
            if VEHICLE_TAGS.PREMIUM in node.tags:
                conditions.append(icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_PREM_SMALL_ICON, 20, 17, -4))
            if VEHICLE_TAGS.PREMIUM_IGR in node.tags:
                conditions.append(icons.premiumIgrSmall())
                conditions.append(separator)
        if node.levels:
            for level in node.levels:
                conditions.append(text_styles.stats(int2roman(level)))
                conditions.append(text_styles.stats(', '))

            conditions = conditions[:-1]
            conditions.append(separator)
        if node.vehicles:
            vehicleName = makeVehiclesShortNamesString(set(node.vehicles), currentVehicle, flat=True)
            conditions.append(text_styles.main(vehicleName) if formatVehicle else vehicleName)
            conditions.append(separator)

    return text_styles.concatStylesToSingleLine(*conditions[:-1])
コード例 #16
0
ファイル: tooltipsfilter.py プロジェクト: aevitas/wotsdk
 def __packNationsListBlock(self):
     return formatters.packImageListParameterBlockData(listIconSrc=[ getNationsFilterAssetPath(n) for n in self._nations ], columnWidth=32, rowHeight=20, padding=formatters.packPadding(left=15, bottom=8))
コード例 #17
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
コード例 #18
0
def _getInitialVO(filters, hasRentedVehicles):
    dataVO = {
        'nationTypeId':
        _SECTIONS.NATION,
        'vehicleTypeId':
        _SECTIONS.VEHICLE_TYPE,
        'specialTypesLeftId':
        _SECTIONS.SPECIAL_LEFT,
        'specialTypesRightId':
        _SECTIONS.SPECIAL_RIGHT,
        'levelTypesId':
        _SECTIONS.LEVELS,
        'rentVehicleId':
        _SECTIONS.RENT_VEHICLE,
        'titleLabel':
        text_styles.highTitle('#tank_carousel_filter:filter/popover/title'),
        'nationLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/nation'),
        'vehicleTypeLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicle'),
        'vehicleLevelLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicleLevel'),
        'vehicleEliteTypeLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicleEliteType'),
        'btnDefaultTooltip':
        makeTooltip(
            '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/header',
            '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/body'),
        'btnDefaultLabel':
        _ms('#tank_carousel_filter:filter/popover/label/defaultBtn'),
        'specialTypeLeft': [{
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/checkBox/Premium'),
            'tooltip':
            makeTooltip(
                '#tank_carousel_filter:filter/popover/tooltip/premium/header',
                '#tank_carousel_filter:filter/popover/tooltip/premium/body'),
            'selected':
            filters['premium']
        }],
        'specialTypeRight': [{
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/checkBox/Elite'),
            'tooltip':
            makeTooltip(
                '#tank_carousel_filter:filter/popover/tooltip/elite/header',
                '#tank_carousel_filter:filter/popover/tooltip/elite/body'),
            'selected':
            filters['elite']
        }],
        'nationsType': [],
        'vehicleType': [],
        'levelsType': [],
        'hasRentedVehicles':
        hasRentedVehicles,
        'rentCheckBox': {
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/label/vehicleLease'),
            'selected':
            filters['hideRented'],
            'enabled':
            not filters['igr'] if constants.IS_KOREA else True
        }
    }
    if constants.IS_KOREA:
        dataVO['specialTypeLeft'].append({
            'label': icons.premiumIgrSmall(),
            'selected': filters['igr']
        })
    for nation in GUI_NATIONS:
        dataVO['nationsType'].append({
            'value':
            getNationsFilterAssetPath(nation),
            'tooltip':
            makeTooltip(
                _ms('#nations:%s' % nation),
                _ms('#tank_carousel_filter:filter/popover/tooltip/nation/body')
            ),
            'selected':
            filters[nation]
        })

    for level in VEHICLE_LEVELS:
        dataVO['levelsType'].append({
            'value': getLevelsAssetPath(level),
            'selected': filters['level_%d' % level]
        })

    for vehicleType in VEHICLE_TYPES_ORDER:
        dataVO['vehicleType'].append({
            'value':
            getVehicleTypeAssetPath(vehicleType),
            'tooltip':
            makeTooltip(
                _ms('#menu:carousel_tank_filter/%s' % vehicleType),
                _ms('#tank_carousel_filter:filter/popover/tooltip/vehicleType/body'
                    )),
            'selected':
            filters[vehicleType]
        })

    return dataVO
コード例 #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