panelWarHQ.py (1517B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\panelWarHQ.py 2 import uthread 3 from carbonui.primitives.container import Container 4 from eve.client.script.ui.control.entries.header import Header 5 from eve.client.script.ui.control.entries.util import GetFromClass 6 from eve.client.script.ui.control.eveScroll import Scroll 7 from eve.client.script.ui.shared.neocom.corporation.war.warEntry import WarEntrySimple 8 from eve.common.lib import appConst as const 9 from localization import GetByLabel 10 11 class WarHQ(Container): 12 13 def ApplyAttributes(self, attributes): 14 Container.ApplyAttributes(self, attributes) 15 self.structureID = attributes.structureID 16 self.wars = None 17 18 def Load(self): 19 self.Flush() 20 self.warHqScroll = Scroll(name='warHqScroll', parent=self, padding=const.defaultPadding) 21 uthread.new(self._LoadWars) 22 23 def _LoadWars(self): 24 text = GetByLabel('UI/InfoWindow/WarHQHeader') 25 scrollList = [GetFromClass(Header, {'label': text})] 26 wars = self.GetWars() 27 wars = sorted(wars, key=lambda x: x.timeDeclared, reverse=True) 28 for war in wars: 29 scrollList.append(GetFromClass(WarEntrySimple, {'war': war, 30 'label': ''})) 31 32 self.warHqScroll.Load(contentList=scrollList) 33 34 def GetWars(self): 35 if self.wars is None: 36 self.wars = sm.RemoteSvc('warsInfoMgr').GetWarsForStructure(self.structureID) 37 return self.wars