|
@@ -73,6 +73,7 @@ class Kaylee:
|
73
|
73
|
for plugin in self.plugins:
|
74
|
74
|
self.recognizer.connect('finished', plugin.recognizer_finished)
|
75
|
75
|
plugin.connect('processed', self.plugin_processed)
|
|
76
|
+ self.recognizer.connect('finished', self.recognizer_finished)
|
76
|
77
|
|
77
|
78
|
def update_voice_commands_if_changed(self):
|
78
|
79
|
"""Use hashes to test if the voice commands have changed"""
|
|
@@ -127,6 +128,25 @@ class Kaylee:
|
127
|
128
|
with open(self.config.history_file, 'w') as hfile:
|
128
|
129
|
for line in self.history:
|
129
|
130
|
hfile.write(line + '\n')
|
|
131
|
+ self._stop_ui(text)
|
|
132
|
+
|
|
133
|
+ def recognizer_finished(self, recognizer, text):
|
|
134
|
+ # No loaded plugin wanted the text, so run the invalid_sentence_command
|
|
135
|
+ # if it's set
|
|
136
|
+ if self.options['invalid_sentence_command']:
|
|
137
|
+ subprocess.call(self.options['invalid_sentence_command'],
|
|
138
|
+ shell=True)
|
|
139
|
+ print("no matching command {0}".format(text))
|
|
140
|
+ self._stop_ui(text)
|
|
141
|
+
|
|
142
|
+ def _stop_ui(self, text):
|
|
143
|
+ # If there is a UI and we are not continuous listen
|
|
144
|
+ if self.ui:
|
|
145
|
+ if not self.continuous_listen:
|
|
146
|
+ # Stop listening
|
|
147
|
+ self.recognizer.pause()
|
|
148
|
+ # Let the UI know that there is a finish
|
|
149
|
+ self.ui.finished(text)
|
130
|
150
|
|
131
|
151
|
def run(self):
|
132
|
152
|
if self.ui:
|