Exemple #1
0
 def _getExtraInfo(self, data):
     result = super(ResearchItemsXMLDumper, self)._getExtraInfo(data)
     return {
         "type": result.get("type", ""),
         "title": html.escape(result.get("title", "")),
         "content": html.escape(result.get("content", "")),
     }
Exemple #2
0
def getPrebattleLocalizedString(string, led=None, escapeHtml=False):
    result = ''
    if led:
        result = i18n.encodeUtf8(led.get(string, ''))
        if escapeHtml:
            html.escape(result)
    return result
Exemple #3
0
def getPrebattleLocalizedString(string, led = None, escapeHtml = False):
    result = ''
    if led:
        result = i18n.encodeUtf8(led.get(string, ''))
        if escapeHtml:
            html.escape(result)
    return result
Exemple #4
0
 def _getExtraInfo(self, data):
     result = super(ResearchItemsXMLDumper, self)._getExtraInfo(data)
     return {
         'type': result.get('type', ''),
         'title': html.escape(result.get('title', '')),
         'content': html.escape(result.get('content', ''))
     }
Exemple #5
0
def getPrebattleLocalizedString(string, led=None, escapeHtml=False):
    result = ''
    if led:
        result = led.get(string, '')
        if type(result) is types.UnicodeType:
            result = result.encode('utf-8', 'ignore')
        if escapeHtml:
            html.escape(result)
    return result
Exemple #6
0
def getPrebattleLocalizedString(string, led = None, escapeHtml = False):
    result = ''
    if led:
        result = led.get(string, '')
        if type(result) is types.UnicodeType:
            result = result.encode('utf-8', 'ignore')
        if escapeHtml:
            html.escape(result)
    return result
Exemple #7
0
def getPrebattleOpponents(extraData, escapeHtml=False):
    first = ''
    second = ''
    if 'opponents' in extraData:
        opponents = extraData['opponents']
        first = i18n.encodeUtf8(opponents.get('1', {}).get('name', ''))
        second = i18n.encodeUtf8(opponents.get('2', {}).get('name', ''))
        if escapeHtml:
            first = html.escape(first)
            second = html.escape(second)
    return (first, second)
Exemple #8
0
def getPrebattleOpponents(extraData, escapeHtml = False):
    first = ''
    second = ''
    if 'opponents' in extraData:
        opponents = extraData['opponents']
        first = opponents.get('1', {}).get('name', '').encode('utf-8', 'ignore')
        second = opponents.get('2', {}).get('name', '').encode('utf-8', 'ignore')
        if escapeHtml:
            first = html.escape(first)
            second = html.escape(second)
    return (first, second)
Exemple #9
0
def getPrebattleOpponents(extraData, escapeHtml = False):
    first = ''
    second = ''
    if 'opponents' in extraData:
        opponents = extraData['opponents']
        first = i18n.encodeUtf8(opponents.get('1', {}).get('name', ''))
        second = i18n.encodeUtf8(opponents.get('2', {}).get('name', ''))
        if escapeHtml:
            first = html.escape(first)
            second = html.escape(second)
    return (first, second)
Exemple #10
0
def getPrebattleOpponents(extraData, escapeHtml=False):
    first = ''
    second = ''
    if 'opponents' in extraData:
        opponents = extraData['opponents']
        first = opponents.get('1', {}).get('name',
                                           '').encode('utf-8', 'ignore')
        second = opponents.get('2', {}).get('name',
                                            '').encode('utf-8', 'ignore')
        if escapeHtml:
            first = html.escape(first)
            second = html.escape(second)
    return (first, second)
    def makeVO(self, contact, includeIcons = True):
        dbID = contact.getID()
        tags = contact.getTags()
        note = contact.getNote()
        isOnline = contact.isOnline()
        if USER_TAG.CLAN_MEMBER in tags:
            pass
        elif contact.getClanAbbrev():
            tags.add(USER_TAG.OTHER_CLAN_MEMBER)
        baseUserProps = self.makeBaseUserProps(contact)
        baseUserProps['rgb'] = self.getColor(tags, isOnline)
        baseUserProps['icons'] = self.getIcons(tags, note)
        baseUserProps['tags'] = list(tags)
        resourceId = contact.getResourceID() or WG_GAMES.TANKS
        if resourceId != WG_GAMES.TANKS:
            for prefix in WG_GAMES.ALL:
                if prefix != WG_GAMES.TANKS:
                    if prefix in resourceId:
                        resourceId = prefix
                        break

        return {'userProps': baseUserProps,
         'dbID': dbID,
         'note': escape(note),
         'isOnline': isOnline,
         'isColorBlind': g_settingsCore.getSetting('isColorBlind'),
         'resource': resourceId}
