From b8c42319e88b9b0fcd986917e636b9c08013f232 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 22 Aug 2010 22:58:52 +0400 Subject: [PATCH] Search fits too --- controller/market.py | 8 ++++++++ gui/shipBrowser.py | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/controller/market.py b/controller/market.py index c0b4eed0a..a0b650e49 100644 --- a/controller/market.py +++ b/controller/market.py @@ -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. diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 83430138e..1a33e400c 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -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)