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, Implant,
collection_class = HandledImplantBoosterList, collection_class = HandledImplantBoosterList,
cascade='all,delete-orphan', cascade='all,delete-orphan',
backref='character',
single_parent=True, single_parent=True,
primaryjoin = charImplants_table.c.charID == characters_table.c.ID, primaryjoin = charImplants_table.c.charID == characters_table.c.ID,
secondaryjoin = charImplants_table.c.implantID == Implant.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.viewColumn import ViewColumn
from gui.bitmapLoader import BitmapLoader from gui.bitmapLoader import BitmapLoader
import wx import wx
from eos.types import Drone, Fit, Module, Slot, Rack from eos.types import Drone, Fit, Module, Slot, Rack, Implant
class BaseIcon(ViewColumn): class BaseIcon(ViewColumn):
name = "Base Icon" name = "Base Icon"
@@ -21,6 +21,11 @@ class BaseIcon(ViewColumn):
return self.shipImage return self.shipImage
if isinstance(stuff, Rack): if isinstance(stuff, Rack):
return -1 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 isinstance(stuff, Module):
if stuff.isEmpty: if stuff.isEmpty:
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui") 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 gui.mainFrame
import wx 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 import service
class BaseName(ViewColumn): class BaseName(ViewColumn):
@@ -61,6 +61,8 @@ class BaseName(ViewColumn):
return "%s Slot" % Slot.getName(stuff.slot).capitalize() return "%s Slot" % Slot.getName(stuff.slot).capitalize()
else: else:
return stuff.item.name return stuff.item.name
elif isinstance(stuff, Implant):
return stuff.item.name
else: else:
item = getattr(stuff, "item", stuff) item = getattr(stuff, "item", stuff)

View File

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