def GetColorCodedSecurityStringForLocation(self, solarsystemID, itemName): sec, col = util.FmtSystemSecStatus( sm.GetService('map').GetSecurityStatus(solarsystemID), 1) col.a = 1.0 color = util.StrFromColor(col) text = '%s <color=%s>%s</color>' % (itemName, color, sec) return text
def GetSolarSystemTrace(self, itemID, altText=None, traceFontSize=12): if util.IsStation(itemID): solarSystemID = cfg.stations.Get(itemID).solarSystemID elif util.IsSolarSystem(itemID): solarSystemID = itemID else: structure = sm.GetService('structureDirectory').GetStructureInfo( itemID) if structure is None: raise RuntimeError('Invalid destination') solarSystemID = structure.solarSystemID try: sec, col = util.FmtSystemSecStatus( sm.GetService('map').GetSecurityStatus(solarSystemID), 1) col.a = 1.0 securityLabel = "</b> <color=%s><hint='%s'>%s</hint></color>" % ( util.StrFromColor(col), localization.GetByLabel('UI/Map/StarMap/SecurityStatus'), sec) except KeyError: self.LogError('Neocom failed to get security status for item', solarSystemID, 'displaying BROKEN') log.LogException() sys.exc_clear() securityLabel = '' si = cfg.mapSystemCache.Get(solarSystemID) constellationID = si.constellationID regionID = si.regionID if altText: solarSystemAlt = " alt='%s'" % uiutil.StripTags( altText, stripOnly=['localized']) else: solarSystemAlt = '' locationTrace = '<url=showinfo:%s//%s%s>%s</url>%s' % ( const.typeSolarSystem, solarSystemID, solarSystemAlt, cfg.evelocations.Get(solarSystemID).locationName, securityLabel) if traceFontSize: locationTrace += '<fontsize=12>' if not util.IsWormholeRegion(regionID): seperator = '<fontsize=%(fontsize)s> </fontsize><<fontsize=%(fontsize)s> </fontsize>' % { 'fontsize': 8 } locationTrace += seperator locationTrace += '<url=showinfo:%s//%s>%s</url>' % ( const.typeConstellation, constellationID, cfg.evelocations.Get(constellationID).locationName) locationTrace += seperator locationTrace += '<url=showinfo:%s//%s>%s</url>' % ( const.typeRegion, regionID, cfg.evelocations.Get(regionID).locationName) return locationTrace
def GetLocation(self, solarSystemID): try: sec, col = util.FmtSystemSecStatus(sm.GetService('map').GetSecurityStatus(solarSystemID), 1) col.a = 1.0 securityLabel = "</b> <color=%s><hint='%s'>%s</hint></color>" % (util.StrFromColor(col), localization.GetByLabel('UI/Map/StarMap/SecurityStatus'), sec) except KeyError: log.LogException('Failed to get security status for item - displaying BROKEN') sys.exc_clear() securityLabel = '' solarSystem = cfg.mapSystemCache[solarSystemID] constellationID = solarSystem.constellationID regionID = solarSystem.regionID locationTrace = '<url=showinfo:%s//%s>%s</url>%s < <url=showinfo:%s//%s>%s</url> < <url=showinfo:%s//%s>%s</url>' % (inventoryConst.typeSolarSystem, solarSystemID, cfg.evelocations.Get(solarSystemID).locationName, securityLabel, inventoryConst.typeConstellation, constellationID, cfg.evelocations.Get(constellationID).locationName, inventoryConst.typeRegion, regionID, cfg.evelocations.Get(regionID).locationName) return locationTrace