serviceBtn.py (2713B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\dockedUI\serviceBtn.py 2 from carbonui.control.buttonIcon import ButtonIcon 3 from carbonui.uicore import uicore 4 from eve.client.script.ui import eveColor 5 from evestations.standingsrestriction import get_station_standings_restriction 6 from localization import GetByLabel 7 8 class StationServiceBtn(ButtonIcon): 9 10 def __init__(self, serviceInfo, **kwargs): 11 self.cmdStr = serviceInfo.command 12 self.maskStationServiceIDs = serviceInfo.stationServiceIDs 13 self.serviceID = serviceInfo.serviceID 14 self.serviceStatus = GetByLabel('UI/Station/Lobby/Enabled') 15 self.serviceEnabled = True 16 self.disableIfServiceUnavailable = serviceInfo.disableButtonIfNotAvailable 17 self.displayName = serviceInfo.label 18 self.standingRestriction = None 19 if hasattr(serviceInfo, 'iconID'): 20 texturePath = serviceInfo.iconID 21 else: 22 texturePath = serviceInfo.texturePath 23 self.standingsRestriction = None 24 for serviceID in serviceInfo.stationServiceIDs: 25 standingsRestriction = get_station_standings_restriction(serviceID, session.stationid, session.charid) 26 if standingsRestriction: 27 self.standingsRestriction = standingsRestriction 28 break 29 30 super(StationServiceBtn, self).__init__(texturePath=texturePath, **kwargs) 31 32 def LoadTooltipPanel(self, panel, owner, *args): 33 panel.LoadGeneric3ColumnTemplate() 34 command = uicore.cmd.commandMap.GetCommandByName(self.cmdStr) 35 panel.AddCommandTooltip(command) 36 if not self.serviceEnabled: 37 panel.AddLabelMedium(text=self.serviceStatus, color=eveColor.WARNING_ORANGE[:3], bold=True, colSpan=panel.columns) 38 if self.standingsRestriction: 39 panel.AddLabelMedium(text=GetByLabel('UI/Standings/Restricted', **self.standingsRestriction), color=eveColor.WARNING_ORANGE[:3], colSpan=panel.columns, wrapWidth=200) 40 41 def UpdateState(self, isEnabled): 42 if not isEnabled: 43 self._SetDisabled(statusMessage=GetByLabel('UI/Station/Lobby/Disabled')) 44 elif self.standingsRestriction: 45 self._SetDisabled(statusMessage=GetByLabel('UI/Station/Lobby/Restricted')) 46 else: 47 self._SetEnabled() 48 49 def _SetDisabled(self, statusMessage): 50 if self.disableIfServiceUnavailable: 51 self.Disable() 52 self.serviceEnabled = False 53 self.serviceStatus = statusMessage 54 55 def _SetEnabled(self): 56 self.Enable() 57 self.serviceEnabled = True 58 self.serviceStatus = GetByLabel('UI/Station/Lobby/Enabled')