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

attributeContainer.py (2358B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\carbonui\control\attributeContainer.py
      2 import carbonui.text.styles
      3 import eveui
      4 import carbonui
      5 from carbonui import Align, TextColor, uiconst
      6 
      7 class AttributeContainer(eveui.ContainerAutoSize):
      8     default_state = uiconst.UI_NORMAL
      9     default_alignMode = Align.TOPLEFT
     10 
     11     def ApplyAttributes(self, attributes):
     12         super(AttributeContainer, self).ApplyAttributes(attributes)
     13         caption = attributes.caption
     14         icon = attributes.icon
     15         text = attributes.text
     16         self.get_menu = attributes.get_menu
     17         self.displayTextBackground = attributes.get('displayTextBackground', True)
     18         padding_top = 0
     19         padding_left = 0
     20         min_row_height = 32
     21         if caption:
     22             carbonui.text.styles.TextBody(parent=self, align=Align.TOPLEFT, text=caption, color=TextColor.SECONDARY)
     23             padding_top = 23
     24         if icon:
     25             icon_size = 16
     26             icon_container = eveui.Container(name='icon_container', parent=self, align=Align.TOPLEFT, pos=(0,
     27              padding_top,
     28              min_row_height,
     29              min_row_height), bgTexturePath='res:/UI/Texture/Shared/DarkStyle/panel1Corner_SolidMirrored.png', bgColor=(1, 1, 1, 0.05))
     30             eveui.Sprite(name='icon', parent=icon_container, align=Align.CENTER, color=TextColor.SECONDARY, pos=(0,
     31              0,
     32              icon_size,
     33              icon_size), texturePath=icon)
     34             padding_left = min_row_height + 4
     35         if text:
     36             text_cont = eveui.ContainerAutoSize(name='text_cont', parent=self, align=Align.TOALL, clipChildren=True, pos=(padding_left,
     37              padding_top,
     38              0,
     39              0), minHeight=min_row_height)
     40             if self.displayTextBackground:
     41                 eveui.Frame(bgParent=text_cont, cornerSize=9, texturePath='res:/UI/Texture/Shared/DarkStyle/panel1Corner_Solid.png', color=(1, 1, 1, 0.1))
     42             self._text = carbonui.text.styles.TextBody(parent=text_cont, align=Align.CENTERLEFT, text=text, left=8, maxLines=1, autoFadeSides=16, state=uiconst.UI_NORMAL)
     43 
     44     def GetMenu(self):
     45         if self.get_menu:
     46             return self.get_menu()
     47 
     48     @property
     49     def text(self):
     50         return self._text.text
     51 
     52     @text.setter
     53     def text(self, txt):
     54         self._text.text = txt