From 066c29395bf87a3cbac330b6f38d9786175fa189 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Sun, 29 Aug 2010 16:32:00 +0200 Subject: [PATCH] Fixup some stuff so we can actualy see calculation results in the stat pane now --- controller/fit.py | 10 ++++++++++ eos | 2 +- util.py | 16 ++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/controller/fit.py b/controller/fit.py index f0134a891..0e6efdae8 100644 --- a/controller/fit.py +++ b/controller/fit.py @@ -19,6 +19,7 @@ import eos.db import eos.types +from eos.types import State import copy class Fit(object): @@ -77,12 +78,21 @@ class Fit(object): item = eos.db.getItem(itemID, eager=("attributes", "group.category")) if item.group.category.name == "Module": m = eos.types.Module(item) + if m.isValidState(State.ACTIVE): + m.state = State.ACTIVE + if m.fits(fit): fit.modules.append(m) eos.db.saveddata_session.flush() + fit.clear() + fit.calculateModifiedAttributes() + return fit def removeItem(self, fitID, position): fit = eos.db.getFit(fitID) fit.modules.toDummy(position) eos.db.saveddata_session.flush() + fit.clear() + fit.calculateModifiedAttributes() + return fit diff --git a/eos b/eos index 5c9e6828e..ad490e424 160000 --- a/eos +++ b/eos @@ -1 +1 @@ -Subproject commit 5c9e6828e58a6b78200ad056032d2ba975e681fe +Subproject commit ad490e424dd3bd2b741643ab8006baf76606b468 diff --git a/util.py b/util.py index 8cdf32efd..9ffb894a1 100644 --- a/util.py +++ b/util.py @@ -1,9 +1,9 @@ def shorten(val, digits): - if val > 10**10: - return ("%." + str(digits)+ "fG") % (val / float(10**9)) - elif val > 10**7: - return ("%." + str(digits)+ "fM") % (val / float(10**6)) - elif val > 10**4: - return ("%." + str(digits)+ "fk") % (val / float(10**3)) - else: - return ("%." + str(digits) + "f") % val + if val > 10**10: + return ("%." + str(digits)+ "fG") % (val / float(10**9)) + elif val > 10**7: + return ("%." + str(digits)+ "fM") % (val / float(10**6)) + elif val > 10**4: + return ("%." + str(digits)+ "fk") % (val / float(10**3)) + else: + return ("%." + str(digits) + "f") % val