scanButton.py (2753B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\scannerFiles\scanButton.py 2 import localization 3 import signals 4 from carbonui import uiconst 5 from carbonui.uianimations import animations 6 from eve.client.script.ui.control import primaryButton 7 from eve.client.script.ui.inflight.scannerFiles.scannerUtil import IsDirectionalScanPanelEmbedded 8 9 class ScanButton(primaryButton.PrimaryButton): 10 11 def ApplyAttributes(self, attributes): 12 super(ScanButton, self).ApplyAttributes(attributes) 13 self.cmd = attributes.cmd 14 self.controller.on_scan_complete.connect(self.blink) 15 16 def blink(self): 17 if self.destroyed: 18 return 19 animations.FadeTo(self._arrows, startVal=self._arrows.opacity, endVal=0.0, loops=3, duration=0.3, curveType=uiconst.ANIM_BOUNCE) 20 21 def LoadTooltipPanel(self, panel, *args): 22 panel.LoadGeneric2ColumnTemplate() 23 panel.AddCommandTooltip(self.cmd) 24 panel.AddSpacer(height=2) 25 shortcut_text = self.cmd.GetShortcutAsString() 26 panel.AddLabelShortcut(localization.GetByLabel('UI/Inflight/Scanner/ScanTowards'), localization.GetByLabel('UI/Inflight/Scanner/AimTowardsShortcut', shortcut=shortcut_text)) 27 if IsDirectionalScanPanelEmbedded(): 28 panel.AddSpacer(height=2) 29 panel.AddLabelShortcut(localization.GetByLabel('UI/Inflight/Scanner/RotateScanCone'), localization.GetByLabel('UI/Inflight/Scanner/RotateScanConeShortcut', shortcut=shortcut_text)) 30 31 32 class ScanButtonController(primaryButton.PrimaryButtonController): 33 34 def __init__(self, directional_scan_service, service_manager): 35 self.directional_scan_service = directional_scan_service 36 self.service_manager = service_manager 37 super(ScanButtonController, self).__init__() 38 self.on_scan_complete = signals.Signal(signalName='on_scan_complete') 39 self.service_manager.RegisterForNotifyEvent(self, 'OnDirectionalScanCooldown') 40 self.service_manager.RegisterForNotifyEvent(self, 'OnDirectionalScanStarted') 41 42 @property 43 def default_is_arrow_animated(self): 44 return self.directional_scan_service.IsScanning() 45 46 @property 47 def default_is_enabled(self): 48 return not self.directional_scan_service.IsScanning() 49 50 @property 51 def default_label(self): 52 return localization.GetByLabel('UI/Inflight/Scanner/Scan') 53 54 def on_clicked(self): 55 self.directional_scan_service.DirectionalScan() 56 57 def OnDirectionalScanCooldown(self): 58 self.is_arrow_animated = False 59 self.is_enabled = True 60 self.on_scan_complete() 61 62 def OnDirectionalScanStarted(self): 63 self.is_arrow_animated = True 64 self.is_enabled = False