Esempio n. 1
0
    def __init__(self, currentVehicle, carouselItemWrapper, proxy):
        super(CustomizationCarouselDataProvider, self).__init__()
        self._currentVehicle = currentVehicle
        self._tabIndex = 0
        self._seasonID = SeasonType.SUMMER
        self._onlyOwnedAndFreeItems = False
        self._historicOnlyItems = False
        self._onlyAppliedItems = False
        self._selectIntCD = None
        self.setItemWrapper(carouselItemWrapper)
        self._proxy = proxy
        self._currentlyApplied = set()
        self._allSeasonAndTabFilterData = {}
        visibleTabs = defaultdict(set)
        c11nContext = self.service.getCtx()
        anchorsData = c11nContext.hangarSpace.getSlotPositions()
        requirement = createCustomizationBaseRequestCriteria(self._currentVehicle.item, self.eventsCache.questsProgress, self._proxy.getAppliedItems())
        allItems = self.itemsCache.items.getItems(GUI_ITEM_TYPE.CUSTOMIZATIONS, requirement)
        for tabIndex in TABS_ITEM_MAPPING.iterkeys():
            self._allSeasonAndTabFilterData[tabIndex] = {}
            for season in SeasonType.COMMON_SEASONS:
                self._allSeasonAndTabFilterData[tabIndex][season] = CustomizationSeasonAndTypeFilterData()

        for item in sorted(allItems.itervalues(), key=comparisonKey):
            if item.isHiddenInUI():
                continue
            groupName = item.groupUserName
            tabIndex = TYPE_TO_TAB_IDX.get(item.itemTypeID)
            for seasonType in SeasonType.COMMON_SEASONS:
                if item.season & seasonType:
                    seasonAndTabData = self._allSeasonAndTabFilterData[tabIndex][seasonType]
                    if groupName and groupName not in seasonAndTabData.allGroups:
                        seasonAndTabData.allGroups.append(groupName)
                    seasonAndTabData.itemCount += 1
                    if tabIndex not in C11nTabs.VISIBLE:
                        continue
                    if item.itemTypeID in (GUI_ITEM_TYPE.INSCRIPTION, GUI_ITEM_TYPE.EMBLEM):
                        for areaData in anchorsData.itervalues():
                            if areaData.get(item.itemTypeID):
                                hasSlots = True
                                break
                        else:
                            hasSlots = False

                        if not hasSlots:
                            continue
                    visibleTabs[seasonType].add(tabIndex)

        c11nContext.updateVisibleTabsList(visibleTabs)
        for tabIndex in TABS_ITEM_MAPPING.iterkeys():
            for seasonType in SeasonType.COMMON_SEASONS:
                seasonAndTabData = self._allSeasonAndTabFilterData[tabIndex][seasonType]
                seasonAndTabData.allGroups.append(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_ALLGROUPS))
                seasonAndTabData.selectedGroupIndex = len(seasonAndTabData.allGroups) - 1

        self._customizationItems = []
        self._itemSizeData = []
        self._customizationBookmarks = []
        self._selectedIdx = -1
        return
    def __init__(self, currentVehicle, carouselItemWrapper, proxy):
        super(CustomizationCarouselDataProvider, self).__init__()
        self._currentVehicle = currentVehicle
        self._tabIndex = 0
        self._seasonID = SeasonType.SUMMER
        self._onlyOwnedAndFreeItems = False
        self._historicOnlyItems = False
        self._onlyAppliedItems = False
        self._selectIntCD = None
        self.setItemWrapper(carouselItemWrapper)
        self._proxy = proxy
        self._currentlyApplied = set()
        self._allSeasonAndTabFilterData = {}
        hasCustomDefaultCamouflage = g_currentVehicle.item.descriptor.type.hasCustomDefaultCamouflage
        requirement = createCustomizationBaseRequestCriteria(
            self._currentVehicle.item, self.eventsCache.questsProgress,
            self._proxy.getAppliedItems())
        allItems = self.itemsCache.items.getItems(GUI_ITEM_TYPE.CUSTOMIZATIONS,
                                                  requirement)
        for tabIndex in TABS_ITEM_MAPPING.iterkeys():
            self._allSeasonAndTabFilterData[tabIndex] = {}
            for season in SeasonType.COMMON_SEASONS:
                self._allSeasonAndTabFilterData[tabIndex][
                    season] = CustomizationSeasonAndTypeFilterData()

        for item in sorted(allItems.itervalues(), key=comparisonKey):
            if isServiceItem(item) and hasCustomDefaultCamouflage:
                continue
            groupName = item.groupUserName
            tabIndex = TYPE_TO_TAB_IDX.get(item.itemTypeID)
            for seasonType in SeasonType.COMMON_SEASONS:
                if item.season & seasonType:
                    seasonAndTabData = self._allSeasonAndTabFilterData[
                        tabIndex][seasonType]
                    if groupName and groupName not in seasonAndTabData.allGroups:
                        seasonAndTabData.allGroups.append(groupName)
                    seasonAndTabData.itemCount += 1

        for tabIndex in TABS_ITEM_MAPPING.iterkeys():
            for seasonType in SeasonType.COMMON_SEASONS:
                seasonAndTabData = self._allSeasonAndTabFilterData[tabIndex][
                    seasonType]
                seasonAndTabData.allGroups.append(
                    _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_ALLGROUPS))
                seasonAndTabData.selectedGroupIndex = len(
                    seasonAndTabData.allGroups) - 1

        self._customizationItems = []
        self._itemSizeData = []
        self._customizationBookmarks = []
        self._selectedIdx = -1
        return
