Make sure implant/booster/projected view gets in sync with current fit (clear its content if there is no active fitting), also , make sure the first item is visible/all selected items deselected in case we switch to other fit

This commit is contained in:
HomeWorld
2010-12-11 14:16:57 +02:00
parent 8660e36bad
commit 22ecdba471
4 changed files with 63 additions and 1 deletions

View File

@@ -49,6 +49,9 @@ class ProjectedView(d.Display):
def __init__(self, parent):
d.Display.__init__(self, parent, style = wx.LC_SINGLE_SEL | wx.BORDER_NONE)
self.lastFitId = None
self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
self.Bind(wx.EVT_LEFT_DOWN, self.click)
self.Bind(wx.EVT_RIGHT_DOWN, self.click)
@@ -108,6 +111,13 @@ class ProjectedView(d.Display):
return fit.name
def fitChanged(self, event):
#Clear list and get out if current fitId is None
if event.fitID is None and self.lastFitId is not None:
self.DeleteAllItems()
self.lastFitId = None
event.Skip()
return
cFit = service.Fit.getInstance()
fit = cFit.getFit(event.fitID)
stuff = []
@@ -124,6 +134,15 @@ class ProjectedView(d.Display):
stuff.extend(self.drones)
stuff.extend(self.fits)
if event.fitID != self.lastFitId:
self.lastFitId = event.fitID
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
if item != -1:
self.EnsureVisible(item)
self.deselectItems()
self.update(stuff)
def get(self, row):