diff options
Diffstat (limited to 'las.py')
-rw-r--r-- | las.py | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -91,9 +91,11 @@ class Listenspell(): self.play_sound("correct") self.points = self.points + self.skill_level self.words_correct = self.words_correct + 1 + self.word_obj.update_score(wordid) def ans_incorrect(self, wordid): self.play_sound("incorrect") + self.word_obj.update_score(wordid, "incorrect") def clear_screen(self,numlines=100): """Clear the console. @@ -136,9 +138,14 @@ class Listenspell(): def say_text(self, text): if self.init == False: - bus = dbus.SessionBus() - self.espeak_object = bus.get_object('org.laptop.Speech','/org/laptop/Speech') - self.init = True + try: + bus = dbus.SessionBus() + self.espeak_object = bus.get_object('org.laptop.Speech','/org/laptop/Speech') + self.init = True + except dbus.exceptions.DBusException: + print "Speech Server not turned on." + return False + text = str(text) self.espeak_object.SayText(text) @@ -153,4 +160,4 @@ class Listenspell(): def exit_game(self): self.say_text("goodbye") - sys.exit()
\ No newline at end of file + sys.exit() |