Exemple #12
0
def getBattleCommandExample(msgText):
    i18nKey = I18N_INGAME_GUI.chat_example(msgText)
    if i18nKey is not None:
        i18nName = html.escape(i18n.makeString(i18nKey))
    else:
        i18nName = msgText
    return i18nName
Exemple #13
0
 def makeVO(cls, contact, useBigIcons=False):
     dbID = contact.getID()
     tags = contact.getTags()
     note = contact.getNote()
     isOnline = contact.isOnline()
     if USER_TAG.CLAN_MEMBER in tags:
         pass
     elif contact.getClanAbbrev():
         tags.add(USER_TAG.OTHER_CLAN_MEMBER)
     baseUserProps = cls.makeBaseUserProps(contact)
     baseUserProps['rgb'] = cls.getColor(tags, isOnline)
     baseUserProps['icons'] = cls.getIcons(tags, note)
     baseUserProps['tags'] = list(tags)
     resourceIconId = cls.getGuiResourceID(contact)
     isColorBlind = cls.settingsCore.getSetting('isColorBlind')
     if resourceIconId == WG_GAMES.TANKS:
         if contact.isOnline():
             if USER_TAG.PRESENCE_DND in tags:
                 resourceIconId = _WOT_GAME_RESOURCE.BUSY_BLIND if isColorBlind else _WOT_GAME_RESOURCE.BUSY
             else:
                 resourceIconId = _WOT_GAME_RESOURCE.ONLINE
         else:
             resourceIconId = _WOT_GAME_RESOURCE.UNKNOWN
     return {'userProps': baseUserProps,
      'dbID': dbID,
      'note': escape(note),
      'resource': RES_ICONS.getContactStatusIcon('48x48' if useBigIcons else '24x24', resourceIconId)}
Exemple #14
0
    def load(cls, resourceId):
        obj = ChinaOLDictionary.__new__(cls)
        dSection = ResMgr.openSection(resourceId)
        if dSection is None:
            return obj
        else:
            eqsSection = dSection['equivalents']
            if eqsSection is not None:
                for eqSection in eqsSection.values():
                    find = eqSection['find'].asWideString if eqSection.has_key(
                        'find') else None
                    replace = eqSection[
                        'replace'].asWideString if eqSection.has_key(
                            'replace') else None
                    if find and replace:
                        obj.__equivalents[find] = replace

            badWordsSection = dSection['badWords']
            if badWordsSection is not None:
                for badWordSet in badWordsSection.values():
                    try:
                        badWordWS = badWordSet.asWideString
                        if not isinstance(badWordWS, types.UnicodeType):
                            badWordWS = unicode(badWordWS, 'utf-8')
                        badWordWS = html.escape(badWordWS)
                        badWordC = re.compile(badWordWS,
                                              re.M | re.S | re.U | re.I)
                        obj.__badWordPatterns.append(badWordC)
                    except sre_compile.error:
                        LOG_CURRENT_EXCEPTION()

            ResMgr.purge(resourceId, True)
            return obj
