From 06c27a48bc3f52e15c15445d822e8a6f523ab98f Mon Sep 17 00:00:00 2001 From: tassaron Date: Thu, 13 Jul 2017 17:03:25 -0400 Subject: more error messages for blank components --- src/components/sound.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/components/sound.py') diff --git a/src/components/sound.py b/src/components/sound.py index 9c114a8..2ffb682 100644 --- a/src/components/sound.py +++ b/src/components/sound.py @@ -34,7 +34,16 @@ class Component(Component): pass def properties(self): - return ['static', 'audio'] + props = ['static', 'audio'] + if not os.path.exists(self.sound): + props.append('error') + return props + + def error(self): + if not self.sound: + return "No audio file selected." + if not os.path.exists(self.sound): + return "The audio file selected no longer exists!" def audio(self): return (self.sound, {}) -- cgit v1.2.3