Fix implant panel selection issue

This commit is contained in:
DarkPhoenix
2019-04-15 14:06:57 +03:00
parent 960bef2b96
commit 0fedb17586
3 changed files with 8 additions and 13 deletions

View File

@@ -110,7 +110,6 @@ class BoosterView(d.Display):
if self.boosters is not None:
self.boosters.sort(key=lambda booster: booster.slot or 0)
if event.fitID != self.lastFitId:
self.lastFitId = event.fitID
@@ -121,8 +120,7 @@ class BoosterView(d.Display):
self.deselectItems()
self.populate(self.boosters)
self.refresh(self.boosters)
self.update(self.boosters)
event.Skip()
def addItem(self, event):
@@ -164,10 +162,8 @@ class BoosterView(d.Display):
def spawnMenu(self, event):
sel = self.GetFirstSelected()
if sel != -1:
sFit = Fit.getInstance()
item = self.boosters[sel]
booster = self.boosters[sel]
srcContext = "boosterItem"
itemContext = "Booster"
menu = ContextMenu.getMenu((item,), (srcContext, itemContext))
menu = ContextMenu.getMenu((booster,), (srcContext, itemContext))
self.PopupMenu(menu)

View File

@@ -94,7 +94,8 @@ class ImplantView(wx.Panel):
def OnRadioSelect(self, event):
fitID = self.mainFrame.getActiveFit()
if fitID is not None:
self.mainFrame.command.Submit(cmd.GuiChangeImplantLocationCommand(fitID, ImplantLocation.FIT if self.rbFit.GetValue() else ImplantLocation.CHARACTER))
self.mainFrame.command.Submit(cmd.GuiChangeImplantLocationCommand(
fitID=fitID, source=ImplantLocation.FIT if self.rbFit.GetValue() else ImplantLocation.CHARACTER))
class ImplantDisplay(d.Display):
@@ -158,7 +159,7 @@ class ImplantDisplay(d.Display):
self.original = fit.implants if fit is not None else None
self.implants = fit.appliedImplants[:] if fit is not None else None
if self.implants is not None:
self.implants.sort(key=lambda implant: implant.slot)
self.implants.sort(key=lambda implant: implant.slot or 0)
if event.fitID != self.lastFitId:
self.lastFitId = event.fitID
@@ -232,8 +233,7 @@ class ImplantDisplay(d.Display):
return
if sel != -1:
implant = fit.appliedImplants[sel]
implant = self.implants[sel]
sMkt = Market.getInstance()
sourceContext = "implantItem" if fit.implantSource == ImplantLocation.FIT else "implantItemChar"
itemContext = sMkt.getCategoryByItem(implant.item).name

View File

@@ -131,12 +131,11 @@ class MetaSwap(ContextMenu):
fitID = self.mainFrame.getActiveFit()
fit = Fit.getInstance().getFit(fitID)
if context == 'implantItem':
position = fit.implants.index(self.selection[0])
self.mainFrame.command.Submit(cmd.GuiSwapImplantMetaCommand(
fitID=fitID, position=position, itemID=item.ID))
if context == 'boosterItem':
elif context == 'boosterItem':
position = fit.boosters.index(self.selection[0])
self.mainFrame.command.Submit(cmd.GuiSwapBoosterMetaCommand(
fitID=fitID, position=position, itemID=item.ID))