all_ui_alliances.py (6073B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\Alliances\all_ui_alliances.py 2 import carbonui.const as uiconst 3 import localization 4 from carbonui.control.tabGroup import TabGroup 5 from carbonui.primitives.container import Container 6 from eve.client.script.ui.control import eveScroll 7 from eve.client.script.ui.shared.neocom.Alliances.all_ui_applications import FormAlliancesApplications 8 from eve.client.script.ui.shared.neocom.Alliances.all_ui_home import FormAlliancesBulletins, FormAlliancesHome 9 from eve.client.script.ui.shared.neocom.Alliances.all_ui_members import FormAlliancesMembers 10 from eve.client.script.ui.shared.neocom.Alliances.all_ui_rankings import FormAlliancesRankings 11 from eve.client.script.ui.shared.neocom.Alliances.all_ui_sovereignty import FormAlliancesSovereignty 12 from eve.client.script.ui.shared.neocom.Alliances.all_ui_systems import FormAlliancesSystems 13 from eve.client.script.ui.shared.neocom.addressBook.contactsConst import TAB_ALLIANCECONTACTS 14 from eve.client.script.ui.shared.neocom.addressBook.contactsForm import ContactsForm 15 from eve.client.script.ui.shared.neocom.corporation import corpUISignals 16 from eve.client.script.ui.shared.neocom.corporation.corpPanelConst import CorpPanel 17 from inventorycommon.util import IsNPC 18 from menucheckers import SessionChecker 19 20 class FormAlliances(Container): 21 __guid__ = 'form.Alliances' 22 __nonpersistvars__ = [] 23 24 def ApplyAttributes(self, attributes): 25 Container.ApplyAttributes(self, attributes) 26 27 def Load(self, key): 28 if not self.sr.Get('inited', 0): 29 self.sr.inited = 1 30 self.sr.wndViewParent = Container(name='wndViewParent', align=uiconst.TOALL, pos=(0, 0, 0, 0), parent=self) 31 if session.allianceid: 32 self.contactsPanel = ContactsForm(name=CorpPanel.ALLIANCES_CONTACTS, parent=self, contactType=TAB_ALLIANCECONTACTS) 33 else: 34 self.contactsPanel = eveScroll.Scroll(name=CorpPanel.ALLIANCES_CONTACTS, parent=self) 35 self.sr.tabs = TabGroup(name='tabparent', parent=self, idx=0) 36 self.sr.tabs.Startup(self._GetTabs(), 'corpaccounts') 37 return 38 self.LoadViewClass(key) 39 40 def GetHomeTabHint(self): 41 tabHint = '' 42 if session.allianceid is None: 43 corporation = sm.GetService('corp').GetCorporation(session.corpid) 44 if corporation.ceoID != session.charid: 45 tabHint = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Home/CEODeclareWarOnlyHint') 46 if not SessionChecker(session, None).IsCorpDirector(): 47 tabHint = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Home/DirectorsCanEdit') 48 return tabHint 49 50 def _GetTabs(self): 51 tabs = [] 52 tabs.append(self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/Home', self.sr.wndViewParent, CorpPanel.ALLIANCES_HOME, self.GetHomeTabHint())) 53 if session.allianceid is not None: 54 tabs.extend([self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/Bulletins', self.sr.wndViewParent, CorpPanel.ALLIANCES_BULLETINS), 55 self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/Members', self.sr.wndViewParent, CorpPanel.ALLIANCES_MEMBERS), 56 self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/AllianceContacts', self.contactsPanel, CorpPanel.ALLIANCES_CONTACTS), 57 self._BuildTabParams('UI/Neocom/Sovereignty', self.sr.wndViewParent, CorpPanel.ALLIANCE_SOVEREIGNTY), 58 self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/Systems', self.sr.wndViewParent, CorpPanel.ALLIANCES_SYSTEMS)]) 59 if not IsNPC(session.corpid): 60 tabs.append(self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/Applications', self.sr.wndViewParent, 'alliances_applications')) 61 tabs.append(self._BuildTabParams('UI/Corporations/CorporationWindow/Alliances/Rankings', self.sr.wndViewParent, 'alliances_rankings', localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Rankings/RankingsCached15'))) 62 return tabs 63 64 def _BuildTabParams(self, labelName, parent, tabArgs, hint = None): 65 return [localization.GetByLabel(labelName), 66 parent, 67 self, 68 tabArgs, 69 None, 70 hint] 71 72 def LoadViewClass(self, tabName): 73 self.sr.wndViewParent.Flush() 74 if self.sr.tabs: 75 if tabName == CorpPanel.ALLIANCES: 76 tabName = self.sr.tabs.GetSelectedArgs() 77 if tabName == CorpPanel.ALLIANCES_CONTACTS: 78 if session.allianceid: 79 self.contactsPanel.LoadPanel() 80 return 81 else: 82 corpNotInAllianceLabel = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/CorpNotInAlliance', corpName=cfg.eveowners.Get(session.corpid).ownerName) 83 self.contactsPanel.Load(fixedEntryHeight=19, contentList=[], noContentHint=corpNotInAllianceLabel) 84 return 85 self.contactsPanel.state = uiconst.UI_HIDDEN 86 if tabName == CorpPanel.ALLIANCES_HOME: 87 panel = FormAlliancesHome(parent=self.sr.wndViewParent) 88 if tabName == CorpPanel.ALLIANCES_SYSTEMS: 89 panel = FormAlliancesSystems(parent=self.sr.wndViewParent) 90 elif tabName == CorpPanel.ALLIANCES_BROWSE_ALL: 91 panel = FormAlliancesRankings(parent=self.sr.wndViewParent) 92 elif tabName == CorpPanel.ALLIANCES_APPLICATIONS: 93 panel = FormAlliancesApplications(parent=self.sr.wndViewParent) 94 elif tabName == CorpPanel.ALLIANCES_MEMBERS: 95 panel = FormAlliancesMembers(parent=self.sr.wndViewParent) 96 elif tabName == CorpPanel.ALLIANCES_BULLETINS: 97 panel = FormAlliancesBulletins(parent=self.sr.wndViewParent) 98 elif tabName == CorpPanel.ALLIANCE_SOVEREIGNTY: 99 panel = FormAlliancesSovereignty(parent=self.sr.wndViewParent) 100 panel.CreateWindow()