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

panelUnderlay.py (1599B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\carbonui\decorative\panelUnderlay.py
      2 from carbonui import uiconst
      3 from carbonui.primitives.container import Container
      4 from carbonui.primitives.fill import Fill
      5 from carbonui.uianimations import animations
      6 from carbonui.util.various_unsorted import GetWindowAbove
      7 
      8 class PanelUnderlay(Container):
      9     OPACITY_IDLE = 0.025
     10     OPACITY_ACTIVE = 0.05
     11     _active = False
     12     _background = None
     13 
     14     def __init__(self, **kwargs):
     15         super(PanelUnderlay, self).__init__(**kwargs)
     16         self._update_active()
     17         self._background = Fill(bgParent=self, align=uiconst.TOALL, color=(1.0, 1.0, 1.0), opacity=self._get_opacity())
     18 
     19     def SetParent(self, parent, idx = None):
     20         super(PanelUnderlay, self).SetParent(parent, idx)
     21         self._update_active()
     22 
     23     def _update_active(self):
     24         was_active = self._active
     25         window = GetWindowAbove(self)
     26         if window:
     27             self._active = window.active
     28         else:
     29             self._active = False
     30         if was_active != self._active:
     31             self._update_opacity()
     32 
     33     def _get_opacity(self):
     34         if self._active:
     35             return self.OPACITY_ACTIVE
     36         return self.OPACITY_IDLE
     37 
     38     def _update_opacity(self):
     39         if self._background:
     40             animations.FadeTo(self._background, startVal=self._background.opacity, endVal=self._get_opacity(), duration=uiconst.TIME_ENTRY)
     41 
     42     def OnWindowAboveSetActive(self):
     43         self._update_active()
     44 
     45     def OnWindowAboveSetInactive(self):
     46         self._update_active()