locked.py (3007B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dynamicresources\client\ess\bracket\reserve_bank\locked.py 2 import signals 3 from carbonui import uiconst 4 from carbonui.control.button import Button 5 from carbonui.primitives.containerAutoSize import ContainerAutoSize 6 from carbonui.uianimations import animations 7 from dynamicresources.client import text 8 from dynamicresources.client.ess.bracket.label import Header 9 from dynamicresources.client.ess.bracket.reserve_bank.key_select import KeySelect 10 from dynamicresources.client.ess.bracket.state_machine import State, StateMachine, Transition 11 12 class Idle(State): 13 14 def __init__(self, panel): 15 super(Idle, self).__init__() 16 self._panel = panel 17 self._content = None 18 self._state_machine = StateMachine() 19 20 def enter(self): 21 self._state_machine.move_to(Initial(parent=self._panel.content, on_unlock=self._on_unlock)) 22 23 def exit(self): 24 self._state_machine.move_to(None) 25 self._panel.unfocus() 26 27 def close(self): 28 self._state_machine.close() 29 30 def _on_unlock(self): 31 self._panel.focus() 32 self._state_machine.move_to(KeySelect(parent=self._panel.content, on_cancel=self._on_cancel_key_select)) 33 34 def _on_cancel_key_select(self): 35 self._panel.unfocus() 36 self._state_machine.move_to(Initial(parent=self._panel.content, on_unlock=self._on_unlock)) 37 38 39 class Initial(State): 40 41 def __init__(self, parent, on_unlock = None): 42 super(Initial, self).__init__() 43 self._parent = parent 44 self._content = None 45 self._label = None 46 self._button = None 47 self.on_unlock = signals.Signal() 48 if on_unlock: 49 self.on_unlock.connect(on_unlock) 50 51 def enter(self): 52 self._content = ContainerAutoSize(parent=self._parent) 53 self._label = Header(parent=self._content, align=uiconst.TOPLEFT, text=text.title_reserve_bank()) 54 self._button = Button(parent=self._content, align=uiconst.TOPLEFT, top=30, label=text.action_unlock_reserve_bank(), func=self._unlock, args=()) 55 animations.FadeTo(self._content, duration=0.2) 56 57 def exit(self): 58 animations.FadeOut(self._button, duration=0.15) 59 transition = Exit(self._content, self._label) 60 self._content = None 61 return transition 62 63 def close(self): 64 if self._content: 65 self._content.Close() 66 67 def _unlock(self): 68 self._button.Disable() 69 self.on_unlock() 70 71 72 class Exit(Transition): 73 74 def __init__(self, content, label): 75 super(Exit, self).__init__() 76 self._content = content 77 self._label = label 78 79 def animation(self): 80 animations.FadeOut(self._label, duration=0.15) 81 animations.MorphScalar(self._label, 'top', startVal=self._label.top, endVal=-10, duration=0.15) 82 self.sleep(0.15) 83 84 def close(self): 85 self._content.Close() 86 87 88 from dynamicresources.client.ess.bracket.debug import __reload_update__