panelRequirements.py (5286B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\panelRequirements.py 2 import expertSystems.client 3 from carbonui import const as uiconst 4 from carbonui.control.dragResizeCont import DragResizeCont 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.primitives.layoutGrid import LayoutGrid 8 from carbonui.primitives.sprite import Sprite 9 from carbonui.util.color import Color 10 from eve.client.script.ui import eveColor 11 from eve.client.script.ui.control import infoIcon 12 from eve.client.script.ui.control.entries.util import GetFromClass 13 from eve.client.script.ui.control.eveScroll import Scroll 14 from eve.client.script.ui.control.eveLabel import EveLabelMedium 15 from eve.client.script.ui.shared.neocom.skillConst import COLOR_SKILL_1 16 from eve.client.script.ui.shared.tooltip.itemObject import ItemObject 17 from eve.client.script.ui.shared.tooltip.skillBtns import SkillActionContainer 18 from eve.client.script.ui.shared.tooltip.skill_requirement import AddTrainingTime, AlphaTrainingTimeContainer, OmegaTrainingTimeContainer, GetActivityTextForType 19 from eve.common.lib import appConst as const 20 import localization 21 from omega.client.clone_grade_svc import get_clone_grade_svc 22 23 class PanelRequirements(Container): 24 default_clipChildren = True 25 26 def ApplyAttributes(self, attributes): 27 Container.ApplyAttributes(self, attributes) 28 self.typeID = attributes.typeID 29 self.bottomContainer = ContainerAutoSize(parent=self, align=uiconst.TOBOTTOM, padding=const.defaultPadding) 30 self.scroll = Scroll(name='scroll', parent=self, padding=const.defaultPadding) 31 self.scroll.ignoreTabTrimming = True 32 self.ConstructExpertSystemSection() 33 34 def ConstructExpertSystemSection(self): 35 self.expertSystemCont = DragResizeCont(parent=self, align=uiconst.TOBOTTOM, minSize=80, defaultSize=80, idx=0) 36 headerCont = ContainerAutoSize(parent=self.expertSystemCont, align=uiconst.TOTOP, alignMode=uiconst.CENTERLEFT, minHeight=24, padLeft=6) 37 Sprite(parent=headerCont, align=uiconst.TOPLEFT, width=24, height=24, texturePath=expertSystems.texture.badge_24) 38 header = EveLabelMedium(parent=headerCont, align=uiconst.CENTERLEFT, left=24, text=localization.GetByLabel('UI/ExpertSystem/HeaderImproveWithExpertSystem'), padding=(8, 0, 8, 0)) 39 icon = infoIcon.MoreInfoIcon(parent=headerCont, align=uiconst.CENTERLEFT, hint=localization.GetByLabel('UI/CharacterSheet/CharacterSheetWindow/ExpertSystems/ExpertSystemDescription')) 40 41 def updateInfoIconPosition(): 42 icon.left = header.left + header.width + header.padLeft + header.padRight 43 icon.top = (header.height - icon.height) / 2 44 45 header.OnSizeChanged = updateInfoIconPosition 46 self.expertSystemScroll = Scroll(name='expertSystemScroll', parent=self.expertSystemCont, padding=const.defaultPadding) 47 self.expertSystemScroll.ignoreTabTrimming = True 48 self.expertSystemCont.display = False 49 50 @classmethod 51 def RequirementsVisible(cls, typeID): 52 return bool(sm.GetService('skills').GetRequiredSkills(typeID)) 53 54 def Load(self): 55 scrollList = sm.GetService('info').GetReqSkillInfo(self.typeID) 56 self.scroll.Load(contentList=scrollList) 57 self.LoadSkillTrainingTimeAndActions() 58 if expertSystems.is_expert_systems_enabled(): 59 self.LoadAssociatedExpertSystems() 60 61 def LoadSkillTrainingTimeAndActions(self): 62 self.bottomContainer.Flush() 63 if sm.GetService('skills').IsSkillRequirementMet(self.typeID): 64 return 65 totalTime = sm.GetService('skills').GetSkillTrainingTimeLeftToUseType(self.typeID, includeBoosters=False) 66 omegaRestricted = ItemObject(self.typeID, None).NeedsOmegaUpgrade() 67 if get_clone_grade_svc().is_omega_with_grace_period(): 68 OmegaTrainingTimeContainer(parent=self.bottomContainer, omegaTime=totalTime) 69 else: 70 omegaTime = totalTime / 2 71 AlphaTrainingTimeContainer(parent=self.bottomContainer, isOmegaRestricted=omegaRestricted, alphaTime=totalTime, omegaTime=omegaTime, activityText=GetActivityTextForType(self.typeID)) 72 if not omegaRestricted: 73 SkillActionContainer(parent=self.bottomContainer, padTop=8, align=uiconst.TOTOP, typeID=self.typeID) 74 75 def LoadAssociatedExpertSystems(self): 76 self.expertSystemCont.display = False 77 if not expertSystems.has_associated_expert_system(self.typeID): 78 return 79 associatedExpertSystems = expertSystems.get_associated_expert_systems(self.typeID) 80 relevantExpertSystems = filter(lambda system: expertSystems.expert_system_benefits_player(system.type_id), associatedExpertSystems) 81 scrollEntries = [] 82 for expertSystem in relevantExpertSystems: 83 data = {'label': expertSystem.name, 84 'typeID': expertSystem.type_id, 85 'showinfo': True} 86 scrollEntries.append(GetFromClass(expertSystems.ExpertSystemEntry, data=data)) 87 88 if scrollEntries: 89 self.expertSystemCont.display = True 90 self.expertSystemScroll.Load(fixedEntryHeight=27, contentList=scrollEntries)