Esempio n. 3
0
 def __getTitleDescrTexts(self, currentElement):
     if self._slotID == GUI_ITEM_TYPE.STYLE:
         if not currentElement:
             titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_ALL
         else:
             titleText = currentElement.userName
     elif self._slotID == GUI_ITEM_TYPE.MODIFICATION:
         titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_ALL
     elif self._slotID == GUI_ITEM_TYPE.INSCRIPTION:
         titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_INSCRIPTION
     elif self._slotID == GUI_ITEM_TYPE.EMBLEM:
         titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_EMBLEM
     else:
         titleText = VEHICLE_CUSTOMIZATION.getSheetVehPartName(
             getCustomizationTankPartName(self._areaID, self._regionID))
     if not currentElement:
         itemTypeID = TABS_ITEM_MAPPING.get(self.__ctx.currentTab)
         itemTypeName = GUI_ITEM_TYPE_NAMES[itemTypeID]
         descrText = text_styles.neutral(
             VEHICLE_CUSTOMIZATION.getSheetEmptyDescription(itemTypeName))
     elif self._slotID == GUI_ITEM_TYPE.STYLE:
         descrText = text_styles.main(currentElement.userType)
     elif self._slotID == GUI_ITEM_TYPE.CAMOUFLAGE:
         descrText = text_styles.main(currentElement.userName)
     else:
         descrText = text_styles.main(
             _ms(VEHICLE_CUSTOMIZATION.PROPERTYSHEET_DESCRIPTION,
                 itemType=currentElement.userType,
                 itemName=currentElement.userName))
     return (text_styles.highTitle(titleText), descrText)
Esempio n. 4
0
 def _extractDataFromElement(self):
     self._isEmpty = not self._item
     if not self._isEmpty:
         self._name = text_styles.highTitle(self._item.userName)
         self._desc = self.__generateDescription()
     else:
         itemTypeID = TABS_ITEM_MAPPING.get(self._c11nView.getCurrentTab())
         itemTypeName = GUI_ITEM_TYPE_NAMES[itemTypeID]
         self._name = text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_EMPTYTEXT, elementType=_ms(ITEM_TYPES.customization(itemTypeName))))
         self._desc = text_styles.neutral(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_EMPTYSLOT_HINT)
Esempio n. 5
0
 def __makeRemoveRendererVO(self, separatorVisible=True):
     iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_CROSS
     if self._slotID == GUI_ITEM_TYPE.STYLE:
         titleText = ''
         iconSrc = ''
         actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVESTYLE
     else:
         itemTypeID = TABS_ITEM_MAPPING.get(self.__ctx.currentTab)
         itemTypeName = GUI_ITEM_TYPE_NAMES[itemTypeID]
         titleText = VEHICLE_CUSTOMIZATION.getSheetRemoveText(itemTypeName)
         if self._slotID == GUI_ITEM_TYPE.MODIFICATION:
             actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_TANK
         elif self._slotID == GUI_ITEM_TYPE.EMBLEM:
             actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_EMBLEM
         elif self._slotID == GUI_ITEM_TYPE.INSCRIPTION:
             actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_INSCRIPTION
         else:
             actionBtnLabel = VEHICLE_CUSTOMIZATION.getSheetBtnRemoveText(
                 getCustomizationTankPartName(self._areaID, self._regionID))
     return {
         'titleText':
         text_styles.standard(titleText),
         'iconSrc':
         iconSrc,
         'actionBtnLabel':
         actionBtnLabel,
         'actionBtnIconSrc':
         RES_ICONS.MAPS_ICONS_LIBRARY_ASSET_1,
         'isAppliedToAll':
         False,
         'separatorVisible':
         separatorVisible,
         'rendererLnk':
         CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_BTN_RENDERER_UI,
         'actionType':
         CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_ACTION_REMOVE_ONE
     }