Merge pull request #1165 from pyfa-org/bug/fit-delete-stuff2
Bug/fit delete stuff2
This commit is contained in:
@@ -55,7 +55,9 @@ class BaseName(ViewColumn):
|
||||
if self.projectedView:
|
||||
# we need a little more information for the projected view
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name)
|
||||
info = stuff.getProjectionInfo(fitID)
|
||||
if info:
|
||||
return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name)
|
||||
else:
|
||||
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
|
||||
elif isinstance(stuff, Rack):
|
||||
|
||||
@@ -1813,6 +1813,10 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
|
||||
sFit.deleteFit(self.fitID)
|
||||
|
||||
# Notify other areas that a fit has been deleted
|
||||
wx.PostEvent(self.mainFrame, FitRemoved(fitID=self.fitID))
|
||||
|
||||
# todo: would a simple RefreshList() work here instead of posting that a stage has been selected?
|
||||
if self.shipBrowser.GetActiveStage() == 5:
|
||||
if fit in self.shipBrowser.lastdata: # remove fit from import cache
|
||||
self.shipBrowser.lastdata.remove(fit)
|
||||
@@ -1822,8 +1826,6 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
else:
|
||||
wx.PostEvent(self.shipBrowser, Stage3Selected(shipID=self.shipID))
|
||||
|
||||
wx.PostEvent(self.mainFrame, FitRemoved(fitID=self.fitID))
|
||||
|
||||
def MouseLeftUp(self, event):
|
||||
if self.dragging and self.dragged:
|
||||
self.OnMouseCaptureLost(event)
|
||||
@@ -2004,9 +2006,10 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
if activeFit == self.fitID and not self.deleted:
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(activeFit)
|
||||
self.timestamp = fit.modifiedCoalesce
|
||||
self.notes = fit.notes
|
||||
self.__setToolTip()
|
||||
if fit is not None: # sometimes happens when deleting fits, dunno why.
|
||||
self.timestamp = fit.modifiedCoalesce
|
||||
self.notes = fit.notes
|
||||
self.__setToolTip()
|
||||
|
||||
SFItem.SFBrowserItem.Refresh(self)
|
||||
|
||||
|
||||
@@ -173,9 +173,22 @@ class Fit(object):
|
||||
|
||||
# refresh any fits this fit is projected onto. Otherwise, if we have
|
||||
# already loaded those fits, they will not reflect the changes
|
||||
|
||||
# A note on refreshFits: we collect the target fits in a set because
|
||||
# if a target fit has the same fit for both projected and command,
|
||||
# it will be refreshed first during the projected loop and throw an
|
||||
# error during the command loop
|
||||
refreshFits = set()
|
||||
for projection in fit.projectedOnto.values():
|
||||
if projection.victim_fit in eos.db.saveddata_session: # GH issue #359
|
||||
eos.db.saveddata_session.refresh(projection.victim_fit)
|
||||
refreshFits.add(projection.victim_fit)
|
||||
|
||||
for booster in fit.boostedOnto.values():
|
||||
if booster.boosted_fit in eos.db.saveddata_session: # GH issue #359
|
||||
refreshFits.add(booster.boosted_fit)
|
||||
|
||||
for fit in refreshFits:
|
||||
eos.db.saveddata_session.refresh(fit)
|
||||
|
||||
@staticmethod
|
||||
def copyFit(fitID):
|
||||
@@ -244,6 +257,9 @@ class Fit(object):
|
||||
return None
|
||||
fit = eos.db.getFit(fitID)
|
||||
|
||||
if fit is None:
|
||||
return None
|
||||
|
||||
if basic:
|
||||
return fit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user