skillPlanSkillEntry.py (3298B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\contents\skillPlanSkillEntry.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.eveLabel import EveLabelLarge 6 from eve.client.script.ui.control.eveWindowUnderlay import ListEntryUnderlay 7 from eve.client.script.ui.control.skillBar.skillBar import SkillBar 8 from eve.client.script.ui.skillPlan.scrollContEntry import ScrollContEntry 9 from eve.client.script.ui.skillPlan.skillPlanConst import REQUIRED_FOR, IS_PREREQ, NO_REQ 10 from skills.client.skillController import SkillController 11 12 class SkillPlanSkillEntry(ScrollContEntry): 13 default_name = 'SkillPlanSkillEntry' 14 default_height = 32 15 default_clipChildren = True 16 17 def ApplyAttributes(self, attributes): 18 super(SkillPlanSkillEntry, self).ApplyAttributes(attributes) 19 self.typeID = attributes.typeID 20 self.level = attributes.level 21 self.controller = SkillController(self.typeID) 22 self.reqState = NO_REQ 23 self.skillBar = SkillBar(parent=self, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, left=8, skillID=self.typeID, requiredLevel=self.level) 24 labelCont = Container(parent=self, padLeft=75) 25 EveLabelLarge(parent=labelCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, text=self.controller.GetRequiredSkillNameAndLevelComparedToTrainedLevel(self.level), autoFadeSides=True, top=-1) 26 trainingTimeLabelParent = ContainerAutoSize(parent=self, align=uiconst.TORIGHT, padding=(12, 0, 12, 0), idx=0) 27 self.trainingTimeLabel = EveLabelLarge(parent=trainingTimeLabelParent, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, top=-1, text=self.controller.GetTrainingTimeForLevelText(self.level), opacity=0.35, idx=-1) 28 29 def UpdateReqState(self, reqState): 30 if reqState in (IS_PREREQ, REQUIRED_FOR): 31 self.underlay.is_dependency_or_requirement = True 32 else: 33 self.underlay.is_dependency_or_requirement = False 34 self.reqState = reqState 35 36 def ConstructUnderlay(self): 37 self.underlay = SkillEntryUnderlay(bgParent=self, padRight=42, padBottom=0) 38 39 def GetDragData(self): 40 return self.skillBar.GetDragData() 41 42 def GetHint(self): 43 return self.skillBar.GetHint() 44 45 def GetMenu(self): 46 return self.skillBar.GetMenu() 47 48 def Refresh(self): 49 self.skillBar.Refresh() 50 51 def OnDblClick(self): 52 sm.GetService('info').ShowInfo(self.typeID) 53 54 55 class SkillEntryUnderlay(ListEntryUnderlay): 56 _is_dependency_or_requirement = False 57 58 @property 59 def is_dependency_or_requirement(self): 60 return self._is_dependency_or_requirement 61 62 @is_dependency_or_requirement.setter 63 def is_dependency_or_requirement(self, value): 64 if self._is_dependency_or_requirement != value: 65 self._is_dependency_or_requirement = value 66 self._update_color(animate=True) 67 self._update_opacity(animate=True) 68 69 def _get_opacity(self): 70 if self._is_dependency_or_requirement: 71 return self.OPACITY_HOVER 72 else: 73 return super(SkillEntryUnderlay, self)._get_opacity()