standingLabel.py (1681B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\standings\standingLabel.py 2 from carbonui import uiconst, fontconst 3 from carbonui.primitives.containerAutoSize import ContainerAutoSize 4 from eve.client.script.ui.control.eveLabel import Label 5 from eve.common.script.sys import idCheckers 6 from eve.common.script.util.standingUtil import OpenStandingsPanelOnOwnerByID 7 8 class StandingLabel(ContainerAutoSize): 9 default_name = 'StandingLabel' 10 default_state = uiconst.UI_NORMAL 11 default_fontSize = fontconst.EVE_MEDIUM_FONTSIZE 12 13 def ApplyAttributes(self, attributes): 14 super(StandingLabel, self).ApplyAttributes(attributes) 15 self.isRightToLeft = attributes.isRightToLeft 16 standingData = attributes.standingData 17 fontSize = attributes.Get('fontSize', self.default_fontSize) 18 self.label = Label(name='toStandingsLabel', parent=self, fontsize=fontSize) 19 if standingData: 20 self.SetStandingData(standingData) 21 22 def SetStandingData(self, standingData): 23 self.standingData = standingData 24 if self.isRightToLeft: 25 self.label.align = uiconst.CENTERLEFT 26 self.label.text = self.standingData.GetStanding2To1Formatted() 27 else: 28 self.label.align = uiconst.CENTERRIGHT 29 self.label.text = self.standingData.GetStanding1To2Formatted() 30 31 def OnClick(self, *args): 32 if idCheckers.IsPlayerOwner(self.standingData.GetOwnerID2()): 33 return 34 if idCheckers.IsCorporation(self.standingData.GetOwnerID1()): 35 return 36 OpenStandingsPanelOnOwnerByID(self.standingData.GetOwnerID2())