NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

navigationButtons.py (2075B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\cosmetics\structure\components\navigationButtons.py
      2 import eveicon
      3 from carbonui import const as uiconst
      4 from carbonui.control.buttonIcon import ButtonIcon
      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.util.uix import GetTextWidth
     10 from localization import GetByLabel
     11 
     12 class BackButton(ContainerAutoSize):
     13     default_height = 24
     14     default_state = uiconst.UI_NORMAL
     15 
     16     def __init__(self, onClick = None, *args, **kwargs):
     17         super(BackButton, self).__init__(*args, **kwargs)
     18         self._icon = None
     19         self._on_click_callback = onClick
     20         self._construct_layout()
     21 
     22     def _construct_layout(self):
     23         self._icon = ButtonIcon(name='icon', parent=self, align=uiconst.TOLEFT, state=uiconst.UI_DISABLED, width=24, height=24, iconSize=16, texturePath=eveicon.navigate_back)
     24         label_text = GetByLabel('UI/Commands/Back')
     25         label_width = GetTextWidth(label_text, fontsize=EveLabelLarge.default_fontsize, fontStyle=EveLabelLarge.default_fontStyle)
     26         label_container = Container(name='label_container', parent=self, align=uiconst.TOLEFT, height=self.height, width=label_width)
     27         EveLabelLarge(name='label', parent=label_container, align=uiconst.CENTERLEFT, text=label_text)
     28 
     29     def OnMouseEnter(self, *args):
     30         if self._icon:
     31             uicore.animations.MorphScalar(self._icon.icon, 'glowBrightness', self._icon.icon.glowBrightness, self._icon.GLOWAMOUNT_MOUSEHOVER, duration=uiconst.TIME_ENTRY)
     32 
     33     def OnMouseExit(self, *args):
     34         if self._icon:
     35             uicore.animations.MorphScalar(self._icon.icon, 'glowBrightness', self._icon.icon.glowBrightness, self._icon.GLOWAMOUNT_IDLE, duration=uiconst.TIME_ENTRY)
     36 
     37     def OnClick(self, *args):
     38         if self._on_click_callback:
     39             self._on_click_callback(*args)