本文整理匯總了Python中gui.prb_control.context.PrbCtrlRequestCtx.removeFlags方法的典型用法代碼示例。如果您正苦於以下問題:Python PrbCtrlRequestCtx.removeFlags方法的具體用法?Python PrbCtrlRequestCtx.removeFlags怎麽用?Python PrbCtrlRequestCtx.removeFlags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gui.prb_control.context.PrbCtrlRequestCtx
的用法示例。
在下文中一共展示了PrbCtrlRequestCtx.removeFlags方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _PrebattleDispatcher
# 需要導入模塊: from gui.prb_control.context import PrbCtrlRequestCtx [as 別名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import removeFlags [as 別名]
#.........這裏部分代碼省略.........
callback(False)
return
else:
ctrlType = ctx.getCtrlType()
formation = self.__collection.getItem(ctx.getCtrlType())
if formation is not None:
if formation.hasLockedState():
entityType = formation.getEntityType()
SystemMessages.pushI18nMessage(
messages.getLeaveDisabledMessage(ctrlType, entityType), type=SystemMessages.SM_TYPE.Warning
)
if callback is not None:
callback(False)
return
LOG_DEBUG("Request to leave formation", ctx)
self.__requestCtx = ctx
formation.leave(ctx, callback=callback)
else:
LOG_ERROR("Functional not found", ctx)
if callback is not None:
callback(False)
return
@async
@process
def unlock(self, unlockCtx, callback=None):
state = self.getFunctionalState()
result = True
if not state.isIntroMode:
canDoLeave = True
elif unlockCtx.hasFlags(FUNCTIONAL_FLAG.SWITCH):
if state.ctrlTypeID == unlockCtx.getCtrlType() and state.entityTypeID != unlockCtx.getEntityType():
canDoLeave = True
unlockCtx.removeFlags(FUNCTIONAL_FLAG.SWITCH)
else:
canDoLeave = False
else:
canDoLeave = True
if canDoLeave:
factory = self.__factories.get(state.ctrlTypeID)
result = False
if factory:
ctx = factory.createLeaveCtx(unlockCtx.getFlags())
if ctx:
meta = self.__collection.getConfirmDialogMeta(state.ctrlTypeID, unlockCtx)
if meta:
result = yield DialogsInterface.showDialog(meta)
else:
result = True
if result:
result = yield self.leave(ctx)
else:
LOG_ERROR("Can not create leave ctx", state)
else:
LOG_ERROR("Factory is not found", state)
if callback is not None:
callback(result)
yield lambda callback=None: callback
return
@async
@process
def select(self, entry, callback=None):
ctx = entry.makeDefCtx()
if ctx and self.__validateJoinOp(ctx):
result = yield self.unlock(ctx)