From 440b2caa8dd394858b0d8aff338da11ba50ce5eb Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Thu, 18 Apr 2019 15:54:56 +0300 Subject: [PATCH] Ensure that in variations menu, items are sorted by name within the same meta group and meta level --- gui/builtinContextMenus/itemVariationChange.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/builtinContextMenus/itemVariationChange.py b/gui/builtinContextMenus/itemVariationChange.py index 0ff0cdfaf..27eb54e9a 100644 --- a/gui/builtinContextMenus/itemVariationChange.py +++ b/gui/builtinContextMenus/itemVariationChange.py @@ -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