def getText(self, stuff): if isinstance(stuff, Drone): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fighter): return "%d/%d %s" % \ (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name) elif isinstance(stuff, Cargo): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fit): if self.projectedView: # we need a little more information for the projected view fitID = self.mainFrame.getActiveFit() info = stuff.getProjectionInfo(fitID) if info: return "%dx %s (%s)" % (stuff.getProjectionInfo( fitID).amount, stuff.name, stuff.ship.item.name) pyfalog.warning( "Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff), info) return "<unknown>" else: return "%s (%s)" % (stuff.name, stuff.ship.item.name) elif isinstance(stuff, Rack): if FitSvc.getInstance().serviceFittingOptions["rackLabels"]: if stuff.slot == Slot.MODE: return u'─ Tactical Mode ─' else: return u'─ {} Slots ─'.format( Slot.getName(stuff.slot).capitalize()) else: return "" elif isinstance(stuff, Module): if stuff.isEmpty: return "%s Slot" % Slot.getName(stuff.slot).capitalize() else: return stuff.item.name elif isinstance(stuff, Implant): return stuff.item.name elif isinstance(stuff, TargetResists): name = getattr(stuff, "name") if name is None: pyfalog.warning("no name for TargetResists instance") name = "?" return name else: item = getattr(stuff, "item", stuff) if FitSvc.getInstance( ).serviceFittingOptions["showMarketShortcuts"]: marketShortcut = getattr(item, "marketShortcut", None) if marketShortcut: # use unicode subscript to display shortcut value shortcut = unichr(marketShortcut + 8320) + u" " del item.marketShortcut return shortcut + item.name return item.name
def getText(self, stuff): if isinstance(stuff, Drone): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fighter): return "%d/%d %s" % \ (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name) elif isinstance(stuff, Cargo): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fit): if self.projectedView: # we need a little more information for the projected view fitID = self.mainFrame.getActiveFit() info = stuff.getProjectionInfo(fitID) if info: return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name) pyfalog.warning("Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff), info) return "<unknown>" else: return "%s (%s)" % (stuff.name, stuff.ship.item.name) elif isinstance(stuff, Rack): if FitSvc.getInstance().serviceFittingOptions["rackLabels"]: if stuff.slot == Slot.MODE: return '─ Tactical Mode ─' else: return '─ {} {} Slot{}─'.format(stuff.num, Slot.getName(stuff.slot).capitalize(), '' if stuff.num == 1 else 's') else: return "" elif isinstance(stuff, Module): if self.projectedView: # check for projected abyssal name name_check = stuff.item.name[0:-2] type = WhProjector.abyssal_mapping.get(name_check, None) if type: sMkt = Market.getInstance() type = sMkt.getItem(type) return "{} {}".format(type.name, stuff.item.name[-1:]) if stuff.isEmpty: return "%s Slot" % Slot.getName(stuff.slot).capitalize() else: return stuff.item.name elif isinstance(stuff, Implant): return stuff.item.name else: item = getattr(stuff, "item", stuff) if FitSvc.getInstance().serviceFittingOptions["showMarketShortcuts"]: marketShortcut = getattr(item, "marketShortcut", None) if marketShortcut: # use unicode subscript to display shortcut value shortcut = chr(marketShortcut + 8320) + " " del item.marketShortcut return shortcut + item.name return item.name
def getText(self, stuff): if isinstance(stuff, Drone): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fighter): return "%d/%d %s" % ( stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name) elif isinstance(stuff, Cargo): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, s_Fit): if self.projectedView: # we need a little more information for the projected view fitID = self.mainFrame.getActiveFit() return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name) else: return "%s (%s)" % (stuff.name, stuff.ship.item.name) elif isinstance(stuff, Rack): if s_Fit.getInstance().serviceFittingOptions["rackLabels"]: if stuff.slot == Slot.MODE: return u'─ Tactical Mode ─' else: return u'─ {} Slots ─'.format( Slot.getName(stuff.slot).capitalize()) else: return "" elif isinstance(stuff, Module): if stuff.isEmpty: return "%s Slot" % Slot.getName(stuff.slot).capitalize() else: return stuff.item.name elif isinstance(stuff, Implant): return stuff.item.name else: item = getattr(stuff, "item", stuff) if s_Fit.getInstance( ).serviceFittingOptions["showMarketShortcuts"]: marketShortcut = getattr(item, "marketShortcut", None) if marketShortcut: # use unicode subscript to display shortcut value shortcut = unichr(marketShortcut + 8320) + u" " del item.marketShortcut return shortcut + item.name return item.name
def getImageId(self, stuff): if isinstance(stuff, Drone): return -1 elif isinstance(stuff, Fit): return self.shipImage elif isinstance(stuff, Rack): return -1 elif isinstance(stuff, Implant): if stuff.character: # if it has a character as it's parent return self.fittingView.imageList.GetImageIndex( "character_small", "gui") else: return self.shipImage elif isinstance(stuff, Module): if stuff.isEmpty: return self.fittingView.imageList.GetImageIndex( "slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui") else: return self.loadIconFile( stuff.item.icon.iconFile if stuff.item.icon else "") elif isinstance(stuff, TargetResists): return self.fittingView.imageList.GetImageIndex( "explosive_small", "gui") item = getattr(stuff, "item", stuff) if not hasattr(item, "icon"): pyfalog.critical("item class %s has no .icon attribute" % (type(stuff).__name__, )) return -1 return self.loadIconFile(item.icon.iconFile if item.icon else "")
def _exportEftBase(fit): offineSuffix = " /OFFLINE" export = "[%s, %s]\n" % (fit.ship.item.name, fit.name) stuff = {} sFit = Fit.getInstance() for module in fit.modules: slot = module.slot if slot not in stuff: stuff[slot] = [] curr = module.item.name if module.item else ( "[Empty %s slot]" % Slot.getName(slot).capitalize() if slot is not None else "") if module.charge and sFit.serviceFittingOptions["exportCharges"]: curr += ", %s" % module.charge.name if module.state == State.OFFLINE: curr += offineSuffix curr += "\n" stuff[slot].append(curr) for slotType in EFT_SLOT_ORDER: data = stuff.get(slotType) if data is not None: export += "\n" for curr in data: export += curr if len(fit.drones) > 0: export += "\n\n" for drone in fit.drones: export += "%s x%s\n" % (drone.item.name, drone.amount) if len(fit.fighters) > 0: export += "\n\n" for fighter in fit.fighters: export += "%s x%s\n" % (fighter.item.name, fighter.amountActive) if export[-1] == "\n": export = export[:-1] return export
def getImageId(self, stuff): if isinstance(stuff, Drone): return -1 elif isinstance(stuff, Fit): return self.shipImage elif isinstance(stuff, Rack): return -1 elif isinstance(stuff, Implant): if stuff.character: # if it has a character as it's parent return self.fittingView.imageList.GetImageIndex("character_small", "gui") else: return self.shipImage elif isinstance(stuff, Module): if stuff.isEmpty: return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui") else: return self.loadIconFile(stuff.item.icon.iconFile if stuff.item.icon else "") item = getattr(stuff, "item", stuff) return self.loadIconFile(item.icon.iconFile if item.icon else "")
def getImageId(self, stuff): if isinstance(stuff, Drone): return -1 elif isinstance(stuff, Fit): return self.shipImage elif isinstance(stuff, Rack): return -1 elif isinstance(stuff, Implant): if stuff.character: # if it has a character as it's parent return self.fittingView.imageList.GetImageIndex("character_small", "gui") else: return self.shipImage elif isinstance(stuff, Module): if stuff.isEmpty: return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui") else: return self.loadIconFile(stuff.item.iconID or "") item = getattr(stuff, "item", stuff) return self.loadIconFile(item.iconID)
def exportXml(iportuser, *fits): doc = xml.dom.minidom.Document() fittings = doc.createElement("fittings") # fit count fit_count = len(fits) fittings.setAttribute("count", "%s" % fit_count) doc.appendChild(fittings) sFit = svcFit.getInstance() for i, fit in enumerate(fits): try: fitting = doc.createElement("fitting") fitting.setAttribute("name", fit.name) fittings.appendChild(fitting) description = doc.createElement("description") # -- 170327 Ignored description -- try: notes = fit.notes # unicode if notes: notes = notes[:397] + '...' if len(notes) > 400 else notes description.setAttribute( "value", re.sub("(\r|\n|\r\n)+", "<br>", notes) if notes is not None else "") except Exception as e: pyfalog.warning("read description is failed, msg=%s\n" % e.args) fitting.appendChild(description) shipType = doc.createElement("shipType") shipType.setAttribute("value", fit.ship.name) fitting.appendChild(shipType) charges = {} slotNum = {} for module in fit.modules: if module.isEmpty: continue slot = module.slot if slot == Slot.SUBSYSTEM: # Order of subsystem matters based on this attr. See GH issue #130 slotId = module.getModifiedItemAttr("subSystemSlot") - 125 else: if slot not in slotNum: slotNum[slot] = 0 slotId = slotNum[slot] slotNum[slot] += 1 hardware = doc.createElement("hardware") hardware.setAttribute("type", module.item.name) slotName = Slot.getName(slot).lower() slotName = slotName if slotName != "high" else "hi" hardware.setAttribute("slot", "%s slot %d" % (slotName, slotId)) fitting.appendChild(hardware) if module.charge and sFit.serviceFittingOptions[ "exportCharges"]: if module.charge.name not in charges: charges[module.charge.name] = 0 # `or 1` because some charges (ie scripts) are without qty charges[module.charge.name] += module.numCharges or 1 for drone in fit.drones: hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % drone.amount) hardware.setAttribute("slot", "drone bay") hardware.setAttribute("type", drone.item.name) fitting.appendChild(hardware) for fighter in fit.fighters: hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % fighter.amountActive) hardware.setAttribute("slot", "fighter bay") hardware.setAttribute("type", fighter.item.name) fitting.appendChild(hardware) for cargo in fit.cargo: if cargo.item.name not in charges: charges[cargo.item.name] = 0 charges[cargo.item.name] += cargo.amount for name, qty in list(charges.items()): hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % qty) hardware.setAttribute("slot", "cargo") hardware.setAttribute("type", name) fitting.appendChild(hardware) except Exception as e: pyfalog.error("Failed on fitID: %d, message: %s" % e.message) continue finally: if iportuser: processing_notify( iportuser, IPortUser.PROCESS_EXPORT | IPortUser.ID_UPDATE, (i, "convert to xml (%s/%s) %s" % (i + 1, fit_count, fit.ship.name))) return doc.toprettyxml()
def exportEft(fit, options): # EFT formatted export is split in several sections, each section is # separated from another using 2 blank lines. Sections might have several # sub-sections, which are separated by 1 blank line sections = [] header = '[{}, {}]'.format(fit.ship.item.name, fit.name) # Section 1: modules, rigs, subsystems, services modsBySlotType = {} sFit = svcFit.getInstance() for module in fit.modules: modsBySlotType.setdefault(module.slot, []).append(module) modSection = [] mutants = {} # Format: {reference number: module} mutantReference = 1 for slotType in SLOT_ORDER: rackLines = [] modules = modsBySlotType.get(slotType, ()) for module in modules: if module.item: mutated = bool(module.mutators) # if module was mutated, use base item name for export if mutated: modName = module.baseItem.name else: modName = module.item.name if mutated and options & Options.MUTATIONS.value: mutants[mutantReference] = module mutationSuffix = ' [{}]'.format(mutantReference) mutantReference += 1 else: mutationSuffix = '' modOfflineSuffix = ' {}'.format( OFFLINE_SUFFIX) if module.state == State.OFFLINE else '' if module.charge and sFit.serviceFittingOptions[ 'exportCharges']: rackLines.append('{}, {}{}{}'.format( modName, module.charge.name, modOfflineSuffix, mutationSuffix)) else: rackLines.append('{}{}{}'.format(modName, modOfflineSuffix, mutationSuffix)) else: rackLines.append('[Empty {} slot]'.format( Slot.getName(slotType).capitalize( ) if slotType is not None else '')) if rackLines: modSection.append('\n'.join(rackLines)) if modSection: sections.append('\n\n'.join(modSection)) # Section 2: drones, fighters minionSection = [] droneLines = [] for drone in sorted(fit.drones, key=lambda d: d.item.name): droneLines.append('{} x{}'.format(drone.item.name, drone.amount)) if droneLines: minionSection.append('\n'.join(droneLines)) fighterLines = [] for fighter in sorted(fit.fighters, key=lambda f: f.item.name): fighterLines.append('{} x{}'.format(fighter.item.name, fighter.amountActive)) if fighterLines: minionSection.append('\n'.join(fighterLines)) if minionSection: sections.append('\n\n'.join(minionSection)) # Section 3: implants, boosters if options & Options.IMPLANTS.value: charSection = [] implantLines = [] for implant in fit.implants: implantLines.append(implant.item.name) if implantLines: charSection.append('\n'.join(implantLines)) boosterLines = [] for booster in fit.boosters: boosterLines.append(booster.item.name) if boosterLines: charSection.append('\n'.join(boosterLines)) if charSection: sections.append('\n\n'.join(charSection)) # Section 4: cargo cargoLines = [] for cargo in sorted( fit.cargo, key=lambda c: (c.item.group.category.name, c.item.group.name, c.item.name)): cargoLines.append('{} x{}'.format(cargo.item.name, cargo.amount)) if cargoLines: sections.append('\n'.join(cargoLines)) # Section 5: mutated modules' details mutationLines = [] if mutants and options & Options.MUTATIONS.value: for mutantReference in sorted(mutants): mutant = mutants[mutantReference] mutationLines.append( renderMutant(mutant, firstPrefix='[{}] '.format(mutantReference), prefix=' ')) if mutationLines: sections.append('\n'.join(mutationLines)) return '{}\n\n{}'.format(header, '\n\n\n'.join(sections))
def exportXml(cls, callback=None, *fits): doc = xml.dom.minidom.Document() fittings = doc.createElement("fittings") doc.appendChild(fittings) sFit = Fit.getInstance() for i, fit in enumerate(fits): try: fitting = doc.createElement("fitting") fitting.setAttribute("name", fit.name) fittings.appendChild(fitting) description = doc.createElement("description") description.setAttribute("value", "") fitting.appendChild(description) shipType = doc.createElement("shipType") shipType.setAttribute("value", fit.ship.item.name) fitting.appendChild(shipType) charges = {} slotNum = {} for module in fit.modules: if module.isEmpty: continue slot = module.slot if slot == Slot.SUBSYSTEM: # Order of subsystem matters based on this attr. See GH issue #130 slotId = module.getModifiedItemAttr( "subSystemSlot") - 125 else: if slot not in slotNum: slotNum[slot] = 0 slotId = slotNum[slot] slotNum[slot] += 1 hardware = doc.createElement("hardware") hardware.setAttribute("type", module.item.name) slotName = Slot.getName(slot).lower() slotName = slotName if slotName != "high" else "hi" hardware.setAttribute("slot", "%s slot %d" % (slotName, slotId)) fitting.appendChild(hardware) if module.charge and sFit.serviceFittingOptions[ "exportCharges"]: if module.charge.name not in charges: charges[module.charge.name] = 0 # `or 1` because some charges (ie scripts) are without qty charges[module.charge.name] += module.numCharges or 1 for drone in fit.drones: hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % drone.amount) hardware.setAttribute("slot", "drone bay") hardware.setAttribute("type", drone.item.name) fitting.appendChild(hardware) for cargo in fit.cargo: if cargo.item.name not in charges: charges[cargo.item.name] = 0 charges[cargo.item.name] += cargo.amount for name, qty in charges.items(): hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % qty) hardware.setAttribute("slot", "cargo") hardware.setAttribute("type", name) fitting.appendChild(hardware) except: print("Failed on fitID: %d" % fit.ID) continue finally: if callback: wx.CallAfter(callback, i) return doc.toprettyxml()
def exportEft(fit, options): # EFT formatted export is split in several sections, each section is # separated from another using 2 blank lines. Sections might have several # sub-sections, which are separated by 1 blank line sections = [] header = '[{}, {}]'.format(fit.ship.item.name, fit.name) # Section 1: modules, rigs, subsystems, services modsBySlotType = {} sFit = svcFit.getInstance() for module in fit.modules: modsBySlotType.setdefault(module.slot, []).append(module) modSection = [] mutants = {} # Format: {reference number: module} mutantReference = 1 for slotType in SLOT_ORDER: rackLines = [] modules = modsBySlotType.get(slotType, ()) for module in modules: if module.item: mutated = bool(module.mutators) # if module was mutated, use base item name for export if mutated: modName = module.baseItem.name else: modName = module.item.name if mutated and options & Options.MUTATIONS.value: mutants[mutantReference] = module mutationSuffix = ' [{}]'.format(mutantReference) mutantReference += 1 else: mutationSuffix = '' modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == State.OFFLINE else '' if module.charge and sFit.serviceFittingOptions['exportCharges']: rackLines.append('{}, {}{}{}'.format( modName, module.charge.name, modOfflineSuffix, mutationSuffix)) else: rackLines.append('{}{}{}'.format(modName, modOfflineSuffix, mutationSuffix)) else: rackLines.append('[Empty {} slot]'.format( Slot.getName(slotType).capitalize() if slotType is not None else '')) if rackLines: modSection.append('\n'.join(rackLines)) if modSection: sections.append('\n\n'.join(modSection)) # Section 2: drones, fighters minionSection = [] droneLines = [] for drone in sorted(fit.drones, key=lambda d: d.item.name): droneLines.append('{} x{}'.format(drone.item.name, drone.amount)) if droneLines: minionSection.append('\n'.join(droneLines)) fighterLines = [] for fighter in sorted(fit.fighters, key=lambda f: f.item.name): fighterLines.append('{} x{}'.format(fighter.item.name, fighter.amountActive)) if fighterLines: minionSection.append('\n'.join(fighterLines)) if minionSection: sections.append('\n\n'.join(minionSection)) # Section 3: implants, boosters if options & Options.IMPLANTS.value: charSection = [] implantLines = [] for implant in fit.implants: implantLines.append(implant.item.name) if implantLines: charSection.append('\n'.join(implantLines)) boosterLines = [] for booster in fit.boosters: boosterLines.append(booster.item.name) if boosterLines: charSection.append('\n'.join(boosterLines)) if charSection: sections.append('\n\n'.join(charSection)) # Section 4: cargo cargoLines = [] for cargo in sorted( fit.cargo, key=lambda c: (c.item.group.category.name, c.item.group.name, c.item.name) ): cargoLines.append('{} x{}'.format(cargo.item.name, cargo.amount)) if cargoLines: sections.append('\n'.join(cargoLines)) # Section 5: mutated modules' details mutationLines = [] if mutants and options & Options.MUTATIONS.value: for mutantReference in sorted(mutants): mutant = mutants[mutantReference] mutationLines.append(renderMutant(mutant, firstPrefix='[{}] '.format(mutantReference), prefix=' ')) if mutationLines: sections.append('\n'.join(mutationLines)) return '{}\n\n{}'.format(header, '\n\n\n'.join(sections))
def exportXml(iportuser, *fits): doc = xml.dom.minidom.Document() fittings = doc.createElement("fittings") # fit count fit_count = len(fits) fittings.setAttribute("count", "%s" % fit_count) doc.appendChild(fittings) sFit = svcFit.getInstance() for i, fit in enumerate(fits): try: fitting = doc.createElement("fitting") fitting.setAttribute("name", fit.name) fittings.appendChild(fitting) description = doc.createElement("description") # -- 170327 Ignored description -- try: notes = fit.notes # unicode if notes: notes = notes[:397] + '...' if len(notes) > 400 else notes description.setAttribute( "value", re.sub("(\r|\n|\r\n)+", "<br>", notes) if notes is not None else "" ) except Exception as e: pyfalog.warning("read description is failed, msg=%s\n" % e.args) fitting.appendChild(description) shipType = doc.createElement("shipType") shipType.setAttribute("value", fit.ship.name) fitting.appendChild(shipType) charges = {} slotNum = {} for module in fit.modules: if module.isEmpty: continue slot = module.slot if slot == Slot.SUBSYSTEM: # Order of subsystem matters based on this attr. See GH issue #130 slotId = module.getModifiedItemAttr("subSystemSlot") - 125 else: if slot not in slotNum: slotNum[slot] = 0 slotId = slotNum[slot] slotNum[slot] += 1 hardware = doc.createElement("hardware") hardware.setAttribute("type", module.item.name) slotName = Slot.getName(slot).lower() slotName = slotName if slotName != "high" else "hi" hardware.setAttribute("slot", "%s slot %d" % (slotName, slotId)) fitting.appendChild(hardware) if module.charge and sFit.serviceFittingOptions["exportCharges"]: if module.charge.name not in charges: charges[module.charge.name] = 0 # `or 1` because some charges (ie scripts) are without qty charges[module.charge.name] += module.numCharges or 1 for drone in fit.drones: hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % drone.amount) hardware.setAttribute("slot", "drone bay") hardware.setAttribute("type", drone.item.name) fitting.appendChild(hardware) for fighter in fit.fighters: hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % fighter.amountActive) hardware.setAttribute("slot", "fighter bay") hardware.setAttribute("type", fighter.item.name) fitting.appendChild(hardware) for cargo in fit.cargo: if cargo.item.name not in charges: charges[cargo.item.name] = 0 charges[cargo.item.name] += cargo.amount for name, qty in list(charges.items()): hardware = doc.createElement("hardware") hardware.setAttribute("qty", "%d" % qty) hardware.setAttribute("slot", "cargo") hardware.setAttribute("type", name) fitting.appendChild(hardware) except Exception as e: pyfalog.error("Failed on fitID: %d, message: %s" % e.message) continue finally: if iportuser: processing_notify( iportuser, IPortUser.PROCESS_EXPORT | IPortUser.ID_UPDATE, (i, "convert to xml (%s/%s) %s" % (i + 1, fit_count, fit.ship.name)) ) return doc.toprettyxml()
def getText(self, stuff): if isinstance(stuff, Drone): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fighter): return "%d/%d %s" % \ (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name) elif isinstance(stuff, Cargo): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fit): if self.projectedView: # we need a little more information for the projected view fitID = self.mainFrame.getActiveFit() info = stuff.getProjectionInfo(fitID) if info: return "%dx %s (%s)" % (stuff.getProjectionInfo( fitID).amount, stuff.name, stuff.ship.item.name) pyfalog.warning( "Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff), info) return "<unknown>" else: return "%s (%s)" % (stuff.name, stuff.ship.item.name) elif isinstance(stuff, Rack): if FitSvc.getInstance().serviceFittingOptions["rackLabels"]: if stuff.slot == Slot.MODE: return '─ Tactical Mode ─' else: return '─ {} {} Slot{}─'.format( stuff.num, Slot.getName(stuff.slot).capitalize(), '' if stuff.num == 1 else 's') else: return "" elif isinstance(stuff, Module): if self.projectedView: # check for projected abyssal name name_check = stuff.item.name[0:-2] type = WhProjector.abyssal_mapping.get(name_check, None) if type: sMkt = Market.getInstance() type = sMkt.getItem(type) return "{} {}".format(type.name, stuff.item.name[-1:]) if stuff.isEmpty: return "%s Slot" % Slot.getName(stuff.slot).capitalize() else: return stuff.item.name elif isinstance(stuff, Implant): return stuff.item.name else: item = getattr(stuff, "item", stuff) if FitSvc.getInstance( ).serviceFittingOptions["showMarketShortcuts"]: marketShortcut = getattr(item, "marketShortcut", None) if marketShortcut: # use unicode subscript to display shortcut value shortcut = chr(marketShortcut + 8320) + " " del item.marketShortcut return shortcut + item.name return item.name