lockButton.py (4005B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skillPlan\selectedPlan\lockButton.py 2 from carbonui import TextColor, uiconst 3 from carbonui.primitives.container import Container 4 from carbonui.primitives.sprite import Sprite 5 from carbonui.uianimations import animations 6 from carbonui.util.color import Color 7 from eve.client.script.ui import eveColor 8 from eve.client.script.ui.control.eveLabel import EveLabelSmall 9 OPACITY_IDLE = 0.6 10 OPACITY_HOVER = 0.9 11 LOCK_BUTTON_SIZE = 48 12 13 class SkillPlanLockButton(Container): 14 default_width = LOCK_BUTTON_SIZE 15 default_height = LOCK_BUTTON_SIZE 16 default_state = uiconst.UI_NORMAL 17 backgroundColorLocked = None 18 backgroundColor = None 19 frameColor = None 20 frameColorLocked = None 21 iconTexturePath = None 22 iconSize = None 23 24 def ApplyAttributes(self, attributes): 25 super(SkillPlanLockButton, self).ApplyAttributes(attributes) 26 self.callback = attributes.get('func', None) 27 self.iconSprite = Sprite(parent=self, name='icon', align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath=self.iconTexturePath, width=self.iconSize, height=self.iconSize) 28 self.bgFill = Sprite(bgParent=self, name='bgFill', texturePath='res:/UI/Texture/classes/SkillPlan/lockButtonBG.png') 29 self.bgFrame = Sprite(name='bgFrame', bgParent=self, texturePath='res:/UI/Texture/classes/SkillPlan/lockButtonFrame.png') 30 self.checkmark = Sprite(parent=self, name='checkmark', align=uiconst.CENTERBOTTOM, texturePath='res:/UI/Texture/classes/SkillPlan/lockButtonCheckmark.png', width=20, height=20, top=-10) 31 32 def OnClick(self, *args): 33 if self.callback: 34 self.callback() 35 36 def Lock(self): 37 self.bgFill.SetRGBA(*self.backgroundColorLocked) 38 self.bgFrame.SetRGBA(*self.frameColorLocked) 39 self.checkmark.Hide() 40 41 def Unlock(self): 42 self.bgFill.SetRGBA(*self.backgroundColor) 43 self.bgFrame.SetRGBA(*self.frameColor) 44 self.checkmark.Show() 45 46 def OnMouseEnter(self, *args): 47 super(SkillPlanLockButton, self).OnMouseEnter(*args) 48 animations.FadeTo(self.bgFill, self.bgFill.opacity, OPACITY_HOVER, duration=uiconst.TIME_ENTRY) 49 50 def OnMouseExit(self, *args): 51 super(SkillPlanLockButton, self).OnMouseExit(*args) 52 animations.FadeTo(self.bgFill, self.bgFill.opacity, OPACITY_IDLE, duration=uiconst.TIME_EXIT) 53 54 55 class OmegaLockButton(SkillPlanLockButton): 56 frameColor = eveColor.WHITE 57 frameColorLocked = eveColor.SAND_YELLOW 58 backgroundColor = Color(*eveColor.BURNISHED_GOLD).SetOpacity(OPACITY_IDLE).GetRGBA() 59 backgroundColorLocked = backgroundColor 60 iconSize = 24 61 iconTexturePath = 'res:/UI/Texture/classes/CloneGrade/Omega_24.png' 62 63 64 class MissingSkillsLockButton(SkillPlanLockButton): 65 frameColor = eveColor.WHITE 66 backgroundColor = Color(*eveColor.COPPER_OXIDE_GREEN).SetOpacity(OPACITY_IDLE).GetRGBA() 67 frameColorLocked = eveColor.PRIMARY_BLUE 68 backgroundColorLocked = Color(*eveColor.SMOKE_BLUE).SetOpacity(OPACITY_IDLE).GetRGBA() 69 iconSize = 20 70 iconTexturePath = 'res:/UI/Texture/Classes/SkillPlan/buttonIcons/skillIcon.png' 71 72 def ApplyAttributes(self, attributes): 73 super(MissingSkillsLockButton, self).ApplyAttributes(attributes) 74 self.numMissingFrame = Container(name='numMissingFrame', parent=self, align=uiconst.BOTTOMRIGHT, pos=(0, 0, 20, 20)) 75 Sprite(bgParent=self.numMissingFrame, texturePath='res:/UI/Texture/Classes/SkillPlan/smallCircleSolid.png', color=eveColor.HOT_RED) 76 self.numMissingLabel = EveLabelSmall(name='numMissingLabel', parent=self.numMissingFrame, align=uiconst.CENTER, color=TextColor.HIGHLIGHT) 77 78 def Lock(self, numMissing): 79 super(MissingSkillsLockButton, self).Lock() 80 self.numMissingFrame.Show() 81 self.numMissingLabel.SetText(str(numMissing)) 82 83 def Unlock(self): 84 super(MissingSkillsLockButton, self).Unlock() 85 self.numMissingFrame.Hide()