<s> '''<STR_LIT>''' <EOL> __all__ = ( '<STR_LIT:start>' , '<STR_LIT>' ) <EOL> from kivy . logger import Logger <EOL> from functools import partial <EOL> def replay ( recorder , * args ) : <EOL> if recorder . play : <EOL> return <EOL> else : <EOL> recorder . play = True <EOL> def on_recorder_key ( recorder , window , key , * largs ) : <EOL> if key == <NUM_LIT> : <EOL> if recorder . play : <EOL> Logger . error ( '<STR_LIT>' ) <EOL> return <EOL> recorder . record = not recorder . record <EOL> elif key == <NUM_LIT> : <EOL> if recorder . record : <EOL> Logger . error ( '<STR_LIT>' ) <EOL> return <EOL> recorder . play = not recorder . play <EOL> elif key == <NUM_LIT> : <EOL> if recorder . play : <EOL> recorder . unbind ( play = replay ) <EOL> else : <EOL> recorder . bind ( play = replay ) <EOL> recorder . play = True <EOL> def start ( win , ctx ) : <EOL> keys = { } <EOL> value = ctx . config . get ( '<STR_LIT>' , None ) <EOL> if value is not None : <EOL> keys [ '<STR_LIT>' ] = value . split ( '<STR_LIT::>' ) <EOL> value = ctx . config . get ( '<STR_LIT>' , None ) <EOL> if value is not None : <EOL> keys [ '<STR_LIT>' ] = value . split ( '<STR_LIT::>' ) <EOL> value = ctx . config . get ( '<STR_LIT:filename>' , None ) <EOL> if value is not None : <EOL> keys [ '<STR_LIT:filename>' ] = value <EOL> from kivy . input . recorder import Recorder <EOL> ctx . recorder = Recorder ( window = win , ** keys ) <EOL> win . bind ( on_key_down = partial ( on_recorder_key , ctx . recorder ) ) <EOL> def stop ( win , ctx ) : <EOL> if hasattr ( ctx , '<STR_LIT>' ) : <EOL> ctx . recorder . release ( ) </s>
