Search fits too

This commit is contained in:
DarkPhoenix
2010-08-22 22:58:52 +04:00
parent 2a9e72d031
commit b8c42319e8
2 changed files with 13 additions and 0 deletions

View File

@@ -87,6 +87,14 @@ class Market():
return ships
def searchFits(self, name):
results = eos.db.searchFits(name)
fits = []
for fit in results:
fits.append((fit.ID, fit.name, fit.ship.item.race, fit.ship.item.name))
return fits
def getMarketRoot(self):
"""
Get the root of the market tree.

View File

@@ -237,6 +237,11 @@ class ShipBrowser(wx.Panel):
for fitID, fitName in cFit.getFitsWithShip(id):
self.searchView.AppendItem(childId, fitName, -1, data=wx.TreeItemData(("fit", fitID)))
for id, name, shipRace, shipName in cMarket.searchFits(search):
iconId = self.raceImageIds[shipRace] if shipRace in self.raceImageIds else -1
self.idRaceMap[id] = shipRace
self.searchView.AppendItem(self.searchRoot, name, iconId, data=wx.TreeItemData(("fit", id)))
#To make sure that the shipView stays in sync, we'll clear its fits data
root = self.shipRoot
child, cookie = self.shipView.GetFirstChild(root)