NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

shipFittingSimulationButton.py (2421B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\fittingScreen\shipFittingSimulationButton.py
      2 import carbonui.const as uiconst
      3 import uthread2
      4 from carbonui.primitives.container import Container
      5 from carbonui.control.buttonIcon import ButtonIcon
      6 
      7 class ShipFittingSimulationButton(ButtonIcon):
      8     default_name = __name__
      9     default_texturePath = 'res:/UI/Texture/classes/Fitting/iconSimulatorToggle.png'
     10     default_hoverTexture = 'res:/UI/Texture/classes/Fitting/iconSimulatorHover.png'
     11     default_exitTexturePath = 'res:/UI/Texture/classes/Fitting/iconSimulatorExit.png'
     12     default_exitHoverTexturePath = 'res:/UI/Texture/classes/Fitting/iconSimulatorExitHover.png'
     13     default_width = 32
     14     default_height = 32
     15     default_iconSize = 32
     16     default_showGlow = True
     17     GLOWAMOUNT_MOUSECLICK = 1.5
     18     GLOWAMOUNT_MOUSEHOVER = 0.5
     19 
     20     def ApplyAttributes(self, attributes):
     21         self.default_func = self.ToggleGhostFittingForActiveShip
     22         super(ShipFittingSimulationButton, self).ApplyAttributes(attributes)
     23         self.fittingSvc = sm.GetService('fittingSvc')
     24         self.enableButtonThread = None
     25 
     26     def Close(self):
     27         self.KillEnableButtonThread()
     28         Container.Close(self)
     29 
     30     def ToggleGhostFittingForActiveShip(self, *args):
     31         ghostFittingSvc = sm.GetService('ghostFittingSvc')
     32         self.KillEnableButtonThread()
     33         self.state = uiconst.UI_DISABLED
     34         try:
     35             ghostFittingSvc.ToggleGhostFitting()
     36         finally:
     37             self.EnableButtonWithDelay()
     38 
     39     def EnableButtonWithDelay(self):
     40         self.KillEnableButtonThread()
     41         self.enableButtonThread = uthread2.call_after_wallclocktime_delay(self.EnableButton, 0.5)
     42 
     43     def EnableButton(self):
     44         self.state = uiconst.UI_NORMAL
     45         self.enableButtonThread = None
     46 
     47     def KillEnableButtonThread(self):
     48         if self.enableButtonThread:
     49             self.enableButtonThread.kill()
     50             self.enableButtonThread = None
     51 
     52     def ShowExitTextures(self):
     53         self.texturePath = self.default_exitTexturePath
     54         self.SetTexturePath(self.default_exitTexturePath)
     55         self.hoverTexture = self.default_exitHoverTexturePath
     56 
     57     def ShowDefaultTextures(self):
     58         self.texturePath = self.default_texturePath
     59         self.SetTexturePath(self.default_texturePath)
     60         self.hoverTexture = self.default_hoverTexture