planetView.py (2155B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\view\planetView.py 2 import carbonui.const as uiconst 3 import uthread 4 from eve.client.script.ui.services.viewStateSvc import View 5 from eve.client.script.ui.shared.planet.planetNavigation import PlanetLayer 6 from player_messaging.client.ui_message import prompt_player_fsd_dialog 7 8 class PlanetView(View): 9 __guid__ = 'viewstate.PlanetView' 10 __notifyevents__ = ['OnUIRefresh'] 11 __dependencies__ = [] 12 __layerClass__ = PlanetLayer 13 14 def CanEnter(self, planetID = None, **kwargs): 15 canEnter = True 16 if planetID is None: 17 self.LogInfo('Must have a valid planetID to open planet view') 18 canEnter = False 19 elif self.IsActive() and planetID == sm.GetService('planetUI').planetID: 20 self.LogInfo('Planet', planetID, 'is already open and loaded') 21 canEnter = False 22 if canEnter: 23 try: 24 sm.GetService('planetSvc').GetPlanet(planetID) 25 except UserError as e: 26 prompt_player_fsd_dialog(*e.args) 27 canEnter = False 28 29 return canEnter 30 31 def CanExit(self): 32 currentPlanet = sm.GetService('planetUI').GetCurrentPlanet() 33 if currentPlanet and currentPlanet.IsInEditMode(): 34 if prompt_player_fsd_dialog('ExitPlanetModeWhileInEditMode', {}, uiconst.YESNO) != uiconst.ID_YES: 35 return False 36 currentPlanet.RevertChanges() 37 return True 38 39 def LoadView(self, planetID = None, **kwargs): 40 planetUI = sm.GetService('planetUI') 41 if self.IsActive(): 42 planetUI.Close(clearAll=False) 43 planetUI._Open(planetID) 44 self.lastPlanetID = planetID 45 46 def UnloadView(self): 47 planetUI = sm.GetService('planetUI') 48 planetUI.Close() 49 50 def OnUIRefresh(self): 51 uthread.new(self._ReOpen) 52 53 def _ReOpen(self): 54 viewState = sm.GetService('viewState') 55 viewState.CloseSecondaryView('planet') 56 planetID = getattr(self, 'lastPlanetID', None) 57 viewState.ActivateView('planet', planetID=planetID)