Show short profile name in graphs
This commit is contained in:
@@ -74,8 +74,8 @@ BUILTINS = OrderedDict([
|
||||
(-48, ('[Projectile Ammo]Proton', 3, 0, 2, 0)),
|
||||
(-49, ('[Projectile Ammo]Carbonized Lead', 0, 0, 4, 1)),
|
||||
(-50, ('[Projectile Ammo]Nuclear', 0, 0, 1, 4)),
|
||||
# Different sizes of plasma do different damage, the values here are
|
||||
# average of proportions across sizes
|
||||
# Different sizes of plasma do different damage ratios, the values here
|
||||
# are average of ratios across sizes
|
||||
(-51, ('[Exotic Plasma]|[T2] Occult', 0, 55863, 0, 44137)),
|
||||
(-52, ('[Exotic Plasma]|[T2] Mystic', 0, 66319, 0, 33681)),
|
||||
(-53, ('[Exotic Plasma]Tetryon', 0, 69208, 0, 30792)),
|
||||
@@ -282,6 +282,11 @@ class DamagePattern:
|
||||
def name(self):
|
||||
return self.rawName
|
||||
|
||||
@property
|
||||
def fullName(self):
|
||||
categories, tail = self.__parseRawName()
|
||||
return '{}{}'.format(''.join('[{}]'.format(c) for c in categories), tail)
|
||||
|
||||
@property
|
||||
def shortName(self):
|
||||
return self.__parseRawName()[1]
|
||||
@@ -291,16 +296,16 @@ class DamagePattern:
|
||||
return self.__parseRawName()[0]
|
||||
|
||||
def __parseRawName(self):
|
||||
hierarchy = []
|
||||
categories = []
|
||||
remainingName = self.rawName.strip() if self.rawName else ''
|
||||
while True:
|
||||
start, end = remainingName.find('['), remainingName.find(']')
|
||||
if start == -1 or end == -1:
|
||||
return hierarchy, remainingName
|
||||
return categories, remainingName
|
||||
splitter = remainingName.find('|')
|
||||
if splitter != -1 and splitter == start - 1:
|
||||
return hierarchy, remainingName[1:]
|
||||
hierarchy.append(remainingName[start + 1:end])
|
||||
return categories, remainingName[1:]
|
||||
categories.append(remainingName[start + 1:end])
|
||||
remainingName = remainingName[end + 1:].strip()
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
|
||||
@@ -265,6 +265,11 @@ class TargetProfile:
|
||||
def name(self):
|
||||
return self.rawName
|
||||
|
||||
@property
|
||||
def fullName(self):
|
||||
categories, tail = self.__parseRawName()
|
||||
return '{}{}'.format(''.join('[{}]'.format(c) for c in categories), tail)
|
||||
|
||||
@property
|
||||
def shortName(self):
|
||||
return self.__parseRawName()[1]
|
||||
|
||||
@@ -43,7 +43,7 @@ class BaseWrapper:
|
||||
if self.isFit:
|
||||
return '{} ({})'.format(self.item.name, self.item.ship.item.name)
|
||||
elif self.isProfile:
|
||||
return self.item.name
|
||||
return self.item.fullName
|
||||
return ''
|
||||
|
||||
@property
|
||||
@@ -51,7 +51,7 @@ class BaseWrapper:
|
||||
if self.isFit:
|
||||
return '{} ({})'.format(self.item.name, self.item.ship.item.getShortName())
|
||||
elif self.isProfile:
|
||||
return self.item.name
|
||||
return self.item.shortName
|
||||
return ''
|
||||
|
||||
def getMaxVelocity(self, extraMultipliers=None, ignoreAfflictors=()):
|
||||
|
||||
@@ -32,7 +32,7 @@ class ChangeDamagePattern(ContextMenuUnconditional):
|
||||
# Order here is important: patterns with duplicate names from the latter will overwrite
|
||||
# patterns from the former
|
||||
self.patterns = list(chain(sDP.getBuiltinDamagePatternList(), sDP.getUserDamagePatternList()))
|
||||
self.patterns.sort(key=lambda p: (p.name not in ["Uniform", "Selected Ammo"], p.name))
|
||||
self.patterns.sort(key=lambda p: (p.fullName not in ["Uniform", "Selected Ammo"], p.fullName))
|
||||
|
||||
self.patternEventMap = {}
|
||||
|
||||
|
||||
@@ -48,21 +48,10 @@ class TargetProfileAdder(ContextMenuUnconditional):
|
||||
self.callingWindow = callingWindow
|
||||
sTR = svc_TargetProfile.getInstance()
|
||||
profiles = list(chain(sTR.getBuiltinTargetProfileList(), sTR.getUserTargetProfileList()))
|
||||
profiles.sort(key=lambda p: (p.name in ['None'], p.name))
|
||||
profiles.sort(key=lambda p: p.fullName)
|
||||
|
||||
self.profileEventMap = {}
|
||||
items = (OrderedDict(), OrderedDict())
|
||||
for profile in profiles:
|
||||
remainingName = profile.name.strip()
|
||||
container = items
|
||||
while True:
|
||||
start, end = remainingName.find('['), remainingName.find(']')
|
||||
if start == -1 or end == -1:
|
||||
container[0][remainingName] = profile
|
||||
break
|
||||
container = container[1].setdefault(remainingName[start + 1:end], (OrderedDict(), OrderedDict()))
|
||||
remainingName = remainingName[end + 1:].strip()
|
||||
items = (OrderedDict(), OrderedDict())
|
||||
for profile in profiles:
|
||||
container = items
|
||||
for categoryName in profile.hierarchy:
|
||||
@@ -76,7 +65,7 @@ class TargetProfileAdder(ContextMenuUnconditional):
|
||||
menu = wx.Menu()
|
||||
if first:
|
||||
idealProfile = TargetProfile.getIdeal()
|
||||
mitem = self._addProfile(rootMenu if msw else parentMenu, idealProfile, idealProfile.name)
|
||||
mitem = self._addProfile(rootMenu if msw else parentMenu, idealProfile, idealProfile.fullName)
|
||||
menu.Append(mitem)
|
||||
for name, pattern in container[0].items():
|
||||
menuItem = self._addProfile(rootMenu if msw else parentMenu, pattern, name)
|
||||
|
||||
@@ -60,7 +60,7 @@ class TargetProfileSwitcher(ContextMenuUnconditional):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
sTR = svc_TargetProfile.getInstance()
|
||||
profiles = list(chain(sTR.getBuiltinTargetProfileList(), sTR.getUserTargetProfileList()))
|
||||
profiles.sort(key=lambda p: (p.name in ['None'], p.name))
|
||||
profiles.sort(key=lambda p: p.fullName)
|
||||
|
||||
self.profileEventMap = {}
|
||||
items = (OrderedDict(), OrderedDict())
|
||||
|
||||
@@ -111,7 +111,7 @@ class BaseName(ViewColumn):
|
||||
elif isinstance(stuff, Implant):
|
||||
return stuff.item.name
|
||||
elif isinstance(stuff, TargetProfile):
|
||||
return stuff.name
|
||||
return stuff.shortName
|
||||
else:
|
||||
item = getattr(stuff, "item", stuff)
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class DmgPatternNameValidator(BaseValidator):
|
||||
try:
|
||||
if len(text) == 0:
|
||||
raise ValueError("You must supply a name for your Damage Profile!")
|
||||
elif text in [x.name for x in entityEditor.choices]:
|
||||
elif text in [x.rawName for x in entityEditor.choices]:
|
||||
raise ValueError("Damage Profile name already in use, please choose another.")
|
||||
|
||||
return True
|
||||
@@ -66,8 +66,8 @@ class DmgPatternEntityEditor(EntityEditor):
|
||||
|
||||
def getEntitiesFromContext(self):
|
||||
sDP = DamagePattern.getInstance()
|
||||
choices = sorted(sDP.getUserDamagePatternList(), key=lambda p: p.name)
|
||||
return [c for c in choices if c.name != "Selected Ammo"]
|
||||
choices = sorted(sDP.getUserDamagePatternList(), key=lambda p: p.rawName)
|
||||
return [c for c in choices if c.rawName != "Selected Ammo"]
|
||||
|
||||
def DoNew(self, name):
|
||||
sDP = DamagePattern.getInstance()
|
||||
@@ -237,7 +237,7 @@ class DmgPatternEditor(AuxiliaryFrame):
|
||||
if p is None:
|
||||
return
|
||||
|
||||
if p.name == "Uniform" or p.name == "Selected Ammo":
|
||||
if p.rawName == "Uniform" or p.rawName == "Selected Ammo":
|
||||
self.restrict()
|
||||
else:
|
||||
self.unrestrict()
|
||||
|
||||
@@ -68,7 +68,7 @@ class TargetProfileNameValidator(BaseValidator):
|
||||
try:
|
||||
if len(text) == 0:
|
||||
raise ValueError("You must supply a name for your Target Profile!")
|
||||
elif text in [x.name for x in entityEditor.choices]:
|
||||
elif text in [x.rawName for x in entityEditor.choices]:
|
||||
raise ValueError("Target Profile name already in use, please choose another.")
|
||||
|
||||
return True
|
||||
@@ -88,7 +88,7 @@ class TargetProfileEntityEditor(EntityEditor):
|
||||
|
||||
def getEntitiesFromContext(self):
|
||||
sTR = TargetProfile.getInstance()
|
||||
choices = sorted(sTR.getUserTargetProfileList(), key=lambda p: p.name)
|
||||
choices = sorted(sTR.getUserTargetProfileList(), key=lambda p: p.rawName)
|
||||
return choices
|
||||
|
||||
def DoNew(self, name):
|
||||
|
||||
Reference in New Issue
Block a user