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


Python Event.EventManager类代码示例

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


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

示例1: AbstractContextMenuHandler

class AbstractContextMenuHandler(object):
    __metaclass__ = ABCMeta

    def __init__(self, cmProxy, ctx = None, handlers = None):
        self._eManager = EventManager()
        self.onContextMenuHide = Event(self._eManager)
        super(AbstractContextMenuHandler, self).__init__()
        self.__cmProxy = weakref.proxy(cmProxy)
        self.__handlers = handlers or {}
        self._initFlashValues(ctx)

    @property
    def app(self):
        return self.__cmProxy.app

    def fini(self):
        self._eManager.clear()
        self.__handlers = None
        self.__cmProxy = None
        self._clearFlashValues()
        return

    def getOptions(self, ctx = None):
        return self._generateOptions(ctx)

    def onOptionSelect(self, optionId):
        if optionId in self.__handlers:
            return getattr(self, self.__handlers[optionId])()
        LOG_WARNING('Unknown context menu option', self, self.__cmProxy, optionId)

    def _dispatchChanges(self, options):
        if self.__cmProxy is not None:
            self.__cmProxy._onOptionsChanged(options)
        return

    @classmethod
    def _makeItem(cls, optId, optLabel = None, optInitData = None, optSubMenu = None):
        return {'id': optId,
         'label': optLabel,
         'initData': optInitData,
         'submenu': optSubMenu}

    def _makeSeparator(self):
        return self._makeItem(_SEPARATOR_ID)

    @abstractmethod
    def _generateOptions(self, ctx = None):
        raise NotImplementedError

    def _initFlashValues(self, ctx):
        pass

    def _clearFlashValues(self):
        pass
开发者ID:webiumsk,项目名称:WOT0.10.0,代码行数:54,代码来源:abstractcontextmenuhandler.py

示例2: __init__

 def __init__(self, cmProxy, ctx = None, handlers = None):
     self._eManager = EventManager()
     self.onContextMenuHide = Event(self._eManager)
     super(AbstractContextMenuHandler, self).__init__()
     self.__cmProxy = weakref.proxy(cmProxy)
     self.__handlers = handlers or {}
     self._initFlashValues(ctx)
开发者ID:webiumsk,项目名称:WoT,代码行数:7,代码来源:abstractcontextmenuhandler.py

示例3: __init__

 def __init__(self, boosterID, balance):
     super(BuyBoosterMeta, self).__init__('buyConfirmation', scope=ScopeTemplates.LOBBY_SUB_SCOPE)
     self.__booster = g_goodiesCache.getBooster(boosterID)
     self.__balance = balance
     self._eManager = EventManager()
     self.onInvalidate = Event(self._eManager)
     g_clientUpdateManager.addCallbacks({'stats': self.__onStatsChanged})
开发者ID:aevitas,项目名称:wotsdk,代码行数:7,代码来源:dialogsconfirmboostermeta.py

示例4: __init__

    def __init__(self):
        super(_PreDefinedHostList, self).__init__()
        self._eManager = EventManager()
        self.onCsisQueryStart = Event(self._eManager)
        self.onCsisQueryComplete = Event(self._eManager)
        self._hosts = []
        self._urlMap = {}
        self._nameMap = {}
        self._peripheryMap = {}
        self._isDataLoaded = False
        self._isCSISQueryInProgress = False
        self.__pingResult = {}
        self.__csisUrl = ''
        self.__csisResponse = {}
        self.__lastRoamingHosts = []
        self.__csisCallbackID = None
        self.__lastCsisUpdateTime = 0
        self.__queryCallback = None
        self.__autoLoginQueryState = AUTO_LOGIN_QUERY_STATE.DEFAULT
        self.__csisAction = CSIS_ACTION.DEFAULT
        self.__recommended = []
        self.__setPingCallback = False
        try:
            BigWorld.WGPinger.setOnPingCallback(self.__onPingPerformed)
            self.__setPingCallback = True
        except AttributeError:
            LOG_CURRENT_EXCEPTION()

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

