Пример #1
0
 def OnSessionMutated(self, isremote, session, change):
     if not self.useJumpMonitor:
         return
     try:
         if type(session) == types.TupleType:
             if len(session) == 1 and session[0] >= const.minFakeItem:
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'wormhole %s' % session[0]
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsStargate(session[0]) and util.IsStargate(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'stargate %d->%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsPlayerItem(session[0]) and util.IsSolarSystem(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'pos cyno array:%d' % (session[0],)
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsPlayerItem(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'bridge src:%s dst:%d in:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsCharacter(session[0]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'cyno char:%s cyno:%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 4 and util.IsCharacter(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[3]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'ship bridge char:%s-%s cyno:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
     except:
         sys.exc_clear()
Пример #2
0
 def ExpandActionMenu(self, itemID, x, y, clickedObject, **kwargs):
     if util.IsCharacter(itemID):
         kwargs['charID'] = itemID
         slimItem = util.SlimItemFromCharID(itemID)
         if slimItem:
             itemID = slimItem.itemID
     else:
         slimItem = uix.GetBallparkRecord(itemID)
     isRadialMenuButtonActive = spaceRadialMenuFunctions.IsRadialMenuButtonActive(
     )
     if not isRadialMenuButtonActive:
         return
     uix.Flush(uicore.layer.menu)
     radialMenuClass = kwargs.get('radialMenuClass', uicls.RadialMenuSpace)
     radialMenu = radialMenuClass(name='radialMenu',
                                  parent=uicore.layer.menu,
                                  state=uiconst.UI_HIDDEN,
                                  align=uiconst.TOPLEFT,
                                  updateDisplayName=True,
                                  slimItem=slimItem,
                                  itemID=itemID,
                                  x=x,
                                  y=y,
                                  clickedObject=clickedObject,
                                  **kwargs)
     uicore.layer.menu.radialMenu = radialMenu
     uicore.uilib.SetMouseCapture(radialMenu)
     isRadialMenuButtonActive = spaceRadialMenuFunctions.IsRadialMenuButtonActive(
     )
     if not isRadialMenuButtonActive:
         radialMenu.Close()
         return
     sm.StartService('state').SetState(itemID, state.mouseOver, 0)
     radialMenu.state = uiconst.UI_NORMAL
     sm.ScatterEvent('OnRadialMenuExpanded')
Пример #3
0
 def ShowResult(self, ownerID):
     if ownerID:
         self.imgCont.Flush()
         self.verifiedCont.display = True
         self.sellKillRightBtn.Enable()
         self.searchCont.display = False
         ownerType = cfg.eveowners.Get(ownerID).typeID
         if util.IsCharacter(ownerID):
             ownerPortrait = uicls.Sprite(
                 parent=self.imgCont,
                 align=uiconst.TOALL,
                 idx=0,
                 texturePath='res:/UI/Texture/silhouette_64.png')
             sm.GetService('photo').GetPortrait(ownerID, 30, ownerPortrait)
         else:
             ownerPortrait = uiutil.GetLogoIcon(itemID=ownerID,
                                                parent=self.imgCont,
                                                acceptNone=False,
                                                align=uiconst.TOPRIGHT,
                                                height=30,
                                                width=30,
                                                state=uiconst.UI_NORMAL)
             ownerPortrait.SetSize(30, 30)
         ownerPortrait.OnClick = (self.ShowInfo, ownerID, ownerType)
         ownerName = cfg.eveowners.Get(ownerID).name
         self.killRightOwner.hint = ownerName
         self.nameLabel.text = localization.GetByLabel(
             'UI/Contracts/ContractsWindow/ShowInfoLink',
             showInfoName=ownerName,
             info=('showinfo', ownerType, ownerID))
         uicore.registry.SetFocus(self.killRightAmount)
    def ProcessEntityVisibility(self, eventList):
        charid = session.charid
        playerEntityCreateIdx = None
        charactersCreated = []
        for i, event in enumerate(eventList):
            if event[0] == 'OnEntityCreate' and event[2] == charid:
                eventList[i] = eventList[0]
                eventList[0] = event
                break

        callsToMake = []
        for t in eventList:
            if t[0] == 'OnEntityCreate':
                eventName, sceneID, entityID, initialState = t
                callsToMake.append(
                    (self._CreateEntity, (sceneID, entityID, initialState)))
                if util.IsCharacter(entityID):
                    charactersCreated.append(entityID)
            elif t[0] == 'OnEntityDestroy':
                eventName, entityID = t
                callsToMake.append((self._RemoveEntity, (entityID, )))
            else:
                self.LogError(
                    'Aperture Client received a unknown event type %s',
                    str(t[0]))

        if charactersCreated:
            uthread.new(cfg.eveowners.Prime, charactersCreated)
        uthread.parallel(callsToMake)
 def CanAttackFreely(self, item):
     if util.IsSystem(item.ownerID) or item.ownerID == session.charid:
         return True
     securityClass = sm.GetService('map').GetSecurityClass(session.solarsystemid)
     if securityClass == const.securityClassZeroSec:
         return True
     if self.IsCriminallyFlagged(item.ownerID):
         return True
     if self.HasLimitedEngagmentWith(item.ownerID):
         return True
     if util.IsCharacter(item.ownerID) and util.IsOutlawStatus(item.securityStatus):
         return True
     if session.warfactionid:
         if hasattr(item, 'corpID') and self.facwar.IsEnemyCorporation(item.corpID, session.warfactionid):
             return True
     belongToPlayerCorp = not util.IsNPC(session.corpid)
     if belongToPlayerCorp:
         if item.ownerID == session.corpid:
             return True
         otherCorpID = getattr(item, 'corpID', None)
         if otherCorpID is not None:
             if otherCorpID == session.corpid:
                 return True
             if self.war.GetRelationship(otherCorpID) == const.warRelationshipAtWarCanFight:
                 return True
         otherAllianceID = getattr(item, 'allianceID', None)
         if otherAllianceID is not None:
             if self.war.GetRelationship(otherAllianceID) == const.warRelationshipAtWarCanFight:
                 return True
     if IsItemFreeForAggression(item.groupID):
         return True
     return False
Пример #6
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 RegisterComponent(self, entity, component):
     if entity.entityID != session.charid:
         ctx = entity.GetComponent('contextMenu')
         if ctx:
             if util.IsCharacter(entity.entityID):
                 ctx.AddMenuEntry(
                     localization.GetByLabel('UI/Commands/ShowInfo'),
                     self.ShowInfo)
Пример #8
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
 def ProcessEntry(typeID, quantity, extra):
     if util.IsCharacter(typeID):
         iconWrap = OwnerWrap(typeID)
         description = localization.GetByLabel('UI/Agents/StandardMission/MissionReferral', agentID=typeID)
     else:
         iconWrap = IconWrap(typeID, extra)
         description = ProcessTypeAndQuantity(typeID, quantity, extra)
     return (iconWrap, description)
Пример #10
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)
Пример #11
0
 def GetKillRights(self, toIDs):
     toIDs = [
         toID for toID in toIDs if toID is not None
         and util.IsCharacter(toID) and util.IsOwner(toID)
     ]
     validIDs = [session.charid, session.corpid]
     if session.allianceid is not None:
         validIDs.append(session.allianceid)
     return self.killRightTracker.GetKillRights(toIDs, *validIDs)
Пример #12
0
def GetDroppedCharInfo(node):
    if not IsUserNode(node):
        return
    charID = GetCharIDFromTextLink(node)
    if charID is None:
        charID = node.charID
    if util.IsCharacter(charID):
        charName = cfg.eveowners.Get(charID).name
        return util.KeyVal(charName=charName, charID=charID)
Пример #13
0
    def GetEntityName(self, entity):
        if entity.HasComponent('info'):
            return entity.GetComponent('info').name
        try:
            if util.IsCharacter(entity.entityID):
                return cfg.eveowners.Get(entity.entityID).name
        except:
            pass

        return 'Entity %s' % entity.entityID
Пример #14
0
 def OnSessionMutated(self, isremote, session, change):
     """
         OnSessionMutated is called on the client, by the client when certain jump events
         are requested. The only way to differentiate between jump types is to observe the 
         change dictionnary and trap known patterns.    
         
         Current patterns of change are:
             wormhole jump: chnage contains a single value, the wormhole object. Which 
                 is a fake item not in the DB
             stargate jump: the clean one really, change contains 2 values, both stargates itemID
             cyno jump: 3 value tuple, of the form: character holding the cyno, cyno itemID 
                 (which is fakeItem too) and destination solarsystem
     """
     if not self.useJumpMonitor:
         return
     try:
         if type(session) == types.TupleType:
             if len(session) == 1 and session[0] >= const.minFakeItem:
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'wormhole %s' % session[0]
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsStargate(session[0]) and util.IsStargate(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'stargate %d->%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsPlayerItem(session[0]) and util.IsSolarSystem(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'pos cyno array:%d' % (session[0],)
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsPlayerItem(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'bridge src:%s dst:%d in:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsCharacter(session[0]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'cyno char:%s cyno:%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 4 and util.IsCharacter(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[3]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'ship bridge char:%s-%s cyno:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
     except:
         sys.exc_clear()
Пример #15
0
 def OnDropCharacter(self, dragObj, nodes):
     node = nodes[0]
     if node.Get('__guid__', None) not in uiutil.AllUserEntries() + ['TextLink']:
         return
     charID = GetCharIDFromTextLink(node)
     if charID is None:
         charID = node.charID
     if util.IsCharacter(charID):
         charName = cfg.eveowners.Get(charID).name
         self.SetValue(charName)
Пример #16
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 LoadContacts(self, *args):
        allContacts = sm.GetService('addressbook').GetContacts()
        contacts = allContacts.contacts.values()
        scrolllist = []
        for contact in contacts:
            if util.IsNPC(contact.contactID) or not util.IsCharacter(contact.contactID):
                continue
            entryTuple = self.GetUserEntryTuple(contact.contactID, contact)
            scrolllist.append(entryTuple)

        scrolllist = uiutil.SortListOfTuples(scrolllist)
        self.sr.contactsScroll.Load(contentList=scrolllist, headers=[], noContentHint=localization.GetByLabel('UI/AddressBook/NoContacts'))
Пример #18
0
 def AddEntry(self, info):
     confirmOnDblClick = self.minChoices == self.maxChoices == 1
     if self.listtype in ('character', 'corporation', 'alliance', 'faction',
                          'owner'):
         typeinfo = None
         if info[2]:
             typeinfo = cfg.invtypes.Get(info[2])
         if typeinfo is None:
             owner = cfg.eveowners.GetIfExists(info[1])
             if owner:
                 typeinfo = cfg.invtypes.Get(owner.typeID)
         if typeinfo is not None:
             charID = info[1]
             if util.IsCharacter(charID) and util.IsNPC(charID):
                 entryType = 'AgentEntry'
             else:
                 entryType = 'User'
             return (40,
                     listentry.Get(
                         entryType, {
                             'charID': charID,
                             'OnDblClick': self.DblClickEntry,
                             'OnClick': self.ClickEntry,
                             'dblconfirm': confirmOnDblClick
                         }))
     else:
         if self.listtype in ('pickStation', ):
             data = info
             data.confirmOnDblClick = confirmOnDblClick
             data.OnDblClick = self.DblClickEntry
             data.OnClick = self.ClickEntry
             return (32, listentry.Get('Generic', data=data))
         if self.listtype == 'generic':
             name, listvalue = info
             data = util.KeyVal()
             data.confirmOnDblClick = confirmOnDblClick
             data.label = name
             data.listvalue = info
             data.OnDblClick = self.DblClickEntry
             data.OnClick = self.ClickEntry
             return (32, listentry.Get('Generic', data=data))
     name, itemID, typeID = info
     data = util.KeyVal()
     data.confirmOnDblClick = confirmOnDblClick
     data.label = name
     data.itemID = itemID
     data.typeID = typeID
     data.listvalue = [name, itemID, typeID]
     data.isStation = self.listtype == 'station'
     data.getIcon = self.listtype == 'item'
     data.OnDblClick = self.DblClickEntry
     data.OnClick = self.ClickEntry
     return (24, listentry.Get('Generic', data=data))
Пример #19
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)
Пример #20
0
 def OnDropCharacter(self, dragObj, nodes):
     node = nodes[0]
     charID = None
     if node.Get('__guid__', None) == 'TextLink' and node.Get(
             'url', '').startswith('showinfo'):
         parts = node.Get('url', '').split('//')
         charID = int(parts[-1])
     elif node.Get('__guid__',
                   None) not in uiutil.AllUserEntries() + ['TextLink']:
         return
     if charID is None:
         charID = node.charID
     if util.IsCharacter(charID):
         charName = cfg.eveowners.Get(charID).name
         self.SetValue(charName)
Пример #21
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
Пример #22
0
    def GetHeaderAndSubtextForActionIndication(self, ballMode, followId, followRange, ball = None, *args):
        """
            returns the header text and subtext for the ship's actions.
            Can return None, None which means there is nothing to display
        """
        headerText = None
        subText = None
        if ballMode != destiny.DSTBALL_GOTO and ball is not None:
            sm.GetService('menu').ClearAlignTargets()
        if followId != 0 and ballMode in (destiny.DSTBALL_ORBIT, destiny.DSTBALL_FOLLOW):
            name = sm.GetService('space').GetWarpDestinationName(followId)
            myRange = followRange
            rangeText = util.FmtDist(myRange, maxdemicals=0)
            if ballMode == destiny.DSTBALL_ORBIT:
                headerText = localization.GetByLabel('UI/Inflight/Messages/OrbitingHeader')
                subText = localization.GetByLabel('UI/Inflight/Messages/OrbitingSubText', targetName=name, rangeText=rangeText)
            elif ballMode == destiny.DSTBALL_FOLLOW:
                if myRange in (const.approachRange, 0):
                    headerText = localization.GetByLabel('UI/Inflight/Messages/ApproachingHeader')
                    subText = localization.GetByLabel('UI/Inflight/Messages/ApproachingSubText', targetName=name)
                else:
                    headerText = localization.GetByLabel('UI/Inflight/Messages/KeepingAtRangeHeader')
                    subText = localization.GetByLabel('UI/Inflight/Messages/KeepingAtRangeSubText', targetName=name, rangeText=rangeText)
        elif ballMode == destiny.DSTBALL_GOTO:
            alignTargetID, aligningToBookmark = sm.GetService('menu').GetLastAlignTarget()
            if not alignTargetID and not aligningToBookmark:
                return (None, None)
            headerText = localization.GetByLabel('UI/Inflight/Messages/AligningHeader')
            if alignTargetID:
                if util.IsCharacter(alignTargetID):
                    subText = localization.GetByLabel('UI/Inflight/Messages/AligningToPlayerSubText', charID=alignTargetID)
                else:
                    try:
                        name = sm.GetService('space').GetWarpDestinationName(alignTargetID)
                        subText = localization.GetByLabel('UI/Inflight/Messages/AligningToLocationSubText', targetName=name)
                    except:
                        subText = localization.GetByLabel('UI/Inflight/Messages/AligningUnknownSubText')

            elif aligningToBookmark:
                subText = localization.GetByLabel('UI/Inflight/Messages/AligningToBookmarkSubText')
            else:
                subText = localization.GetByLabel('UI/Inflight/Messages/AligningUnknownSubText')
        elif ballMode == destiny.DSTBALL_WARP:
            return self.IndicateWarp()
        return (headerText, subText)
Пример #23
0
 def Confirm(self):
     if self.level is None:
         eve.Message('NoStandingsSelected')
         return
     relationshipID = self.level
     inWatchlist = False
     sendNotification = False
     message = None
     contactLabel = None
     if hasattr(self, 'labelsCombo'):
         contactLabel = self.labelsCombo.GetValue()
     if util.IsCharacter(self.entityID):
         inWatchlist = self.inWatchlistCb.checked
         sendNotification = self.sendNotificationCb.checked
         message = self.message.GetValue()
     self.result = (relationshipID, inWatchlist, sendNotification, message,
                    contactLabel)
     if getattr(self, 'isModal', None):
         self.SetModalResult(1)
Пример #24
0
    def _GetMultiMenu(self, selected):
        m = []
        charIDs = []
        multiCharIDs = []
        listGroupIDs = {}
        listGroupID_charIDs = []
        onlyCharacters = True
        for entry in selected:
            listGroupID = entry.listGroupID
            if listGroupID:
                listGroupIDs[listGroupID] = 0
                listGroupID_charIDs.append((listGroupID, entry.charID))
            if entry.charID:
                charIDs.append((entry.charID, None))
                multiCharIDs.append(entry.charID)
                if not util.IsCharacter(entry.charID):
                    onlyCharacters = False

        if onlyCharacters:
            m += sm.GetService('menu').CharacterMenu(charIDs)
        if listGroupIDs:
            listname = ''
            delCharIDs = []
            rem = []
            for listGroupID, charID in listGroupID_charIDs:
                if listGroupID == ('agentgroups', 'all'):
                    if onlyCharacters:
                        return m
                    group = uicore.registry.GetListGroup(listGroupID)
                    listname = [
                        localization.GetByLabel('UI/Agents/AgentList'),
                        localization.GetByLabel('UI/Generic/BuddyList')
                    ][listGroupID == ('buddygroups', 'all')]
                    delCharIDs.append(charID)
                    rem.append((listGroupID, charID))

            for each in rem:
                listGroupID_charIDs.remove(each)

            foldername = 'folders'
            if len(listGroupIDs) == 1:
                group = uicore.registry.GetListGroup(listGroupIDs.keys()[0])
                if group:
                    foldername = group['label']
            label = ''
            if delCharIDs and listname:
                label = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveMultipleFromAddressbook',
                    removecount=len(delCharIDs))
                if listGroupID_charIDs:
                    label += [', ']
            if listGroupID_charIDs:
                label += localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveFromFolder',
                    foldername=foldername,
                    removecount=len(listGroupID_charIDs))
            m.append((label, self.RemoveFromListGroup, (listGroupID_charIDs,
                                                        delCharIDs, listname)))
        if self.sr.node.Get('MenuFunction', None):
            cm = [None]
            cm += self.sr.node.MenuFunction(selected)
            m += cm
        return m
Пример #25
0
 def OnDropData(self, dragObj, nodes):
     if not self.charid or not util.IsCharacter(self.charid):
         return
     from eve.client.script.ui.station.pvptrade.tradeUtil import TryInitiateTrade
     TryInitiateTrade(self.charid, nodes)
Пример #26
0
    def _GetMultiMenu(self, selected):
        m = []
        charIDs = []
        multiCharIDs = []
        multiEveCharIDs = []
        listGroupIDs = {}
        listGroupID_charIDs = []
        onlyCharacters = True
        for entry in selected:
            listGroupID = entry.listGroupID
            if listGroupID:
                listGroupIDs[listGroupID] = 0
                listGroupID_charIDs.append((listGroupID, entry.charID))
            if entry.charID:
                charIDs.append((entry.charID, None))
                multiCharIDs.append(entry.charID)
                if not util.IsCharacter(entry.charID):
                    onlyCharacters = False
                elif util.IsDustCharacter(entry.charID):
                    multiEveCharIDs.append(entry.charID)

        if self.isContactList is None:
            if onlyCharacters:
                m += sm.GetService('menu').CharacterMenu(charIDs)
            if listGroupIDs:
                listname = ''
                delCharIDs = []
                rem = []
                for listGroupID, charID in listGroupID_charIDs:
                    if listGroupID in [('buddygroups', 'all'),
                                       ('buddygroups', 'allcorps')]:
                        if onlyCharacters:
                            return m
                        group = uicore.registry.GetListGroup(listGroupID)
                        listname = [
                            localization.GetByLabel('UI/Generic/BuddyList')
                        ][listGroupID == ('buddygroups', 'all')]
                        delCharIDs.append(charID)
                        rem.append((listGroupID, charID))

                for each in rem:
                    listGroupID_charIDs.remove(each)

                foldername = 'folders'
                if len(listGroupIDs) == 1:
                    group = uicore.registry.GetListGroup(
                        listGroupIDs.keys()[0])
                    if group:
                        foldername = group['label']
                label = ''
                if delCharIDs and listname:
                    label = localization.GetByLabel(
                        'UI/PeopleAndPlaces/RemoveMultipleFromAddressbook',
                        removecount=len(delCharIDs))
                    if listGroupID_charIDs:
                        label += [', ']
                if listGroupID_charIDs:
                    label += localization.GetByLabel(
                        'UI/PeopleAndPlaces/RemoveFromFolder',
                        foldername=foldername,
                        removecount=len(listGroupID_charIDs))
                m.append((label, self.RemoveFromListGroup,
                          (listGroupID_charIDs, delCharIDs, listname)))
        else:
            addressBookSvc = sm.GetService('addressbook')
            counter = len(selected)
            blocked = 0
            if self.isContactList == 'contact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditContacts', contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'contact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveContacts', contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'contact']))
                for charid in multiCharIDs:
                    if sm.GetService('addressbook').IsBlocked(charid):
                        blocked += 1

                if blocked == counter:
                    unblockLabel = localization.GetByLabel(
                        'UI/PeopleAndPlaces/UnblockContacts',
                        contactcount=blocked)
                    m.append((unblockLabel, addressBookSvc.UnblockOwner,
                              [multiCharIDs]))
            elif self.isContactList == 'corpcontact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditCorpContacts',
                    contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'corpcontact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveCorpContacts',
                    contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'corpcontact']))
            elif self.isContactList == 'alliancecontact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditAllianceContacts',
                    contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'alliancecontact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveAllianceContacts',
                    contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'alliancecontact']))
            m.append(None)
            assignLabelMenu = sm.StartService(
                'addressbook').GetAssignLabelMenu(selected, multiCharIDs,
                                                  self.isContactList)
            if len(assignLabelMenu) > 0:
                m.append(
                    (uiutil.MenuLabel('UI/PeopleAndPlaces/AddContactLabel'),
                     assignLabelMenu))
            removeLabelMenu = sm.StartService(
                'addressbook').GetRemoveLabelMenu(selected, multiCharIDs,
                                                  self.isContactList)
            if len(removeLabelMenu) > 0:
                m.append(
                    (uiutil.MenuLabel('UI/PeopleAndPlaces/RemoveContactLabel'),
                     removeLabelMenu))
            m.append(None)
            m.append(
                (uiutil.MenuLabel('UI/Commands/CapturePortrait'),
                 sm.StartService('photo').SavePortraits, [multiEveCharIDs]))
        if self.sr.node.Get('MenuFunction', None):
            cm = [None]
            cm += self.sr.node.MenuFunction(selected)
            m += cm
        return m
