Parcourir la source

Work towards Python 3 support

Clara Hobbs il y a 8 ans
Parent
révision
980c6c4c05
2 fichiers modifiés avec 4 ajouts et 4 suppressions
  1. 1
    1
      blather.py
  2. 3
    3
      gtkui.py

+ 1
- 1
blather.py Voir le fichier

180
     def recognizer_finished(self, recognizer, text):
180
     def recognizer_finished(self, recognizer, text):
181
         t = text.lower()
181
         t = text.lower()
182
         # Is there a matching command?
182
         # Is there a matching command?
183
-        if self.commands.has_key( t ):
183
+        if t in self.commands:
184
             # Run the valid_sentence_command if there is a valid sentence command
184
             # Run the valid_sentence_command if there is a valid sentence command
185
             if self.options['valid_sentence_command']:
185
             if self.options['valid_sentence_command']:
186
                 subprocess.call(self.options['valid_sentence_command'], shell=True)
186
                 subprocess.call(self.options['valid_sentence_command'], shell=True)

+ 3
- 3
gtkui.py Voir le fichier

13
         'command' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (GObject.TYPE_STRING,))
13
         'command' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (GObject.TYPE_STRING,))
14
     }
14
     }
15
 
15
 
16
-    def __init__(self,args, continuous):
16
+    def __init__(self, args, continuous):
17
         GObject.GObject.__init__(self)
17
         GObject.GObject.__init__(self)
18
         self.continuous = continuous
18
         self.continuous = continuous
19
         # Make a window
19
         # Make a window
33
         layout.add(self.ccheckbox)
33
         layout.add(self.ccheckbox)
34
 
34
 
35
         # Connect the buttons
35
         # Connect the buttons
36
-        self.lsbutton.connect("clicked",self.lsbutton_clicked)
37
-        self.ccheckbox.connect("clicked",self.ccheckbox_clicked)
36
+        self.lsbutton.connect("clicked", self.lsbutton_clicked)
37
+        self.ccheckbox.connect("clicked", self.ccheckbox_clicked)
38
 
38
 
39
         # Add a label to the UI to display the last command
39
         # Add a label to the UI to display the last command
40
         self.label = Gtk.Label()
40
         self.label = Gtk.Label()

Chargement…
Annuler
Enregistrer