orca r3796 - in trunk: . src/orca/scripts



Author: richb
Date: Wed Apr  2 21:22:30 2008
New Revision: 3796
URL: http://svn.gnome.org/viewvc/orca?rev=3796&view=rev

Log:
        * src/orca/scripts/gaim.py:
          Fix for bug #525656 - Orca needs to handle the new Pidgin typing 
          status updates.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/gaim.py

Modified: trunk/src/orca/scripts/gaim.py
==============================================================================
--- trunk/src/orca/scripts/gaim.py	(original)
+++ trunk/src/orca/scripts/gaim.py	Wed Apr  2 21:22:30 2008
@@ -55,6 +55,10 @@
 #
 prefixChatMessage = False
 
+# Whether we announce when a buddy is typing.
+#
+announceBuddyTyping = False
+
 # Possible ways of how Orca should speak pidgin chat messages.
 #
 SPEAK_ALL_MESSAGES              = 0
@@ -386,6 +390,11 @@
                 _("Toggle whether we prefix chat room messages with " \
                   "the name of the chat room."))
 
+        self.inputEventHandlers["toggleBuddyTypingHandler"] = \
+            input_event.InputEventHandler(
+                Script.toggleBuddyTyping,
+                _("Toggle whether we announce when our buddies are typing."))
+
         # Add the chat room message history event handler.
         #
         self.inputEventHandlers["reviewMessage"] = \
@@ -455,6 +464,16 @@
         gtk.ToggleButton.set_active(self.speakNameCheckButton,
                                     prefixChatMessage)
 
+        # Translators: If this checkbox is checked, then Orca will tell
+        # you when one of your buddies is typing a message.
+        #
+        label = _("Announce when your _buddies are typing")
+        self.buddyTypingCheckButton = gtk.CheckButton(label)
+        gtk.Widget.show(self.buddyTypingCheckButton)
+        gtk.Box.pack_start(vbox, self.buddyTypingCheckButton, False, False, 0)
+        gtk.ToggleButton.set_active(self.buddyTypingCheckButton,
+                                    announceBuddyTyping)
+
         # "Speak Messages" frame.
         #
         messagesFrame = gtk.Frame()
@@ -526,13 +545,17 @@
         - prefs: file handle for application preferences.
         """
 
-        global prefixChatMessage, speakMessages
+        global announceBuddyTyping, prefixChatMessage, speakMessages
 
         prefixChatMessage = self.speakNameCheckButton.get_active()
         prefs.writelines("\n")
         prefs.writelines("orca.scripts.gaim.prefixChatMessage = %s\n" % \
                          prefixChatMessage)
 
+        announceBuddyTyping = self.buddyTypingCheckButton.get_active()
+        prefs.writelines("orca.scripts.gaim.announceBuddyTyping = %s\n" % \
+                         announceBuddyTyping)
+
         if self.allMessagesRadioButton.get_active():
             speakMessages = SPEAK_ALL_MESSAGES
             option = "orca.scripts.gaim.SPEAK_ALL_MESSAGES"
@@ -590,6 +613,26 @@
 
         return True
 
+    def toggleBuddyTyping(self, inputEvent):
+        """ Toggle whether we announce when our buddies are typing a message.
+
+        Arguments:
+        - inputEvent: if not None, the input event that caused this action.
+        """
+
+        global prefixChatMessage
+
+        debug.println(self.debugLevel, "gaim.toggleBuddyTyping.")
+
+        line = _("announce when your buddies are typing.")
+        announceBuddyTyping = not announceBuddyTyping
+        if not announceBuddyTyping:
+            line = _("Do not announce when your buddies are typing.")
+
+        speech.speak(line)
+
+        return True
+
     def utterMessage(self, chatRoomName, message, hasFocus=True):
         """ Speak/braille a chat room message.
 
@@ -757,6 +800,13 @@
             if message and message[0] == "\n":
                 message = message[1:]
 
+            # If the user doesn't want announcements for when their buddies
+            # are typing, and this is such a message, then just return.
+            #
+            if not announceBuddyTyping and \
+               message.endswith(_(" is typing...")):
+                return
+
             chatRoomName = self.getDisplayedText(chatRoomTab)
 
             # If the new message came from the room with focus, we don't



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]