skillPlanEntryTooltip.py (4454B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\browser\skillPlanEntryTooltip.py 2 from carbonui import uiconst 3 from carbonui.primitives.container import Container 4 from carbonui.primitives.frame import Frame 5 from carbonui.primitives.sprite import Sprite 6 from clonegrade import COLOR_OMEGA_GOLD 7 from eve.client.script.ui.control.eveLabel import EveLabelLarge 8 from eve.client.script.ui import eveColor 9 from localization import GetByLabel 10 from omega.client.clone_grade_svc import get_clone_grade_svc 11 bgColor = (1, 1, 1, 0.15) 12 horizontalPadding = 10 13 14 class SkillPlanEntryTooltip(object): 15 16 def __init__(self, skillPlan, tooltipPanel, *args, **kwargs): 17 super(SkillPlanEntryTooltip, self).__init__(*args, **kwargs) 18 self.skillPlan = skillPlan 19 self.tooltipPanel = tooltipPanel 20 self.tooltipPanel.columns = 1 21 self.tooltipPanel.LoadStandardSpacing() 22 containersAdded = [] 23 row = self.tooltipPanel.AddHeaderRow() 24 skillPlan = SkillPlanEntryTooltipRow(text=GetByLabel('UI/SkillPlan/SkillPlan')) 25 row.AddCell(cellObject=skillPlan) 26 containersAdded.append(skillPlan) 27 desc = self.skillPlan.GetDescription() 28 if desc: 29 self.tooltipPanel.AddLabelMedium(text=desc, wrapWidth=250, state=uiconst.UI_NORMAL, linkStyle=uiconst.LINKSTYLE_REGULAR) 30 self.tooltipPanel.state = uiconst.UI_NORMAL 31 if self.skillPlan.IsMissingSkillbooks(): 32 row = self.tooltipPanel.AddHeaderRow() 33 nbMissing = len(self.skillPlan.GetMissingSkillbooks()) 34 missingSkillsEntry = SkillPlanEntryTooltipRowWithNumber(text=GetByLabel('UI/SkillPlan/SkillbooksMissing2'), textureColor=eveColor.HOT_RED, texturePath='res:/UI/Texture/classes/SkillPlan/lockButtonSkillbook.png', counterNum=nbMissing) 35 row.AddCell(cellObject=missingSkillsEntry) 36 containersAdded.append(missingSkillsEntry) 37 numOmegaSkills = self.skillPlan.GetNumOmegaSkills() 38 if numOmegaSkills and not get_clone_grade_svc().is_omega_with_grace_period(): 39 row = self.tooltipPanel.AddHeaderRow() 40 requiresOmega = SkillPlanEntryTooltipRowWithNumber(text=GetByLabel('UI/SkillPlan/RequireOmega'), texturePath='res:/UI/Texture/classes/SkillPlan/lockButtonOmega.png', textureColor=COLOR_OMEGA_GOLD, counterNum=numOmegaSkills) 41 row.AddCell(cellObject=requiresOmega) 42 containersAdded.append(requiresOmega) 43 maxContHeight = max((x.height for x in containersAdded)) 44 for c in containersAdded: 45 c.height = maxContHeight 46 47 48 class SkillPlanEntryTooltipRow(Container): 49 default_align = uiconst.CENTERLEFT 50 51 def ApplyAttributes(self, attributes): 52 super(SkillPlanEntryTooltipRow, self).ApplyAttributes(attributes) 53 text = attributes.text 54 texturePath = attributes.texturePath 55 textureColor = attributes.textureColor 56 left = 0 57 iconHeight = 0 58 if texturePath: 59 icon = Sprite(parent=self, align=uiconst.CENTERLEFT, texturePath=texturePath, pos=(0, 0, 20, 20), color=textureColor) 60 left = icon.width + horizontalPadding 61 iconHeight = icon.height 62 self.label = EveLabelLarge(parent=self, text=text, align=uiconst.CENTERLEFT, left=left) 63 self.height = max(self.height, self.label.height, iconHeight) 64 self.width = self.label.left + self.label.width 65 66 67 class SkillPlanEntryTooltipRowWithNumber(SkillPlanEntryTooltipRow): 68 69 def ApplyAttributes(self, attributes): 70 super(SkillPlanEntryTooltipRowWithNumber, self).ApplyAttributes(attributes) 71 counterNum = attributes.counterNum 72 left = self.label.left + self.label.width + horizontalPadding 73 counterCont = Container(parent=self, align=uiconst.CENTERLEFT, pos=(left, 74 0, 75 20, 76 20)) 77 counterText = 'x%s' % counterNum 78 counterLabel = EveLabelLarge(parent=counterCont, text=counterText, align=uiconst.CENTER) 79 Frame(name='badgeFrame', bgParent=counterCont, texturePath='res:/UI/Texture/Shared/counterFrame.png', cornerSize=8, offset=-1, color=bgColor) 80 counterCont.height = max(counterCont.height, counterLabel.height + 4) 81 counterCont.width = max(counterCont.width, counterLabel.width + 4) 82 self.height = max(self.height, counterCont.height + 4) 83 self.width = counterCont.left + counterCont.width