MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / getText

Method getText

gui/builtinViewColumns/baseName.py:68–143  ·  view source on GitHub ↗
(self, stuff)

Source from the content-addressed store, hash-verified

66
67
68 def getText(self, stuff):
69 if isinstance(stuff, BaseWrapper):
70 stuff = stuff.item
71
72 if isinstance(stuff, Drone):
73 if FitSvc.getInstance().serviceFittingOptions["expandedMutantNames"]:
74 return "%dx %s" % (stuff.amount, stuff.fullName)
75 else:
76 return "%dx %s" % (stuff.amount, stuff.item.name)
77 elif isinstance(stuff, Fighter):
78 return "%d/%d %s" % \
79 (stuff.amount, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name)
80 elif isinstance(stuff, Cargo):
81 if stuff.item.group.name in ("Cargo Container", "Secure Cargo Container", "Audit Log Secure Container", "Freight Container"):
82 capacity = stuff.item.getAttribute('capacity')
83 if capacity:
84 return "{:d}x {} ({} m\u00B3)".format(stuff.amount, stuff.item.name, formatAmount(capacity, 3, 0, 6))
85 return "{:d}x {}".format(stuff.amount, stuff.item.name)
86 elif isinstance(stuff, Fit):
87 if self.projectedView:
88 # we need a little more information for the projected view
89 fitID = self.mainFrame.getActiveFit()
90 info = stuff.getProjectionInfo(fitID)
91
92 if info:
93 return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name)
94
95 pyfalog.warning("Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff),
96 info)
97 return "<unknown>"
98 else:
99 return "%s (%s)" % (stuff.name, stuff.ship.item.name)
100 elif isinstance(stuff, FitLite):
101 return "{} ({})".format(stuff.name, stuff.shipName)
102 elif isinstance(stuff, Rack):
103 if FitSvc.getInstance().serviceFittingOptions["rackLabels"]:
104 if stuff.slot == FittingSlot.MODE:
105 return '─ {} ─'.format(_t('Tactical Mode'))
106 else:
107 return '─ {} ─'.format(_t('{} {} Slot', '{} {} Slots', stuff.num).format(stuff.num, self.rackTranslations.get(stuff.slot, FittingSlot(stuff.slot).name.capitalize())))
108 else:
109 return ""
110 elif isinstance(stuff, Module):
111 if self.projectedView:
112 # check for projected abyssal name
113 name_check = stuff.item.customName[0:-2]
114 type = AddEnvironmentEffect.abyssal_mapping.get(name_check, None)
115 if type:
116 sMkt = Market.getInstance()
117 type = sMkt.getItem(type)
118 return "{} {}".format(type.name, stuff.item.customName[-1:])
119
120 if stuff.isEmpty:
121 return "%s Slot" % FittingSlot(stuff.slot).name.capitalize()
122 else:
123 if FitSvc.getInstance().serviceFittingOptions["expandedMutantNames"]:
124 return stuff.fullName
125 else:

Callers

nothing calls this directly

Calls 10

formatAmountFunction · 0.90
FittingSlotClass · 0.90
getAttributeMethod · 0.80
getProjectionInfoMethod · 0.80
getItemMethod · 0.80
_tFunction · 0.50
getInstanceMethod · 0.45
getModifiedItemAttrMethod · 0.45
getActiveFitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected