Do some ground work on implementing metaGroup filtertoggles. Rest tomorrow, too tiiiiired.
This commit is contained in:
@@ -23,6 +23,11 @@ class Market():
|
||||
instance = None
|
||||
FORCED_SHIPS = ("Freiki", "Mimir", "Utu", "Adrestia", "Ibis", "Impairor", "Velator", "Reaper")
|
||||
FORCED_GROUPS = ("Rookie ship",)
|
||||
META_MAP = {"normal": (1, 2,),
|
||||
"faction": (4, 3),
|
||||
"complex": (6,),
|
||||
"officer": (5,)}
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
if cls.instance == None:
|
||||
@@ -30,6 +35,9 @@ class Market():
|
||||
|
||||
return cls.instance
|
||||
|
||||
def __init__(self):
|
||||
self.activeMetas = set()
|
||||
|
||||
def getItems(self, id):
|
||||
"""
|
||||
Get the items contained in the marketGroup with the passed id.
|
||||
@@ -114,3 +122,12 @@ class Market():
|
||||
root.append((id, mg.name, mg.icon.iconFile if mg.icon else ""))
|
||||
|
||||
return root
|
||||
|
||||
def activateMetaGroup(self, name):
|
||||
self.activeMetas.add(name)
|
||||
|
||||
def disableMetaGroup(self, name):
|
||||
self.activeMetas.remove(name)
|
||||
|
||||
def getVariations(self, item):
|
||||
pass
|
||||
|
||||
@@ -93,10 +93,12 @@ class MarketBrowser(wx.Panel):
|
||||
p.SetSizer(box)
|
||||
vbox.Add(p, 0, wx.EXPAND)
|
||||
for name in ("normal", "faction", "complex", "officer"):
|
||||
btn = wx.Button(p, wx.ID_ANY, name.capitalize(), style=wx.BU_EXACTFIT)
|
||||
btn = wx.ToggleButton(p, wx.ID_ANY, name.capitalize(), style=wx.BU_EXACTFIT)
|
||||
setattr(self, name, btn)
|
||||
box.Add(btn, 1, wx.ALIGN_CENTER)
|
||||
btn.Bind(wx.EVT_TOGGLEBUTTON, self.toggleMetagroup)
|
||||
|
||||
self.normal.SetValue(True)
|
||||
p.SetMinSize((wx.SIZE_AUTO_WIDTH, btn.GetSize()[1] + 5))
|
||||
|
||||
def addMarketViewImage(self, iconFile):
|
||||
@@ -154,3 +156,12 @@ class MarketBrowser(wx.Panel):
|
||||
|
||||
self.itemView.SortItems(lambda id1, id2: cmp(idNameMap[id1], idNameMap[id2]))
|
||||
self.itemView.SetColumnWidth(0, wx.LIST_AUTOSIZE)
|
||||
|
||||
def toggleMetagroup(self, event):
|
||||
ctrl = wx.GetMouseState().ControlDown()
|
||||
if not ctrl:
|
||||
for name in ("normal", "faction", "complex", "officer"):
|
||||
getattr(self, name).SetValue(False)
|
||||
|
||||
event.EventObject.SetValue(True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user