def GetDominantAllianceName(self):
     """
     Will return the name of most influential alliance with in the current scope.
     returns:
         contested if two or more have equal number of systems with sov
         none if none has sov
         else returns the alliance name
     """
     sovID = sm.GetService('sov').GetDominantAllianceID(
         self.locationScope, self.regionID, self.constellationID,
         self.solarSystemID)
     if sovID == 'none':
         self.sovID = None
         return ('', '', localization.GetByLabel('UI/Common/None'), '')
     elif sovID == 'contested':
         self.sovID = None
         return ('', '', '',
                 localization.GetByLabel(
                     'UI/Inflight/Brackets/SystemContested'))
     else:
         self.sovID = sovID
         typeID = const.typeAlliance
         if util.IsFaction(self.sovID):
             typeID = const.typeFaction
         sovName = cfg.eveowners.Get(sovID).name
         return (typeID, sovID, sovName, '')
Beispiel #2
0
def GetOwnerLogo(parent,
                 ownerID,
                 size=64,
                 noServerCall=False,
                 callback=False,
                 orderIfMissing=True):
    if util.IsCharacter(ownerID) or util.IsAlliance(ownerID):
        logo = Icon(icon=None,
                    parent=parent,
                    pos=(0, 0, size, size),
                    ignoreSize=True)
        if util.IsAlliance(ownerID):
            path = sm.GetService('photo').GetAllianceLogo(
                ownerID,
                128,
                logo,
                callback=callback,
                orderIfMissing=orderIfMissing)
        else:
            path = sm.GetService('photo').GetPortrait(
                ownerID,
                size,
                logo,
                callback=callback,
                orderIfMissing=orderIfMissing)
        return path is not None
    if util.IsCorporation(ownerID) or util.IsFaction(ownerID):
        GetLogoIcon(itemID=ownerID,
                    parent=parent,
                    pos=(0, 0, size, size),
                    ignoreSize=True)
    else:
        raise RuntimeError('ownerID %d is not of an owner type!!' % ownerID)
    return True
def OwnerWrap(ownerID, typeID = None):
    if ownerID is None:
        return ''
    elif util.IsFaction(ownerID):
        return '<a href=showinfo:%d//%d><img src="factionlogo:%d" width=32 height=32 hspace=2 vspace=2></a>' % (const.typeFaction, ownerID, ownerID)
    elif util.IsCorporation(ownerID):
        return '<a href=showinfo:%d//%d><img src="corplogo:%d" width=32 height=32 hspace=2 vspace=2></a>' % (const.typeCorporation, ownerID, ownerID)
    else:
        if not typeID:
            typeID = cfg.eveowners.Get(ownerID).typeID
        return '<a href=showinfo:%d//%d><img src="portrait:%d" width=32 height=32 hspace=2 vspace=2></a>' % (typeID, ownerID, ownerID)
Beispiel #4
0
 def GetMenu(self):
     m = []
     if self.legend.data is not None:
         m += sm.GetService('menu').GetGMMenu(itemID=self.legend.data)
     if self.legend.data is not None:
         if util.IsFaction(self.legend.data):
             m += sm.GetService('menu').GetMenuFormItemIDTypeID(self.legend.data, const.typeFaction)
         elif util.IsRegion(self.legend.data):
             m += sm.GetService('menu').CelestialMenu(self.legend.data)
         else:
             m += sm.GetService('menu').GetMenuFormItemIDTypeID(self.legend.data, const.typeAlliance)
     return m
Beispiel #5
0
 def GetDominantAllianceName(self):
     sovID = sm.GetService('sov').GetDominantAllianceID(
         self.locationScope, self.regionID, self.constellationID,
         self.solarSystemID)
     if sovID == 'none':
         self.sovID = None
         return ('', '', localization.GetByLabel('UI/Common/None'), '')
     elif sovID == 'contested':
         self.sovID = None
         return ('', '', '',
                 localization.GetByLabel(
                     'UI/Inflight/Brackets/SystemContested'))
     else:
         self.sovID = sovID
         typeID = const.typeAlliance
         if util.IsFaction(self.sovID):
             typeID = const.typeFaction
         sovName = cfg.eveowners.Get(sovID).name
         return (typeID, sovID, sovName, '')
