Performance fix for Damage Editors
Also fixed a chmod divot
This commit is contained in:
0
gui/builtinContextMenus/ammoPattern.py
Executable file → Normal file
0
gui/builtinContextMenus/ammoPattern.py
Executable file → Normal 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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user