plexPanel.py (7659B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\charsheet\plexPanel.py 2 import carbonui.const as uiconst 3 import uthread 4 from carbonui.control.scrollContainer import ScrollContainer 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.util.color import Color 8 from eve.client.script.ui.control.eveIcon import Icon 9 from eve.client.script.ui.control.eveLabel import EveLabelMedium, EveLabelLargeBold, EveLabelMediumBold 10 from eve.client.script.ui.control.themeColored import FillThemeColored 11 from eve.client.script.ui.shared.cloneGrade import ORIGIN_CHARACTERSHEET 12 from eve.client.script.ui.shared.cloneGrade.cloneStateIcon import CloneStateIcon 13 from eve.client.script.ui.shared.inventory.plexVault import Vault, PlexVaultActions, PlexVaultController 14 from eve.client.script.ui.shared.monetization.events import LogCharacterSheetPilotLicenseImpression 15 from eve.common.lib import appConst as const 16 from localization import GetByLabel 17 from fastcheckout.const import FROM_CHARACTER_SHEET 18 19 class PLEXPanel(Container): 20 default_name = 'PLEXPanel' 21 __notifyevents__ = ['OnMultipleCharactersTrainingRefreshed', 'OnSubscriptionTimeUpdateServer'] 22 23 def ApplyAttributes(self, attributes): 24 Container.ApplyAttributes(self, attributes) 25 sm.RegisterNotify(self) 26 self.isConstructed = False 27 28 def LoadPanel(self, *args): 29 self.ConstructLayout() 30 self.multipleQueueLabel1.text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/AdditionalQueueNotActive') 31 self.multipleQueueLabel1.color = Color.GRAY5 32 self.multipleQueueExpiryLabel1.state = uiconst.UI_HIDDEN 33 self.multipleQueueIcon1.opacity = 0.3 34 self.multipleQueueLabel2.text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/AdditionalQueueNotActive') 35 self.multipleQueueLabel2.color = Color.GRAY5 36 self.multipleQueueExpiryLabel2.state = uiconst.UI_HIDDEN 37 self.multipleQueueIcon2.opacity = 0.3 38 for index, (trainingID, trainingExpiry) in enumerate(sorted(sm.GetService('skillqueue').GetMultipleCharacterTraining().iteritems())): 39 if index == 0: 40 self.multipleQueueLabel1.text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/AdditionalQueueActive') 41 self.multipleQueueLabel1.color = (0.0, 1.0, 0.0, 0.8) 42 self.multipleQueueExpiryLabel1.text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/AdditionalQueueExpires', expiryDate=trainingExpiry) 43 self.multipleQueueExpiryLabel1.state = uiconst.UI_DISABLED 44 self.multipleQueueIcon1.opacity = 1.0 45 elif index == 1: 46 self.multipleQueueLabel2.text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/AdditionalQueueActive') 47 self.multipleQueueLabel2.color = (0.0, 1.0, 0.0, 0.8) 48 self.multipleQueueExpiryLabel2.text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/AdditionalQueueExpires', expiryDate=trainingExpiry) 49 self.multipleQueueExpiryLabel2.state = uiconst.UI_DISABLED 50 self.multipleQueueIcon2.opacity = 1.0 51 52 self.RefreshOmegaTime(self.GetOmegaTime()) 53 54 def ConstructLayout(self): 55 if self.isConstructed: 56 return 57 self.isConstructed = True 58 controller = PlexVaultController() 59 Vault(parent=self, align=uiconst.TOTOP, controller=controller) 60 scrollContainer = ScrollContainer(name='plexScroll', parent=self, align=uiconst.TOALL) 61 scrollMainCont = ContainerAutoSize(parent=scrollContainer, align=uiconst.TOTOP, padding=(10, 10, 10, 10)) 62 PlexVaultActions(parent=scrollMainCont, align=uiconst.TOTOP, logContext=FROM_CHARACTER_SHEET, controller=controller) 63 EveLabelLargeBold(parent=scrollMainCont, align=uiconst.TOTOP, text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/CloneState'), padding=(10, 25, 0, 0)) 64 EveLabelMedium(parent=scrollMainCont, align=uiconst.TOTOP, text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/PlexDescription'), padding=(10, 10, 0, 10), color=Color.GRAY5) 65 subscription = ContainerAutoSize(parent=scrollMainCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0, 0, 0, 0.3)) 66 self.subscriptionHeaderLabel = EveLabelLargeBold(parent=subscription, align=uiconst.TOTOP, text=None, padding=(75, 15, 0, 8)) 67 self.subscriptionDescriptionLabel = EveLabelMedium(parent=subscription, align=uiconst.TOTOP, text=None, padding=(75, 0, 0, 15)) 68 self.cloneState = CloneStateIcon(parent=subscription, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, pos=(10, 0, 55, 55), origin=ORIGIN_CHARACTERSHEET) 69 EveLabelLargeBold(parent=scrollMainCont, align=uiconst.TOTOP, text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/MultipleCharacterTitle'), padding=(10, 25, 0, 0)) 70 EveLabelMedium(parent=scrollMainCont, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/MultipleCharacterDescription', typeID=const.typeMultiTrainingToken), padding=(10, 2, 0, 10), color=Color.GRAY5) 71 multipleQueue1 = ContainerAutoSize(parent=scrollMainCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0, 0, 0, 0.3)) 72 self.multipleQueueLabel1 = EveLabelMediumBold(parent=multipleQueue1, align=uiconst.TOTOP, text='', padding=(35, 8, 0, 8)) 73 self.multipleQueueExpiryLabel1 = EveLabelMediumBold(parent=multipleQueue1, align=uiconst.TOPRIGHT, text='', pos=(10, 8, 0, 0), color=Color.GRAY5) 74 self.multipleQueueIcon1 = Icon(parent=multipleQueue1, align=uiconst.TOPLEFT, icon='res:/UI/Texture/Icons/additional_training_queue.png', pos=(10, 7, 17, 17)) 75 multipleQueue2 = ContainerAutoSize(parent=scrollMainCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0, 0, 0, 0.3)) 76 self.multipleQueueLabel2 = EveLabelMediumBold(parent=multipleQueue2, align=uiconst.TOTOP, text='', padding=(35, 8, 0, 8)) 77 self.multipleQueueExpiryLabel2 = EveLabelMediumBold(parent=multipleQueue2, align=uiconst.TOPRIGHT, text='', pos=(10, 8, 0, 0), color=Color.GRAY5) 78 self.multipleQueueIcon2 = Icon(parent=multipleQueue2, align=uiconst.TOPLEFT, icon='res:/UI/Texture/Icons/additional_training_queue.png', pos=(10, 7, 17, 17)) 79 80 def OnMultipleCharactersTrainingRefreshed(self): 81 if self.display: 82 self.LoadPanel() 83 84 def GetOmegaTime(self): 85 return sm.RemoteSvc('subscriptionMgr').GetSubscriptionTime() 86 87 def RefreshOmegaTime(self, omegaTime): 88 if omegaTime: 89 text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SkillTabs/CurrentCloneStateOmega') 90 self.subscriptionHeaderLabel.SetText(text) 91 text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/PilotLicense/DaysLeft', expireDate=omegaTime) 92 self.subscriptionDescriptionLabel.SetText(text) 93 else: 94 text = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SkillTabs/CurrentCloneStateAlpha') 95 self.subscriptionHeaderLabel.SetText(text) 96 self.subscriptionDescriptionLabel.SetText(None) 97 98 def OnSubscriptionTimeUpdateServer(self, omegaTime): 99 if self.isConstructed: 100 self.RefreshOmegaTime(omegaTime) 101 102 103 def LogOpenPilotLicense(): 104 uthread.new(LogCharacterSheetPilotLicenseImpression())