Ejemplo n.º 1
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
Ejemplo n.º 2
0
def MatchLocation(job, locationID=None, flagID=None):
    """
    In the time between installing a job and completing it, the output location could have been moved
    or destroyed. This method will try to find the best location that is still valid and doesn't
    break any corporate security rules.
    """
    for location in job.locations:
        if location.flagID == flagID and location.itemID == locationID:
            return copy.copy(location)

    for location in job.locations:
        if location.flagID == flagID and location.ownerID == job.ownerID:
            return copy.copy(location)

    if locationID and util.IsCorporation(job.ownerID) and util.IsStation(
            job.facility.facilityID):
        return industry.Location(itemID=job.facility.facilityID,
                                 ownerID=job.ownerID,
                                 flagID=const.flagHangar,
                                 typeID=cfg.stations.Get(
                                     job.facility.facilityID).stationTypeID)
    try:
        return copy.copy(job.locations[0])
    except IndexError:
        return None
Ejemplo n.º 3
0
 def GetForSaleText(self):
     amount = util.FmtISK(self.price, 0)
     saleText = localization.GetByLabel(
         'UI/CharacterSheet/CharacterSheetWindow/ForSale', amount=amount)
     if self.restrictedTo is None:
         availableText = localization.GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/AvailableToAll')
     else:
         entityName = cfg.eveowners.Get(self.restrictedTo).name
         entityType = cfg.eveowners.Get(self.restrictedTo).typeID
         entityText = localization.GetByLabel(
             'UI/Contracts/ContractsWindow/ShowInfoLink',
             showInfoName=entityName,
             info=('showinfo', entityType, self.restrictedTo))
         if util.IsCorporation(
                 self.restrictedTo) and not util.IsNPC(self.restrictedTo):
             corpInfo = sm.RemoteSvc('corpmgr').GetPublicInfo(
                 self.restrictedTo)
             allianceID = corpInfo.allianceID
             if allianceID:
                 allianceName = cfg.allianceshortnames.Get(
                     allianceID).shortName
                 allianceType = const.typeAlliance
                 allianceText = localization.GetByLabel(
                     'UI/Contracts/ContractsWindow/ShowInfoLink',
                     showInfoName=allianceName,
                     info=('showinfo', allianceType, allianceID))
                 entityText += ' [%s]' % allianceText
         availableText = localization.GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/AvailableToSpecific',
             entityName=entityText)
     return (saleText, availableText)
Ejemplo n.º 4
0
    def PopulateView(self, ownerID, scroll):
        try:
            sm.GetService('corpui').ShowLoad()
            self.viewingOwnerID = ownerID
            regwars = sm.GetService('war').GetWars(self.viewingOwnerID)
            facwars = {}
            if not util.IsAlliance(self.viewingOwnerID) and util.IsCorporation(self.viewingOwnerID) and sm.StartService('facwar').GetCorporationWarFactionID(self.viewingOwnerID):
                facwars = self.GetFactionWars(self.viewingOwnerID)
            owners = set()
            for wars in (regwars, facwars):
                for war in wars.itervalues():
                    owners.add(war.declaredByID)
                    owners.add(war.againstID)
                    owners.update(getattr(war, 'allies', {}).keys())

            if len(owners):
                cfg.eveowners.Prime(owners)
                cfg.corptickernames.Prime(owners)
            if self.destroyed:
                return
            scrolllist = []
            allyNegotiationsByWarID = defaultdict(list)
            for row in sm.GetService('war').GetAllyNegotiations():
                allyNegotiationsByWarID[row.warID].append(row)

            for wars in (regwars, facwars):
                for war in wars.itervalues():
                    activeAllies = set()
                    self.__AddToList(war, scrolllist)
                    try:
                        for allyID, allyRow in war.allies.iteritems():
                            if blue.os.GetWallclockTime() > allyRow.timeFinished:
                                continue
                            activeAllies.add(allyID)
                            scrolllist.append(listentry.Get('AllyEntry', {'warID': war.warID,
                             'allyID': allyID,
                             'isAlly': True,
                             'allyRow': allyRow}))

                    except AttributeError:
                        pass

                    if war.warID in allyNegotiationsByWarID:
                        for neg in allyNegotiationsByWarID[war.warID]:
                            if neg.ownerID1 in activeAllies:
                                continue
                            scrolllist.append(listentry.Get('AllyEntry', {'warID': neg.warID,
                             'allyID': neg.ownerID1,
                             'warNegotiation': neg}))

            if self.tabs.GetSelectedArgs() == 'all' and len(scrolllist):
                searchValue = self.searchEdit.GetValue()
                scrolllist.insert(0, listentry.Get('HeaderClear', {'label': localization.GetByLabel('UI/Corporations/Wars/SearchResult', searchResult=searchValue),
                 'func': self.ClearSearch}))
            corpName = cfg.eveowners.Get(self.viewingOwnerID).ownerName
            notContentHint = localization.GetByLabel('UI/Corporations/CorporationWindow/Wars/CorpOrAllianceNotInvolvedInWars', corpName=corpName)
            scroll.Load(contentList=scrolllist, headers=[], noContentHint=notContentHint)
        finally:
            sm.GetService('corpui').HideLoad()