Пример #27
0
    def ConstructLayout(self):
        topCont = uiprimitives.Container(
            name='topCont',
            parent=self.sr.main,
            align=uiconst.TOTOP,
            pos=(0, 0, 0, 70),
            padding=(const.defaultPadding, const.defaultPadding,
                     const.defaultPadding, const.defaultPadding))
        imgCont = uiprimitives.Container(name='imgCont',
                                         parent=topCont,
                                         align=uiconst.TOLEFT,
                                         pos=(0, 0, 64, 0),
                                         padding=(0, 0, const.defaultPadding,
                                                  0))
        topRightCont = uiprimitives.Container(name='topRightCont',
                                              parent=topCont,
                                              align=uiconst.TOALL,
                                              pos=(0, 0, 0, 0),
                                              padding=(const.defaultPadding, 0,
                                                       0, 0))
        nameCont = uiprimitives.Container(name='nameCont',
                                          parent=topRightCont,
                                          align=uiconst.TOTOP,
                                          pos=(0, 0, 0, 20))
        uiprimitives.Line(parent=nameCont, align=uiconst.TOBOTTOM)
        levelCont = uiprimitives.Container(name='levelCont',
                                           parent=topRightCont,
                                           align=uiconst.TOTOP,
                                           height=42,
                                           padding=(0, const.defaultPadding, 0,
                                                    0))
        self.standingList = {
            const.contactHighStanding:
            localization.GetByLabel('UI/PeopleAndPlaces/ExcellentStanding'),
            const.contactGoodStanding:
            localization.GetByLabel('UI/PeopleAndPlaces/GoodStanding'),
            const.contactNeutralStanding:
            localization.GetByLabel('UI/PeopleAndPlaces/NeutralStanding'),
            const.contactBadStanding:
            localization.GetByLabel('UI/PeopleAndPlaces/BadStanding'),
            const.contactHorribleStanding:
            localization.GetByLabel('UI/PeopleAndPlaces/TerribleStanding')
        }
        levelList = self.standingList.keys()
        levelList.sort()
        levelText = self.standingList.get(self.level)
        self.levelText = uicontrols.EveLabelMedium(text=levelText,
                                                   parent=levelCont,
                                                   height=14,
                                                   align=uiconst.TOTOP,
                                                   state=uiconst.UI_DISABLED,
                                                   idx=0)
        self.levelSelector = uicls.StandingLevelSelector(name='levelCont',
                                                         parent=levelCont,
                                                         align=uiconst.TOTOP,
                                                         height=55,
                                                         padTop=4,
                                                         level=self.level)
        self.levelSelector.OnStandingLevelSelected = self.OnStandingLevelSelected
        charName = cfg.eveowners.Get(self.entityID).name
        uiutil.GetOwnerLogo(imgCont, self.entityID, size=64, noServerCall=True)
        label = uicontrols.EveLabelLargeBold(text=charName,
                                             parent=nameCont,
                                             left=0,
                                             align=uiconst.TOPLEFT,
                                             width=170,
                                             state=uiconst.UI_DISABLED,
                                             idx=0)
        nameCont.state = uiconst.UI_DISABLED
        nameCont.height = label.height + 2
        self.minHeight += nameCont.height
        topCont.height = max(topCont.height,
                             nameCont.height + levelCont.height)
        labels = sm.GetService('addressbook').GetContactLabels(
            'contact').values()
        if not self.isContact and len(labels):
            labelList = []
            labelCont = uiprimitives.Container(name='topCont',
                                               parent=self.sr.main,
                                               align=uiconst.TOTOP,
                                               pos=(0, 0, 0, 18),
                                               padding=(const.defaultPadding,
                                                        0, 0,
                                                        const.defaultPadding))
            for label in labels:
                labelList.append(
                    (label.name.lower(), (label.name, label.labelID)))

            labelList = uiutil.SortListOfTuples(labelList)
            assignLabelText = '-- %s --' % localization.GetByLabel(
                'UI/Mail/AssignLabel')
            labelList.insert(0, (assignLabelText, None))
            self.labelsCombo = uicontrols.Combo(label='',
                                                parent=labelCont,
                                                options=labelList,
                                                name='labelscombo',
                                                adjustWidth=True)
            self.minHeight += labelCont.height
            if self.labelID:
                self.labelsCombo.SetValue(self.labelID)
        if util.IsCharacter(self.entityID):
            splitter = uiprimitives.Container(name='splitter',
                                              parent=self.sr.main,
                                              align=uiconst.TOTOP,
                                              pos=(0, 0, 0, 1),
                                              padding=(0, 0, 0, 0))
            uiprimitives.Line(parent=splitter, align=uiconst.TOBOTTOM)
            bottomCont = uiprimitives.Container(name='bottomCont',
                                                parent=self.sr.main,
                                                align=uiconst.TOALL,
                                                pos=(0, 0, 0, 0),
                                                padding=const.defaultPadding)
            cbCont = uiprimitives.Container(name='cbCont',
                                            parent=bottomCont,
                                            align=uiconst.TOTOP,
                                            pos=(0, 0, 0, 16),
                                            state=uiconst.UI_HIDDEN)
            notifyCont = uiprimitives.Container(name='notifyCont',
                                                parent=bottomCont,
                                                align=uiconst.TOTOP,
                                                pos=(0, 0, 0, 95))
            cbCont.state = uiconst.UI_NORMAL
            self.inWatchlistCb = uicontrols.Checkbox(
                text=localization.GetByLabel(
                    'UI/PeopleAndPlaces/AddContactToWatchlist'),
                parent=cbCont,
                configName='inWatchlistCb',
                retval=0,
                checked=self.watchlist,
                align=uiconst.TOTOP)
            self.inWatchlistCb.hint = localization.GetByLabel(
                'UI/PeopleAndPlaces/BuddyListHint')
            self.sendNotificationCb = uicontrols.Checkbox(
                text=localization.GetByLabel(
                    'UI/PeopleAndPlaces/SendNotificationTo',
                    contactName=charName),
                parent=notifyCont,
                configName='sendNotificationCb',
                retval=0,
                checked=0,
                align=uiconst.TOTOP)
            self.message = uicls.EditPlainText(setvalue='',
                                               parent=notifyCont,
                                               align=uiconst.TOALL,
                                               maxLength=120,
                                               padBottom=const.defaultPadding)
            self.minHeight += 120
        btnText = localization.GetByLabel('UI/PeopleAndPlaces/AddContact')
        if self.isContact:
            btnText = localization.GetByLabel('UI/PeopleAndPlaces/EditContact')
        self.btnGroup = uicontrols.ButtonGroup(
            btns=[[btnText, self.Confirm, (), 81, 1, 1, 0],
                  [
                      localization.GetByLabel('UI/Common/Buttons/Cancel'),
                      self.Cancel, (), 81, 0, 0, 0
                  ]],
            parent=self.sr.main,
            idx=0)
        if self.level is None:
            self.levelText.text = localization.GetByLabel(
                'UI/PeopleAndPlaces/SelectStanding')
            btn = self.btnGroup.GetBtnByLabel(btnText)
            uicore.registry.SetFocus(btn)
        uthread.new(self.SetWindowSize)
