Revert "Implement basic context meenu sorting (by source context only for now)"
This reverts commit a2bba48190.
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit",
|
||||
"ammoPattern", "project", "factorReload"]
|
||||
srcContextOrder = ("fittingModule", "fittingCharge", "fittingShip")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user