Sort itemView of the marketbrowser by meta level, highest meta level on top, ticket 90

This commit is contained in:
Weeknie
2010-10-25 16:25:35 +02:00
parent c563839429
commit f5e83f0415

View File

@@ -23,8 +23,10 @@ import wx.lib.newevent
import service import service
import bitmapLoader import bitmapLoader
import gui.mainFrame import gui.mainFrame
import eos.db
from gui.cachingImageList import CachingImageList from gui.cachingImageList import CachingImageList
from gui.contextMenu import ContextMenu from gui.contextMenu import ContextMenu
from eos.saveddata import module
ItemSelected, ITEM_SELECTED = wx.lib.newevent.NewEvent() ItemSelected, ITEM_SELECTED = wx.lib.newevent.NewEvent()
@@ -333,11 +335,15 @@ class MarketBrowser(wx.Panel):
self.toggleButtons(usedMetas) self.toggleButtons(usedMetas)
def sort(id1, id2): def sort(id1, id2):
grp = cmp(idGroupMap[id1], idGroupMap[id2]) item1 = eos.db.getItem(id1)
if grp != 0: item2 = eos.db.getItem(id2)
return grp
if item1.getAttribute("metaLevel") > item2.getAttribute("metaLevel"):
return cmp(idNameMap[id1], idNameMap[id2]) return -1
elif item1.getAttribute("metaLevel") == item2.getAttribute("metaLevel"):
return 0
else:
return 1
self.itemView.SortItems(sort) self.itemView.SortItems(sort)
self.itemView.SetColumnWidth(0, wx.LIST_AUTOSIZE) self.itemView.SetColumnWidth(0, wx.LIST_AUTOSIZE)