Пример #28
0
    def OnDropDataDelegate(self, node, nodes):
        """ 
            Handle the event when something is drag-dropped into the edit 
        """
        uicontrols.EditPlainTextCore.OnDropDataDelegate(self, node, nodes)
        if self.readonly:
            return
        uicore.registry.SetFocus(self)
        for entry in nodes:
            if entry.__guid__ in uiutil.AllUserEntries():
                link = 'showinfo:' + str(entry.info.typeID) + '//' + str(
                    entry.charID)
                self.AddLink(entry.info.name, link)
            elif entry.__guid__ == 'listentry.PlaceEntry' and self.allowPrivateDrops:
                bookmarkID = entry.bm.bookmarkID
                bookmarkSvc = sm.GetService('bookmarkSvc')
                bms = bookmarkSvc.GetBookmarks()
                if bookmarkID in bms:
                    bookmark = bms[bookmarkID]
                    hint, comment = bookmarkSvc.UnzipMemo(bookmark.memo)
                link = 'showinfo:' + str(bms[bookmarkID].typeID) + '//' + str(
                    bms[bookmarkID].itemID)
                self.AddLink(hint, link)
            elif entry.__guid__ == 'listentry.NoteItem' and self.allowPrivateDrops:
                link = 'note:' + str(entry.noteID)
                self.AddLink(entry.label, link)
            elif entry.__guid__ in ('listentry.InvItem', 'xtriui.InvItem',
                                    'xtriui.ShipUIModule',
                                    'listentry.InvAssetItem',
                                    'listentry.ItemCheckbox'):
                if type(entry.rec.itemID) is tuple:
                    link = 'showinfo:' + str(entry.rec.typeID)
                else:
                    link = 'showinfo:' + str(entry.rec.typeID) + '//' + str(
                        entry.rec.itemID)
                self.AddLink(entry.name, link)
            elif entry.__guid__ in ('listentry.VirtualAgentMissionEntry', ):
                link = 'fleetmission:' + str(entry.agentID) + '//' + str(
                    entry.charID)
                self.AddLink(entry.label, link)
            elif entry.__guid__ in ('listentry.CertEntry',
                                    'listentry.CertEntryBasic'):
                link = 'CertEntry:%s//%s' % (entry.certID, entry.level)
                self.AddLink(entry.label, link)
            elif entry.__guid__.startswith('listentry.ContractEntry'):
                link = 'contract:' + str(entry.solarSystemID) + '//' + str(
                    entry.contractID)
                self.AddLink(entry.name.replace('>', '>'), link)
            elif entry.__guid__ in ('listentry.FleetFinderEntry', ):
                link = 'fleet:%s' % entry.fleet.fleetID
                self.AddLink(
                    entry.fleet.fleetName
                    or localization.GetByLabel('UI/Common/Unknown'), link)
            elif entry.__guid__ in ('xtriui.ListSurroundingsBtn',
                                    'listentry.LocationTextEntry',
                                    'listentry.LabelLocationTextTop',
                                    'listentry.LocationGroup',
                                    'listentry.LocationSearchItem'):
                if not entry.typeID and not entry.itemID:
                    return
                link = 'showinfo:' + str(entry.typeID) + '//' + str(
                    entry.itemID)
                displayLabel = getattr(entry, 'genericDisplayLabel',
                                       None) or entry.label
                self.AddLink(displayLabel, link)
            elif entry.__guid__ == 'listentry.FittingEntry':
                PADDING = 12
                link = 'fitting:' + sm.StartService(
                    'fittingSvc').GetStringForFitting(entry.fitting)
                roomLeft = self.RoomLeft()
                if roomLeft is not None:
                    roomLeft = roomLeft - PADDING
                    if len(link) >= roomLeft:
                        if roomLeft < 14:
                            raise UserError('LinkTooLong')
                        if eve.Message(
                                'ConfirmTruncateLink', {
                                    'numchar': len(link),
                                    'maxchar': roomLeft
                                },
                                uiconst.YESNO,
                                suppress=uiconst.ID_YES) != uiconst.ID_YES:
                            return
                        link = link[:roomLeft]
                self.AddLink(entry.fitting.name, link)
            elif entry.__guid__ in ('listentry.GenericMarketItem',
                                    'listentry.QuickbarItem',
                                    'uicls.GenericDraggableForTypeID',
                                    'listentry.DroneEntry',
                                    'listentry.SkillTreeEntry'):
                link = 'showinfo:' + str(entry.typeID)
                label = getattr(entry, 'label', None) or getattr(
                    entry, 'text', '')
                self.AddLink(label, link)
            elif entry.__guid__ == 'TextLink':
                self.AddLink(entry.displayText, entry.url)
            elif entry.__guid__ == 'listentry.ChannelField':
                link = 'joinChannel:%s//%s//%s' % (entry.channel.channelID,
                                                   None, None)
                label = getattr(entry, 'genericDisplayLabel',
                                None) or entry.label
                self.AddLink(label, link)
            elif entry.__guid__ in ('listentry.KillMail',
                                    'listentry.KillMailCondensed',
                                    'listentry.WarKillEntry'):
                killmail = entry.mail
                hashValue = util.GetKillReportHashValue(killmail)
                if util.IsCharacter(killmail.victimCharacterID):
                    victimName = cfg.eveowners.Get(
                        killmail.victimCharacterID).name
                    shipName = cfg.invtypes.Get(
                        killmail.victimShipTypeID).typeName
                    label = localization.GetByLabel(
                        'UI/Corporations/Wars/Killmails/KillLinkCharacter',
                        charName=victimName,
                        typeName=shipName)
                else:
                    shipName = cfg.invtypes.Get(
                        killmail.victimShipTypeID).typeName
                    label = localization.GetByLabel(
                        'UI/Corporations/Wars/Killmails/KillLinkStructure',
                        typeName=shipName)
                link = 'killReport:%d:%s' % (entry.mail.killID, hashValue)
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.WarEntry':
                warID = entry.war.warID
                attackerID = entry.war.declaredByID
                defenderID = entry.war.againstID
                attackerName = cfg.eveowners.Get(attackerID).name
                defenderName = cfg.eveowners.Get(defenderID).name
                label = localization.GetByLabel(
                    'UI/Corporations/Wars/WarReportLink',
                    attackerName=attackerName,
                    defenderName=defenderName)
                link = 'warReport:%d' % warID
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.TutorialEntry':
                tutorialID = entry.tutorialID
                link = 'tutorial:%s' % tutorialID
                label = entry.label
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.listentry.RecruitmentEntry':
                label = '%s - %s ' % (cfg.eveowners.Get(
                    entry.advert.corporationID).name, entry.adTitle)
                link = 'recruitmentAd:' + str(
                    entry.advert.corporationID) + '//' + str(entry.advert.adID)
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.DirectionalScanResults':
                label = entry.typeName
                link = 'showinfo:' + str(entry.typeID) + '//' + str(
                    entry.itemID)
                self.AddLink(label, link, addLineBreak=True)
            elif entry.__guid__ in ('listentry.SkillEntry',
                                    'listentry.SkillQueueSkillEntry'):
                label = entry.invtype.typeName
                link = 'showinfo:' + str(entry.invtype.typeID)
                self.AddLink(label, link)
            elif entry.__guid__ in ('listentry.Item',
                                    'listentry.ContractItemSelect',
                                    'listentry.RedeemToken',
                                    'listentry.FittingModuleEntry',
                                    'listentry.KillItems'):
                label = cfg.invtypes.Get(entry.typeID).name
                link = 'showinfo:' + str(entry.typeID)
                self.AddLink(label, link)
            elif entry.__guid__ in ('listentry.PodGuideBrowseEntry', ):
                label = entry.label
                link = 'podGuideLink:%s' % entry.termID
                self.AddLink(label, link)
            elif entry.__guid__ == 'fakeentry.OverviewProfile':
                progressText = localization.GetByLabel(
                    'UI/Overview/FetchingOverviewProfile')
                sm.GetService('loading').ProgressWnd(progressText, '', 1, 2)
                try:
                    presetKeyVal = sm.RemoteSvc(
                        'overviewPresetMgr').StoreLinkAndGetID(entry.data)
                    if presetKeyVal is None:
                        raise UserError('OverviewProfileLoadingError')
                    else:
                        presetKey = (presetKeyVal.hashvalue, presetKeyVal.sqID)
                finally:
                    sm.GetService('loading').ProgressWnd(
                        progressText, '', 2, 2)

                link = 'overviewPreset:%s//%s' % presetKey
                label = entry.label
                self.AddLink(label, link)
