mapMarkerEmanationLock.py (4561B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\mapView\markers\mapMarkerEmanationLock.py 2 import blue 3 import evetypes 4 import uthread 5 from carbonui.uianimations import animations 6 from carbonui.uicore import uicore 7 from carbonui.util.various_unsorted import GetWindowAbove 8 from eve.client.script.ui import eveColor 9 from eve.client.script.ui.control.themeColored import SpriteThemeColored 10 from eve.client.script.ui.shared.agencyNew.ui.contentPages.contentPageZarzakh import Topics 11 from eve.client.script.ui.shared.mapView.markers.mapMarkerBase_Icon import MarkerIconBase 12 import eve.client.script.ui.shared.agencyNew.contentGroups.contentGroupConst as agencyContentGroupConst 13 from eve.client.script.ui.shared.agencyNew.ui.agencyWnd import AgencyWndNew 14 from localization import GetByLabel 15 import carbonui.const as uiconst 16 from carbonui.primitives.base import ScaleDpi 17 from math import pi 18 import logging 19 log = logging.getLogger(__name__) 20 21 class MarkerEmanationLock(MarkerIconBase): 22 solarSystemID = None 23 distanceFadeAlphaNearFar = None 24 texturePath = 'res:/UI/Texture/eveicon/system_icons/link_16px.png' 25 26 def __init__(self, animate = True, *args, **kwds): 27 super(MarkerEmanationLock, self).__init__(*args, **kwds) 28 self.bgCircles = [] 29 self.projectBracket.offsetY = ScaleDpi(30) 30 self.lock_label = '' 31 32 def Load(self): 33 super(MarkerEmanationLock, self).Load() 34 self.backgroundSprite.rotation = pi 35 self.backgroundSprite.pos = ((self.width - 64) / 2, 36 (self.height - 64) / 2 - 12, 37 64, 38 64) 39 self.backgroundSprite.color = eveColor.CHERRY_RED 40 41 def Close(self): 42 uicore.animations.StopAllAnimations(self) 43 super(MarkerEmanationLock, self).Close() 44 45 def GetMenu(self): 46 pass 47 48 def OnDblClick(self, *args): 49 log.info('MarkerEmanationLock.OnDblClick') 50 AgencyWndNew.OpenAndShowContentGroup(contentGroupID=agencyContentGroupConst.contentGroupZarzakh) 51 wnd = AgencyWndNew.GetIfOpen() 52 if wnd is None: 53 return 54 wnd.contentGroupBrowser.contentPage.select_topic(Topics.JOVIAN) 55 56 def SetLabelTextFromItem(self, itemID, typeID): 57 text = self.GetLabelTextFromItem(itemID, typeID) 58 self.lock_label = GetByLabel('UI/Map/StarMap/EmanationLockMarkerTooltip', gate_name=text) 59 60 def GetLabelTextFromItem(self, itemID, typeID): 61 displayName = '' 62 locationName = cfg.evelocations.Get(itemID).name 63 if locationName: 64 displayName = locationName 65 elif typeID: 66 displayName = evetypes.GetName(typeID) 67 return displayName 68 69 def GetLabelText(self): 70 return self.lock_label 71 72 def ShowDscanHilite(self): 73 pass 74 75 def _CreateRenderObject(self): 76 super(MarkerEmanationLock, self)._CreateRenderObject() 77 self.CheckConstructCircles() 78 79 def CheckConstructCircles(self): 80 if self.markerContainer and not self.markerContainer.destroyed: 81 self.ConstructCircles() 82 uthread.new(self.AnimateBGCircles) 83 84 def AnimateBGCircles(self): 85 duration = 3.0 86 radius = 300 87 kOffset = 0.6 88 while not self.destroyed: 89 blue.pyos.synchro.SleepWallclock((3 * kOffset + duration) * 1000) 90 if not self.IsThisWindowActive(): 91 continue 92 for i, circle in enumerate(self.bgCircles): 93 timeOffset = i * kOffset 94 animations.MorphScalar(circle, 'width', 0, radius, duration=duration, timeOffset=timeOffset) 95 animations.MorphScalar(circle, 'height', 0, radius, duration=duration, timeOffset=timeOffset) 96 animations.FadeTo(circle, 0.0, 0.02, duration=duration, timeOffset=timeOffset, curveType=uiconst.ANIM_WAVE) 97 98 def IsThisWindowActive(self): 99 if not self.markerContainer: 100 return False 101 wnd = GetWindowAbove(self.markerContainer) 102 return uicore.registry.GetActive() == wnd 103 104 def ConstructCircles(self): 105 for i in xrange(3): 106 circle = SpriteThemeColored(name='circle', parent=self.markerContainer, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/hexMap/circleFilled256.png', colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) 107 self.bgCircles.append(circle) 108 109 def GetMarkerOpacity(self, bracketCameraDistance, cameraZoomDistance): 110 return 1.0 111 112 def GetOverlapSortValue(self, reset = False): 113 return None