Fix jump to for deadspace/storyline items, as well as for rigs &

subsystems
This commit is contained in:
cncfanatics
2010-10-24 15:04:43 +02:00
parent b57b22cb75
commit 5b321d2fb9
2 changed files with 17 additions and 10 deletions

View File

@@ -131,14 +131,14 @@ class MarketBrowser(wx.Panel):
def jump(self, item):
mg = item.marketGroup
cMarket = service.Market.getInstance()
if mg is None and item.metaGroup is not None:
mg = item.metaGroup.parent.marketGroup
cMarket = service.Market.getInstance()
for btn in ("normal", "faction", "complex", "officer"):
getattr(self, btn).SetValue(False)
cMarket.disableMetaGroup(btn)
metaGroup = item.metaGroup.name.lower()
metaGroup = cMarket.getMetaName(item.metaGroup.ID)
getattr(self, metaGroup).SetValue(True)
cMarket.activateMetaGroup(metaGroup)
self.searching = False
@@ -151,11 +151,16 @@ class MarketBrowser(wx.Panel):
jumpList.append(mg.ID)
mg = mg.parent
cMarket.MARKET_GROUPS
for id in cMarket.MARKET_GROUPS:
if id in jumpList:
jumpList = jumpList[:jumpList.index(id)+1]
item = self.marketRoot
for i in range(len(jumpList) -1, -1, -1):
target = jumpList[i]
child, cookie = self.marketView.GetFirstChild(item)
while self.marketView.GetItemPyData(child) != target and child.IsOk():
while self.marketView.GetItemPyData(child) != target:
child, cookie = self.marketView.GetNextChild(item, cookie)
item = child

View File

@@ -176,6 +176,13 @@ class Market():
def getGroup(self, groupId):
return eos.db.getGroup(groupId)
MARKET_GROUPS = (9, #Modules
1111, #Rigs
157, #Drones
11, #Ammo
1112, #Subsystems
24) #Implants & Boosters
def getMarketRoot(self):
"""
Get the root of the market tree.
@@ -183,14 +190,9 @@ class Market():
the ID, the name and the icon of the group
"""
marketGroups = (9, #Modules
1111, #Rigs
157, #Drones
11, #Ammo
1112, #Subsystems
24) #Implants & Boosters
root = []
for id in marketGroups:
for id in self.MARKET_GROUPS:
mg = eos.db.getMarketGroup(id, eager="icon")
root.append((id, mg.name, self.figureIcon(mg)))