warzoneGaugeCont.py (3000B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\factionalWarfare\enlistmentFlow\warzoneGaugeCont.py 2 import uthread2 3 from carbonui import const as uiconst 4 from carbonui.text.custom import TextCustom 5 from carbonui.primitives.container import Container 6 from carbonui.text.const import FontSizePreset 7 from eve.client.script.ui.shared.factionalWarfare.enlistmentFlow.enlistmentUtil import GetFactionColor 8 from eve.common.script.util.facwarCommon import IsOccupierFWFaction 9 from fwwarzone.client.dashboard.gauges.warzoneStatusGauge import WarzoneStatusGaugeFaintOpponent 10 11 class WarzoneGaugeCont(Container): 12 default_align = uiconst.CENTER 13 default_fontsize = FontSizePreset.BODY 14 default_showScore = True 15 default_iconSize = 65 16 17 def ApplyAttributes(self, attributes): 18 super(WarzoneGaugeCont, self).ApplyAttributes(attributes) 19 self.gaugeRadius = attributes.gaugeRadius or self.width / 2 20 fontsize = attributes.get('fontsize', self.default_fontsize) 21 showScore = attributes.get('showScore', self.default_showScore) 22 self.iconSize = attributes.get('iconSize', self.default_iconSize) 23 self.innerCont = Container(name='innerCont', parent=self, align=uiconst.CENTER, pos=(0, 24 0, 25 2 * self.gaugeRadius, 26 2 * self.gaugeRadius)) 27 labelLeft = self.gaugeRadius + 20 28 self.factionScoreLabel = TextCustom(name='factionScoreLabel', parent=Container(parent=self, align=uiconst.CENTER, pos=(labelLeft, 29 0, 30 20, 31 20)), align=uiconst.CENTERLEFT, text='', fontsize=fontsize) 32 labelLeft = -self.gaugeRadius - 20 33 self.enemyScoreLAbel = TextCustom(name='enemyScoreLAbel', parent=Container(parent=self, align=uiconst.CENTER, pos=(labelLeft, 34 0, 35 20, 36 20)), align=uiconst.CENTERRIGHT, text='', fontsize=fontsize) 37 if not showScore: 38 self.factionScoreLabel.Hide() 39 self.enemyScoreLAbel.Hide() 40 41 def ShowFaction(self, factionID): 42 self.innerCont.Flush() 43 if IsOccupierFWFaction(factionID): 44 self.Show() 45 uthread2.StartTasklet(self.LoadGauge_thread, factionID) 46 else: 47 self.Hide() 48 self.factionScoreLabel.text = '' 49 self.enemyScoreLAbel.text = '' 50 51 def LoadGauge_thread(self, factionID): 52 self.innerCont.Flush() 53 warzoneID = sm.GetService('fwWarzoneSvc').GetWarzoneIdForFaction(factionID) 54 warzoneStatusGauge = WarzoneStatusGaugeFaintOpponent(parent=self.innerCont, radius=self.gaugeRadius, lineWidth=6, align=uiconst.CENTER, warzoneId=warzoneID, animateIn=False, viewingFactionId=factionID, iconSize=self.iconSize) 55 self.factionScoreLabel.text = warzoneStatusGauge.friendlySystemCount 56 self.enemyScoreLAbel.text = warzoneStatusGauge.opposingSystemCount 57 factionRGB = GetFactionColor(factionID) or (1, 1, 1, 1) 58 self.factionScoreLabel.SetRGBA(*factionRGB)