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

linkLabel.py (1773B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\control\linkLabel.py
      2 from carbonui import uiconst
      3 from carbonui.text.custom import TextCustom
      4 from carbonui.util.color import Color
      5 from eve.client.script.ui.control.eveLabel import Label
      6 COLOR = (1.0, 0.65, 0.0, 1.0)
      7 HIGHLIGHT_COLOR = Color.WHITE
      8 
      9 class LinkLabel(Label):
     10     default_state = uiconst.UI_CLICK
     11     default_color = COLOR
     12     default_highlight = HIGHLIGHT_COLOR
     13 
     14     def ApplyAttributes(self, attributes):
     15         super(LinkLabel, self).ApplyAttributes(attributes)
     16         self.baseColor = attributes.get('baseColor', self.default_color)
     17         self.highlightColor = attributes.get('highlightColor', self.default_highlight)
     18         self.function = attributes.get('function', None)
     19         self.SetTextColor(self.baseColor)
     20 
     21     def OnMouseEnter(self, *args):
     22         self.SetTextColor(self.highlightColor)
     23 
     24     def OnMouseExit(self, *args):
     25         self.SetTextColor(self.baseColor)
     26 
     27     def OnClick(self, *args):
     28         self.function()
     29 
     30 
     31 class CustomLinkLabel(TextCustom):
     32     default_state = uiconst.UI_CLICK
     33     default_color = COLOR
     34     default_highlight = HIGHLIGHT_COLOR
     35 
     36     def ApplyAttributes(self, attributes):
     37         super(CustomLinkLabel, self).ApplyAttributes(attributes)
     38         self.baseColor = attributes.get('baseColor', self.default_color)
     39         self.highlightColor = attributes.get('highlightColor', self.default_highlight)
     40         self.function = attributes.get('function', None)
     41         self.SetTextColor(self.baseColor)
     42 
     43     def OnMouseEnter(self, *args):
     44         self.SetTextColor(self.highlightColor)
     45 
     46     def OnMouseExit(self, *args):
     47         self.SetTextColor(self.baseColor)
     48 
     49     def OnClick(self, *args):
     50         self.function()