mirror of https://github.com/kivy/kivy.git
Merge pull request #4501 from KeyWeeUsr/recorder_stop
Add on_stop to recorder
This commit is contained in:
commit
1d2cdb588d
|
@ -112,6 +112,13 @@ class RecorderMotionEvent(MotionEvent):
|
|||
|
||||
class Recorder(EventDispatcher):
|
||||
'''Recorder class. Please check module documentation for more information.
|
||||
|
||||
:Events:
|
||||
`on_stop`:
|
||||
Fired when the playing stops.
|
||||
|
||||
.. versionchanged:: 1.9.2
|
||||
Event `on_stop` added.
|
||||
'''
|
||||
|
||||
window = ObjectProperty(None)
|
||||
|
@ -168,6 +175,8 @@ class Recorder(EventDispatcher):
|
|||
record_fd = ObjectProperty(None)
|
||||
record_time = NumericProperty(0.)
|
||||
|
||||
__events__ = ('on_stop',)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Recorder, self).__init__(**kwargs)
|
||||
if self.window is None:
|
||||
|
@ -262,10 +271,14 @@ class Recorder(EventDispatcher):
|
|||
(len(self.play_data), self.filename))
|
||||
EventLoop.add_input_provider(self)
|
||||
|
||||
def on_stop(self):
|
||||
pass
|
||||
|
||||
def update(self, dispatch_fn):
|
||||
if not self.play_data:
|
||||
Logger.info('Recorder: Playing finished.')
|
||||
self.play = False
|
||||
self.dispatch('on_stop')
|
||||
|
||||
dt = time() - self.play_time
|
||||
while self.play_data:
|
||||
|
|
Loading…
Reference in New Issue