本文整理汇总了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)