panelCertificateSkills.py (3731B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\panelCertificateSkills.py 2 import localization 3 from carbonui import uiconst 4 from carbonui.primitives.container import Container 5 from carbonui.util.color import Color 6 from eve.client.script.ui.control.entries.text import Text 7 from eve.client.script.ui.control.entries.util import GetFromClass 8 from eve.client.script.ui.control.eveLabel import EveLabelMediumBold 9 from eve.client.script.ui.control.toggleButtonGroup import ToggleButtonGroup 10 from eve.client.script.ui.control.toggleButtonGroupButton import ToggleButtonGroupButtonIcon 11 from eve.client.script.ui.shared.neocom.skillConst import COLOR_SKILL_1 12 from eve.client.script.ui.control.eveScroll import Scroll 13 from eve.common.lib import appConst as const 14 COLOR_BUTTONS = (0.156, 0.24, 0.3, 1.0) 15 16 class PanelCertificateSkills(Container): 17 __notifyevents__ = ['OnSkillsChanged'] 18 19 def ApplyAttributes(self, attributes): 20 Container.ApplyAttributes(self, attributes) 21 self.typeID = attributes.typeID 22 self.certificateID = attributes.certificateID 23 self.masteryLevel = 0 24 sm.RegisterNotify(self) 25 26 def Load(self): 27 self.Flush() 28 toggleButtonCont = Container(name='btnGroupCont', parent=self, align=uiconst.TOTOP, height=45) 29 btnGroup = ToggleButtonGroup(parent=toggleButtonCont, align=uiconst.CENTER, height=toggleButtonCont.height, width=330, padding=(10, 4, 10, 3), callback=self.LoadCertificateSkillsLevel, btnClass=ToggleButtonGroupButtonIcon) 30 btns = ((1, 'res:/UI/Texture/icons/79_64_2.png'), 31 (2, 'res:/UI/Texture/icons/79_64_3.png'), 32 (3, 'res:/UI/Texture/icons/79_64_4.png'), 33 (4, 'res:/UI/Texture/icons/79_64_5.png'), 34 (5, 'res:/UI/Texture/icons/79_64_6.png')) 35 for level, iconPath in btns: 36 hint = localization.GetByLabel('UI/InfoWindow/CertificateLevelButtonHint', level=level) 37 btnGroup.AddButton(btnID=level, iconPath=iconPath, iconSize=32, hint=hint, colorSelected=COLOR_BUTTONS) 38 39 self.masteryTimeLabel = EveLabelMediumBold(name='masteryTimeLabel', parent=self, align=uiconst.TOTOP, top=10, left=10) 40 self.scroll = Scroll(name='certSkillScroll', parent=self, padding=const.defaultPadding) 41 cert = sm.GetService('certificates').GetCertificate(self.certificateID) 42 btnGroup.SelectByID(max(1, cert.GetLevel())) 43 44 def LoadCertificateSkillsLevel(self, level, *args): 45 if getattr(self, 'scroll', None) is None: 46 return 47 self.masteryLevel = level 48 scrolllist = [] 49 entries = sm.GetService('certificates').GetCertificate(self.certificateID).SkillsByTypeAndLevel(level) 50 skillScrollList = sm.GetService('info').GetReqSkillInfo(None, entries, showPrereqSkills=False) 51 scrolllist += skillScrollList 52 if not len(scrolllist): 53 scrolllist.append(GetFromClass(Text, {'line': 0, 54 'text': localization.GetByLabel('UI/Certificates/NoSkillRequirements')})) 55 self.scroll.Load(contentList=scrolllist) 56 self.UpdateTrainingTime(level) 57 58 def UpdateTrainingTime(self, level): 59 trainingTime = sm.GetService('certificates').GetCertificateTrainingTimeForMasteryLevel(self.certificateID, level) 60 if trainingTime > 0: 61 self.masteryTimeLabel.text = localization.GetByLabel('UI/SkillQueue/Skills/TotalTrainingTime', timeLeft=long(trainingTime), color=Color(*COLOR_SKILL_1).GetHex()) 62 else: 63 self.masteryTimeLabel.text = localization.GetByLabel('UI/InfoWindow/CertificateAcquired') 64 65 def OnSkillsChanged(self, *args): 66 self.LoadCertificateSkillsLevel(self.masteryLevel)