omegaCloneOverlayIcon.py (2391B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\cloneGrade\omegaCloneOverlayIcon.py 2 from carbonui.primitives.container import Container 3 from carbonui.primitives.frame import Frame 4 from carbonui.primitives.sprite import Sprite 5 import carbonui.const as uiconst 6 from carbonui.uianimations import animations 7 from localization import GetByLabel 8 from eve.client.script.ui.shared.cloneGrade import cloneStateUtil 9 from omega.client.clone_grade_svc import get_clone_grade_svc 10 OPACITY_FRAME_IDLE = 0.7 11 OPACITY_FRAME_HOVER = 1.0 12 13 class OmegaCloneOverlayIcon(Container): 14 default_state = uiconst.UI_NORMAL 15 default_align = uiconst.TOPLEFT 16 default_iconSize = 40 17 18 def ApplyAttributes(self, attributes): 19 Container.ApplyAttributes(self, attributes) 20 iconSize = attributes.get('iconSize', self.default_iconSize) 21 self.origin = attributes.origin 22 self.reason = attributes.reason 23 self.frame = Frame(name='frame', parent=self, align=uiconst.TOALL, texturePath='res:/UI/Texture/Classes/CloneGrade/Omega_Overlay_1_64.png', opacity=OPACITY_FRAME_IDLE) 24 self.iconCont = Container(name='iconCont', parent=self, state=uiconst.UI_DISABLED, bgColor=(0.0, 0.0, 0.0, 0.75), opacity=0.0) 25 Sprite(name='icon', parent=self.iconCont, align=uiconst.CENTER, texturePath='res:/UI/Texture/Classes/CloneGrade/omega_icon.png', pos=(0, 26 0, 27 iconSize, 28 iconSize)) 29 30 def IsRestricted(self): 31 return not get_clone_grade_svc().is_omega_with_grace_period() 32 33 def LoadTooltipPanel(self, tooltipPanel, *args): 34 if not self.IsRestricted(): 35 text = GetByLabel('UI/CloneState/RequiresOmegaCloneIsOmega') 36 else: 37 text = GetByLabel('UI/CloneState/RequiresOmegaClone') 38 cloneStateUtil.LoadTooltipPanel(tooltipPanel, text, self.origin, self.reason) 39 40 def OnMouseEnter(self, *args): 41 if self.IsRestricted(): 42 animations.FadeTo(self.iconCont, self.iconCont.opacity, 1.0, duration=0.15) 43 animations.FadeTo(self.frame, self.frame.opacity, OPACITY_FRAME_HOVER, duration=0.15) 44 45 def OnMouseExit(self, *args): 46 if self.IsRestricted(): 47 animations.FadeTo(self.iconCont, self.iconCont.opacity, 0.0, duration=0.3) 48 animations.FadeTo(self.frame, self.frame.opacity, OPACITY_FRAME_IDLE, duration=0.3)