当前位置: 首页>>代码示例>>Python>>正文


Python g_settings.getColorScheme函数代码示例

本文整理汇总了Python中messenger.g_settings.getColorScheme函数的典型用法代码示例。如果您正苦于以下问题:Python getColorScheme函数的具体用法?Python getColorScheme怎么用?Python getColorScheme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getColorScheme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addDefMessage

def addDefMessage(message):
    mColor = g_settings.getColorScheme('battle/message').getHexStr('unknown')
    pColor = g_settings.getColorScheme('battle/player').getHexStr('unknown')
    return g_settings.battle.messageFormat % {'playerColor': pColor,
     'playerName': unicode(g_sessionProvider.getCtx().getFullPlayerName(accID=message.originator), 'utf-8', errors='ignore'),
     'messageColor': mColor,
     'messageText': message.data}
开发者ID:webiumsk,项目名称:WoT,代码行数:7,代码来源:battle_controllers.py

示例2: addDefMessage

def addDefMessage(message):
    mColor = g_settings.getColorScheme("battle/message").getHexStr("unknown")
    pColor = g_settings.getColorScheme("battle/player").getHexStr("unknown")
    return g_settings.battle.messageFormat % {
        "playerColor": pColor,
        "playerName": unicode(g_battleContext.getFullPlayerName(accID=message.originator), "utf-8", errors="ignore"),
        "messageColor": mColor,
        "messageText": message.data,
    }
开发者ID:19colt87,项目名称:WOTDecompiled,代码行数:9,代码来源:bw_battle_controllers.py

示例3: setColors

 def setColors(self, dbID):
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('squadman')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     elif g_sessionProvider.getCtx().isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr('teamkiller')
     self._ctx['playerColor'] = pColor
     self._ctx['messageColor'] = g_settings.getColorScheme('battle/message').getHexStr('squad')
     return self
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:10,代码来源:chat_message.py

示例4: getMessageColors

 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme('battle/message').getHexStr('squad')
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('squadman')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     elif g_sessionProvider.getCtx().isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr('teamkiller')
     return (pColor, mColor)
开发者ID:webiumsk,项目名称:WoT,代码行数:10,代码来源:battle_controllers.py

示例5: getMessageColors

 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme("battle/message").getHexStr("squad")
     pColorScheme = g_settings.getColorScheme("battle/player")
     pColor = pColorScheme.getHexStr("squadman")
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr("himself")
     elif g_battleContext.isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr("teamkiller")
     return (pColor, mColor)
开发者ID:19colt87,项目名称:WOTDecompiled,代码行数:10,代码来源:bw_battle_controllers.py

示例6: setPlayers

    def setPlayers(self, prbID, roster):
        foundIdx = -1
        getUser = self.usersStorage.getUser
        getColor = g_settings.getColorScheme('rosters').getColor
        for idx, item in enumerate(self.__list):
            if item['prbID'] == prbID:
                players = []
                foundIdx = idx
                for info in roster:
                    if info.roster is PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
                        user = getUser(info.dbID)
                        if user is not None:
                            key = user.getGuiType()
                        else:
                            key = USER_GUI_TYPE.OTHER
                        players.append({'label': info.getFullName(),
                         'userName': info.name,
                         'clanAbbrev': info.clanAbbrev,
                         'igrType': info.igrType,
                         'region': g_lobbyContext.getRegionCode(info.dbID),
                         'color': getColor(key)})

                item['players'] = players
            else:
                item['players'] = []

        return foundIdx
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:27,代码来源:companies_dps.py

示例7: buildList

    def buildList(self, selectedID, result):
        self.clear()
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        pNameGetter = g_lobbyContext.getPeripheryName
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        for unitItem in result:
            creator = unitItem.creator
            if creator:
                dbID = creator.dbID
                creatorVO = makePlayerVO(creator, userGetter(dbID), colorGetter)
            else:
                creatorVO = None
            cfdUnitID = unitItem.cfdUnitID
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            self.collection.append({'cfdUnitID': cfdUnitID,
             'unitMgrID': unitItem.unitMgrID,
             'creator': creatorVO,
             'creatorName': creatorVO.get('userName', ''),
             'rating': ratingFormatter(unitItem.rating),
             'playersCount': unitItem.playersCount,
             'commandSize': unitItem.commandSize,
             'inBattle': unitItem.state.isInArena(),
             'isFreezed': unitItem.state.isLocked(),
             'isRestricted': unitItem.isRosterSet,
             'description': unitItem.description,
             'peripheryID': unitItem.peripheryID,
             'server': pNameGetter(unitItem.peripheryID)})

        return self._selectedIdx
