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

info_panel_progress_bar.py (2217B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\infoPanels\info_panel_progress_bar.py
      2 import eveui
      3 from eve.client.script.ui import eveColor
      4 from eve.client.script.ui.shared.infoPanels.const.infoPanelTextureConst import PROGRESS_FILL_TEXTURE_PATH
      5 
      6 class InfoPanelProgressBar(eveui.Container):
      7     default_name = 'InfoPanelProgressBar'
      8     default_state = eveui.State.normal
      9     default_align = eveui.Align.to_top
     10     default_height = 28
     11     default_clipChildren = True
     12 
     13     def __init__(self, progress = None, **kwargs):
     14         super(InfoPanelProgressBar, self).__init__(**kwargs)
     15         self._layout()
     16         if progress is not None:
     17             self.set_progress(progress, snap_to_value=True)
     18 
     19     def set_progress(self, progress, snap_to_value = False, on_complete = None):
     20         if not progress:
     21             self.progress_fill.state = eveui.State.hidden
     22             return
     23         self.progress_fill.state = eveui.State.disabled
     24         if snap_to_value:
     25             self.progress_fill.width = progress
     26             if on_complete:
     27                 on_complete()
     28         else:
     29             eveui.animate(self.progress_fill, 'width', end_value=progress, duration=1, on_complete=on_complete)
     30 
     31     def OnMouseEnter(self, *args):
     32         eveui.fade(self._progress_bg_container, end_value=0.7, duration=0.1)
     33 
     34     def OnMouseExit(self, *args):
     35         eveui.fade(self._progress_bg_container, end_value=0.35, duration=0.2)
     36 
     37     def _layout(self):
     38         self.content_container = eveui.Container(parent=self, align=eveui.Align.to_all, padding=(6, 6, 12, 6), clipChildren=True)
     39         self._progress_fill_parent = fill_container = eveui.Container(name='fillContainer', parent=self, align=eveui.Align.to_all, clipChildren=True)
     40         self.progress_fill = eveui.StretchSpriteHorizontal(parent=fill_container, state=eveui.State.hidden, align=eveui.Align.to_left_prop, texturePath=PROGRESS_FILL_TEXTURE_PATH, color=eveColor.CRYO_BLUE, leftEdgeSize=2, rightEdgeSize=10, padLeft=-2, padRight=-10, width=0, opacity=0.5)
     41         self._progress_bg_container = eveui.Fill(parent=self, state=eveui.State.disabled, align=eveui.Align.to_all, color=(0, 0, 0), opacity=0.35)