GUI support (also made regular checkboxes pretty for drones/implant/etc)

This commit is contained in:
blitzmann
2015-07-07 00:12:36 -04:00
parent 9ef182aa99
commit 2bca3ddcc8
2 changed files with 27 additions and 5 deletions

View File

@@ -117,6 +117,7 @@ class Fit(object):
self.__capUsed = None
self.__capRecharge = None
self.__calculatedTargets = []
self.__projectionInfo = None
self.factorReload = False
self.fleet = None
self.boostsFits = set()
@@ -207,6 +208,14 @@ class Fit(object):
def projectedFits(self):
return self.__projectedFits
@property
def projectionInfo(self):
return self.__projectionInfo
@projectionInfo.setter
def projectionInfo(self, projectionInfo):
self.__projectionInfo = projectionInfo
@property
def projectedDrones(self):
return self.__projectedDrones
@@ -452,7 +461,7 @@ class Fit(object):
item.calculateModifiedAttributes(targetFit, runTime, True)
for fit in self.projectedFits:
if fit.projectionInfo.amount:
if fit.projectionInfo.amount > 0:
fit.calculateModifiedAttributes(self, withBoosters=withBoosters, dirtyStorage=dirtyStorage)
def fill(self):

View File

@@ -20,7 +20,7 @@
from gui.viewColumn import ViewColumn
from gui import bitmapLoader
import wx
from eos.types import Drone, Module, Rack
from eos.types import Drone, Module, Rack, Fit
from eos.types import State as State_
class State(ViewColumn):
@@ -49,8 +49,14 @@ class State(ViewColumn):
return State_.getName(mod.state).title()
def getImageId(self, stuff):
generic_active = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(1).lower(), "icons")
generic_inactive = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(-1).lower(), "icons")
if isinstance(stuff, Drone):
return self.checkedId if stuff.amountActive > 0 else self.uncheckedId
if stuff.amountActive > 0:
return generic_active
else:
return generic_inactive
elif isinstance(stuff, Rack):
return -1
elif isinstance(stuff, Module):
@@ -58,11 +64,18 @@ class State(ViewColumn):
return -1
else:
return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(stuff.state).lower(), "icons")
elif isinstance(stuff, Fit):
if stuff.projectionInfo is None:
return -1
if stuff.projectionInfo.amount > 0:
return generic_active
return generic_inactive
else:
active = getattr(stuff, "active", None)
if active is None:
return -1
else:
return self.checkedId if active else self.uncheckedId
if active:
return generic_active
return generic_inactive
State.register()