Ejemplo n.º 5
0
def GetMinimumBountyAmount(ownerID):
    if util.IsCharacter(ownerID):
        return const.MIN_BOUNTY_AMOUNT_CHAR
    if util.IsCorporation(ownerID):
        return const.MIN_BOUNTY_AMOUNT_CORP
    if util.IsAlliance(ownerID):
        return const.MIN_BOUNTY_AMOUNT_ALLIANCE
    return 0
Ejemplo n.º 6
0
 def OnShowOwnerDetailsWindow(self, targetID):
     if util.IsCharacter(targetID):
         sm.GetService('info').ShowInfo(const.typeCharacterGallente,
                                        targetID)
     elif util.IsCorporation(targetID):
         sm.GetService('info').ShowInfo(const.typeCorporation, targetID)
     elif util.IsAlliance(targetID):
         sm.GetService('info').ShowInfo(const.typeAlliance, targetID)
Ejemplo n.º 7
0
def GetLogoIcon(itemID = None, **kw):
    if util.IsAlliance(itemID):
        logo = uicls.Icon(icon=None, **kw)
        sm.GetService('photo').GetAllianceLogo(itemID, 128, logo)
        return logo
    elif not util.IsCorporation(itemID) or CheckCorpID(itemID):
        return LogoIcon(itemID=itemID, **kw)
    else:
        return CorpIcon(corpID=itemID, **kw)
Ejemplo n.º 8
0
def CanViewItem(session, ownerID, locationID, flagID):
    if session.role & service.ROLE_SERVICE:
        return True
    if ownerID == session.charid:
        return True
    if util.IsCorporation(ownerID):
        required = const.corpHangarQueryRolesByFlag.get(
            flagID, 0) | const.corpRoleFactoryManager
        if RolesAtLocation(session, locationID) & required == required:
            return True
    return False
Ejemplo n.º 9
0
 def IsItemLocked(self, item):
     itemID = item.itemID
     if not util.IsCorporation(item.ownerID):
         return 0
     if util.IsStation(item.locationID):
         if item.flagID == const.flagCorpMarket:
             roles = const.corpRoleAccountant | const.corpRoleTrader
             if eve.session.corprole & roles != 0:
                 return 0
         return 1
     return self.IsItemIDLocked(itemID, item.locationID, item.typeID)
Ejemplo n.º 10
0
 def SearchBounties(self, targetID):
     if util.IsCharacter(targetID):
         fetcher = sm.ProxySvc('bountyProxy').SearchCharBounties
     elif util.IsCorporation(targetID):
         fetcher = sm.ProxySvc('bountyProxy').SearchCorpBounties
     elif util.IsAlliance(targetID):
         fetcher = sm.ProxySvc('bountyProxy').SearchAllianceBounties
     bountyAndRank = fetcher(targetID)
     bountyUtil.CacheBounties(self.bounties,
                              [bounty for rank, bounty in bountyAndRank])
     return bountyAndRank
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)
Ejemplo n.º 12
0
def GetDroppedCharCorpOrAllianceName(node):
    if not IsUserNode(node):
        return
    validTypeIDs = const.characterTypeByBloodline.values() + [
        const.typeCorporation, const.typeAlliance
    ]
    itemID = GetItemIDFromTextLink(node, validTypeIDs)
    if itemID is None:
        itemID = node.itemID
    if util.IsCharacter(itemID) or util.IsCorporation(
            itemID) or util.IsAlliance(itemID):
        itemName = cfg.eveowners.Get(itemID).name
        return util.KeyVal(itemName=itemName, itemID=itemID)