Exemple #15
0
def getBattleCommandExample(msgText):
    i18nKey = I18N_INGAME_GUI.chat_example(msgText)
    if i18nKey is not None:
        i18nName = html.escape(i18n.makeString(i18nKey))
    else:
        i18nName = msgText
    return i18nName
Exemple #16
0
    def buildList(self, selectedID, result, syncUserInfo=True):
        self.clear()
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        self._lastResult = result
        data = []
        for clubItem in result:
            cfdUnitID = clubItem.getID()
            creatorID = clubItem.getCreatorID()
            rating = self.getUserRating(creatorID)
            creator = self._UserEntityAdapter(creatorID, clubItem,
                                              userGetter(creatorID), self)
            creatorName = creator.getName()
            creatorVO = makeUserVO(creator, colorGetter)
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            data.append((rating, {
                'cfdUnitID':
                cfdUnitID,
                'unitMgrID':
                cfdUnitID,
                'creator':
                creatorVO,
                'creatorName':
                creatorName,
                'rating':
                self.getGuiUserRating(creatorID),
                'playersCount':
                clubItem.getMembersCount(),
                'commandSize':
                clubItem.getCommandSize(),
                'inBattle':
                False,
                'isFreezed':
                False,
                'isRestricted':
                False,
                'description':
                html.escape(clubItem.getShortDescription()),
                'peripheryID':
                -1,
                'server':
                None,
                'ladderIcon':
                getLadderChevron16x16(clubItem.getDivision()),
                'isStatic':
                True
            }))

        self.collection.extend(
            map(lambda (r, c): c,
                sorted(data, reverse=True, key=operator.itemgetter(0))))
        if syncUserInfo:
            self.syncUsersInfo()
        return self._selectedIdx
Exemple #17
0
 def getComment(self, invite):
     comment = passCensor(invite.comment)
     return '' if not comment else makeHtmlString(
         'html_templates:lobby/prebattle', 'inviteComment', {
             'comment':
             i18n.makeString(I18N_INVITES.INVITES_COMMENT,
                             comment=html.escape(comment))
         })
Exemple #18
0
 def getVO(self, club = None, currentState = None, profile = None):
     if club is None or currentState is None or profile is None:
         return
     else:
         _ms = i18n.makeString
         ladderInfo = club.getLadderInfo()
         if ladderInfo.isInLadder():
             ladderLeagueStr = getLeagueString(ladderInfo.getLeague())
             ladderDivStr = getDivisionString(ladderInfo.getDivision())
             ladderInfoStr = text_styles.middleTitle(_ms(CYBERSPORT.WINDOW_STATICRALLYINFO_LADDERINFO, league=ladderLeagueStr, division=ladderDivStr))
         else:
             ladderInfoStr = ''
         dossier = club.getTotalDossier()
         clubTotalStats = dossier.getTotalStats()
         isButtonDisabled = False
         buttonLabel = '#cyberSport:window/staticRallyInfo/joinBtnLabel'
         buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/join'
         buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/join'
         limits = currentState.getLimits()
         canSendApp, appReason = limits.canSendApplication(profile, club)
         if currentState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
             if currentState.getClubDbID() == club.getClubDbID():
                 buttonLabel = '#cyberSport:window/staticRallyInfo/cancelBtnLabel'
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcess'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcess'
             else:
                 isButtonDisabled = True
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcessOther'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcessOther'
         elif currentState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/alreadyJoined'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/alreadyJoined'
         elif not canSendApp:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/applicationCooldown'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/applicationCooldown'
         return {'battlesCount': self.__getIndicatorData(clubTotalStats.getBattlesCount(), BigWorld.wg_getIntegralFormat, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATSBATTLESCOUNT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_BATTLES40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSBATTLESCOUNT),
          'winsPercent': self.__getIndicatorData(clubTotalStats.getWinsEfficiency(), ProfileUtils.formatFloatPercent, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATICRALLY_STATSWINSPERCENT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_WINS40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSWINSPERCENT),
          'ladderIcon': getLadderChevron128x128(ladderInfo.getDivision()),
          'ladderInfo': ladderInfoStr,
          'joinInfo': text_styles.main(_ms(buttonInfo)),
          'joinBtnLabel': _ms(buttonLabel),
          'joinBtnTooltip': buttonTooltip,
          'joinBtnDisabled': isButtonDisabled,
          'noAwardsText': CYBERSPORT.WINDOW_STATICRALLYINFO_NOAWARDS,
          'achievements': AchievementsUtils.packAchievementList(clubTotalStats.getTopAchievements(3), dossier.getDossierType(), dumpDossier(dossier), False, False),
          'rallyInfo': {'icon': None,
                        'name': text_styles.highTitle(club.getUserName()),
                        'profileBtnLabel': CYBERSPORT.RALLYINFO_PROFILEBTN_LABEL,
                        'profileBtnTooltip': TOOLTIPS.RALLYINFO_PROFILEBTN,
                        'description': text_styles.main(html.escape(club.getUserShortDescription())),
                        'ladderIcon': None,
                        'id': club.getClubDbID(),
                        'showLadder': False}}
