skillPlansBrowserPanel.py (3886B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\browser\skillPlansBrowserPanel.py 2 from carbonui import uiconst 3 from carbonui.primitives.container import Container 4 from carbonui.primitives.containerAutoSize import ContainerAutoSize 5 from eve.client.script.ui.control.toggleButtonGroup import ToggleButtonGroup 6 from eve.client.script.ui.skillPlan import skillPlanUtil 7 from eve.client.script.ui.skillPlan.browser.certifiedPlansPanel import CertifiedPlansPanel 8 from eve.client.script.ui.skillPlan.browser.corpPlansPanel import CorpPlansPanel 9 from eve.client.script.ui.skillPlan.browser.personalPlansPanel import PersonalPlansPanel 10 from eve.client.script.ui.shared.pointerTool.pointerToolConst import UNIQUE_NAME_SKILL_PLANS_CERTIFIED_TAB, UNIQUE_NAME_SKILL_PLANS_CORP_TAB, UNIQUE_NAME_SKILL_PLANS_PERSONAL_TAB 11 from eve.client.script.ui.skillPlan.skillPlanConst import BUTTON_GROUP_ID_SKILL_PLANS, PANEL_CERTIFIED, PANEL_CORP, PANEL_PERSONAL 12 from eve.common.script.sys import idCheckers 13 from localization import GetByLabel 14 15 class SkillPlansBrowserPanel(Container): 16 17 def ApplyAttributes(self, attributes): 18 super(SkillPlansBrowserPanel, self).ApplyAttributes(attributes) 19 self.isInitialized = False 20 self.certifiedSkillPlans = None 21 self.mainCont = Container(name='mainCont', parent=self) 22 if sm.GetService('publicGatewaySvc').is_available(): 23 self.tabCont = ContainerAutoSize(name='tabCont', parent=self.mainCont, align=uiconst.TOTOP, padding=(0, 5, 0, 20)) 24 self.ConstructToggleButtonGroup() 25 else: 26 self.tabCont = self.toggleButtonGroup = None 27 CertifiedPlansPanel(parent=self.mainCont) 28 29 def ConstructToggleButtonGroup(self): 30 isInPlayerCorp = idCheckers.IsPlayerCorporation(session.corpid) 31 self.toggleButtonGroup = ToggleButtonGroup(parent=self.tabCont, align=uiconst.CENTERTOP, fontsize=16, width=500 if isInPlayerCorp else 400, callback=self.OnToggleButtonGroup) 32 self.certifiedSkillPlans = CertifiedPlansPanel(parent=self.mainCont, state=uiconst.UI_HIDDEN) 33 self.toggleButtonGroup.AddButton(btnID=PANEL_CERTIFIED, label=GetByLabel('UI/SkillPlan/CertifiedPlans'), panel=self.certifiedSkillPlans, hint=GetByLabel('UI/SkillPlan/CertifiedPlansHoverTooltip'), analyticID='SkillPlanTabs_CertifiedPlans', uniqueUiName=UNIQUE_NAME_SKILL_PLANS_CERTIFIED_TAB) 34 panelPersonal = PersonalPlansPanel(parent=self.mainCont, state=uiconst.UI_HIDDEN) 35 self.toggleButtonGroup.AddButton(btnID=PANEL_PERSONAL, label=GetByLabel('UI/SkillPlan/PersonalPlans'), panel=panelPersonal, hint=GetByLabel('UI/SkillPlan/PersonalPlansHoverTooltip'), analyticID='SkillPlanTabs_PersonalPlans', uniqueUiName=UNIQUE_NAME_SKILL_PLANS_PERSONAL_TAB) 36 if isInPlayerCorp: 37 panelCorp = CorpPlansPanel(parent=self.mainCont, state=uiconst.UI_HIDDEN) 38 self.toggleButtonGroup.AddButton(btnID=PANEL_CORP, label=GetByLabel('UI/SkillPlan/CorpPlans'), panel=panelCorp, hint=GetByLabel('UI/SkillPlan/CorpPlansHoverTooltip'), analyticID='SkillPlanTabs_CorpPlans', uniqueUiName=UNIQUE_NAME_SKILL_PLANS_CORP_TAB) 39 40 def Show(self, *args): 41 super(SkillPlansBrowserPanel, self).Show(*args) 42 if not self.isInitialized: 43 self.AutoSelectTab() 44 self.isInitialized = True 45 46 def AutoSelectTab(self): 47 if not self.toggleButtonGroup: 48 return 49 btnID = skillPlanUtil.GetPersistedPanelID(BUTTON_GROUP_ID_SKILL_PLANS) 50 self.toggleButtonGroup.SelectByID(btnID) 51 52 def OnToggleButtonGroup(self, btnID, oldBtnID): 53 skillPlanUtil.SetPersistedPanelID(BUTTON_GROUP_ID_SKILL_PLANS, btnID) 54 55 def ShowCertifiedPlans(self, careerID): 56 self.toggleButtonGroup.SelectByID(PANEL_CERTIFIED) 57 self.certifiedSkillPlans.ShowCertifiedPlans(careerID)