def getRankedAwardVOs(self, iconSize='small', withCounts=False, withKey=False): """ Here we're supporting bonuses only that allowed in ranked battles """ result = [] badgesIconSizes = {'big': BADGES_ICONS.X80, 'small': BADGES_ICONS.X48} for (block, record), value in self.getRecords().iteritems(): if _isBadge(block): header = i18n.makeString(BADGE.badgeName(record)) body = i18n.makeString(BADGE.badgeDescriptor(record)) note = i18n.makeString(BADGE.BADGE_NOTE) badgeVO = { 'imgSource': getBadgeIconPath(badgesIconSizes[iconSize], record), 'label': '', 'tooltip': makeTooltip(header, body, note) } if withKey: badgeVO['itemKey'] = BADGE.badgeName(record) if withCounts: badgeVO['count'] = 1 result.append(badgeVO) return result
def getEpicAwardVOs(self, withDescription=False): result = [] for (block, record), _ in self.getRecords().iteritems(): badgeVO = self.__getCommonAwardsVOs(block, record, iconSize='big') if not badgeVO: continue badgeVO['align'] = TEXT_ALIGN.CENTER badgeVO.update(_EPIC_AWARD_STATIC_VO_ENTRIES) if withDescription: badgeVO['title'] = i18n.makeString(BADGE.badgeName(record)) badgeVO['description'] = i18n.makeString( BADGE.badgeDescriptor(record)) result.append(badgeVO) return result
def _makeBadgeVO(badgeID, enabled, selected): return { 'id': int(badgeID), 'icon': settings.getBadgeIconPath(settings.BADGES_ICONS.X80, badgeID) if badgeID != _EMPTY_BADGE_ID else '', 'title': text_styles.stats(BADGE.badgeName(badgeID)), 'description': text_styles.main(BADGE.badgeDescriptor(badgeID)), 'enabled': enabled, 'selected': selected }
def __getCommonAwardsVOs(self, block, record, iconSize='small', withCounts=False): badgesIconSizes = {'big': BADGES_ICONS.X80, 'small': BADGES_ICONS.X48} if _isBadge(block): header = i18n.makeString(BADGE.badgeName(record)) body = i18n.makeString(BADGE.badgeDescriptor(record)) note = i18n.makeString(BADGE.BADGE_NOTE) badgeVO = { 'imgSource': getBadgeIconPath(badgesIconSizes[iconSize], record), 'label': '', 'tooltip': makeTooltip(header, body, note) } if withCounts: badgeVO['count'] = 1 return badgeVO else: return None
def getRankedAwardVOs(self, iconSize='small', withCounts=False, withKey=False): result = [] for (block, record), _ in self.getRecords().iteritems(): badgeVO = self.__getCommonAwardsVOs(block, record, iconSize=iconSize, withCounts=withCounts) if not badgeVO: continue if withKey: badgeVO['itemKey'] = BADGE.badgeName(record) result.append(badgeVO) return result
def getUserDescription(self): key = BADGE.badgeDescriptor(self.badgeID) return i18n.makeString(key)
def getShortUserName(self): key = BADGE.getShortName(self.badgeID) return self.getUserName() if key is None else i18n.makeString(key)
def getUserName(self): key = BADGE.badgeName(self.badgeID) return i18n.makeString(key)