示例5: __init__

 def __init__(self, eventsCache):
     self.__clearCaches()
     self.__eventsCache = weakref.proxy(eventsCache)
     self.__em = EventManager()
     self.__hasQuestsForSelect = False
     self.__hasQuestsForReward = False
     self.onSelectedQuestsChanged = Event(self.__em)
     self.onSlotsCountChanged = Event(self.__em)
     self.onProgressUpdated = Event(self.__em)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:9,代码来源:pqcontroller.py

示例6: __init__

 def __init__(self):
     self.__tabs = {TABS_IDS.INVENTORY: InventoryBoostersTab(),
      TABS_IDS.SHOP: ShopBoostersTab(),
      TABS_IDS.QUESTS: QuestsBoostersTab()}
     self.__currentTabIdx = None
     self.__activeBoostersCount = None
     self.__eManager = EventManager()
     self.onTabsUpdate = Event(self.__eManager)
     return
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:9,代码来源:booster_tabs.py

示例7: CalendarComponent

class CalendarComponent(CalendarMeta):

    def __init__(self):
        super(CalendarComponent, self).__init__()
        self.__em = EventManager()
        self.onMonthChangedEvent = Event(self.__em)
        self.onDateSelectedEvent = Event(self.__em)

    def onMonthChanged(self, timestamp):
        self.onMonthChangedEvent(timestamp)

    def onDateSelected(self, timestamp):
        self.onDateSelectedEvent(timestamp)

    def formatYMHeader(self, rawDate):
        return BigWorld.wg_getYMDateFormat(rawDate)

    def _dispose(self):
        self.__em.clear()
        super(CalendarComponent, self)._dispose()
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:20,代码来源:calendarcomponent.py

示例8: __init__

 def __init__(self, proxy):
     super(RefSystem, self).__init__(proxy)
     self.__referrers = []
     self.__referrals = []
     self.__quests = []
     self.__xpPoolOfDeletedRals = 0
     self.__totalXP = 0
     self.__isTotallyCompleted = False
     self.__posByXPinTeam = 0
     self.__eventMgr = EventManager()
     self.onUpdated = Event(self.__eventMgr)
     self.onQuestsUpdated = Event(self.__eventMgr)
     self.onPlayerBecomeReferrer = Event(self.__eventMgr)
     self.onPlayerBecomeReferral = Event(self.__eventMgr)
开发者ID:kblw,项目名称:wot_client,代码行数:14,代码来源:refsystem.py

示例9: __init__

 def __init__(self):
     self.__waitForSync = False
     self.__invalidateCbID = None
     self.__cache = defaultdict(dict)
     self.__potapovHidden = {}
     self.__actionsCache = defaultdict(lambda : defaultdict(dict))
     self.__questsDossierBonuses = defaultdict(set)
     self.__random = RandomPQController()
     self.__fallout = FalloutPQController()
     self.__potapovComposer = _PotapovComposer(self.__random, self.__fallout)
     self.__questsProgress = QuestsProgressRequester()
     self.__companies = CompanyBattleController(self)
     self.__em = EventManager()
     self.onSyncStarted = Event(self.__em)
     self.onSyncCompleted = Event(self.__em)
     self.onSelectedQuestsChanged = Event(self.__em)
     self.onSlotsCountChanged = Event(self.__em)
     self.onProgressUpdated = Event(self.__em)
     return
开发者ID:webiumsk,项目名称:WOT0.10.0,代码行数:19,代码来源:eventscache.py