Exemple #19
0
 def getVO(self, club = None, currentState = None, profile = None):
     if club is None or currentState is None or profile is None:
         return
     else:
         _ms = i18n.makeString
         ladderInfo = club.getLadderInfo()
         if ladderInfo.isInLadder():
             ladderLeagueStr = getLeagueString(ladderInfo.getLeague())
             ladderDivStr = getDivisionString(ladderInfo.getDivision())
             ladderInfoStr = text_styles.middleTitle(_ms(CYBERSPORT.WINDOW_STATICRALLYINFO_LADDERINFO, league=ladderLeagueStr, division=ladderDivStr))
         else:
             ladderInfoStr = ''
         dossier = club.getTotalDossier()
         clubTotalStats = dossier.getTotalStats()
         isButtonDisabled = False
         buttonLabel = '#cyberSport:window/staticRallyInfo/joinBtnLabel'
         buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/join'
         buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/join'
         limits = currentState.getLimits()
         canSendApp, appReason = limits.canSendApplication(profile, club)
         if currentState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
             if currentState.getClubDbID() == club.getClubDbID():
                 buttonLabel = '#cyberSport:window/staticRallyInfo/cancelBtnLabel'
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcess'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcess'
             else:
                 isButtonDisabled = True
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcessOther'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcessOther'
         elif currentState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/alreadyJoined'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/alreadyJoined'
         elif not canSendApp:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/applicationCooldown'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/applicationCooldown'
         return {'battlesCount': self.__getIndicatorData(clubTotalStats.getBattlesCount(), BigWorld.wg_getIntegralFormat, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATSBATTLESCOUNT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_BATTLES40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSBATTLESCOUNT),
          'winsPercent': self.__getIndicatorData(clubTotalStats.getWinsEfficiency(), ProfileUtils.formatFloatPercent, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATICRALLY_STATSWINSPERCENT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_WINS40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSWINSPERCENT),
          'ladderIcon': getLadderChevron128x128(ladderInfo.getDivision()),
          'ladderInfo': ladderInfoStr,
          'joinInfo': text_styles.main(_ms(buttonInfo)),
          'joinBtnLabel': _ms(buttonLabel),
          'joinBtnTooltip': buttonTooltip,
          'joinBtnDisabled': isButtonDisabled,
          'noAwardsText': CYBERSPORT.WINDOW_STATICRALLYINFO_NOAWARDS,
          'achievements': AchievementsUtils.packAchievementList(clubTotalStats.getTopAchievements(3), dossier.getDossierType(), dumpDossier(dossier), False, False),
          'rallyInfo': {'icon': None,
                        'name': text_styles.highTitle(club.getUserName()),
                        'profileBtnLabel': CYBERSPORT.RALLYINFO_PROFILEBTN_LABEL,
                        'profileBtnTooltip': TOOLTIPS.RALLYINFO_PROFILEBTN,
                        'description': text_styles.main(html.escape(club.getUserShortDescription())),
                        'ladderIcon': None,
                        'id': club.getClubDbID(),
                        'showLadder': False}}