Ejemplo n.º 13
0
def OwnerAccess(session, ownerID, locationID=None, flagID=None):
    if not session or session.role & service.ROLE_SERVICE:
        return True
    if util.IsCharacter(ownerID):
        if session.charid != ownerID and session.role & service.ROLE_SERVICE == 0:
            return False
    elif util.IsCorporation(ownerID) and not util.IsNPCCorporation(ownerID):
        if not session.corprole & const.corpRoleFactoryManager:
            return False
        if session.corpid != ownerID and session.role & service.ROLE_SERVICE == 0:
            return False
    else:
        return False
    if locationID and flagID and not CanViewItem(session, ownerID, locationID,
                                                 flagID):
        return False
    return True
Ejemplo n.º 14
0
def CanTakeItem(session, ownerID, locationID, flagID, container=False):
    """
    Verify if we can take an item based on location, owner and flag.
    """
    if session.role & service.ROLE_SERVICE:
        return True
    if ownerID == session.charid:
        return True
    if util.IsCorporation(ownerID):
        if container:
            required = const.corpContainerTakeRolesByFlag.get(
                flagID, 0) | const.corpRoleFactoryManager
        else:
            required = const.corpHangarTakeRolesByFlag.get(
                flagID, 0) | const.corpRoleFactoryManager
        if RolesAtLocation(session, locationID) & required == required:
            return True
    return False
Ejemplo n.º 15
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)
Ejemplo n.º 16
0
def MatchLocation(job, locationID=None, flagID=None):
    for location in job.locations:
        if location.flagID == flagID and location.itemID == locationID:
            return copy.copy(location)

    for location in job.locations:
        if location.flagID == flagID and location.ownerID == job.ownerID:
            return copy.copy(location)

    if locationID and util.IsCorporation(job.ownerID) and util.IsStation(
            job.facility.facilityID):
        return industry.Location(itemID=job.facility.facilityID,
                                 ownerID=job.ownerID,
                                 flagID=const.flagHangar,
                                 typeID=cfg.stations.Get(
                                     job.facility.facilityID).stationTypeID)
    try:
        return copy.copy(job.locations[0])
    except IndexError:
        return None