示例10: __init__

 def __init__(self):
     self.__connectionData = ConnectionData()
     self.__connectionUrl = None
     self.__connectionMethod = CONNECTION_METHOD.BASIC
     self.__connectionStatus = LOGIN_STATUS.NOT_SET
     self.__lastLoginName = None
     self.__hostItem = g_preDefinedHosts._makeHostItem('', '', '')
     self.__retryConnectionPeriod = _MIN_RECONNECTION_TIMEOUT
     self.__retryConnectionCallbackID = None
     g_playerEvents.onKickWhileLoginReceived += self.__processKick
     g_playerEvents.onLoginQueueNumberReceived += self.__processQueue
     self.__eManager = EventManager()
     self.onLoggedOn = Event(self.__eManager)
     self.onConnected = Event(self.__eManager)
     self.onRejected = Event(self.__eManager)
     self.onDisconnected = Event(self.__eManager)
     self.onKickedFromServer = Event(self.__eManager)
     self.onKickWhileLoginReceived = Event(self.__eManager)
     self.onQueued = Event(self.__eManager)
     return
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:20,代码来源:connectionmanager.py

示例11: __init__

 def __init__(self):
     super(_PreDefinedHostList, self).__init__()
     self._eManager = EventManager()
     self.onCsisQueryStart = Event(self._eManager)
     self.onCsisQueryComplete = Event(self._eManager)
     self.onPingPerformed = Event(self._eManager)
     self._hosts = []
     self._urlMap = {}
     self._nameMap = {}
     self._peripheryMap = {}
     self._isDataLoaded = False
     self._isCSISQueryInProgress = False
     self.__csisUrl = ''
     self.__csisResponse = {}
     self.__lastRoamingHosts = []
     self.__csisCallbackID = None
     self.__lastCsisUpdateTime = 0
     self.__queryCallback = None
     self.__autoLoginQueryState = AUTO_LOGIN_QUERY_STATE.DEFAULT
     self.__csisAction = CSIS_ACTION.DEFAULT
     self.__recommended = []
     self.__pingRequester = _PingRequester(self.__onPingPerformed)
     return
开发者ID:aevitas,项目名称:wotsdk,代码行数:23,代码来源:clientpredefined_hosts.py

示例12: _EventsCache

class _EventsCache(object):
    USER_QUESTS = (EVENT_TYPE.BATTLE_QUEST,
     EVENT_TYPE.TOKEN_QUEST,
     EVENT_TYPE.FORT_QUEST,
     EVENT_TYPE.PERSONAL_QUEST,
     EVENT_TYPE.POTAPOV_QUEST)
    SYSTEM_QUESTS = (EVENT_TYPE.REF_SYSTEM_QUEST,)

    def __init__(self):
        self.__waitForSync = False
        self.__invalidateCbID = None
        self.__cache = defaultdict(dict)
        self.__potapovHidden = {}
        self.__actionsCache = defaultdict(lambda : defaultdict(dict))
        self.__questsDossierBonuses = defaultdict(set)
        self.__random = RandomPQController()
        self.__fallout = FalloutPQController()
        self.__potapovComposer = _PotapovComposer(self.__random, self.__fallout)
        self.__questsProgress = QuestsProgressRequester()
        self.__companies = CompanyBattleController(self)
        self.__em = EventManager()
        self.onSyncStarted = Event(self.__em)
        self.onSyncCompleted = Event(self.__em)
        self.onSelectedQuestsChanged = Event(self.__em)
        self.onSlotsCountChanged = Event(self.__em)
        self.onProgressUpdated = Event(self.__em)
        return

    def init(self):
        self.__random.init()
        self.__fallout.init()

    def fini(self):
        self.__fallout.fini()
        self.__random.fini()
        self.__em.clear()
        self.__clearInvalidateCallback()

    def start(self):
        self.__companies.start()

    def stop(self):
        self.__companies.stop()

    def clear(self):
        self.stop()
        quests_caches.clearNavInfo()

    @property
    def waitForSync(self):
        return self.__waitForSync

    @property
    def falloutQuestsProgress(self):
        return self.__fallout.questsProgress

    @property
    def randomQuestsProgress(self):
        return self.__random.questsProgress

    @property
    def random(self):
        return self.__random

    @property
    def fallout(self):
        return self.__fallout

    @property
    def questsProgress(self):
        return self.__questsProgress

    @property
    def potapov(self):
        return self.__potapovComposer

    @property
    def companies(self):
        return self.__companies

    @async
    @process
    def update(self, diff = None, callback = None):
        if diff is not None:
            if diff.get('eventsData', {}).get(EVENT_CLIENT_DATA.INGAME_EVENTS):
                self.__companies.setNotificators()
        yield self.falloutQuestsProgress.request()
        yield self.randomQuestsProgress.request()
        yield self.__questsProgress.request()
        isNeedToInvalidate = True
        isNeedToClearItemsCaches = False

        def _cbWrapper(*args):
            self.__random.update(self, diff)
            self.__fallout.update(self, diff)
            callback(*args)

        if diff is not None:
            isQPUpdated = 'quests' in diff
            isEventsDataUpdated = ('eventsData', '_r') in diff or diff.get('eventsData', {})
