本文整理汇总了Python中gui.prb_control.context.PrbCtrlRequestCtx.isProcessing方法的典型用法代码示例。如果您正苦于以下问题:Python PrbCtrlRequestCtx.isProcessing方法的具体用法?Python PrbCtrlRequestCtx.isProcessing怎么用?Python PrbCtrlRequestCtx.isProcessing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.prb_control.context.PrbCtrlRequestCtx
的用法示例。
在下文中一共展示了PrbCtrlRequestCtx.isProcessing方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RandomQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import isProcessing [as 别名]
class RandomQueueFunctional(PreQueueFunctional):
def __init__(self, settings = None):
super(RandomQueueFunctional, self).__init__(QUEUE_TYPE.RANDOMS, {QUEUE_EVENT_TYPE.ENQUEUED: g_playerEvents.onEnqueuedRandom,
QUEUE_EVENT_TYPE.DEQUEUED: g_playerEvents.onDequeuedRandom,
QUEUE_EVENT_TYPE.ENQUEUE_ERROR: g_playerEvents.onEnqueueRandomFailure,
QUEUE_EVENT_TYPE.KICKED_FROM_QUEUE: g_playerEvents.onKickedFromRandomQueue,
QUEUE_EVENT_TYPE.KICKED_FROM_ARENA: g_playerEvents.onKickedFromArena}, settings=settings)
self.__requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
result = super(RandomQueueFunctional, self).init(ctx)
g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled
if self.isInQueue():
g_eventDispatcher.loadBattleQueue()
result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
return result
def fini(self, woEvents = False):
self.__requestCtx = None
g_gameCtrl.captcha.onCaptchaInputCanceled -= self.onCaptchaInputCanceled
super(RandomQueueFunctional, self).fini(woEvents)
@vehicleAmmoCheck
def join(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if isParentControlActivated():
g_eventDispatcher.showParentControlNotification()
if callback:
callback(False)
return
if not hasattr(BigWorld.player(), 'enqueueRandom'):
if callback:
callback(False)
LOG_ERROR('Player can not join to random queue')
return
mapID = ctx.getDemoArenaTypeID()
if mapID:
LOG_DEBUG('Demonstrator mapID:', ArenaType.g_cache[mapID].geometryName)
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().enqueueRandom(ctx.getVehicleInventoryID(), gameplaysMask=ctx.getGamePlayMask(), arenaTypeID=mapID)
LOG_DEBUG('Player is joining to random queue', ctx)
def leave(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if hasattr(BigWorld.player(), 'dequeueRandom'):
if self.isInQueue():
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().dequeueRandom()
else:
super(RandomQueueFunctional, self).leave(ctx, callback)
else:
if callback:
callback(False)
LOG_ERROR('Player can not exit from random queue')
def isInQueue(self):
return isInRandomQueue()
def hasGUIPage(self):
return True
def doAction(self, action = None, dispatcher = None):
result = False
def _leavePreQueue():
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
if not self.isInQueue():
def _joinResponse(success):
if not success:
_leavePreQueue()
self.join(pre_queue_ctx.JoinRandomQueueCtx(action.mapID if action else 0, waitingID='prebattle/join'), callback=_joinResponse)
else:
_leavePreQueue()
return result
def onEnqueued(self):
super(RandomQueueFunctional, self).onEnqueued()
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadBattleQueue()
g_eventDispatcher.updateUI()
def onDequeued(self):
super(RandomQueueFunctional, self).onDequeued()
self.__requestCtx.stopProcessing(True)
g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
g_eventDispatcher.loadHangar()
#.........这里部分代码省略.........
示例2: _PrebattleDispatcher
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import isProcessing [as 别名]
class _PrebattleDispatcher(object):
def __init__(self):
super(_PrebattleDispatcher, self).__init__()
self.__requestCtx = None
self.__collection = FunctionalCollection()
self.__factories = ControlFactoryDecorator()
self.__nextPrbFunctional = None
self._globalListeners = set()
return
def __del__(self):
LOG_DEBUG('_PrebattleDispatcher deleted')
def start(self, ctx):
g_eventDispatcher.init(self)
self.__requestCtx = PrbCtrlRequestCtx()
result = self.__factories.start(self, CreateFunctionalCtx(CTRL_ENTITY_TYPE.UNKNOWN, create={'queueType': ctx.getQueueType(),
'settings': ctx.prbSettings}))
self._startListening()
functional.initDevFunctional()
if result & FUNCTIONAL_INIT_RESULT.LOAD_PAGE == 0:
BigWorld.callback(0.001, lambda : g_eventDispatcher.loadHangar())
g_eventDispatcher.updateUI()
if GUI_SETTINGS.specPrebatlesVisible and not areSpecBattlesHidden():
g_eventDispatcher.addSpecBattlesToCarousel()
def stop(self):
self.__nextPrbFunctional = None
self._stopListening()
functional.finiDevFunctional()
self._clear(woEvents=True)
g_eventDispatcher.fini()
return
def getPrbFunctional(self):
return self.__collection.getItem(CTRL_ENTITY_TYPE.PREBATTLE)
def getUnitFunctional(self):
return self.__collection.getItem(CTRL_ENTITY_TYPE.UNIT)
def getPreQueueFunctional(self):
return self.__collection.getItem(CTRL_ENTITY_TYPE.PREQUEUE)
def getFunctional(self, ctrlType):
return self.__collection.getItem(ctrlType)
def getFunctionalCollection(self):
return self.__collection
def getControlFactories(self):
return self.__factories
def hasModalEntity(self):
return self.__collection.hasModalEntity()
def getFunctionalState(self):
return self.__collection.getState(self.__factories)
@async
@process
def create(self, ctx, callback = None):
if ctx.getRequestType() == REQUEST_TYPE.CREATE:
if not self.__requestCtx.isProcessing():
result = yield self.unlock(ctx.getFuncExit(), True)
if result:
entry = self.__factories.createEntry(ctx)
if entry:
LOG_DEBUG('Request to create', ctx)
self.__requestCtx = ctx
entry.create(ctx, callback=callback)
else:
LOG_ERROR('Entry not found', ctx)
if callback:
callback(False)
elif callback:
callback(False)
else:
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
yield lambda callback = None: callback
else:
LOG_ERROR('Invalid context to create', ctx)
if callback:
callback(False)
yield lambda callback = None: callback
return
@async
@process
def join(self, ctx, callback = None):
if self._validateJoinOp(ctx):
result = yield self.unlock(ctx.getFuncExit(), ctx.isForced())
ctx.setForced(result)
if result:
entry = self.__factories.createEntry(ctx)
if entry:
LOG_DEBUG('Request to join', ctx)
self.__requestCtx = ctx
#.........这里部分代码省略.........
示例3: HistoricalQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import isProcessing [as 别名]
class HistoricalQueueFunctional(PreQueueFunctional, IStatefulFunctional):
def __init__(self, settings = None):
super(HistoricalQueueFunctional, self).__init__(QUEUE_TYPE.HISTORICAL, {QUEUE_EVENT_TYPE.ENQUEUED: g_playerEvents.onEnqueuedHistorical,
QUEUE_EVENT_TYPE.DEQUEUED: g_playerEvents.onDequeuedHistorical,
QUEUE_EVENT_TYPE.ENQUEUE_ERROR: g_playerEvents.onEnqueueHistoricalFailure,
QUEUE_EVENT_TYPE.KICKED_FROM_QUEUE: g_playerEvents.onKickedFromHistoricalQueue,
QUEUE_EVENT_TYPE.KICKED_FROM_ARENA: g_playerEvents.onKickedFromArena}, settings=settings)
self.__requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
result = super(HistoricalQueueFunctional, self).init(ctx=ctx)
g_eventDispatcher.loadHistoryBattles()
g_eventsCache.onSyncCompleted += self.onEventsCacheResync
g_eventBus.addListener(events.ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled
result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW)
return result
def fini(self, woEvents = False):
self.__requestCtx = None
if not woEvents:
g_eventDispatcher.unloadHistoryBattles()
else:
g_eventDispatcher.removeHistoryBattlesFromCarousel()
g_gameCtrl.captcha.onCaptchaInputCanceled -= self.onCaptchaInputCanceled
g_eventBus.removeListener(events.ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
g_eventDispatcher.unloadHistoryBattles()
g_eventsCache.onSyncCompleted -= self.onEventsCacheResync
g_currentVehicle.setHistoricalBattle(None)
super(HistoricalQueueFunctional, self).fini(woEvents=woEvents)
return
def getStates(self):
return ({'isInHistoricalQueue': True}, dict(self._settings))
def isInQueue(self):
return isInHistoricalQueue()
def showGUI(self):
g_eventDispatcher.loadHistoryBattles()
@process
def doLeaveAction(self, dispatcher, ctx = None, showConfirmation = True):
meta = self.getConfirmDialogMeta()
if meta is not None:
isConfirmed = yield DialogsInterface.showDialog(meta)
else:
isConfirmed = yield lambda callback: callback(True)
if isConfirmed:
super(HistoricalQueueFunctional, self).doLeaveAction(dispatcher, ctx=None)
return
def join(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if isParentControlActivated():
g_eventDispatcher.showParentControlNotification()
if callback:
callback(False)
return
if not hasattr(BigWorld.player(), 'enqueueHistorical'):
if callback:
callback(False)
LOG_ERROR('Player can not join to history queue')
return
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
invID = ctx.getVehicleInventoryID()
histBattleID = ctx.getHistBattleID()
isCreditsAmmo = ctx.getIsCreditsAmmo()
BigWorld.player().enqueueHistorical(invID, histBattleID=histBattleID, isCreditsAmmo=isCreditsAmmo)
LOG_DEBUG('Player is joining to historical queue', ctx)
def leave(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if hasattr(BigWorld.player(), 'dequeueHistorical'):
if self.isInQueue():
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().dequeueHistorical()
else:
super(HistoricalQueueFunctional, self).leave(ctx, callback)
else:
if callback:
callback(False)
LOG_ERROR('Player can not exit from random queue')
def getItemData(self):
battleID = self.getSetting(PREQUEUE_SETTING_NAME.BATTLE_ID)
return g_eventsCache.getHistoricalBattles().get(battleID)
def canPlayerDoAction(self):
#.........这里部分代码省略.........
示例4: EventBattlesQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import isProcessing [as 别名]
class EventBattlesQueueFunctional(PreQueueFunctional):
def __init__(self, settings = None):
super(EventBattlesQueueFunctional, self).__init__(QUEUE_TYPE.EVENT_BATTLES, {QUEUE_EVENT_TYPE.ENQUEUED: g_playerEvents.onEnqueuedEventBattles,
QUEUE_EVENT_TYPE.DEQUEUED: g_playerEvents.onDequeuedEventBattles,
QUEUE_EVENT_TYPE.ENQUEUE_ERROR: g_playerEvents.onEnqueueEventBattlesFailure,
QUEUE_EVENT_TYPE.KICKED_FROM_QUEUE: g_playerEvents.onKickedFromEventBattles,
QUEUE_EVENT_TYPE.KICKED_FROM_ARENA: g_playerEvents.onKickedFromArena}, settings=settings)
self.__requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
result = super(EventBattlesQueueFunctional, self).init(ctx)
g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled
if self.isInQueue():
g_eventDispatcher.loadBattleQueue()
result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
return result
def fini(self, woEvents = False):
self.__requestCtx = None
g_gameCtrl.captcha.onCaptchaInputCanceled -= self.onCaptchaInputCanceled
super(EventBattlesQueueFunctional, self).fini(woEvents)
@groupAmmoCheck
def join(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if isParentControlActivated():
g_eventDispatcher.showParentControlNotification()
if callback:
callback(False)
return
if not hasattr(BigWorld.player(), 'enqueueEventBattles'):
if callback:
callback(False)
LOG_ERROR('Player can not join to event battles queue')
return
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().enqueueEventBattles(ctx.getVehicleInventoryIDs(), ctx.getBattleType())
LOG_DEBUG('Player is joining to event battles queue', ctx)
def leave(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if hasattr(BigWorld.player(), 'dequeueEventBattles'):
if self.isInQueue():
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().dequeueEventBattles()
else:
super(EventBattlesQueueFunctional, self).leave(ctx, callback)
else:
if callback:
callback(False)
LOG_ERROR('Player can not exit from event battles queue')
def isInQueue(self):
return isInEventBattlesQueue()
def hasGUIPage(self):
return True
def doAction(self, action = None, dispatcher = None):
result = False
def _leavePreQueue():
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
if not self.isInQueue():
def _joinResponse(success):
if not success:
_leavePreQueue()
falloutCtrl = getFalloutCtrl()
self.join(pre_queue_ctx.JoinEventBattlesQueueCtx(map(lambda v: v.invID, falloutCtrl.getSelectedVehicles()), falloutCtrl.getBattleType(), waitingID='prebattle/join'), callback=_joinResponse)
else:
_leavePreQueue()
return result
def onEnqueued(self):
super(EventBattlesQueueFunctional, self).onEnqueued()
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadBattleQueue()
g_eventDispatcher.updateUI()
def onDequeued(self):
super(EventBattlesQueueFunctional, self).onDequeued()
self.__requestCtx.stopProcessing(True)
g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
g_eventDispatcher.loadHangar()
def onEnqueueError(self, errorCode, _):
#.........这里部分代码省略.........
示例5: AccountQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import isProcessing [as 别名]
class AccountQueueFunctional(PreQueueFunctional):
def __init__(self, queueType, subscriber, flags = FUNCTIONAL_FLAG.UNDEFINED):
super(AccountQueueFunctional, self).__init__(queueType, subscriber, flags)
self._requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
return super(AccountQueueFunctional, self).init(ctx)
def fini(self, woEvents = False):
self._requestCtx.clear()
super(AccountQueueFunctional, self).fini(woEvents)
def doAction(self, action = None):
if not self.isInQueue():
self.queue(self._makeQueueCtxByAction(action))
else:
self.dequeue(pre_queue_ctx.DequeueCtx(waitingID='prebattle/leave'))
return True
def queue(self, ctx, callback = None):
if ctx is None:
ctx = self._makeQueueCtxByAction()
if self._requestCtx.isProcessing():
LOG_ERROR('Request is processing', self._requestCtx)
if callback is not None:
callback(False)
return
elif self.isInQueue():
LOG_ERROR('Player already is in the queue', self._requestCtx)
if callback is not None:
callback(False)
return
elif self._validateParentControl():
if callback is not None:
callback(False)
return
else:
self._requestCtx = ctx
self._requestCtx.startProcessing(callback)
try:
self._doQueue(ctx)
except (AttributeError, TypeError, NotImplementedError):
LOG_CURRENT_EXCEPTION()
self._requestCtx.stopProcessing(False)
return
def dequeue(self, ctx, callback = None):
if self._requestCtx.isProcessing():
LOG_ERROR('Request is processing', self._requestCtx)
if callback:
callback(False)
return
elif not self.isInQueue():
LOG_ERROR('Player is not in the queue', ctx)
if callback is not None:
callback(False)
return
else:
self._requestCtx = ctx
self._requestCtx.startProcessing(callback)
try:
self._doDequeue(ctx)
except (AttributeError, TypeError, NotImplementedError):
LOG_CURRENT_EXCEPTION()
self._requestCtx.stopProcessing(False)
return
def onEnqueued(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onEnqueued(*args)
def onDequeued(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onDequeued(*args)
def onEnqueueError(self, *args):
self._requestCtx.stopProcessing(False)
super(AccountQueueFunctional, self).onEnqueueError(*args)
def onKickedFromQueue(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onKickedFromQueue(*args)
def onKickedFromArena(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onKickedFromArena(*args)
def _doQueue(self, ctx):
raise NotImplementedError('Routine _doQueue must be overridden')
def _doDequeue(self, ctx):
raise NotImplementedError('Routine _doDequeue must be overridden')
def _makeQueueCtxByAction(self, action = None):
raise NotImplementedError('Routine _makeDefQueueCtx must be overridden')
def _validateParentControl(self):
#.........这里部分代码省略.........
示例6: _PrebattleDispatcher
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import isProcessing [as 别名]
class _PrebattleDispatcher(ListenersCollection):
def __init__(self):
super(_PrebattleDispatcher, self).__init__()
self.__requestCtx = None
self.__collection = FunctionalCollection()
self.__factories = ControlFactoryDecorator()
self.__nextPrbFunctional = None
self._setListenerClass(IGlobalListener)
return
def __del__(self):
LOG_DEBUG("_PrebattleDispatcher deleted")
def start(self):
g_eventDispatcher.init(self)
result = self.__setFunctional(CreateFunctionalCtx())
self.__requestCtx = PrbCtrlRequestCtx()
self.__startListening()
functional.initDevFunctional()
if result & FUNCTIONAL_FLAG.LOAD_PAGE == 0:
BigWorld.callback(0.001, lambda: g_eventDispatcher.loadHangar())
g_eventDispatcher.updateUI()
if GUI_SETTINGS.specPrebatlesVisible and not prb_getters.areSpecBattlesHidden():
g_eventDispatcher.addSpecBattlesToCarousel()
def stop(self):
self.__nextPrbFunctional = None
self.__stopListening()
functional.finiDevFunctional()
self.__clear(woEvents=True)
g_eventDispatcher.fini()
return
def getPrbFunctional(self):
return self.__collection.getItem(_CTRL_TYPE.PREBATTLE)
def getUnitFunctional(self):
return self.__collection.getItem(_CTRL_TYPE.UNIT)
def getPreQueueFunctional(self):
return self.__collection.getItem(_CTRL_TYPE.PREQUEUE)
def getFunctional(self, ctrlType):
return self.__collection.getItem(ctrlType)
def getFunctionalCollection(self):
return self.__collection
def getControlFactories(self):
return self.__factories
def hasModalEntity(self):
return self.__collection.hasModalEntity()
def getFunctionalState(self):
return self.__collection.getState(self.__factories)
@async
@process
def create(self, ctx, callback=None):
if ctx.getRequestType() == _RQ_TYPE.CREATE:
if not self.__requestCtx.isProcessing():
result = yield self.unlock(ctx)
if result:
entry = self.__factories.createEntry(ctx)
if entry:
LOG_DEBUG("Request to create", ctx)
self.__requestCtx = ctx
entry.create(ctx, callback=callback)
else:
LOG_ERROR("Entry not found", ctx)
if callback is not None:
callback(False)
elif callback is not None:
callback(False)
else:
LOG_ERROR("Request is processing", self.__requestCtx)
if callback is not None:
callback(False)
yield lambda callback=None: callback
else:
LOG_ERROR("Invalid context to create", ctx)
if callback is not None:
callback(False)
yield lambda callback=None: callback
return
@async
@process
def join(self, ctx, callback=None):
if self.__validateJoinOp(ctx):
result = yield self.unlock(ctx)
ctx.setForced(result)
if result:
entry = self.__factories.createEntry(ctx)
if entry:
LOG_DEBUG("Request to join", ctx)
self.__requestCtx = ctx
entry.join(ctx, callback=callback)
else:
#.........这里部分代码省略.........