ソースを参照

Whoa bub! you don't have to yell.

Case insensitive commands
Jezra 11年前
コミット
abd0eacddb
1個のファイルの変更5行の追加4行の削除
  1. 5
    4
      Blather.py

+ 5
- 4
Blather.py ファイルの表示

@@ -51,16 +51,17 @@ class Blather:
51 51
 						#this is a parsible line
52 52
 						(key,value) = line.split(":",1)
53 53
 						print key, value
54
-						self.commands[key.strip()] = value.strip()
54
+						self.commands[key.strip().lower()] = value.strip()
55 55
 						strings.write( key.strip()+"\n")
56 56
 		#close the strings file
57 57
 		strings.close()
58 58
 	
59 59
 	
60 60
 	def recognizer_finished(self, recognizer, text):
61
+		t = text.lower()
61 62
 		#is there a matching command?
62
-		if self.commands.has_key( text ):
63
-			cmd = self.commands[text]
63
+		if self.commands.has_key( t ):
64
+			cmd = self.commands[t]
64 65
 			print cmd
65 66
 			subprocess.call(cmd, shell=True)
66 67
 		else:
@@ -71,7 +72,7 @@ class Blather:
71 72
 				#stop listening
72 73
 				self.recognizer.pause()
73 74
 			#let the UI know that there is a finish
74
-			self.ui.finished(text)
75
+			self.ui.finished(t)
75 76
 	
76 77
 	def run(self):
77 78
 		if self.ui:

読み込み中…
キャンセル
保存