skillGroupSkillEntry.py (3790B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\skillsCatalogue\skillGroupSkillEntry.py 2 import evetypes 3 from carbonui import uiconst 4 from carbonui.control.dragdrop import dragdata 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.uicore import uicore 8 from eve.client.script.ui.control.eveLabel import EveLabelLarge 9 from eve.client.script.ui.control.eveWindowUnderlay import ListEntryUnderlay 10 from eve.client.script.ui.control.skillBar.skillBar import SkillBar 11 from eve.client.script.ui.shared.tooltip.skill import LoadSkillEntryTooltipInfoOnly 12 from eve.client.script.ui.skillPlan.contents.skillEntryPrimaryButton import SkillEntryPrimaryButton 13 from eve.client.script.ui.skillPlan.scrollContEntry import ScrollContEntry 14 ENTRY_HEIGHT = 32 15 16 class SkillGroupSkillEntry(ScrollContEntry): 17 default_height = ENTRY_HEIGHT 18 default_clipChildren = True 19 20 def ApplyAttributes(self, attributes): 21 super(SkillGroupSkillEntry, self).ApplyAttributes(attributes) 22 self.controller = attributes.controller 23 self.showPrimaryButton = attributes.get('showPrimaryButton', False) 24 self.primaryButton = None 25 self.skillBar = SkillBar(parent=self, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, left=8, skillID=self.controller.GetTypeID()) 26 self._CreatePrimaryButton() 27 self._ConstructLabel() 28 self.UpdatePrimaryButton() 29 30 def ConstructUnderlay(self): 31 self.underlay = ListEntryUnderlay(bgParent=self, padRight=40, padBottom=0) 32 33 def _ConstructLabel(self): 34 self.trainingTimeLabelCont = ContainerAutoSize(name='timeRemainingCont', parent=self, align=uiconst.TORIGHT, padLeft=8) 35 self.trainingTimeLabel = EveLabelLarge(name='timeRemainingLabel', parent=self.trainingTimeLabelCont, align=uiconst.CENTERRIGHT, state=uiconst.UI_DISABLED, opacity=0.35) 36 self.UpdateTrainingTimeLabel() 37 textCont = Container(name='textCont', parent=self) 38 EveLabelLarge(parent=textCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, left=75, text=evetypes.GetName(self.controller.GetTypeID()), autoFadeSides=16) 39 40 def UpdateTrainingTimeLabel(self): 41 level = self.controller.GetNextLevelToAddToQueue() 42 if level: 43 text = self.controller.GetTrainingTimeForLevelText(level) 44 else: 45 text = '' 46 self.trainingTimeLabel.SetText(text) 47 if not text: 48 self.trainingTimeLabelCont.Hide() 49 else: 50 self.trainingTimeLabelCont.Show() 51 52 def GetDragData(self): 53 return dragdata.TypeDragData(self.controller.GetTypeID()) 54 55 def LoadTooltipPanel(self, tooltipPanel, *args): 56 if uicore.IsDragging(): 57 return 58 LoadSkillEntryTooltipInfoOnly(tooltipPanel, self.controller.typeID) 59 60 def GetTooltipPointer(self): 61 return uiconst.POINT_BOTTOM_2 62 63 def GetMenu(self): 64 return self.controller.GetMenu() 65 66 def Refresh(self): 67 self.skillBar.Refresh() 68 self.UpdatePrimaryButton() 69 70 def _CreatePrimaryButton(self): 71 if not self.showPrimaryButton or self.primaryButton is not None: 72 return 73 self.primaryButton = SkillEntryPrimaryButton(parent=self, align=uiconst.TORIGHT, iconAlign=uiconst.CENTER, iconLeft=0, fixedwidth=36, padLeft=8, skillController=self.controller) 74 75 def UpdatePrimaryButton(self): 76 if not self.showPrimaryButton: 77 return 78 if not self.primaryButton: 79 self._CreatePrimaryButton() 80 self.primaryButton.UpdateState() 81 self.UpdateTrainingTimeLabel() 82 83 def OnDblClick(self): 84 sm.GetService('info').ShowInfo(self.controller.GetTypeID())