Ensure that in variations menu, items are sorted by name within the same meta group and meta level

This commit is contained in:
DarkPhoenix
2019-04-18 15:54:56 +03:00
parent 7131cdbac6
commit 440b2caa8d

View File

@@ -88,12 +88,13 @@ class ChangeItemToVariation(ContextMenu):
# Sort items by metalevel, and group within that metalevel
items = list(self.variations)
# Sort all items by name first
items.sort(key=lambda x: x.name)
# Do not do any extra sorting for implants
if 'implantItem' in context:
# sort implants based on name
items.sort(key=lambda x: x.name)
pass
# Boosters don't have meta or anything concrete that we can rank by. Go by chance to inflict side effect
elif 'boosterItem' in context:
# boosters don't have meta or anything concrete that we can rank by. Go by chance to inflict side effect
items.sort(key=get_boosterrank)
else:
# sort by group and meta level