From 5225647278e8d7f61c6846ca022b508358290a9c Mon Sep 17 00:00:00 2001 From: Corollax Date: Thu, 28 Oct 2010 14:11:15 -0500 Subject: [PATCH] Performance fix for Damage Editors Also fixed a chmod divot --- gui/builtinContextMenus/ammoPattern.py | 0 gui/builtinContextMenus/damagePattern.py | 5 ++--- gui/patternEditor.py | 7 +++---- 3 files changed, 5 insertions(+), 7 deletions(-) mode change 100755 => 100644 gui/builtinContextMenus/ammoPattern.py diff --git a/gui/builtinContextMenus/ammoPattern.py b/gui/builtinContextMenus/ammoPattern.py old mode 100755 new mode 100644 diff --git a/gui/builtinContextMenus/damagePattern.py b/gui/builtinContextMenus/damagePattern.py index 4af1ee318..a2da50777 100644 --- a/gui/builtinContextMenus/damagePattern.py +++ b/gui/builtinContextMenus/damagePattern.py @@ -12,12 +12,11 @@ class DamagePattern(ContextMenu): def display(self, context, selection): return context in ("resistancesViewFull",) and self.mainFrame.getActiveFit() is not None - SPCL_PTRN = ("Selected Ammo", "Uniform") def getText(self, context, selection): sDP = service.DamagePattern.getInstance() self.patterns = sDP.getDamagePatternList() - self.patterns.sort( key=lambda p: (p.name in - DamagePattern.SPCL_PTRN, p.name) ) + self.patterns.sort( key=lambda p: (p.name in ["Selected Ammo", + "Uniform"], p.name) ) m = map(lambda p: p.name, self.patterns) return m diff --git a/gui/patternEditor.py b/gui/patternEditor.py index 1d9996690..8d6b72718 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -40,10 +40,9 @@ class DmgPatternEditorDlg (wx.Dialog): self.choices = cDP.getDamagePatternList() # Remove "Uniform" and "Selected Ammo" Damage Patterns - names = map(lambda p: p.name, self.choices) - del self.choices[names.index("Uniform")] - names.remove("Uniform") - del self.choices[names.index("Selected Ammo")] + for dp in self.choices: + if dp.name in ("Uniform", "Selected Ammo"): + self.choices.remove(dp) # Sort the remaining list and continue on self.choices.sort(key=lambda p: p.name) self.ccDmgPattern = wx.Choice(self, choices=map(lambda p: p.name, self.choices))