Beispiel #6
0
 def GetMenu(self):
     """
     tiles can highlight, hopefully stars someday
     here we have to deal with different types of data
     factionID
     regionID
     allianceID
     and just color
     """
     m = []
     if self.legend.data is not None:
         m += sm.GetService('menu').GetGMMenu(itemID=self.legend.data)
     if self.legend.data is not None:
         if util.IsFaction(self.legend.data):
             m += sm.GetService('menu').GetMenuFormItemIDTypeID(self.legend.data, const.typeFaction)
         elif util.IsRegion(self.legend.data):
             m += sm.GetService('menu').CelestialMenu(self.legend.data)
         else:
             m += sm.GetService('menu').GetMenuFormItemIDTypeID(self.legend.data, const.typeAlliance)
     return m
Beispiel #7
0
 def ApplyAttributes(self, attributes):
     itemID = attributes.get('itemID', None)
     icon = None
     if itemID is not None:
         if util.IsCorporation(itemID):
             if CheckCorpID(itemID):
                 icon = CORP_ICONS[itemID]
             else:
                 raise ValueError, 'LogoIcon class does not support custom corp icons.  Use CorpIcon for that'
         elif util.IsAlliance(itemID):
             raise ValueError, 'LogoIcon class does not support Alliance Logos.  Use GetLogoIcon or GetOwnerIcon'
         elif util.IsFaction(itemID):
             isSmall = attributes.get('isSmall', self.default_isSmall)
             icon = self.GetFactionIconID(itemID, isSmall)
         elif itemID in RACE_ICONS:
             icon = RACE_ICONS[itemID]
     if icon is None:
         icon = 'ui_1_16_256'
     attributes['icon'] = icon
     EveIcon.ApplyAttributes(self, attributes)
Beispiel #8
0
 def GetMenu(self):
     m = []
     mm = []
     mmm = []
     if self.locationID:
         if self.regionID is None:
             label = ''
             if self.scope == SovereigntyTab.SolarSystem:
                 label = None
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append(
                     (uiutil.MenuLabel('UI/Common/LocationTypes/System'),
                      mm))
             if self.scope == SovereigntyTab.World:
                 label = uiutil.MenuLabel('UI/Common/LocationTypes/Region')
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append((label, mm))
             elif self.scope == SovereigntyTab.Region:
                 label = uiutil.MenuLabel(
                     'UI/Common/LocationTypes/Constellation')
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append((label, mm))
             elif self.scope == SovereigntyTab.Constellation:
                 label = uiutil.MenuLabel('UI/Common/LocationTypes/System')
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append((label, mm))
             m.append(None)
             if label is not None:
                 if label == uiutil.MenuLabel(
                         'UI/Common/LocationTypes/System'):
                     viewLabel = uiutil.MenuLabel(
                         'UI/Common/LocationTypes/ViewSystem')
                 elif label == uiutil.MenuLabel(
                         'UI/Common/LocationTypes/Constellation'):
                     viewLabel = uiutil.MenuLabel(
                         'UI/Common/LocationTypes/ViewConstellation')
                 else:
                     viewLabel = uiutil.MenuLabel(
                         'UI/Common/LocationTypes/ViewRegion')
                 m.append([viewLabel, self.DrillToLocation])
         else:
             mm += sm.GetService('menu').CelestialMenu(self.locationID)
             m.append(
                 (uiutil.MenuLabel('UI/Common/LocationTypes/System'), mm))
             mmm += sm.GetService('menu').CelestialMenu(self.regionID)
             m.append(
                 (uiutil.MenuLabel('UI/Common/LocationTypes/Region'), mmm))
             m.append(None)
         if self.allianceID is not None:
             if util.IsFaction(self.allianceID):
                 m.append([
                     uiutil.MenuLabel('UI/Sovereignty/ShowInfoOnFaction'),
                     self.ShowInfoOnSovHolder,
                     (const.typeFaction, self.allianceID)
                 ])
             else:
                 m.append([
                     uiutil.MenuLabel('UI/Sovereignty/ShowInfoOnAlliance'),
                     self.ShowInfoOnSovHolder,
                     (const.typeAlliance, self.allianceID)
                 ])
         elif self.corpID is not None:
             m.append([
                 uiutil.MenuLabel('UI/Sovereignty/ShowInfoOnCorporation'),
                 self.ShowInfoOnSovHolder,
                 (const.typeCorporation, self.corpID)
             ])
         return m
     else:
         return