Differentiate between character implants and fits

This commit is contained in:
blitzmann
2015-11-10 02:06:44 -05:00
parent 938e2a871d
commit ca34d7cced
4 changed files with 12 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ mapper(Character, characters_table,
Implant,
collection_class = HandledImplantBoosterList,
cascade='all,delete-orphan',
backref='character',
single_parent=True,
primaryjoin = charImplants_table.c.charID == characters_table.c.ID,
secondaryjoin = charImplants_table.c.implantID == Implant.ID,

View File

@@ -2,7 +2,7 @@ from gui import builtinViewColumns
from gui.viewColumn import ViewColumn
from gui.bitmapLoader import BitmapLoader
import wx
from eos.types import Drone, Fit, Module, Slot, Rack
from eos.types import Drone, Fit, Module, Slot, Rack, Implant
class BaseIcon(ViewColumn):
name = "Base Icon"
@@ -21,6 +21,11 @@ class BaseIcon(ViewColumn):
return self.shipImage
if isinstance(stuff, Rack):
return -1
if isinstance(stuff, Implant):
if stuff.character: # if it has a character as it's parent
return self.fittingView.imageList.GetImageIndex("character_small", "gui")
else:
return self.shipImage
if isinstance(stuff, Module):
if stuff.isEmpty:
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui")

View File

@@ -22,7 +22,7 @@ from gui.viewColumn import ViewColumn
import gui.mainFrame
import wx
from eos.types import Drone, Cargo, Fit, Module, Slot, Rack
from eos.types import Drone, Cargo, Fit, Module, Slot, Rack, Implant
import service
class BaseName(ViewColumn):
@@ -61,6 +61,8 @@ class BaseName(ViewColumn):
return "%s Slot" % Slot.getName(stuff.slot).capitalize()
else:
return stuff.item.name
elif isinstance(stuff, Implant):
return stuff.item.name
else:
item = getattr(stuff, "item", stuff)

View File

@@ -27,6 +27,7 @@ import globalEvents as GE
class ImplantView(d.Display):
DEFAULT_COLS = ["State",
"attr:implantness",
"Base Icon",
"Base Name"]
def __init__(self, parent):
@@ -65,7 +66,7 @@ class ImplantView(d.Display):
fit = sFit.getFit(event.fitID)
self.original = fit.implants if fit is not None else None
self.implants = stuff = fit.implants if fit is not None else None
self.implants = stuff = fit.appliedImplants if fit is not None else None
if stuff is not None: stuff.sort(key=lambda implant: implant.slot)
if event.fitID != self.lastFitId: