From 108f858fcb8794b2d1c9ce75216458bd7e0a80f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 25 Jul 2016 11:30:32 +0200 Subject: [PATCH] Cleanup Machine use --- helpers/music_file.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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) -- 2.41.0