Exemple #20
0
def getBattleCommandExample(msgText):
    result = msgText.split('/', 1)
    if len(result) > 1:
        i18nKey = I18N_INGAME_GUI.chat_example(result[1])
        if i18nKey is not None:
            i18nName = html.escape(i18n.makeString(i18nKey))
        else:
            i18nName = msgText
    else:
        i18nName = i18n.makeString(msgText)
    return i18nName
Exemple #21
0
def getBattleCommandExample(msgText):
    result = msgText.split('/', 1)
    if len(result) > 1:
        i18nKey = I18N_INGAME_GUI.chat_example(result[1])
        if i18nKey is not None:
            i18nName = html.escape(i18n.makeString(i18nKey))
        else:
            i18nName = msgText
    else:
        i18nName = i18n.makeString(msgText)
    return i18nName
Exemple #22
0
 def _makeVO(self, item, extraData):
     isChecked = extraData['checked']
     status = item.getStatus()
     outcome = {
         'dbID':
         item.getDbID(),
         'checked':
         isChecked,
         'clanVO': {
             'fullName': formatField(getter=item.getClanFullName),
             'clanName': formatField(getter=item.getClanName),
             'clanAbbrev': formatField(getter=item.getClanAbbrev),
             'dbID': item.getClanDbID(),
             'isActive': item.isClanActive()
         },
         'personalRating':
         formatField(getter=item.getPersonalRating,
                     formatter=BigWorld.wg_getIntegralFormat),
         'battlesCount':
         formatField(getter=item.getBattlesCount,
                     formatter=BigWorld.wg_getIntegralFormat),
         'wins':
         formatField(getter=item.getBattleXpAvg,
                     formatter=lambda value: BigWorld.
                     wg_getNiceNumberFormat(value) + '%'),
         'awgExp':
         formatField(getter=item.getBattlesPerformanceAvg,
                     formatter=BigWorld.wg_getIntegralFormat),
         'status': {
             'text':
             self._makeInviteStateString(item),
             'tooltip':
             self._makeTooltip(body=self._makeRequestTooltip(
                 status=item.getStatus(),
                 user=formatField(getter=item.getSenderName),
                 date=formatField(
                     getter=item.getUpdatedAt,
                     formatter=formatters.formatShortDateShortTimeString)))
         },
         'enabled':
         status == CLAN_INVITE_STATES.ACTIVE
         or status == CLAN_INVITE_STATES.ERROR,
         'canShowContextMenu':
         True,
         'messageTooltip':
         self._makeTooltip(
             body=escape(item.getComment()) if isValueAvailable(
                 getter=item.getComment) else str()),
         'actions':
         self.__buildActionsSection(item.getStatus())
     }
     return outcome
Exemple #23
0
 def makeVO(self, pattern=None):
     contacts = super(GroupConverter, self).makeVO(pattern)
     if pattern:
         isOpened = True
         if not contacts:
             return None
     else:
         isOpened = self._isOpened
     vo = self.__makeBaseVO(self._parentCategory)
     vo['isOpened'] = isOpened
     vo['children'] = contacts
     vo['data']['isOpened'] = isOpened
     vo['data']['headerDisplayTitle'] = escape(self._name)
     vo['data']['headerHtmlPart'] = self._condition.getHtmlString()
     return vo
 def makeVO(self, pattern = None):
     contacts = super(GroupConverter, self).makeVO(pattern)
     if pattern:
         isOpened = True
         if not contacts:
             return None
     else:
         isOpened = self._isOpened
     vo = self.__makeBaseVO(self._parentCategory)
     vo['isOpened'] = isOpened
     vo['children'] = contacts
     vo['data']['isOpened'] = isOpened
     vo['data']['headerDisplayTitle'] = escape(self._name)
     vo['data']['headerHtmlPart'] = self._condition.getHtmlString()
     return vo