开发者ID:Infernux,项目名称:Projects,代码行数:34,代码来源:rally_dps.py

示例8: buildList

 def buildList(self, members):
     self.__list = []
     members = sorted(members, key=lambda member: member.getName().lower())
     getUser = self.usersStorage.getUser
     getColors = g_settings.getColorScheme("rosters").getColors
     for member in members:
         dbID = member.getDatabaseID()
         isOnline = member.isOnline()
         user = getUser(dbID)
         if user:
             tags = list(user.getTags())
             colors = getColors(user.getGuiType())
         else:
             tags = []
             colors = getColors(USER_GUI_TYPE.OTHER)
         self.__list.append(
             {
                 "dbID": dbID,
                 "userName": member.getFullName(),
                 "isOnline": isOnline,
                 "color": colors[0 if isOnline else 1],
                 "tags": tags,
                 "isPlayerSpeaking": False,
             }
         )
开发者ID:aevitas,项目名称:wotsdk,代码行数:25,代码来源:datamembersdataprovider.py

示例9: __updateUsersData

    def __updateUsersData(self, userDBIDs):
        diff = []
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        for userDBID in userDBIDs:
            data = findFirst(lambda d: d['creator'].get('dbID') == userDBID, self.collection)
            if data is not None:
                clubDBID = data['cfdUnitID']
                try:
                    index = self.mapping[clubDBID]
                    item = self.collection[index]
                except (KeyError, IndexError):
                    LOG_ERROR('Item not found', clubDBID)
                    continue

                creator = userGetter(userDBID)
                creatorVO = makeUserVO(creator, colorGetter)
                creatorName = creator.getName()
                item.update({'creatorName': creatorName,
                 'rating': self.getGuiUserRating(userDBID)})
                if creator.hasValidName():
                    item['creator'] = creatorVO
                diff.append(index)

        if len(diff):
            self.updateItems(diff)
        return
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:27,代码来源:rally_dps.py

示例10: _getColors

 def _getColors(cls, name):
     if not cls._colors:
         scheme = g_settings.getColorScheme('contacts')
         cls._colors = {'friend': scheme.getColors('friend'),
          'clanMember': scheme.getColors('clanMember'),
          'others': scheme.getColors('others'),
          'currentUser': scheme.getColors('currentUser')}
     return cls._colors[name]
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:8,代码来源:contacts_vo_converter.py

示例11: makeUserItem

def makeUserItem(user):
    return {'uid': user.getID(),
     'userName': user.getName(),
     'chatRoster': user.getRoster(),
     'online': user.isOnline(),
     'himself': user.isCurrentPlayer(),
     'displayName': user.getFullName(),
     'colors': g_settings.getColorScheme('rosters').getColors(user.getGuiType())}
开发者ID:19colt87,项目名称:WOTDecompiled,代码行数:8,代码来源:users_data_providers.py

示例12: makeUserItem

def makeUserItem(user):
    return {'dbID': user.getID(),
     'userName': user.getName(),
     'fullName': user.getFullName(),
     'tags': list(user.getTags()),
     'isOnline': user.isOnline(),
     'colors': g_settings.getColorScheme('rosters').getColors(user.getGuiType()),
     'clanAbbrev': user.getClanAbbrev()}
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:8,代码来源:users_data_providers.py

示例13: _getSlotsData

