Revert "Implement basic context meenu sorting (by source context only for now)"

This reverts commit a2bba48190.
This commit is contained in:
DarkPhoenix
2011-04-25 10:41:55 +04:00
parent a2bba48190
commit 3af8792556
2 changed files with 2 additions and 16 deletions

View File

@@ -1,3 +1,2 @@
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit",
"ammoPattern", "project", "factorReload"]
srcContextOrder = ("fittingModule", "fittingCharge", "fittingShip")

View File

@@ -18,7 +18,6 @@
#===============================================================================
import wx
import gui.builtinContextMenus
class ContextMenu(object):
menus = []
@@ -33,19 +32,7 @@ class ContextMenu(object):
menu.selection = selection
empty = True
menu.Bind(wx.EVT_MENU, cls.handler)
# Reorder list of contexts
fullContexts = set(fullContexts)
orderedFullContexts = []
for srcContext in gui.builtinContextMenus.srcContextOrder:
# Compose list of matches against scrContext in provided list of full contexts
filtered = filter(lambda item: item[0] == srcContext, fullContexts)
# Append them to reordered list and remove from source
for match in filtered:
orderedFullContexts.append(match)
fullContexts.discard(match)
# Combine both lists
orderedFullContexts += fullContexts
for i, fullContext in enumerate(orderedFullContexts):
for i, fullContext in enumerate(fullContexts):
amount = 0
srcContext = fullContext[0]
try:
@@ -83,7 +70,7 @@ class ContextMenu(object):
empty = False
if amount > 0 and i != len(orderedFullContexts) - 1:
if amount > 0 and i != len(fullContexts) - 1:
menu.AppendSeparator()
return menu if empty is False else None