Exemple #25
0
    def buildList(self, selectedID, result, syncUserInfo=True):
        self.clear()
        userGetter = storage_getter("users")().getUser
        colorGetter = g_settings.getColorScheme("rosters").getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        self._lastResult = result
        data = []
        for clubItem in result:
            cfdUnitID = clubItem.getID()
            creatorID = clubItem.getCreatorID()
            rating = self.getUserRating(creatorID)
            creator = self._UserEntityAdapter(creatorID, clubItem, userGetter(creatorID), self)
            creatorName = creator.getName()
            creatorVO = makeUserVO(creator, colorGetter)
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            data.append(
                (
                    rating,
                    {
                        "cfdUnitID": cfdUnitID,
                        "unitMgrID": cfdUnitID,
                        "creator": creatorVO,
                        "creatorName": creatorName,
                        "rating": self.getGuiUserRating(creatorID),
                        "playersCount": clubItem.getMembersCount(),
                        "commandSize": clubItem.getCommandSize(),
                        "inBattle": False,
                        "isFreezed": False,
                        "isRestricted": False,
                        "description": html.escape(clubItem.getShortDescription()),
                        "peripheryID": -1,
                        "server": None,
                        "ladderIcon": getLadderChevron16x16(clubItem.getDivision()),
                        "isStatic": True,
                    },
                )
            )

        self.collection.extend(map(lambda (r, c): c, sorted(data, reverse=True, key=operator.itemgetter(0))))
        if syncUserInfo:
            self.syncUsersInfo()
        return self._selectedIdx