Ejemplo n.º 17
0
def ConfigureALSC(itemID, invCacheSvc):
    container = invCacheSvc.GetInventoryFromId(itemID)
    config = container.ALSCConfigGet()
    defaultLock = bool(config & const.ALSCLockAddedItems)
    containerOwnerID = container.GetItem().ownerID
    if util.IsCorporation(containerOwnerID):
        if charsession.corprole & const.corpRoleEquipmentConfig == 0:
            raise UserError('PermissionDeniedNeedEquipRole',
                            {'corp': (const.UE_OWNERID, containerOwnerID)})
    else:
        userDefaultLock = settings.user.ui.Get(
            'defaultContainerLock_%s' % itemID, None)
        if userDefaultLock:
            defaultLock = True if userDefaultLock == const.flagLocked else False
    configSettings = [
        (const.ALSCPasswordNeededToOpen,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForOpening')),
        (const.ALSCPasswordNeededToLock,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForLocking')),
        (const.ALSCPasswordNeededToUnlock,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForUnlocking')),
        (const.ALSCPasswordNeededToViewAuditLog,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForViewingLog'))
    ]
    formFormat = []
    formFormat.append({
        'type':
        'header',
        'text':
        localization.GetByLabel('UI/Menusvc/ContainerDefaultLocked'),
        'frame':
        1
    })
    formFormat.append({
        'type': 'checkbox',
        'setvalue': defaultLock,
        'key': const.ALSCLockAddedItems,
        'label': '',
        'text': localization.GetByLabel('UI/Menusvc/ALSCLocked'),
        'frame': 1
    })
    formFormat.append({'type': 'btline'})
    formFormat.append({'type': 'push'})
    formFormat.append({
        'type':
        'header',
        'text':
        localization.GetByLabel('UI/Menusvc/ContainerPasswordRequiredFor'),
        'frame':
        1
    })
    for value, settingName in configSettings:
        formFormat.append({
            'type': 'checkbox',
            'setvalue': value & config == value,
            'key': value,
            'label': '',
            'text': settingName,
            'frame': 1
        })

    formFormat.append({'type': 'btline'})
    formFormat.append({'type': 'push'})
    retval = uix.HybridWnd(
        formFormat,
        localization.GetByLabel('UI/Menusvc/ContainerConfigurationHeader'),
        1,
        None,
        uiconst.OKCANCEL,
        unresizeAble=1,
        minW=300)
    if retval is None:
        return
    settings.user.ui.Delete('defaultContainerLock_%s' % itemID)
    newconfig = 0
    for k, v in retval.iteritems():
        newconfig |= k * v

    if config != newconfig:
        container.ALSCConfigSet(newconfig)
Ejemplo n.º 18
0
    def LoadInfo_thread(self, warID):
        if warID == self.warID:
            if self.showGraph.checked:
                if self.graphLoaded:
                    return
            elif self.killsLoaded:
                return
        self.warStatisticMoniker = self.GetWarStatisticMoniker(warID)
        self.war, shipsKilled, iskKilled, self.allies = self.warStatisticMoniker.GetBaseInfo()
        attackerID, defenderID = self.war.declaredByID, self.war.againstID
        if self.war.mutual:
            self.warDateLabel.top = -6
            self.mutualWarLabel.top = 8
            self.mutualWarLabel.display = True
        else:
            self.warDateLabel.top = 0
            self.mutualWarLabel.top = 0
            self.mutualWarLabel.display = False
        if not len(self.allies):
            self.allyBtn.Disable()
            self.allyBtn.hint = localization.GetByLabel('UI/Corporations/Wars/DefenderHasNoAllies')
        else:
            self.allyBtn.Enable()
            self.allyBtn.hint = localization.GetByLabel('UI/Corporations/Wars/DefenderHasNumAllies', num=len(self.allies))
        self.SetAllyBtnIcon()
        self.attackerLogoDetailed.Flush()
        self.defenderLogoDetailed.Flush()
        self.killsByShipGroup.clear()
        self.killsLoaded = False
        self.graphLoaded = False
        requesterID = session.allianceid or session.corpid
        if requesterID in (attackerID, defenderID) and self.war.retracted is None:
            if const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector:
                self.surrenderBtn.display = True
                self.surrenderBtn.hint = localization.GetByLabel('UI/Corporations/Wars/OffereToSurrender')
                surrenders = sm.GetService('war').GetSurrenderNegotiations(warID)
                for surrender in surrenders:
                    iskValue = surrender.iskValue
                    self.warNegotiationID = surrender.warNegotiationID
                    corpName = cfg.eveowners.Get(surrender.ownerID1).name
                    self.surrenderBtn.hint = localization.GetByLabel('UI/Corporations/Wars/OfferedToSurrender', amount=iskValue, corpName=corpName)

        shipsKilledByID = dict(shipsKilled)
        iskKilledByID = dict(iskKilled)
        if warID != self.warID:
            self.warID = warID
        if attackerID != self.attackerID:
            self.attackerID = attackerID
        if defenderID != self.defenderID:
            self.defenderID = defenderID
        self.warDateLabel.text = self.GetWarDateText()
        uicls.Frame(parent=self.attackerLogoDetailed, color=ATTACKER_COLOR)
        if util.IsCorporation(self.attackerID):
            attackerLinkType = const.typeCorporation
        else:
            attackerLinkType = const.typeAlliance
        attackerLogo = uiutil.GetLogoIcon(itemID=self.attackerID, parent=self.attackerLogoDetailed, acceptNone=False, align=uiconst.TOPRIGHT, height=64, width=64, state=uiconst.UI_NORMAL, ignoreSize=True)
        attackerLogo.OnClick = (self.ShowInfo, self.attackerID, attackerLinkType)
        attackerName = cfg.eveowners.Get(self.attackerID).name
        attackerLogo.hint = '%s<br>%s' % (attackerName, localization.GetByLabel('UI/Corporations/Wars/Offender'))
        attackerNameLabel = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=attackerName, info=('showinfo', attackerLinkType, self.attackerID))
        self.attackerNameLabel.text = attackerNameLabel
        self.attackerShipsLostLabel.text = localization.GetByLabel('UI/Corporations/Wars/NumShipsKilled', ships=util.FmtAmt(shipsKilledByID.get(self.attackerID, 0)))
        self.attackerISKLostLabel.text = localization.GetByLabel('UI/Corporations/Wars/ISKKilled', iskAmount=util.FmtISK(iskKilledByID.get(self.attackerID, 0), 0))
        uicls.Frame(parent=self.defenderLogoDetailed, color=DEFENDER_COLOR)
        if util.IsCorporation(self.defenderID):
            defenderLinkType = const.typeCorporation
        else:
            defenderLinkType = const.typeAlliance
        defenderLogo = uiutil.GetLogoIcon(itemID=self.defenderID, parent=self.defenderLogoDetailed, acceptNone=False, align=uiconst.TOPLEFT, height=64, width=64, state=uiconst.UI_NORMAL, ignoreSize=True)
        defenderLogo.OnClick = (self.ShowInfo, self.defenderID, defenderLinkType)
        defenderName = cfg.eveowners.Get(self.defenderID).name
        defenderLogo.hint = '%s<br>%s' % (defenderName, localization.GetByLabel('UI/Corporations/Wars/Defender'))
        defenderNameLabel = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=defenderName, info=('showinfo', defenderLinkType, self.defenderID))
        self.defenderNameLabel.text = defenderNameLabel
        self.defenderShipsKilledLabel.text = localization.GetByLabel('UI/Corporations/Wars/NumShipsKilled', ships=util.FmtAmt(shipsKilledByID.get(self.defenderID, 0)))
        self.defenderISKKilledLabel.text = localization.GetByLabel('UI/Corporations/Wars/ISKKilled', iskAmount=util.FmtISK(iskKilledByID.get(self.defenderID, 0), 0))
        self.ShowLoading()
        self.GetMaxKills()
        self.ShowGraph()
        self.HideLoading()
Ejemplo n.º 19
0
    def ConstructHeader(self):
        if self.loadingHeader:
            return
        self.loadingHeader = True
        self.topCont.Flush()
        characterName = cfg.eveowners.Get(session.charid).name
        if not getattr(self, 'charMgr', None):
            self.charMgr = sm.RemoteSvc('charMgr')
        if not getattr(self, 'cc', None):
            self.charsvc = sm.GetService('cc')
        self.sr.charinfo = charinfo = self.charMgr.GetPublicInfo(
            session.charid)
        if settings.user.ui.Get('charsheetExpanded', 1):
            parent = self.topCont
            self.sr.picParent = Container(name='picpar',
                                          parent=parent,
                                          align=uiconst.TOPLEFT,
                                          width=200,
                                          height=200,
                                          left=const.defaultPadding,
                                          top=16)
            self.sr.pic = Sprite(parent=self.sr.picParent,
                                 align=uiconst.TOALL,
                                 left=1,
                                 top=1,
                                 height=1,
                                 width=1)
            self.sr.pic.OnClick = self.OpenPortraitWnd
            self.sr.pic.cursor = uiconst.UICURSOR_MAGNIFIER
            uicontrols.Frame(parent=self.sr.picParent, opacity=0.2)
            sm.GetService('photo').GetPortrait(session.charid, 256,
                                               self.sr.pic)
            infoTextPadding = self.sr.picParent.width + const.defaultPadding * 4
            characterLink = GetByLabel(
                'UI/Contracts/ContractsWindow/ShowInfoLink',
                showInfoName=characterName,
                info=('showinfo', const.typeCharacterAmarr, session.charid))
            self.sr.nameText = uicontrols.EveCaptionMedium(
                text=characterLink,
                parent=self.topCont,
                left=infoTextPadding,
                top=12,
                state=uiconst.UI_NORMAL)
            self.sr.raceinfo = raceinfo = cfg.races.Get(charinfo.raceID)
            self.sr.bloodlineinfo = bloodlineinfo = cfg.bloodlines.Get(
                charinfo.bloodlineID)
            self.sr.schoolinfo = schoolinfo = self.charsvc.GetData(
                'schools', ['schoolID', charinfo.schoolID])
            self.sr.ancestryinfo = ancestryinfo = self.charsvc.GetData(
                'ancestries', ['ancestryID', charinfo.ancestryID])
            if self.destroyed:
                self.loadingHeader = False
                return
            securityStatus = sm.GetService(
                'crimewatchSvc').GetMySecurityStatus()
            roundedSecurityStatus = localization.formatters.FormatNumeric(
                securityStatus, decimalPlaces=1)
            cloneLocationRow = sm.RemoteSvc('charMgr').GetHomeStationRow()
            if cloneLocationRow:
                stationID = cloneLocationRow.stationID
                cloneLocationSystemID = cloneLocationRow.solarSystemID
                if cloneLocationSystemID:
                    labelPath = 'UI/CharacterSheet/CharacterSheetWindow/CloneLocationHint'
                    cloneLocationHint = GetByLabel(
                        labelPath,
                        locationId=stationID,
                        systemId=cloneLocationSystemID)
                    cloneLocation = cfg.evelocations.Get(
                        cloneLocationSystemID).name
                else:
                    cloneLocationHint = cfg.evelocations.Get(stationID).name
                    cloneLocation = GetByLabel(
                        'UI/CharacterSheet/CharacterSheetWindow/UnknownSystem')
            else:
                cloneLocation = GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/UnknownSystem')
                cloneLocationHint = ''
            alliance = ''
            if session.allianceid:
                cfg.eveowners.Prime([session.allianceid])
                alliance = (GetByLabel('UI/Common/Alliance'),
                            cfg.eveowners.Get(session.allianceid).name, '')
            faction = ''
            if session.warfactionid:
                fac = sm.StartService('facwar').GetFactionalWarStatus()
                faction = (GetByLabel('UI/Common/Militia'),
                           cfg.eveowners.Get(fac.factionID).name, '')
            bounty = ''
            bountyOwnerIDs = (session.charid, session.corpid,
                              session.allianceid)
            bountyAmount = sm.GetService('bountySvc').GetBounty(
                *bountyOwnerIDs)
            bountyAmounts = sm.GetService('bountySvc').GetBounties(
                *bountyOwnerIDs)
            charBounty = 0
            corpBounty = 0
            allianceBounty = 0
            if len(bountyAmounts):
                for ownerID, value in bountyAmounts.iteritems():
                    if util.IsCharacter(ownerID):
                        charBounty = value
                    elif util.IsCorporation(ownerID):
                        corpBounty = value
                    elif util.IsAlliance(ownerID):
                        allianceBounty = value

            bountyHint = GetByLabel('UI/Station/BountyOffice/BountyHint',
                                    charBounty=util.FmtISK(charBounty, 0),
                                    corpBounty=util.FmtISK(corpBounty, 0),
                                    allianceBounty=util.FmtISK(
                                        allianceBounty, 0))
            bounty = (GetByLabel('UI/Station/BountyOffice/Bounty'),
                      util.FmtISK(bountyAmount, 0), bountyHint)
            skillPoints = int(sm.GetService('skills').GetSkillPoints())
            textList = [
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/SkillPoints'),
                 localization.formatters.FormatNumeric(skillPoints,
                                                       useGrouping=True), ''),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/HomeSystem'),
                 cloneLocation, cloneLocationHint),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/CharacterBackground'
                ),
                 GetByLabel(
                     'UI/CharacterSheet/CharacterSheetWindow/CharacterBackgroundInformation',
                     raceName=localization.GetByMessageID(raceinfo.raceNameID),
                     bloodlineName=localization.GetByMessageID(
                         bloodlineinfo.bloodlineNameID),
                     ancestryName=localization.GetByMessageID(
                         ancestryinfo.ancestryNameID)),
                 GetByLabel(
                     'UI/CharacterSheet/CharacterSheetWindow/CharacterBackgroundHint'
                 )),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/DateOfBirth'),
                 localization.formatters.FormatDateTime(
                     charinfo.createDateTime,
                     dateFormat='long',
                     timeFormat='long'), ''),
                (GetByLabel('UI/CharacterSheet/CharacterSheetWindow/School'),
                 localization.GetByMessageID(schoolinfo.schoolNameID), ''),
                (GetByLabel('UI/Common/Corporation'),
                 cfg.eveowners.Get(session.corpid).name, ''),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/SecurityStatus'),
                 roundedSecurityStatus,
                 localization.formatters.FormatNumeric(securityStatus,
                                                       decimalPlaces=4))
            ]
            if faction:
                textList.insert(len(textList) - 1, faction)
            if alliance:
                textList.insert(len(textList) - 1, alliance)
            if bounty:
                textList.insert(len(textList), bounty)
            numLines = len(textList) + 2
            mtext = 'Xg<br>' * numLines
            mtext = mtext[:-4]
            th = GetTextHeight(mtext)
            topParentHeight = max(220, th + const.defaultPadding * 2 + 2)
            top = max(34, self.sr.nameText.top + self.sr.nameText.height)
            leftContainer = Container(parent=self.topCont,
                                      left=infoTextPadding,
                                      top=top,
                                      align=uiconst.TOPLEFT)
            rightContainer = Container(parent=self.topCont,
                                       top=top,
                                       align=uiconst.TOPLEFT)
            subTop = 0
            for label, value, hint in textList:
                label = uicontrols.EveLabelMedium(text=label,
                                                  parent=leftContainer,
                                                  idx=0,
                                                  state=uiconst.UI_NORMAL,
                                                  align=uiconst.TOPLEFT,
                                                  top=subTop)
                label.hint = hint
                label._tabMargin = 0
                display = uicontrols.EveLabelMedium(text=value,
                                                    parent=rightContainer,
                                                    idx=0,
                                                    state=uiconst.UI_NORMAL,
                                                    align=uiconst.TOPLEFT,
                                                    top=subTop)
                display.hint = hint
                display._tabMargin = 0
                subTop += label.height

            leftContainer.AutoFitToContent()
            rightContainer.left = leftContainer.left + leftContainer.width + 20
            rightContainer.AutoFitToContent()
            self.topCont.EnableAutoSize()
        else:
            self.topCont.DisableAutoSize()
            self.topCont.height = 18
        charsheetExpanded = settings.user.ui.Get('charsheetExpanded', 1)
        if not charsheetExpanded:
            uicontrols.EveLabelMedium(text=characterName,
                                      parent=self.topCont,
                                      left=8,
                                      top=1,
                                      state=uiconst.UI_DISABLED)
        expandOptions = [
            GetByLabel('UI/CharacterSheet/CharacterSheetWindow/Expand'),
            GetByLabel('UI/CharacterSheet/CharacterSheetWindow/Collapse')
        ]
        a = uicontrols.EveLabelSmall(text=expandOptions[charsheetExpanded],
                                     parent=self.topCont,
                                     left=15,
                                     top=3,
                                     state=uiconst.UI_NORMAL,
                                     align=uiconst.TOPRIGHT,
                                     bold=True)
        a.OnClick = self.ToggleGeneral
        expander = Sprite(parent=self.topCont,
                          pos=(3, 2, 11, 11),
                          name='expandericon',
                          state=uiconst.UI_NORMAL,
                          texturePath=[
                              'res:/UI/Texture/Shared/expanderDown.png',
                              'res:/UI/Texture/Shared/expanderUp.png'
                          ][charsheetExpanded],
                          align=uiconst.TOPRIGHT)
        expander.OnClick = self.ToggleGeneral
        self.loadingHeader = False