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

panelShipAvailableSkinLicenses.py (2779B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\panelShipAvailableSkinLicenses.py
      2 from carbonui.primitives.container import Container
      3 from carbonui.primitives.sprite import Sprite
      4 from carbonui.util.sortUtil import SortListOfTuples
      5 from eve.client.script.ui.control.eveScroll import Scroll
      6 from eve.client.script.ui.control.entries.item import Item
      7 from eve.client.script.ui.control.entries.util import GetFromClass
      8 import evetypes
      9 from carbonui import const as uiconst
     10 from localization import GetByLabel
     11 
     12 class PanelShipAvailableSkinLicenses(Container):
     13 
     14     def ApplyAttributes(self, attributes):
     15         Container.ApplyAttributes(self, attributes)
     16         self.typeID = attributes.typeID
     17         self.Layout()
     18 
     19     def Layout(self):
     20         self.scroll = Scroll(name='scroll', parent=self, padding=4)
     21 
     22     def Load(self):
     23         entries = []
     24         cosmeticsSvc = sm.GetService('cosmeticsSvc')
     25         skins = cosmeticsSvc.GetSkins(self.typeID)
     26         skinForType = {s.skinID:s.expires for s in cosmeticsSvc.GetLicensedSkinsForType(self.typeID)}
     27         for skin in skins:
     28             static = cosmeticsSvc.static
     29             licenses = static.GetLicensesForTypeWithMaterial(self.typeID, skin.materialID)
     30             for license in licenses:
     31                 skinID = license.skinID
     32                 haveSkinMaterial = skinID in skinForType
     33                 ownSkinTypeInList = False
     34                 if haveSkinMaterial:
     35                     expiryOfOwnedSkin = skinForType[skinID]
     36                     if license.duration == -1:
     37                         if expiryOfOwnedSkin is None:
     38                             ownSkinTypeInList = True
     39                     else:
     40                         ownSkinTypeInList = True
     41                 skinName = evetypes.GetName(license.licenseTypeID)
     42                 data = {'typeID': license.licenseTypeID,
     43                  'itemID': None,
     44                  'label': skinName,
     45                  'sublevel': 1,
     46                  'getIcon': True,
     47                  'ownSkin': ownSkinTypeInList}
     48                 entry = GetFromClass(SkinItemEntry, data=data)
     49                 sortKey = (-ownSkinTypeInList, skinName)
     50                 entries.append((sortKey, entry))
     51 
     52         entries = SortListOfTuples(entries)
     53         self.scroll.Load(contentList=entries)
     54 
     55 
     56 class SkinItemEntry(Item):
     57 
     58     def Startup(self, *args):
     59         Item.Startup(self, args)
     60         self.haveIcon = Sprite(parent=self, align=uiconst.CENTERLEFT, pos=(0, 0, 16, 16), texturePath='res:/ui/Texture/classes/Skills/SkillRequirementMet.png', hint=GetByLabel('UI/Skins/OwnSkinLicense'))
     61 
     62     def Load(self, node):
     63         Item.Load(self, node)
     64         ownSkin = node.ownSkin
     65         self.haveIcon.display = bool(ownSkin)