Exemple #26
0
    def buildList(self, selectedID, result, syncUserInfo = True):
        self.clear()
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        self._lastResult = result
        data = []
        for clubItem in result:
            cfdUnitID = clubItem.getID()
            creatorID = clubItem.getCreatorID()
            creator = userGetter(creatorID)
            rating = self.getUserRating(creatorID)
            if creator is None:
                creator = self._UserEntityAdapter(creatorID, self)
            creatorName = creator.getName()
            creatorVO = makeUserVO(creator, colorGetter)
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            data.append((rating, {'cfdUnitID': cfdUnitID,
              'unitMgrID': cfdUnitID,
              'creator': creatorVO,
              'creatorName': creatorName,
              'rating': ratingFormatter(rating),
              'playersCount': clubItem.getMembersCount(),
              'commandSize': clubItem.getCommandSize(),
              'inBattle': False,
              'isFreezed': False,
              'isRestricted': False,
              'description': html.escape(clubItem.getShortDescription()),
              'peripheryID': -1,
              'server': None,
              'ladderIcon': getLadderChevron16x16(clubItem.getDivision()),
              'isStatic': True}))

        self.collection.extend(map(lambda (r, c): c, sorted(data, reverse=True, key=operator.itemgetter(0))))
        if syncUserInfo:
            self.syncUsersInfo()
        return self._selectedIdx
 def _makeVO(self, item, extraData):
     isChecked = extraData['checked']
     status = item.getStatus()
     outcome = {'dbID': item.getDbID(),
      'checked': isChecked,
      'clanVO': {'fullName': formatField(getter=item.getClanFullName),
                 'clanName': formatField(getter=item.getClanName),
                 'clanAbbrev': formatField(getter=item.getClanAbbrev),
                 'dbID': item.getClanDbID(),
                 'isActive': item.isClanActive()},
      'personalRating': formatField(getter=item.getPersonalRating, formatter=BigWorld.wg_getIntegralFormat),
      'battlesCount': formatField(getter=item.getBattlesCount, formatter=BigWorld.wg_getIntegralFormat),
      'wins': formatField(getter=item.getBattleXpAvg, formatter=lambda value: BigWorld.wg_getNiceNumberFormat(value) + '%'),
      'awgExp': formatField(getter=item.getBattlesPerformanceAvg, formatter=BigWorld.wg_getIntegralFormat),
      'status': {'text': self._makeInviteStateString(item),
                 'tooltip': self._makeTooltip(body=self._makeRequestTooltip(status=item.getStatus(), user=formatField(getter=item.getSenderName), date=formatField(getter=item.getUpdatedAt, formatter=formatters.formatShortDateShortTimeString)))},
      'enabled': status == CLAN_INVITE_STATES.ACTIVE or status == CLAN_INVITE_STATES.ERROR,
      'canShowContextMenu': True,
      'messageTooltip': self._makeTooltip(body=escape(item.getComment()) if isValueAvailable(getter=item.getComment) else str()),
      'actions': self.__buildActionsSection(item.getStatus())}
     return outcome
    def makeVO(self, contact, includeIcons = True):
        dbID = contact.getID()
        tags = contact.getTags()
        note = contact.getNote()
        isOnline = contact.isOnline()
        baseUserProps = self.makeBaseUserProps(contact)
        baseUserProps['rgb'] = self.getColor(tags, isOnline)
        resourceId = contact.getResourceID() or WG_GAMES.TANKS
        if resourceId != WG_GAMES.TANKS:
            for prefix in WG_GAMES.ALL:
                if prefix != WG_GAMES.TANKS:
                    if prefix in resourceId:
                        resourceId = prefix
                        break

        return {'userProps': baseUserProps,
         'dbID': dbID,
         'note': escape(note),
         'isOnline': isOnline,
         'isColorBlind': g_settingsCore.getSetting('isColorBlind'),
         'resource': resourceId}
    def makeVO(self, contact, includeIcons=True):
        dbID = contact.getID()
        tags = contact.getTags()
        note = contact.getNote()
        isOnline = contact.isOnline()
        baseUserProps = self.makeBaseUserProps(contact)
        baseUserProps["rgb"] = self.getColor(tags, isOnline)
        resourceId = contact.getResourceID() or WG_GAMES.TANKS
        if resourceId != WG_GAMES.TANKS:
            for prefix in WG_GAMES.ALL:
                if prefix != WG_GAMES.TANKS:
                    if prefix in resourceId:
                        resourceId = prefix
                        break

        return {
            "userProps": baseUserProps,
            "dbID": dbID,
            "note": escape(note),
            "isOnline": isOnline,
            "isColorBlind": g_settingsCore.getSetting("isColorBlind"),
            "resource": resourceId,
        }
    def makeVO(self, contact, includeIcons=True):
        dbID = contact.getID()
        tags = contact.getTags()
        note = contact.getNote()
        isOnline = contact.isOnline()
        baseUserProps = self.makeBaseUserProps(contact)
        baseUserProps['rgb'] = self.getColor(tags, isOnline)
        resourceId = contact.getResourceID() or WG_GAMES.TANKS
        if resourceId != WG_GAMES.TANKS:
            for prefix in WG_GAMES.ALL:
                if prefix != WG_GAMES.TANKS:
                    if prefix in resourceId:
                        resourceId = prefix
                        break

        return {
            'userProps': baseUserProps,
            'dbID': dbID,
            'note': escape(note),
            'isOnline': isOnline,
            'isColorBlind': g_settingsCore.getSetting('isColorBlind'),
            'resource': resourceId
        }
 def _makeVO(self, item, extraData):
     isChecked = extraData["checked"]
     status = item.getStatus()
     outcome = {
         "dbID": item.getDbID(),
         "checked": isChecked,
         "clanVO": {
             "fullName": formatField(getter=item.getClanFullName),
             "clanName": formatField(getter=item.getClanName),
             "clanAbbrev": formatField(getter=item.getClanAbbrev),
             "dbID": item.getClanDbID(),
             "isActive": item.isClanActive(),
         },
         "personalRating": formatField(getter=item.getPersonalRating, formatter=BigWorld.wg_getIntegralFormat),
         "battlesCount": formatField(getter=item.getBattlesCount, formatter=BigWorld.wg_getIntegralFormat),
         "wins": formatField(
             getter=item.getBattleXpAvg, formatter=lambda value: BigWorld.wg_getNiceNumberFormat(value) + "%"
         ),
         "awgExp": formatField(getter=item.getBattlesPerformanceAvg, formatter=BigWorld.wg_getIntegralFormat),
         "status": {
             "text": self._makeInviteStateString(item),
             "tooltip": self._makeTooltip(
                 body=self._makeRequestTooltip(
                     status=item.getStatus(),
                     user=formatField(getter=item.getSenderName),
                     date=formatField(getter=item.getUpdatedAt, formatter=formatters.formatShortDateShortTimeString),
                 )
             ),
         },
         "enabled": status == CLAN_INVITE_STATES.ACTIVE or status == CLAN_INVITE_STATES.ERROR,
         "canShowContextMenu": True,
         "messageTooltip": self._makeTooltip(
             body=escape(item.getComment()) if isValueAvailable(getter=item.getComment) else str()
         ),
         "actions": self.__buildActionsSection(item.getStatus()),
     }
     return outcome
