From: Ismaƫl Bouya Date: Mon, 25 Jul 2016 09:30:32 +0000 (+0200) Subject: Cleanup Machine use X-Git-Tag: 1.0.0~28 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=108f858fcb8794b2d1c9ce75216458bd7e0a80f2;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git Cleanup Machine use --- diff --git a/helpers/music_file.py b/helpers/music_file.py index b0e218f..017fc59 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py @@ -14,7 +14,7 @@ from .music_effect import GainEffect file_lock = Lock("file") -class MusicFile(Machine): +class MusicFile: def __init__(self, filename, mapping, name=None, gain=1): states = [ 'initial', @@ -22,7 +22,13 @@ class MusicFile(Machine): 'failed', { 'name': 'loaded', - 'children': ['stopped', 'playing', 'paused', 'stopping'] + 'children': [ + 'stopped', + 'playing', + 'paused', + 'stopping', + 'stopped' + ] } ] transitions = [ @@ -69,7 +75,7 @@ class MusicFile(Machine): } ] - Machine.__init__(self, states=states, + Machine(model=self, states=states, transitions=transitions, initial='initial', ignore_invalid_triggers=True)