Get a working UI skeleton going for assigning boost fits

This commit is contained in:
blitzmann
2016-11-08 19:36:57 -05:00
parent 9fd81e8acd
commit 34243b7b71
4 changed files with 99 additions and 39 deletions

View File

@@ -381,6 +381,25 @@ class Fit(object):
self.recalc(fit)
return True
def addCommandFit(self, fitID, thing):
if fitID is None:
return
fit = eos.db.getFit(fitID)
if thing in fit.commandFits:
return
fit.__commandFits[thing.ID] = thing
# this bit is required -- see GH issue # 83
eos.db.saveddata_session.flush()
eos.db.saveddata_session.refresh(thing)
eos.db.commit()
self.recalc(fit)
return True
def toggleProjected(self, fitID, thing, click):
fit = eos.db.getFit(fitID)
if isinstance(thing, eos.types.Drone):
@@ -402,6 +421,15 @@ class Fit(object):
eos.db.commit()
self.recalc(fit)
def toggleCommandFit(self, fitID, thing):
fit = eos.db.getFit(fitID)
commandInfo = thing.getCommandInfo(fitID)
if commandInfo:
commandInfo.active = not commandInfo.active
eos.db.commit()
self.recalc(fit)
def changeAmount(self, fitID, projected_fit, amount):
"""Change amount of projected fits"""
fit = eos.db.getFit(fitID)
@@ -435,6 +463,13 @@ class Fit(object):
eos.db.commit()
self.recalc(fit)
def removeCommand(self, fitID, thing):
fit = eos.db.getFit(fitID)
del fit.__commandFits[thing.ID]
eos.db.commit()
self.recalc(fit)
def appendModule(self, fitID, itemID):
fit = eos.db.getFit(fitID)
item = eos.db.getItem(itemID, eager=("attributes", "group.category"))