Exemple #32
0
 def clanName(self):
     return passCensor(html.escape(self.clanInfo[0]))
Exemple #33
0
 def onClanInfoReceived(self, clanDBID, clanName, clanAbbrev, clanMotto,
                        clanDescription):
     self.__clanMotto = passCensor(html.escape(clanMotto))
     self.__clanDescription = passCensor(html.escape(clanDescription))
Exemple #34
0
 def clanName(self):
     return passCensor(html.escape(self.clanInfo[0]))
Exemple #35
0
 def onClanInfoReceived(self, clanDBID, clanName, clanAbbrev, clanMotto, clanDescription):
     self.__clanMotto = passCensor(html.escape(clanMotto))
     self.__clanDescription = passCensor(html.escape(clanDescription))
Exemple #36
0
 def getComment(self, invite):
     comment = passCensor(invite.comment)
     return '' if not comment else makeHtmlString(
         'html_templates:lobby/prebattle', 'inviteComment',
         {'comment': html.escape(comment)})
Exemple #37
0
 def filter(self, senderID, text):
     return html.escape(text)
 def getClanName(self):
     return passCensor(html.escape(self.itemData.clanName))
Exemple #39
0
 def getClanName(self):
     return passCensor(html.escape(self.itemData.clanName))
Exemple #40
0
 def getComment(self, invite):
     comment = passCensor(invite.comment)
     if not comment:
         return ''
     return makeHtmlString('html_templates:lobby/prebattle', 'inviteComment', {'comment': i18n.makeString(I18N_INVITES.INVITES_COMMENT, comment=html.escape(comment))})
 def getClanMotto(self):
     return passCensor(html.escape(self.itemData.clanMotto))
 def _makeChildrenString(self):
     return html.escape(self._text)
Exemple #43
0
 def getClanDescr(self):
     return passCensor(html.escape(self.itemData.clanDescr))
Exemple #44
0
 def _getExtraInfo(self, data):
     result = super(ResearchItemsXMLDumper, self)._getExtraInfo(data)
     return {'type': result.get('type', ''),
      'title': html.escape(result.get('title', '')),
      'content': html.escape(result.get('content', ''))}
Exemple #45
0
 def _makeChildrenString(self):
     return html.escape(self._text)
 def getClanDescr(self):
     return passCensor(html.escape(self.itemData.clanDescr))
Exemple #47
0
 def filter(self, senderID, text):
     return html.escape(text)
Exemple #48
0
 def getClanMotto(self):
     return passCensor(html.escape(self.itemData.clanMotto))