evermarkTab.py (3344B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\wallet\tabs\evermarkTab.py 2 import evetypes 3 from appConst import corpHeraldry 4 from carbonui import uiconst 5 from carbonui.primitives.container import Container 6 from carbonui.util.color import Color 7 from eve.client.script.ui.shared.neocom.wallet.tabs.baseWalletTab import BaseWalletTab 8 from eve.client.script.ui.shared.neocom.wallet.walletUtil import HaveAccessToCorpEMWallet 9 from inventorycommon.const import typeLoyaltyPointsHeraldry 10 from localization import GetByLabel 11 from eve.client.script.ui.control.eveLabel import EveLabelMediumBold 12 13 class CorpEverMarkTab(BaseWalletTab): 14 default_name = 'CorpEverMarkTab' 15 default_height = 0.5 16 default_texturePath = 'res:/ui/texture/WindowIcons/evermark_24px.png' 17 default_underlayColor = Color.HextoRGBA('#6E966B') 18 default_hint = evetypes.GetDescription(typeLoyaltyPointsHeraldry) 19 default_padding = (2, 2, 2, 2) 20 iconContainerSize = 32 21 iconSize = 24 22 __notifyevents__ = ['OnCorporationLPBalanceChange_Local'] 23 24 def ApplyAttributes(self, attributes): 25 super(CorpEverMarkTab, self).ApplyAttributes(attributes) 26 sm.RegisterNotify(self) 27 28 def ConstructDataContainer(self): 29 dataContainer = Container(parent=self.mainContainer, align=uiconst.TOALL) 30 self.tabNameLabel = EveLabelMediumBold(name='tabNameLabel', parent=dataContainer, align=uiconst.CENTERLEFT, left=6, text='') 31 self.ConstructInfoIcon(dataContainer) 32 self.Update() 33 34 def Update(self): 35 self.enabled = HaveAccessToCorpEMWallet() 36 if not HaveAccessToCorpEMWallet(): 37 return 38 everMarks = sm.GetService('loyaltyPointsWalletSvc').GetCorporationEvermarkBalance() 39 self.tabNameLabel.text = GetByLabel('UI/Wallet/WalletWindow/EvermarkAmount', everMarkAmount=everMarks) 40 41 def OnCorporationLPBalanceChange_Local(self, issuerCorpID): 42 if issuerCorpID == corpHeraldry: 43 self.Update() 44 45 46 class EverMarkTab(BaseWalletTab): 47 default_name = 'EvermarkTab' 48 default_height = 0.5 49 default_texturePath = 'res:/ui/texture/WindowIcons/evermark_24px.png' 50 default_underlayColor = Color.HextoRGBA('#6E966B') 51 default_hint = evetypes.GetDescription(typeLoyaltyPointsHeraldry) 52 default_padding = (2, 2, 2, 2) 53 iconContainerSize = 32 54 iconSize = 24 55 __notifyevents__ = ['OnCharacterLPBalanceChange_Local'] 56 57 def ApplyAttributes(self, attributes): 58 super(EverMarkTab, self).ApplyAttributes(attributes) 59 sm.RegisterNotify(self) 60 61 def ConstructDataContainer(self): 62 dataContainer = Container(parent=self.mainContainer, align=uiconst.TOALL) 63 self.tabNameLabel = EveLabelMediumBold(name='tabNameLabel', parent=dataContainer, align=uiconst.CENTERLEFT, left=6, text='') 64 self.ConstructInfoIcon(dataContainer) 65 self.Update() 66 67 def Update(self): 68 everMarks = sm.GetService('loyaltyPointsWalletSvc').GetCharacterEvermarkBalance() 69 self.tabNameLabel.text = GetByLabel('UI/Wallet/WalletWindow/EvermarkAmount', everMarkAmount=everMarks) 70 71 def PopulateBottomContainer(self): 72 pass 73 74 def OnCharacterLPBalanceChange_Local(self, issuerCorpID, _lpBefore, _lpAfter): 75 if issuerCorpID == corpHeraldry: 76 self.Update()