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

certifiedPlansPanel.py (7894B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\browser\certifiedPlansPanel.py
      2 import characterdata
      3 import characterdata.factions
      4 import localization
      5 from carbonui import TextAlign, uiconst
      6 from carbonui.primitives.container import Container
      7 from carbonui.primitives.line import Line
      8 from characterdata import careerpathconst, careerpath, bloodlines
      9 from eve.client.script.ui.control.eveLabel import EveCaptionLarge
     10 from eve.client.script.ui.control.toggleButtonGroup import ToggleButtonGroup
     11 from eve.client.script.ui.skillPlan.browser.airSkillPlanContainer import AirSkillPlanContainer
     12 from eve.client.script.ui.skillPlan.browser.careerPathToggleButtonGroup import CareerPathToggleButtonGroupButton, SimpleCareerPathToggleButtonGroupButton
     13 from eve.client.script.ui.skillPlan.browser.empireFactionToggleButtonGroup import EmpireFactionToggleButtonGroupButton
     14 from eve.client.script.ui.skillPlan.browser.skillPlanScroll import SkillPlanScroll
     15 from eve.client.script.ui.skillPlan.skillPlanConst import ICON_BY_FACTION_ID
     16 from eve.common.lib import appConst
     17 from localization import GetByLabel
     18 from skills.skillplan.skillPlanService import GetSkillPlanSvc
     19 from uihighlighting.uniqueNameConst import GetUniqueSkillPlanFactionName, GetUniqueSkillPlanCareerName
     20 
     21 class CertifiedPlansPanel(Container):
     22     __notifyevents__ = ['OnSkillsChanged', 'OnSkillQueueChanged']
     23 
     24     def ApplyAttributes(self, attributes):
     25         super(CertifiedPlansPanel, self).ApplyAttributes(attributes)
     26         self.careerPathID = None
     27         self.factionID = None
     28         self.isLimitedHeight = False
     29         self.empireFactionContainer = None
     30         self.ReconstructLayout()
     31         sm.RegisterNotify(self)
     32 
     33     def ReconstructLayout(self):
     34         self.Flush()
     35         if GetSkillPlanSvc().HasFinishedAIRSkillPlan():
     36             self.ConstructCareerPathTabGroup()
     37             self.ConstructEmpireFactionTabGroup()
     38             self.scroll = SkillPlanScroll(parent=self, padTop=10)
     39             self.scroll.addUniqueName = True
     40             self.AutoSelectCareerPath()
     41         else:
     42             self.ConstructAirSkillPlanContainer()
     43             self.ConstructCareerPathTabGroup()
     44             self.careerPathTabGroup.Disable()
     45             self.careerPathTabGroup.opacity = 0.3
     46 
     47     def AutoSelectCareerPath(self):
     48         btnID = settings.char.ui.Get('skillPlanCareerPathID', None)
     49         if btnID:
     50             self.careerPathTabGroup.SelectByID(btnID)
     51             self.careerPathID = btnID
     52 
     53     def ShowCertifiedPlans(self, careerID):
     54         if GetSkillPlanSvc().HasFinishedAIRSkillPlan():
     55             self.careerPathTabGroup.SelectByID(careerID)
     56             if self.HasFactionTabGroup():
     57                 self.empireFactionToggleButtons.SelectByID(session.raceID)
     58 
     59     def ConstructAirSkillPlanContainer(self):
     60         AirSkillPlanContainer(parent=self, align=uiconst.TOTOP_PROP, height=0.6, padTop=-100, clipChildren=True)
     61 
     62     def ConstructCareerPathTabGroup(self):
     63         if self.isLimitedHeight:
     64             self.careerPathTabGroup = ToggleButtonGroup(parent=self, align=uiconst.TOTOP, padding=(10, 25, 10, 50), callback=self.OnCareerPathTabGroup, height=60, btnClass=SimpleCareerPathToggleButtonGroupButton, selectSound='skills_planner_path_details_play')
     65         else:
     66             self.careerPathTabGroup = ToggleButtonGroup(parent=self, align=uiconst.TOTOP, height=315, padTop=0, padBottom=50, callback=self.OnCareerPathTabGroup, btnClass=CareerPathToggleButtonGroupButton, selectSound='skills_planner_path_details_play')
     67         self.selectCareerPathHint = EveCaptionLarge(parent=self, align=uiconst.TOTOP, textAlign=TextAlign.CENTER, padTop=60, text=GetByLabel('UI/SkillPlan/SelectCareerPathHint'))
     68         for careerPathID, careerPath in careerpath.get_career_paths().iteritems():
     69             label = localization.GetByMessageID(careerPath.nameID)
     70             self.careerPathTabGroup.AddButton(btnID=careerPathID, label=label, careerPathHint=localization.GetByMessageID(careerPath.descriptionID), analyticID='CareerPath_%s' % careerPathID, uniqueUiName=GetUniqueSkillPlanCareerName(careerPathID))
     71 
     72     def UpdateFactionUniqueNames(self):
     73         for btn in self.empireFactionToggleButtons.buttons:
     74             btn.uniqueUiName = GetUniqueSkillPlanFactionName(self.careerPathID, btn.btnID)
     75 
     76     def OnCareerPathTabGroup(self, btnID, oldBtnID):
     77         self.careerPathID = btnID
     78         self.factionID = None
     79         self.empireFactionToggleButtons.SelectByID(None)
     80         if self.careerPathID == careerpathconst.career_path_industrialist:
     81             self.empireFactionContainer.Hide()
     82             self.PopulateScroll()
     83         else:
     84             self.empireFactionContainer.Show()
     85             raceID = bloodlines.get_race_id(session.bloodlineID)
     86             factionID = appConst.factionByRace[raceID]
     87             self.empireFactionToggleButtons.SelectByID(factionID)
     88         self.UpdateFactionUniqueNames()
     89         self.selectCareerPathHint.Hide()
     90         settings.char.ui.Set('skillPlanCareerPathID', btnID)
     91         if btnID and oldBtnID != btnID:
     92             sm.ScatterEvent('OnSkillPlansCareerPathTabChanged', self.careerPathID)
     93 
     94     def GetVisibleCareerPathTabGroup(self):
     95         return self.careerPathID
     96 
     97     def GetVisibleFactionTabGroup(self):
     98         return self.factionID
     99 
    100     def HasFactionTabGroup(self):
    101         return self.empireFactionContainer and not self.empireFactionContainer.IsHidden()
    102 
    103     def ConstructEmpireFactionTabGroup(self):
    104         self.empireFactionContainer = Container(parent=self, align=uiconst.TOTOP, height=48, padding=(0, 25, 0, 25), state=uiconst.UI_HIDDEN)
    105         leftCont = Container(name='leftCont', parent=self.empireFactionContainer, align=uiconst.TOLEFT_PROP, width=0.275)
    106         Line(parent=leftCont, align=uiconst.TOPLEFT_PROP, pos=(0.999, 0.5, 0.999, 2), opacity=0.1)
    107         rightCont = Container(name='rightCont', parent=self.empireFactionContainer, align=uiconst.TORIGHT_PROP, width=0.275)
    108         Line(parent=rightCont, align=uiconst.TOPLEFT_PROP, pos=(0, 0.5, 0.999, 2), opacity=0.1)
    109         self.empireFactionToggleButtons = ToggleButtonGroup(parent=self.empireFactionContainer, align=uiconst.TOALL, height=0, callback=self.OnEmpireFactionTabGroup, btnClass=EmpireFactionToggleButtonGroupButton, selectSound='skills_planner_race_select_play')
    110         for factionID in appConst.factionByRace.values():
    111             hint = characterdata.factions.get_faction_name(factionID)
    112             self.empireFactionToggleButtons.AddButton(btnID=factionID, hint=hint, analyticID='Faction_%s' % factionID, iconPath=ICON_BY_FACTION_ID[factionID])
    113 
    114     def OnEmpireFactionTabGroup(self, tabID, oldTabID):
    115         self.factionID = tabID
    116         self.PopulateScroll()
    117         if tabID and oldTabID != tabID:
    118             sm.ScatterEvent('OnSkillPlanFactionTabChanged', self.factionID)
    119 
    120     def PopulateScroll(self):
    121         skillPlans = GetSkillPlanSvc().GetAllCertifiedForCareerPath(self.careerPathID)
    122         if self.factionID:
    123             skillPlans = [ skillPlan for skillPlan in skillPlans if skillPlan.factionID == self.factionID ]
    124         self.scroll.ConstructSkillPlanEntries(skillPlans)
    125 
    126     def OnSkillsChanged(self, skillInfoChange):
    127         self.ReconstructLayout()
    128 
    129     def OnSkillQueueChanged(self):
    130         self.ReconstructLayout()
    131 
    132     def _OnSizeChange_NoBlock(self, *args):
    133         super(CertifiedPlansPanel, self)._OnSizeChange_NoBlock(*args)
    134         w, h = self.GetAbsoluteSize()
    135         if h < 550 or w < 860:
    136             self.SetLimitedHeight()
    137         else:
    138             self.SetNotLimitedHeight()
    139 
    140     def SetNotLimitedHeight(self):
    141         if self.isLimitedHeight:
    142             self.isLimitedHeight = False
    143             self.ReconstructLayout()
    144 
    145     def SetLimitedHeight(self):
    146         if not self.isLimitedHeight:
    147             self.isLimitedHeight = True
    148             self.ReconstructLayout()