stargateSystemEntry.py (4331B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\structure\deployment\stargateSystemEntry.py 2 from carbon.common.script.util.linkUtil import GetShowInfoLink 3 from carbonui.util.stringManip import GetAsUnicode 4 from eve.client.script.ui.control.baseListEntry import BaseListEntryCustomColumns 5 import carbonui.const as uiconst 6 from eve.client.script.ui.control.eveLabel import EveLabelMedium 7 from eve.client.script.ui.shared.stateFlag import FlagIconWithState 8 from localization import GetByLabel 9 from menu import MenuLabel 10 11 class StargateDestSystemsEntry(BaseListEntryCustomColumns): 12 default_name = 'StructureEntryMyCorp' 13 isDragObject = True 14 15 def ApplyAttributes(self, attributes): 16 BaseListEntryCustomColumns.ApplyAttributes(self, attributes) 17 self.BuildUI() 18 19 def BuildUI(self): 20 self.nameLabel = self.AddColumnText() 21 distCont = self.AddColumnContainer() 22 self.distLabel = EveLabelMedium(parent=distCont, name='distLabel', align=uiconst.CENTERRIGHT, left=10) 23 jumpCont = self.AddColumnContainer() 24 self.jumpLabel = EveLabelMedium(parent=jumpCont, name='jumpLabel', align=uiconst.CENTERRIGHT, left=10) 25 self.corpCont = self.AddColumnContainer() 26 self.corpFlag = FlagIconWithState(parent=self.corpCont, left=4, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT) 27 self.structureLabel = EveLabelMedium(parent=self.corpCont, name='jumpLabel', align=uiconst.CENTERLEFT, left=20, state=uiconst.UI_NORMAL) 28 self.linkLabel = self.AddColumnText() 29 self.LoadUI() 30 31 def LoadUI(self): 32 node = self.node 33 jumpGate = node.jumpGate 34 alignedToCurrentSystem = jumpGate and jumpGate.alignedToCurrentSystem 35 self.nameLabel.text = node.systemName 36 self.distLabel.text = node.distText 37 self.jumpLabel.text = node.jumpText 38 self.corpFlag.display = False 39 if jumpGate: 40 if node.corpFlagInfo: 41 self.corpFlag.ModifyIcon(node.corpFlagInfo) 42 self.corpFlag.hint = node.corpFlagInfo.flagProperties.ownerText 43 self.corpFlag.display = True 44 if alignedToCurrentSystem: 45 linkColor = (0, 1, 0, 0.75) 46 else: 47 linkColor = (1, 0, 0, 0.75) 48 structureText = GetShowInfoLink(jumpGate.typeID, jumpGate.structureName, jumpGate.structureID) 49 labelState = uiconst.UI_NORMAL 50 else: 51 structureText = GetByLabel('UI/Structures/Deployment/NoGate') 52 labelState = uiconst.UI_DISABLED 53 linkColor = (1, 1, 1, 0.75) 54 self.structureLabel.text = structureText 55 self.structureLabel.state = labelState 56 self.linkLabel.text = self.GetLinkText(node) 57 self.linkLabel.SetRGBA(*linkColor) 58 59 def GetMenu(self): 60 node = self.node 61 m = [(MenuLabel('UI/Commands/ShowInfo'), sm.GetService('info').ShowInfo, (const.typeSolarSystem, node.solarSystemID))] 62 if node.hasGate: 63 m = [(MenuLabel('UI/Commands/ShowInfo'), sm.GetService('info').ShowInfo, (const.typeSolarSystem, node.solarSystemID))] 64 return m 65 66 @staticmethod 67 def GetHeaders(): 68 return [GetByLabel('UI/Common/LocationTypes/System'), 69 GetByLabel('UI/Common/Distance'), 70 GetByLabel('UI/Common/Jumps'), 71 GetByLabel('UI/Structures/Deployment/StargateHeader'), 72 GetByLabel('UI/Structures/Deployment/LinkHeader')] 73 74 @staticmethod 75 def GetLinkText(node): 76 if not node.jumpGate: 77 return GetByLabel('UI/Structures/Deployment/GateLinkUnavailable') 78 if node.jumpGate.alignedToCurrentSystem: 79 return GetByLabel('UI/Structures/Deployment/GateLinkAvailable') 80 return GetByLabel('UI/Structures/Deployment/GateLinkElsewhere') 81 82 @staticmethod 83 def GetDynamicHeight(node, width): 84 return 20 85 86 @staticmethod 87 def GetStringFromNode(node): 88 structureName = node.jumpGate.structureName if node.jumpGate else GetByLabel('UI/Structures/Deployment/NoGate') 89 textList = [node.systemName, 90 node.distText, 91 node.jumpText, 92 ' ' + structureName, 93 StargateDestSystemsEntry.GetLinkText(node)] 94 text = '<t>'.join(textList) 95 return GetAsUnicode(text)