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

landingPageWidgets.py (4068B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\theatersOfWar\landingPage\landingPageWidgets.py
      2 import eveicon
      3 from carbonui import Align, uiconst, TextColor
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      6 from carbonui.primitives.layoutGrid import LayoutGrid
      7 from carbonui.primitives.sprite import Sprite
      8 from carbonui.text.styles import TextBody
      9 TOP_BOTTOM_HEIGHT = 32
     10 
     11 class WidgetCont(Container):
     12     default_padding = 16
     13 
     14     def ApplyAttributes(self, attributes):
     15         self.widget_texture_path = attributes.widget_texture_path
     16         super(WidgetCont, self).ApplyAttributes(attributes)
     17         self.construct_ui()
     18 
     19     def construct_ui(self):
     20         top_cont = Container(name='top_cont', parent=self, align=Align.TOTOP, height=TOP_BOTTOM_HEIGHT, clipChildren=True)
     21         bottom_cont = Container(name='bottom_cont', parent=self, align=Align.TOBOTTOM, height=TOP_BOTTOM_HEIGHT, clipChildren=True)
     22         self.center_cont = Container(name='center_cont', parent=self, align=Align.TOALL, clipChildren=True, padding=self.get_center_cont_padding())
     23         grid = LayoutGrid(parent=top_cont, align=Align.TOPLEFT, columns=2, cellSpacing=(8, 0))
     24         if self.widget_texture_path:
     25             grid.columns = 3
     26             Sprite(parent=grid, pos=(0, 0, 16, 16), align=Align.CENTER, texturePath=self.widget_texture_path, color=TextColor.SECONDARY)
     27         self.header = TextBody(name='header', parent=grid, align=Align.CENTERLEFT, color=TextColor.HIGHLIGHT)
     28         self.sub_header = TextBody(name='sub_header', parent=grid, align=Align.CENTERLEFT, color=TextColor.SECONDARY)
     29         footer_left_cont = LayoutGrid(parent=bottom_cont, align=Align.BOTTOMLEFT, columns=2)
     30         self.footer_left_icon_cont = sprite_cont = Container(parent=footer_left_cont, align=Align.CENTER, pos=(0, 0, 24, 16))
     31         self.footer_left_icon = Sprite(parent=self.footer_left_icon_cont, pos=(0, 0, 16, 16), align=Align.CENTER, color=TextColor.SECONDARY)
     32         self.footer_left_icon_cont.Hide()
     33         self.footer_left = TextBody(name='footer_left', parent=footer_left_cont, align=Align.BOTTOMLEFT, color=TextColor.SECONDARY)
     34         self.footer_right = TextBody(name='footer_right', parent=bottom_cont, align=Align.BOTTOMRIGHT, color=TextColor.SECONDARY)
     35 
     36     def set_header(self, text):
     37         self.header.SetText(text)
     38 
     39     def set_sub_header(self, text):
     40         self.sub_header.SetText(text)
     41 
     42     def set_footer_left(self, text):
     43         self.footer_left.SetText(text)
     44 
     45     def set_footer_left_icon(self, texture_path):
     46         if texture_path:
     47             self.footer_left_icon.SetTexturePath(texture_path)
     48             self.footer_left_icon_cont.Show()
     49         else:
     50             self.footer_left_icon_cont.Hide()
     51 
     52     def set_footer_right(self, text):
     53         self.footer_right.SetText(text)
     54 
     55     def get_center_cont_padding(self):
     56         return (0, 0, 0, 0)
     57 
     58 
     59 class WidgetContWithContent(WidgetCont):
     60 
     61     def construct_ui(self):
     62         super(WidgetContWithContent, self).construct_ui()
     63         self.content_cont = ContainerAutoSize(name='content_cont', parent=self.center_cont, align=uiconst.VERTICALLY_CENTERED, alignMode=Align.TOTOP, overflowAnchoring=uiconst.TOTOP, opacity=0.8, top=0.0)
     64 
     65 
     66 class WidgetContWithContentWithIcon(WidgetContWithContent):
     67     default_iconsSize = 96
     68 
     69     def ApplyAttributes(self, attributes):
     70         self.iconSize = attributes.get('iconSize', self.default_iconsSize)
     71         super(WidgetContWithContentWithIcon, self).ApplyAttributes(attributes)
     72 
     73     def construct_ui(self):
     74         super(WidgetContWithContentWithIcon, self).construct_ui()
     75         self.construct_logo()
     76 
     77     def construct_logo(self):
     78         c = Container(parent=self.content_cont, align=Align.TOLEFT, width=self.iconSize)
     79         self.icon = Sprite(parent=c, pos=(0,
     80          0,
     81          self.iconSize,
     82          self.iconSize), align=Align.CENTER)
     83 
     84     def load_texture(self, texture_path):
     85         self.icon.SetTexturePath(texture_path)