def __populateSeasonsData(self): seasons = [] pqType = self.__navInfo.selectedPQType for seasonID, season in _getQuestsCache().getSeasons().iteritems(): tiles = [] for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')): isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked() iconID = tile.getIconID() if isCompleted: bgImgUp = event_items.getTileNormalUpIconPath(iconID) bgImgOver = event_items.getTileNormalOverIconPath(iconID) else: bgImgUp = event_items.getTileGrayUpIconPath(iconID) bgImgOver = event_items.getTileGrayOverIconPath(iconID) vehicleBonus = tile.getVehicleBonus() if vehicleBonus is not None: vehLevelStr = icons.makeImageTag(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0) vehTypeStr = icons.makeImageTag(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0) vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName) else: vehicleBonusLabel = '' tokenIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0) if isUnlocked and not isCompleted and pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM: gottenTokensCount, totalTokensCount = tile.getTokensCount() progress = text_styles.standard(i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=text_styles.gold(str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon)) else: progress = '' if tile.isFullCompleted(): animation = event_items.getTileAnimationPath(iconID) else: animation = None if pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM: tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_TILE else: tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_FALLOUT_TILE tiles.append({'id': tile.getID(), 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID()), 'label': text_styles.standard(vehicleBonusLabel), 'progress': progress, 'isCompleted': isUnlocked and isCompleted, 'enabled': isUnlocked, 'image': bgImgUp, 'imageOver': bgImgOver, 'animation': animation, 'tooltipType': tooltipType}) seasons.append({'id': seasonID, 'title': quests_fmts.getFullSeasonUserName(season), 'tiles': tiles}) self.as_setSeasonsDataS({'seasons': seasons}) return
def __populateSeasonsData(self): _getText = self.app.utilsManager.textManager.getText pqSettings = quest_settings.get() seasons = [] for seasonID, season in g_eventsCache.potapov.getSeasons().iteritems(): tiles = [] for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')): isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked() iconID = tile.getIconID() if isCompleted: bgImgUp, bgImgOver = event_items.getTileNormalUpIconPath(iconID), event_items.getTileNormalOverIconPath(iconID) else: bgImgUp, bgImgOver = event_items.getTileGrayUpIconPath(iconID), event_items.getTileGrayOverIconPath(iconID) vehicleBonus = tile.getVehicleBonus() if vehicleBonus is not None: vehLevelStr = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0)) vehTypeStr = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0)) vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName) else: vehicleBonusLabel = '' tokenIcon = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0)) if isUnlocked and not isCompleted: gottenTokensCount, totalTokensCount = tile.getTokensCount() progress = _getText(TextType.STANDARD_TEXT, i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=_getText(TextType.GOLD_TEXT, str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon)) else: progress = '' if tile.isFullCompleted(): animation = event_items.getTileAnimationPath(iconID) else: animation = None tiles.append({'id': tile.getID(), 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID(), pqSettings), 'label': _getText(TextType.STANDARD_TEXT, vehicleBonusLabel), 'progress': progress, 'isCompleted': isUnlocked and isCompleted, 'enabled': isUnlocked, 'image': bgImgUp, 'imageOver': bgImgOver, 'animation': animation}) seasons.append({'id': seasonID, 'title': quests_fmts.getFullSeasonUserName(season), 'tiles': tiles}) self.as_setSeasonsDataS(seasons) return