Пример #29
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
Пример #30
0
 def OnDropDataDelegate(self, node, nodes):
     EditCore.OnDropDataDelegate(self, node, nodes)
     if self.readonly:
         return
     for entry in nodes:
         if entry.__guid__ in uiutil.AllUserEntries():
             link = 'showinfo:' + str(entry.info.typeID) + '//' + str(
                 entry.charID)
             self.AddLink(entry.info.name, link)
         elif entry.__guid__ == 'listentry.PlaceEntry' and self.allowPrivateDrops:
             bookmarkID = entry.bm.bookmarkID
             bookmarkSvc = sm.GetService('bookmarkSvc')
             bms = bookmarkSvc.GetBookmarks()
             if bookmarkID in bms:
                 bookmark = bms[bookmarkID]
                 hint, comment = bookmarkSvc.UnzipMemo(bookmark.memo)
             link = 'showinfo:' + str(bms[bookmarkID].typeID) + '//' + str(
                 bms[bookmarkID].itemID)
             self.AddLink(hint, link)
         elif entry.__guid__ == 'listentry.NoteItem' and self.allowPrivateDrops:
             link = 'note:' + str(entry.noteID)
             self.AddLink(entry.label, link)
         elif entry.__guid__ in ('listentry.InvItem', 'xtriui.InvItem',
                                 'xtriui.ShipUIModule',
                                 'listentry.InvAssetItem'):
             if type(entry.rec.itemID) is tuple:
                 link = 'showinfo:' + str(entry.rec.typeID)
             else:
                 link = 'showinfo:' + str(entry.rec.typeID) + '//' + str(
                     entry.rec.itemID)
             self.AddLink(entry.name, link)
         elif entry.__guid__ == 'listentry.VirtualAgentMissionEntry':
             link = 'fleetmission:' + str(entry.agentID) + '//' + str(
                 entry.charID)
             self.AddLink(entry.label, link)
         elif entry.__guid__ in ('listentry.CertEntry',
                                 'listentry.CertEntryBasic'):
             link = 'CertEntry:%s//%s' % (entry.certID, entry.level)
             self.AddLink(entry.label, link)
         elif entry.__guid__ and entry.__guid__.startswith(
                 'listentry.ContractEntry'):
             link = 'contract:' + str(entry.solarSystemID) + '//' + str(
                 entry.contractID)
             self.AddLink(entry.name.replace('&gt;', '>'), link)
         elif entry.__guid__ == 'listentry.FleetFinderEntry':
             link = 'fleet:%s' % entry.fleet.fleetID
             self.AddLink(
                 entry.fleet.fleetName
                 or localization.GetByLabel('UI/Common/Unknown'), link)
         elif entry.__guid__ in ('xtriui.ListSurroundingsBtn',
                                 'listentry.LocationTextEntry',
                                 'listentry.LabelLocationTextTop',
                                 'listentry.LocationGroup',
                                 'listentry.LocationSearchItem'):
             if not entry.typeID and not entry.itemID:
                 return
             link = 'showinfo:' + str(entry.typeID) + '//' + str(
                 entry.itemID)
             displayLabel = getattr(entry, 'genericDisplayLabel',
                                    None) or entry.label
             self.AddLink(displayLabel, link)
         elif entry.__guid__ == 'listentry.FittingEntry':
             PADDING = 12
             link = 'fitting:' + sm.StartService(
                 'fittingSvc').GetStringForFitting(entry.fitting)
             roomLeft = self.RoomLeft() - PADDING
             if len(link) >= roomLeft:
                 if roomLeft < 14:
                     raise UserError('LinkTooLong')
                 if eve.Message('ConfirmTruncateLink', {
                         'numchar': len(link),
                         'maxchar': roomLeft
                 },
                                uiconst.YESNO,
                                suppress=uiconst.ID_YES) != uiconst.ID_YES:
                     return
                 link = link[:roomLeft]
             self.AddLink(entry.fitting.name, link)
         elif entry.__guid__ in ('listentry.GenericMarketItem',
                                 'uicls.GenericDraggableForTypeID',
                                 'listentry.DroneEntry',
                                 'listentry.SkillTreeEntry'):
             link = 'showinfo:' + str(entry.typeID)
             label = getattr(entry, 'label', None) or getattr(
                 entry, 'text', '')
             self.AddLink(label, link)
         elif entry.__guid__ in ('listentry.KillMail',
                                 'listentry.KillMailCondensed',
                                 'listentry.WarKillEntry'):
             killmail = entry.mail
             hashValue = util.GetKillReportHashValue(killmail)
             if util.IsCharacter(killmail.victimCharacterID):
                 victimName = cfg.eveowners.Get(
                     killmail.victimCharacterID).name
                 shipName = evetypes.GetName(killmail.victimShipTypeID)
                 label = localization.GetByLabel(
                     'UI/Corporations/Wars/Killmails/KillLinkCharacter',
                     charName=victimName,
                     typeName=shipName)
             else:
                 shipName = evetypes.GetName(killmail.victimShipTypeID)
                 label = localization.GetByLabel(
                     'UI/Corporations/Wars/Killmails/KillLinkStructure',
                     typeName=shipName)
             link = 'killReport:%d:%s' % (entry.mail.killID, hashValue)
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.WarEntry':
             warID = entry.war.warID
             attackerID = entry.war.declaredByID
             defenderID = entry.war.againstID
             attackerName = cfg.eveowners.Get(attackerID).name
             defenderName = cfg.eveowners.Get(defenderID).name
             label = localization.GetByLabel(
                 'UI/Corporations/Wars/WarReportLink',
                 attackerName=attackerName,
                 defenderName=defenderName)
             link = 'warReport:%d' % warID
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.TutorialEntry':
             tutorialID = entry.tutorialID
             link = 'tutorial:%s' % tutorialID
             label = entry.label
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.listentry.RecruitmentEntry':
             label = '%s - %s ' % (cfg.eveowners.Get(
                 entry.advert.corporationID).name, entry.adTitle)
             link = 'recruitmentAd:' + str(
                 entry.advert.corporationID) + '//' + str(entry.advert.adID)
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.DirectionalScanResults':
             label = entry.typeName
             link = 'showinfo:' + str(entry.typeID) + '//' + str(
                 entry.itemID)
             self.AddLink(label, link)
         elif entry.__guid__ in ('listentry.SkillEntry',
                                 'listentry.SkillQueueSkillEntry'):
             label = entry.invtype.typeName
             link = 'showinfo:' + str(entry.invtype.typeID)
             self.AddLink(label, link)