def _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app = None, levelsRange = None, checkForVehicles = True):
    isPlayerCreator = pInfo.isCreator()
    isPlayerInSlot = pInfo.isInSlot
    slots = []
    userGetter = storage_getter('users')().getUser
    colorGetter = g_settings.getColorScheme('rosters').getColors
    vehicleGetter = g_itemsCache.items.getItemByCD
    if app:
        isPlayerSpeaking = app.voiceChatManager.isPlayerSpeaking
    else:
        isPlayerSpeaking = lambda dbID: False
    if unitState.isFortBattle():
        makeVO = makeClanBattlePlayerVO
    elif unitState.isSortie():
        makeVO = makeSortiePlayerVO
    else:
        makeVO = makePlayerVO
    for slotInfo in slotsIter:
        index = slotInfo.index
        slotState = slotInfo.state
        player = slotInfo.player
        vehicle = slotInfo.vehicle
        canAssign, vehicles = pInfo.canAssignToSlot(index)
        vehCount = len(vehicles)
        slotLevel = 0
        vehicleVO = None
        slotPlayerUI = None
        if player is not None:
            dbID = player.dbID
            slotPlayerUI = makeVO(player, userGetter(dbID), colorGetter, isPlayerSpeaking(dbID))
            if vehicle:
                if 'vehLevel' in vehicle:
                    slotLevel = vehicle['vehLevel']
                if 'vehTypeCompDescr' in vehicle:
                    vehicleVO = makeVehicleVO(vehicleGetter(vehicle['vehTypeCompDescr']), levelsRange)
        slotLabel = makeSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles)
        playerStatus = getPlayerStatus(slotState, player, unitState.isFortBattle())
        if unit is not None:
            restrictions = makeUnitRosterVO(unit, pInfo, index=index, isSortie=unitState.isSortie(), levelsRange=levelsRange)['conditions']
        else:
            restrictions = []
        isFreezed = unitState.isLocked() or unitState.isInSearch() or unitState.isInQueue() or unitState.isInArena()
        slot = {'rallyIdx': unitIdx,
         'isCommanderState': isPlayerCreator,
         'isCurrentUserInSlot': isPlayerInSlot,
         'playerStatus': playerStatus,
         'isClosed': slotState.isClosed,
         'isFreezed': isFreezed,
         'slotLabel': slotLabel,
         'player': slotPlayerUI,
         'canBeTaken': canAssign,
         'compatibleVehiclesCount': vehCount,
         'selectedVehicle': vehicleVO,
         'selectedVehicleLevel': 1 if slotState.isClosed else slotLevel,
         'restrictions': restrictions}
        slots.append(slot)

    return slots
开发者ID:webiumsk,项目名称:WoT,代码行数:58,代码来源:vo_converters.py

示例14: updateList

    def updateList(self, selectedID, result):
        isFullUpdate, diff = False, []
        self._selectedIdx = None
        userGetter = storage_getter("users")().getUser
        colorGetter = g_settings.getColorScheme("rosters").getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        result = set(result)
        removed = set(filter(lambda item: item[1] is None, result))
        isFullUpdate = len(removed)
        for cfdUnitID, unitItem in removed:
            index = self.mapping.pop(cfdUnitID, None)
            if index is not None:
                self.collection.pop(index)
                if cfdUnitID == selectedID:
                    self._selectedIdx = -1
                self.rebuildIndexes()

        if isFullUpdate:
            updated = result.difference(removed)
        else:
            updated = result
        for cfdUnitID, unitItem in updated:
            try:
                index = self.mapping[cfdUnitID]
                item = self.collection[index]
            except (KeyError, IndexError):
                LOG_ERROR("Item not found", unitItem)
                continue

            creator = unitItem.creator
            if creator:
                dbID = creator.dbID
                creatorVO = makePlayerVO(creator, userGetter(dbID), colorGetter)
            else:
                creatorVO = None
            item.update(
                {
                    "creator": creatorVO,
                    "creatorName": creatorVO.get("userName", ""),
                    "rating": ratingFormatter(unitItem.rating),
                    "playersCount": unitItem.playersCount,
                    "commandSize": unitItem.commandSize,
                    "inBattle": unitItem.flags.isInArena() or unitItem.flags.isInPreArena(),
                    "isFreezed": unitItem.flags.isLocked(),
                    "isRestricted": unitItem.isRosterSet,
                    "description": unitItem.description,
                }
            )
            diff.append(index)

        if self._selectedIdx is None and selectedID in self.mapping:
            self._selectedIdx = self.mapping[selectedID]
        if isFullUpdate:
            self.refresh()
        elif len(diff):
            self.updateItems(diff)
        return self._selectedIdx
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:57,代码来源:rally_dps.py

示例15: getGuiUserData

 def getGuiUserData(self, userDbID):
     user = self.getContact(userDbID)
     colorGetter = g_settings.getColorScheme('rosters').getColors
     return {'userName': self.getGuiUserName(userDbID),
      'clanAbbrev': self.getUserClanAbbrev(userDbID),
      'region': self.getUserRegionCode(userDbID),
      'tags': user.getTags() if user else [],
      'dbID': userDbID,
      'colors': colorGetter(user.getGuiType() if user else USER_GUI_TYPE.OTHER)}
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:9,代码来源:usersinfohelper.py


注:本文中的messenger.g_settings.getColorScheme函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。