#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WOT0.10.0,代码行数:101,代码来源:eventscache.py

示例13: __init__

 def __init__(self):
     self._eManager = EventManager()
     self.onChanged = Event(self._eManager)
     self.onChangeStarted = Event(self._eManager)
     self.__changeCallbackID = None
     return
开发者ID:aevitas,项目名称:wotsdk,代码行数:6,代码来源:clientcurrentvehicle.py

示例14: _CachedVehicle

class _CachedVehicle(object):

    def __init__(self):
        self._eManager = EventManager()
        self.onChanged = Event(self._eManager)
        self.onChangeStarted = Event(self._eManager)
        self.__changeCallbackID = None
        return

    def init(self):
        self._addListeners()

    def destroy(self):
        self._eManager.clear()
        self._clearChangeCallback()
        self._removeListeners()

    def selectVehicle(self, vehID):
        raise NotImplementedError

    def selectNoVehicle(self):
        raise NotImplementedError

    def isPresent(self):
        return self.item is not None

    def onInventoryUpdate(self, invDiff):
        raise NotImplementedError

    def refreshModel(self):
        raise NotImplementedError

    @property
    def item(self):
        raise NotImplementedError

    @property
    def invID(self):
        raise NotImplementedError

    @property
    def hangarSpace(self):
        return _getHangarSpace()

    def _addListeners(self):
        g_clientUpdateManager.addCallbacks({'inventory': self.onInventoryUpdate})

    def _removeListeners(self):
        g_clientUpdateManager.removeObjectCallbacks(self)

    def _changeDone(self):
        self._clearChangeCallback()
        if isPlayerAccount():
            self.onChanged()
        Waiting.hide('updateCurrentVehicle')

    def _setChangeCallback(self):
        if not self.__changeCallbackID:
            self.__changeCallbackID = BigWorld.callback(0.2, self._changeDone)

    def _clearChangeCallback(self):
        if self.__changeCallbackID is not None:
            BigWorld.cancelCallback(self.__changeCallbackID)
            self.__changeCallbackID = None
        return

    def _selectVehicle(self, vehID):
        raise NotImplementedError
开发者ID:aevitas,项目名称:wotsdk,代码行数:68,代码来源:clientcurrentvehicle.py

示例15: ConnectionManager

