buyPlexButton.py (1899B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\wallet\buyPlexButton.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 carbonui.uicore import uicore 7 from eve.client.script.ui.shared.vgs.const import COLOR_PLEX 8 from fastcheckout.const import FROM_WALLET_PLUS_BUTTON 9 from localization import GetByLabel 10 DEFAULT_OPACITY = 0.3 11 MOUSE_HOVER_OPACITY = 0.75 12 MOUSE_DOWN_OPACITY = 0.55 13 14 class BuyPlexButton(Container): 15 default_width = 16 16 default_height = 16 17 default_state = uiconst.UI_NORMAL 18 default_hint = GetByLabel('UI/VirtualGoodsStore/Buttons/BuyPlex') 19 20 def ApplyAttributes(self, attributes): 21 super(BuyPlexButton, self).ApplyAttributes(attributes) 22 self.ConstructLayout() 23 24 def ConstructLayout(self): 25 self.icon = Sprite(name='icon', parent=self, align=uiconst.CENTER, height=14, width=14, texturePath='res:/UI/Texture/Shared/DarkStyle/buttonIconPlus.png', state=uiconst.UI_DISABLED) 26 self.fill = Frame(parent=self, texturePath='res:/UI/Texture/Shared/DarkStyle/buttonSmall_Solid.png', cornerSize=6, color=COLOR_PLEX, opacity=DEFAULT_OPACITY) 27 self.stroke = Frame(parent=self, texturePath='res:/UI/Texture/Shared/DarkStyle/buttonSmall_Stroke.png', cornerSize=6, color=COLOR_PLEX, opacity=0.75) 28 29 def OnClick(self, *args): 30 self.BuyPlex() 31 32 def BuyPlex(self): 33 uicore.cmd.CmdBuyPlex(FROM_WALLET_PLUS_BUTTON) 34 35 def OnMouseEnter(self, *args): 36 self.fill.SetAlpha(MOUSE_HOVER_OPACITY) 37 38 def OnMouseExit(self, *args): 39 self.fill.SetAlpha(DEFAULT_OPACITY) 40 41 def OnMouseDown(self, *args): 42 self.fill.SetAlpha(MOUSE_DOWN_OPACITY) 43 44 def OnMouseUp(self, *args): 45 self.fill.SetAlpha(MOUSE_HOVER_OPACITY)