NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

labelTooltip.py (2145B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\addressBook\labelTooltip.py
      2 import eveicon
      3 from carbonui import TextColor
      4 from carbonui.primitives.sprite import Sprite
      5 from eve.client.script.ui.shared.neocom.addressBook.contactsConst import TAB_CONTACTS, TAB_CORPCONTACTS, TAB_ALLIANCECONTACTS
      6 from eve.common.script.sys import idCheckers
      7 from localization import GetByLabel
      8 
      9 def LoadContactTooltipPanel(tooltipPanel, charID, corpid, allianceid):
     10     allContactsByContactType = sm.GetService('addressbook').GetAllLabelsForOwnerID(charID, corpid, allianceid)
     11     tooltipPanel.LoadStandardSpacing()
     12     tooltipPanel.columns = 1
     13     typesAdded = 0
     14     for ct, myOwnerID, textLabelPath in [(TAB_CONTACTS, session.charid, 'UI/PeopleAndPlaces/MyAssignedLabels'), (TAB_CORPCONTACTS, session.corpid, 'UI/PeopleAndPlaces/OwnerAssignedLabels'), (TAB_ALLIANCECONTACTS, session.allianceid, 'UI/PeopleAndPlaces/OwnerAssignedLabels')]:
     15         labelsOfType = allContactsByContactType.get(ct, None)
     16         if labelsOfType is None or myOwnerID is None:
     17             continue
     18         if ct == TAB_CONTACTS:
     19             headerText = GetByLabel('UI/PeopleAndPlaces/MyAssignedLabels')
     20         else:
     21             headerText = GetByLabel(textLabelPath, ownerName=cfg.eveowners.Get(myOwnerID).name)
     22         tooltipPanel.AddTextDetailsLabel(text=headerText, colSpan=tooltipPanel.columns, color=TextColor.SECONDARY, top=8 if typesAdded else 0)
     23         for ownerID, labelList in labelsOfType.iteritems():
     24             text = ', '.join([ x[0] for x in labelList ])
     25             texturePath = _GetLabelTexturePath(ownerID)
     26             label = tooltipPanel.AddTextBodyLabel(text=text, left=24, wrapWidth=300)
     27             Sprite(parent=label.parent, pos=(0, 0, 16, 16), texturePath=texturePath, color=TextColor.NORMAL)
     28             typesAdded += 1
     29 
     30 
     31 def _GetLabelTexturePath(ownerID):
     32     if idCheckers.IsAlliance(ownerID):
     33         texturePath = ''
     34     elif idCheckers.IsCorporation(ownerID):
     35         texturePath = eveicon.corporation_management
     36     else:
     37         texturePath = eveicon.person
     38     return texturePath