solarSystemViewPanel.py (8970B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\mapView\solarSystemViewPanel.py 2 import carbonui.const as uiconst 3 import localization 4 import uthread 5 from carbon.client.script.environment.AudioUtil import PlaySound 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.fill import Fill 8 from carbonui.uicore import uicore 9 from carbonui.control.buttonIcon import ButtonIcon 10 from eve.client.script.ui import eveThemeColor 11 from eve.client.script.ui.inflight.probeScannerWindow import ProbeScannerWindow 12 from eve.client.script.ui.inflight.scannerFiles.directionalScannerWindow import DirectionalScanner 13 from eve.client.script.ui.inflight.scannerFiles.scannerUtil import IsProbeScanEmbeddedPanelOpen, IsDirectionalScanEmbeddedPanelOpen 14 from eve.client.script.ui.shared.mapView.dockPanel import DockablePanel 15 from eve.client.script.ui.shared.mapView.dockPanelConst import DOCKPANELID_SOLARSYSTEMMAP 16 from eve.client.script.ui.shared.mapView.mapViewConst import MAPVIEW_SOLARSYSTEM_ID 17 from eve.client.script.ui.shared.mapView.mapViewScannerNavigationStandalone import MapViewScannerNavigation 18 from eve.client.script.ui.shared.mapView.mapViewSolarSystem import MapViewSolarSystem 19 from eve.client.script.ui.view.viewStateConst import ViewState 20 from eve.common.script.sys.idCheckers import IsSolarSystem 21 from eveuniverse.solar_systems import is_solarsystem_map_suppressed 22 23 class SolarSystemViewPanel(DockablePanel): 24 __notifyevents__ = DockablePanel.__notifyevents__ + ['OnBallparkSetState', 25 'OnTacticalOverlayChange', 26 'OnSessionChanged', 27 'OnSetCameraOffset', 28 'OnHideUI', 29 'OnShowUI', 30 'OnProbeScannerOpened'] 31 default_captionLabelPath = None 32 default_caption = None 33 default_windowID = DOCKPANELID_SOLARSYSTEMMAP 34 default_iconNum = 'res:/UI/Texture/classes/ProbeScanner/solarsystemMapButton.png' 35 default_minSize = (600, 500) 36 panelID = default_windowID 37 mapView = None 38 overlayTools = None 39 mapViewID = MAPVIEW_SOLARSYSTEM_ID 40 viewState = ViewState.SystemMapNew 41 hasImmersiveAudioOverlay = True 42 43 def ApplyAttributes(self, attributes): 44 DockablePanel.ApplyAttributes(self, attributes) 45 self.showRangeIndicator = sm.GetService('tactical').IsTacticalOverlayActive() 46 self.mapView = MapViewSolarSystem(parent=self.GetMainArea(), showInfobox=False, navigationPadding=(0, 0, 0, 0), navigationClass=MapViewScannerNavigation, mapViewID=self.mapViewID, showSolarSystemNebula=True, showStarfield=False, showDebugInfo=False, sceneBlendMode=None, stackMarkers=True) 47 sceneOptionsContainer = Container(parent=self.toolbarContainer, align=uiconst.CENTERLEFT, width=100, height=32, left=4, idx=0) 48 from eve.client.script.ui.shared.mapView.controls.mapViewMarkersSettingButton import MapViewMarkersSettingButton 49 self.markersSettingButton = MapViewMarkersSettingButton(parent=sceneOptionsContainer, callback=self.OnMarkersSettingChanged, mapViewID=self.mapViewID, align=uiconst.TOPLEFT, left=2, top=2) 50 focusSelf = ButtonIcon(parent=sceneOptionsContainer, pos=(26, 2, 26, 26), iconSize=16, func=self.OnFocusSelf, hint=localization.GetByLabel('UI/Map/FocusCurrentLocation'), texturePath='res:/UI/Texture/classes/MapView/focusIcon.png', align=uiconst.TOPLEFT) 51 focusSelf.tooltipPointer = uiconst.POINT_TOP_1 52 Fill(bgParent=self.content, color=eveThemeColor.THEME_TINT, opacity=0.8) 53 if not sm.GetService('ui').IsUiVisible(): 54 self.OnHideUI() 55 uthread.new(self.LoadSolarSystem) 56 self.UpdateScope() 57 58 def UpdateScope(self): 59 if session.solarsystemid2: 60 self.scope = uiconst.SCOPE_INFLIGHT 61 elif session.structureid: 62 self.scope = uiconst.SCOPE_STATION 63 else: 64 self.scope = uiconst.SCOPE_STATION 65 66 def OnShortcutKeyDown(self, modkey, vkey, flag): 67 if uicore.registry.GetActive() == self: 68 return self.mapView.CheckExecuteFilterShortcut(vkey) 69 return False 70 71 def Close(self, *args): 72 DockablePanel.Close(self, *args) 73 PlaySound('scanner_atmo_loop_stop') 74 75 def ToggleDirectionalScanner(self): 76 wasMinimized = False 77 if self.IsMinimized(): 78 wasMinimized = True 79 self.Maximize() 80 self.mapView.ToggleDirectionalScanner(wasMinimized) 81 uicore.registry.SetFocus(self) 82 83 def ToggleProbeScanner(self): 84 wasMinimized = False 85 if self.IsMinimized(): 86 wasMinimized = True 87 self.Maximize() 88 self.mapView.ToggleProbeScanner(wasMinimized) 89 uicore.registry.SetFocus(self) 90 91 def OpenProbeScanner(self): 92 if self.IsMinimized(): 93 self.Maximize() 94 self.mapView.OpenProbeScanPanelEmbedded() 95 uicore.registry.SetFocus(self) 96 97 def OnShowUI(self): 98 self.toolbarContainer.display = True 99 100 def OnHideUI(self): 101 if self.IsFullscreen(): 102 self.toolbarContainer.display = False 103 104 def StartDirectionalScanHandler(self): 105 if self.mapView and self.mapView.currentSolarsystem: 106 self.mapView.currentSolarsystem.EnableDirectionalScanHandler() 107 108 def StopDirectionalScanHandler(self): 109 if self.mapView and self.mapView.currentSolarsystem: 110 self.mapView.currentSolarsystem.StopDirectionalScanHandler() 111 112 def GetDirectionalScanHandler(self): 113 if self.mapView and self.mapView.currentSolarsystem: 114 return self.mapView.currentSolarsystem.directionalScanHandler 115 116 def StartProbeHandler(self): 117 if self.mapView and self.mapView.currentSolarsystem: 118 self.mapView.currentSolarsystem.EnableProbeHandlerStandalone() 119 120 def StopProbeHandler(self): 121 if self.mapView and self.mapView.currentSolarsystem: 122 self.mapView.currentSolarsystem.StopProbeHandler() 123 124 def OnFocusSelf(self, *args, **kwds): 125 self.mapView.FocusSelf() 126 127 def OnMarkersSettingChanged(self, *args, **kwds): 128 self.mapView.OnMapViewSettingChanged(*args, **kwds) 129 130 def OnDockModeChanged(self, *args, **kwds): 131 self.mapView.OnDockModeChanged(self.IsFullscreen()) 132 133 def OnTacticalOverlayChange(self): 134 if not self.mapView: 135 return 136 visible = sm.GetService('tactical').IsTacticalOverlayActive() 137 self.showRangeIndicator = visible 138 if visible: 139 self.mapView.currentSolarsystem.ShowRangeIndicator() 140 else: 141 self.mapView.currentSolarsystem.HideRangeIndicator() 142 143 def OnBallparkSetState(self): 144 if not self.destroyed: 145 uthread.new(self.LoadSolarSystem) 146 147 def OnSetCameraOffset(self, cameraOffset): 148 if self.mapView.camera: 149 if self.IsFullscreen(): 150 x = -(cameraOffset * 0.5 - 0.5) 151 self.mapView.camera.cameraCenter = (x, 0.5) 152 else: 153 self.mapView.camera.cameraCenter = (0.5, 0.5) 154 155 def OnSessionChanged(self, isRemote, session, change): 156 if 'solarsystemid2' in change: 157 if is_solarsystem_map_suppressed(session.solarsystemid2): 158 self.Close() 159 return 160 if 'locationid' in change and not IsSolarSystem(change['locationid'][1]): 161 uthread.new(self.LoadSolarSystem) 162 163 def LoadSolarSystem(self): 164 if self.destroyed: 165 return 166 self.mapView.LoadSolarSystemDetails(session.solarsystemid2) 167 settings.char.ui.Set('solarSystemView_loaded_%s' % self.mapViewID, session.solarsystemid2) 168 self.mapView.FrameSolarSystem() 169 self.mapView.sceneContainer.display = True 170 self.SetCaption(cfg.evelocations.Get(session.solarsystemid2).name) 171 if self.showRangeIndicator: 172 self.mapView.currentSolarsystem.ShowRangeIndicator() 173 self.UpdateProbeHandlers() 174 175 def CmdZoomInOut(self, zoomDelta): 176 if self.mapView: 177 self.mapView.camera.Zoom(0.001 * zoomDelta) 178 179 def OnProbeScannerOpened(self): 180 self.UpdateProbeHandlers() 181 182 def IsDirectionalScannerOpen(self): 183 return IsDirectionalScanEmbeddedPanelOpen() or DirectionalScanner.IsOpen() 184 185 def IsProbeScannerOpen(self): 186 return IsProbeScanEmbeddedPanelOpen() or ProbeScannerWindow.IsOpen() 187 188 def UpdateProbeHandlers(self): 189 if self.IsProbeScannerOpen(): 190 self.StartProbeHandler() 191 else: 192 self.StopProbeHandler() 193 if self.IsDirectionalScannerOpen(): 194 self.StartDirectionalScanHandler() 195 else: 196 self.StopDirectionalScanHandler() 197 198 def OnSetActive_(self, *args): 199 PlaySound('scanner_atmo_window_loop_play') 200 201 def OnSetInactive(self, *args): 202 super(SolarSystemViewPanel, self).OnSetInactive() 203 PlaySound('scanner_atmo_loop_play') 204 205 def OnStartMinimize_(self, *args): 206 self.mapView.Hide() 207 208 def OnStartMaximize_(self, *args): 209 self.mapView.Show()