本文整理汇总了Python中eos.saveddata.module.Module.getProposedState方法的典型用法代码示例。如果您正苦于以下问题:Python Module.getProposedState方法的具体用法?Python Module.getProposedState怎么用?Python Module.getProposedState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eos.saveddata.module.Module
的用法示例。
在下文中一共展示了Module.getProposedState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Do
# 需要导入模块: from eos.saveddata.module import Module [as 别名]
# 或者: from eos.saveddata.module.Module import getProposedState [as 别名]
def Do(self):
pyfalog.debug('Doing change of local module states at position {}/{} to click {} on fit {}'.format(self.mainPosition, self.positions, self.click, self.fitID))
sFit = Fit.getInstance()
fit = sFit.getFit(self.fitID)
mainMod = fit.modules[self.mainPosition]
if mainMod.isEmpty:
return False
positions = [pos for pos in self.positions if not fit.modules[pos].isEmpty]
if self.mainPosition not in positions:
positions.append(self.mainPosition)
self.savedStates = {pos: fit.modules[pos].state for pos in positions}
changed = False
mainProposedState = Module.getProposedState(mainMod, self.click)
pyfalog.debug('Attempting to change modules to {}'.format(mainProposedState))
if mainProposedState != mainMod.state:
pyfalog.debug('Toggle {} state: {} for fit ID: {}'.format(mainMod, mainProposedState, self.fitID))
mainMod.state = mainProposedState
changed = True
for position in [pos for pos in positions if pos != self.mainPosition]:
mod = fit.modules[position]
proposedState = Module.getProposedState(mod, self.click, mainProposedState)
if proposedState != mod.state:
pyfalog.debug('Toggle {} state: {} for fit ID: {}'.format(mod, proposedState, self.fitID))
mod.state = proposedState
changed = True
if not changed:
return False
sFit.recalc(fit)
self.savedStateCheckChanges = sFit.checkStates(fit, mainMod)
return True
示例2: __init__
# 需要导入模块: from eos.saveddata.module import Module [as 别名]
# 或者: from eos.saveddata.module.Module import getProposedState [as 别名]
def __init__(self, fitID, mainItem, items, click):
wx.Command.__init__(self, True, 'Change Projected Item States')
self.internalHistory = InternalCommandHistory()
self.fitID = fitID
self.pModPositions = []
self.pDroneItemIDs = []
self.pFighterPositions = []
self.pFitIDs = []
fit = Fit.getInstance().getFit(fitID)
for item in items:
if isinstance(item, EosModule):
if item in fit.projectedModules:
self.pModPositions.append(fit.projectedModules.index(item))
elif isinstance(item, EosDrone):
self.pDroneItemIDs.append(item.itemID)
elif isinstance(item, EosFighter):
if item in fit.projectedFighters:
self.pFighterPositions.append(fit.projectedFighters.index(item))
elif isinstance(item, EosFit):
self.pFitIDs.append(item.ID)
self.proposedState = None
if click == 'right' and isinstance(mainItem, EosModule):
self.proposedState = 'overheat'
elif click == 'left':
if isinstance(mainItem, EosModule):
modProposedState = EosModule.getProposedState(mainItem, click)
self.proposedState = 'inactive' if modProposedState == FittingModuleState.OFFLINE else 'active'
elif isinstance(mainItem, EosDrone):
self.proposedState = 'active' if mainItem.amountActive == 0 else 'inactive'
elif isinstance(mainItem, EosFighter):
self.proposedState = 'inactive' if mainItem.active else 'active'
elif isinstance(mainItem, EosFit):
projectionInfo = mainItem.getProjectionInfo(self.fitID)
if projectionInfo is not None:
self.proposedState = 'inactive' if projectionInfo.active else 'active'
示例3: toggleModulesState
# 需要导入模块: from eos.saveddata.module import Module [as 别名]
# 或者: from eos.saveddata.module.Module import getProposedState [as 别名]
def toggleModulesState(self, fitID, base, modules, click):
pyfalog.debug("Toggle module state for fit ID: {0}", fitID)
changed = False
proposedState = es_Module.getProposedState(base, click)
if proposedState != base.state:
changed = True
base.state = proposedState
for mod in modules:
if mod != base:
p = es_Module.getProposedState(mod, click, proposedState)
mod.state = p
if p != mod.state:
changed = True
if changed:
eos.db.commit()
fit = eos.db.getFit(fitID)
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
self.recalc(fit)
# Then, check states of all modules and change where needed. This will recalc if needed
self.checkStates(fit, base)
示例4: toggleProjected
# 需要导入模块: from eos.saveddata.module import Module [as 别名]
# 或者: from eos.saveddata.module.Module import getProposedState [as 别名]
def toggleProjected(self, fitID, thing, click):
pyfalog.debug("Toggling projected on fit ({0}) for: {1}", fitID, thing)
fit = eos.db.getFit(fitID)
if isinstance(thing, es_Drone):
if thing.amountActive == 0 and thing.canBeApplied(fit):
thing.amountActive = thing.amount
else:
thing.amountActive = 0
elif isinstance(thing, es_Fighter):
thing.active = not thing.active
elif isinstance(thing, es_Module):
thing.state = es_Module.getProposedState(thing, click)
if not thing.canHaveState(thing.state, fit):
thing.state = State.OFFLINE
elif isinstance(thing, FitType):
projectionInfo = thing.getProjectionInfo(fitID)
if projectionInfo:
projectionInfo.active = not projectionInfo.active
eos.db.commit()
self.recalc(fit)