class ConnectionManager(object):

    def __init__(self):
        self.__connectionData = ConnectionData()
        self.__connectionUrl = None
        self.__connectionMethod = CONNECTION_METHOD.BASIC
        self.__connectionStatus = LOGIN_STATUS.NOT_SET
        self.__lastLoginName = None
        self.__hostItem = g_preDefinedHosts._makeHostItem('', '', '')
        self.__retryConnectionPeriod = _MIN_RECONNECTION_TIMEOUT
        self.__retryConnectionCallbackID = None
        g_playerEvents.onKickWhileLoginReceived += self.__processKick
        g_playerEvents.onLoginQueueNumberReceived += self.__processQueue
        self.__eManager = EventManager()
        self.onLoggedOn = Event(self.__eManager)
        self.onConnected = Event(self.__eManager)
        self.onRejected = Event(self.__eManager)
        self.onDisconnected = Event(self.__eManager)
        self.onKickedFromServer = Event(self.__eManager)
        self.onKickWhileLoginReceived = Event(self.__eManager)
        self.onQueued = Event(self.__eManager)
        return

    def __del__(self):
        g_playerEvents.onKickWhileLoginReceived -= self.__processKick
        g_playerEvents.onLoginQueueNumberReceived -= self.__processQueue
        self.__eManager.clear()
        self.stopRetryConnection()

    def initiateConnection(self, params, password, serverName):
        self.__setConnectionData(params, password)
        if serverName == AUTO_LOGIN_QUERY_URL:
            g_preDefinedHosts.autoLoginQuery(self.__setHostDataAndConnect)
        else:
            self.__setHostDataAndConnect(g_preDefinedHosts.byUrl(serverName))

    def stopRetryConnection(self):
        if self.__retryConnectionCallbackID is not None:
            BigWorld.cancelCallback(self.__retryConnectionCallbackID)
            self.__retryConnectionPeriod = 0
            self.__retryConnectionCallbackID = None
        return

    def __connect(self):
        self.__retryConnectionCallbackID = None
        if constants.IS_DEVELOPMENT:
            LOG_DEBUG('Calling BigWorld.connect with params: {0}, serverName: {1}, inactivityTimeout: {2}, publicKeyPath: {3}'.format(self.__connectionData.username, self.__connectionUrl, constants.CLIENT_INACTIVITY_TIMEOUT, self.__connectionData.publicKeyPath))
        nextTick(lambda : BigWorld.connect(self.__connectionUrl, self.__connectionData, self.__serverResponseHandler))()
        if g_preDefinedHosts.predefined(self.__connectionUrl) or g_preDefinedHosts.roaming(self.__connectionUrl):
            self.__hostItem = g_preDefinedHosts.byUrl(self.__connectionUrl)
        else:
            for server in BigWorld.serverDiscovery.servers:
                if server.serverString == self.__connectionUrl:
                    self.__hostItem = self.__hostItem._replace(name=server.ownerName)
                    break

        return

    def __serverResponseHandler(self, stage, status, responseDataJSON):
        if constants.IS_DEVELOPMENT:
            LOG_DEBUG('Received server response with stage: {0}, status: {1}, responseData: {2}'.format(stage, status, responseDataJSON))
        self.__connectionStatus = status
        try:
            responseData = json.loads(responseDataJSON)
        except ValueError:
            responseData = {'errorMessage': responseDataJSON}

        if status == LOGIN_STATUS.LOGGED_ON:
            if stage == 1:
                if self.__connectionMethod == CONNECTION_METHOD.TOKEN and 'token2' in responseData:
                    self.__swtichToToken2(responseData['token2'])
                self.onLoggedOn(responseData)
                self.onConnected()
        else:
            if self.__retryConnectionCallbackID is None:
                status_ = self.__connectionStatus
                if responseData.get('errorMessage', '') == _INVALID_PASSWORD_TOKEN2_EXPIRED:
                    status_ = LOGIN_STATUS.SESSION_END
                self.onRejected(status_, responseData)
            if status == LOGIN_STATUS.LOGIN_REJECTED_RATE_LIMITED:
                self.__reconnect()
            if stage == 6:
                self.onDisconnected()
        return

    def __setConnectionData(self, params, password):
        self.__lastLoginName = params['login']
        self.__connectionMethod = params['auth_method']
        params['auth_realm'] = constants.AUTH_REALM
        m = hashlib.md5()
        m.update(params['session'])
        params['session'] = m.hexdigest()
        if constants.IS_IGR_ENABLED:
            params['is_igr'] = '1'
        username_ = json.dumps(params, encoding='utf-8')
        LOG_NOTE('User authentication method: {0}'.format(params['auth_method']))
        if 'token2' in params and params['token2']:
            password = ''
        else:
            password = pwd_token.generate(password)
#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:101,代码来源:connectionmanager.py


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