Support changing amount of projected fits

This commit is contained in:
blitzmann
2015-07-07 01:57:59 -04:00
parent b95a10d284
commit 06e4a7e80f
4 changed files with 90 additions and 66 deletions

View File

@@ -363,13 +363,24 @@ class Fit(object):
thing.state = self.__getProposedState(thing, click)
if not thing.canHaveState(thing.state, fit):
thing.state = State.OFFLINE
elif isinstance(thing, eos.types.Fit):
elif isinstance(thing, eos.types.Fit) and thing.projectionInfo is not None:
print "toggle fit"
thing.projectionInfo.active = not thing.projectionInfo.active
eos.db.commit()
self.recalc(fit)
def changeAmount(self, fitID, projected_fit, amount):
"""Change amount of projected fits"""
fit = eos.db.getFit(fitID)
amount = min(5, max(1, amount)) # 1 <= a <= 5
if projected_fit.projectionInfo is not None:
projected_fit.projectionInfo.amount = amount
eos.db.commit()
self.recalc(fit)
def removeProjected(self, fitID, thing):
fit = eos.db.getFit(fitID)
if isinstance(thing, eos.types.Drone):