stats_cont.py (1686B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\theatersOfWar\campaigns\panels\stats_cont.py 2 from carbonui import Align, uiconst, TextAlign 3 from carbonui.primitives.container import Container 4 from carbonui.primitives.containerAutoSize import ContainerAutoSize 5 from carbonui.primitives.line import Line 6 from carbonui.text.custom import TextCustom 7 from carbonui.text.styles import TextDetail 8 from carbonui.uianimations import animations 9 from eve.client.script.ui import eveThemeColor 10 11 class StatsContainer(ContainerAutoSize): 12 default_alignMode = Align.TOTOP 13 14 def ApplyAttributes(self, attributes): 15 super(StatsContainer, self).ApplyAttributes(attributes) 16 stat_name = attributes.stat_name 17 value_cont = ContainerAutoSize(name='value_cont', parent=self, align=Align.TOTOP) 18 self.value_label = TextCustom(parent=value_cont, align=Align.CENTER, fontsize=64) 19 self.stat_name_label = TextDetail(parent=self, text=stat_name, align=Align.TOTOP, textAlign=TextAlign.CENTER) 20 line_cont = Container(name='line_cont', parent=self, align=Align.TOTOP, height=2, top=10) 21 self.line = Line(parent=line_cont, align=Align.CENTER, color=eveThemeColor.THEME_FOCUS, outputMode=uiconst.OUTPUT_COLOR_AND_GLOW, pos=(0, 0, 40, 1)) 22 self._update_width() 23 self.opacity = 0.0 24 25 def load_stats(self, value, color): 26 self.value_label.SetText(value) 27 self.line.SetRGBA(*color) 28 self._update_width() 29 animations.FadeIn(self, duration=0.3) 30 31 def _update_width(self): 32 self.width = max(100, self.value_label.width + 16, self.stat_name_label.width + 16)