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

lpTab.py (2024B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\wallet\tabs\lpTab.py
      2 from carbonui import uiconst
      3 from carbonui.primitives.container import Container
      4 from carbonui.util.color import Color
      5 from eve.client.script.ui.control.eveLabel import EveLabelMediumBold
      6 from eve.client.script.ui.shared.neocom.wallet.tabs.baseWalletTab import BaseWalletTab
      7 from localization import GetByLabel
      8 
      9 class LoyaltyPointsTab(BaseWalletTab):
     10     default_name = 'LoyaltyPointsTab'
     11     default_texturePath = 'res:/ui/Texture/WindowIcons/lpstore_24px.png'
     12     tabNamePath = 'UI/Journal/JournalWindow/Agents/LoyaltyPoints'
     13     default_underlayColor = Color.HextoRGBA('#B0C9EE')
     14     default_hint = GetByLabel('UI/Wallet/WalletWindow/LPDescription')
     15     default_height = 0.5
     16     default_padding = (2, 2, 2, 2)
     17     iconContainerSize = 32
     18     iconSize = 28
     19     __notifyevents__ = ['OnCharacterLPBalanceChange_Local']
     20 
     21     def __init__(self, **kwargs):
     22         self.loyaltyPointsWalletSvc = sm.GetService('loyaltyPointsWalletSvc')
     23         super(LoyaltyPointsTab, self).__init__(**kwargs)
     24 
     25     def ApplyAttributes(self, attributes):
     26         super(LoyaltyPointsTab, self).ApplyAttributes(attributes)
     27         sm.RegisterNotify(self)
     28 
     29     def ConstructDataContainer(self):
     30         dataContainer = Container(parent=self.mainContainer, align=uiconst.TOALL)
     31         self.tabNameLabel = EveLabelMediumBold(name='tabNameLabel', parent=dataContainer, align=uiconst.CENTERLEFT, left=6, text='')
     32         self.ConstructInfoIcon(dataContainer)
     33         self.Update()
     34 
     35     def Update(self):
     36         numCorpLPs = self.GetAmountOfCorporationsIHaveLoyaltyPointsWith()
     37         self.tabNameLabel.text = GetByLabel('UI/Wallet/WalletWindow/TabLPCorpNumber', numLPCorps=numCorpLPs)
     38 
     39     def GetAmountOfCorporationsIHaveLoyaltyPointsWith(self):
     40         return len(self.loyaltyPointsWalletSvc.GetAllCharacterLPBalancesExcludingEvermarks())
     41 
     42     def OnCharacterLPBalanceChange_Local(self, *args):
     43         self.Update()