Performance fix for Damage Editors

Also fixed a chmod divot
This commit is contained in:
Corollax
2010-10-28 14:11:15 -05:00
parent 45f837e446
commit 5225647278
3 changed files with 5 additions and 7 deletions

0
gui/builtinContextMenus/ammoPattern.py Executable file → Normal file
View File

View File

@@ -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

View File

@@ -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))