[orca] More work on bgo#589925 Adding support for Empathy.



commit 71b8c9ac3b1532b79eaf85dece629bc6ff390842
Author: Joanmarie <joanmarie diggs gmail com>
Date:   Sun Apr 11 11:04:28 2010 -0400

    More work on bgo#589925 Adding support for Empathy.
    
    Note that this is still a work in progress.

 configure.in                              |    1 +
 src/orca/chat.py                          |    6 +-
 src/orca/scripts/apps/Makefile.am         |    1 +
 src/orca/scripts/apps/empathy/Makefile.am |    8 +++
 src/orca/scripts/apps/empathy/__init__.py |   20 ++++++
 src/orca/scripts/apps/empathy/script.py   |   98 +++++++++++++++++++++++++++++
 6 files changed, 132 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index 9265f14..f775675 100644
--- a/configure.in
+++ b/configure.in
@@ -76,6 +76,7 @@ src/orca/Makefile
 src/orca/scripts/Makefile
 src/orca/scripts/apps/Makefile
 src/orca/scripts/apps/soffice/Makefile
+src/orca/scripts/apps/empathy/Makefile
 src/orca/scripts/apps/evolution/Makefile
 src/orca/scripts/apps/gcalctool/Makefile
 src/orca/scripts/apps/packagemanager/Makefile
diff --git a/src/orca/chat.py b/src/orca/chat.py
index 06f80cc..abef254 100644
--- a/src/orca/chat.py
+++ b/src/orca/chat.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2005-2009 Sun Microsystems Inc.
+# Copyright 2010 Joanmarie Diggs.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -22,7 +22,7 @@
 __id__ = "$Id$"
 __version__   = "$Revision$"
 __date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
+__copyright__ = "Copyright (c) 2010 Joanmarie Diggs."
 __license__   = "LGPL"
 
 import pyatspi
@@ -732,6 +732,8 @@ class Chat:
                 speech.speak(text)
             return True
 
+        return False
+
     def presentTypingStatusChange(self, event, status):
         """Presents a change in typing status for the current conversation
         if the status has indeed changed and if the user wants to hear it.
diff --git a/src/orca/scripts/apps/Makefile.am b/src/orca/scripts/apps/Makefile.am
index cbf7ad3..917116b 100644
--- a/src/orca/scripts/apps/Makefile.am
+++ b/src/orca/scripts/apps/Makefile.am
@@ -10,6 +10,7 @@ SUBDIRS = \
 	gedit \
 	gnome-window-properties \
 	Banshee \
+	empathy \
 	yelp
 
 orca_pathdir=$(pyexecdir)
diff --git a/src/orca/scripts/apps/empathy/Makefile.am b/src/orca/scripts/apps/empathy/Makefile.am
new file mode 100644
index 0000000..11f10fa
--- /dev/null
+++ b/src/orca/scripts/apps/empathy/Makefile.am
@@ -0,0 +1,8 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+	__init__.py \
+	script.py
+
+orca_pythondir=$(pyexecdir)/orca/scripts/apps/empathy
+
diff --git a/src/orca/scripts/apps/empathy/__init__.py b/src/orca/scripts/apps/empathy/__init__.py
new file mode 100644
index 0000000..c81df83
--- /dev/null
+++ b/src/orca/scripts/apps/empathy/__init__.py
@@ -0,0 +1,20 @@
+# Orca
+#
+# Copyright 2010 Joanmarie Diggs
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+from script import Script
diff --git a/src/orca/scripts/apps/empathy/script.py b/src/orca/scripts/apps/empathy/script.py
new file mode 100644
index 0000000..4bf4db7
--- /dev/null
+++ b/src/orca/scripts/apps/empathy/script.py
@@ -0,0 +1,98 @@
+# Orca
+#
+# Copyright 2010 Joanmarie Diggs.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""Custom script for Empathy."""
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2010 Joanmarie Diggs."
+__license__   = "LGPL"
+
+import orca.chat as chat
+import orca.default as default
+
+########################################################################
+#                                                                      #
+# The Empathy script class.                                            #
+#                                                                      #
+########################################################################
+
+class Script(default.Script):
+
+    def __init__(self, app):
+        """Creates a new script for the given application."""
+
+        default.Script.__init__(self, app)
+
+    def getChat(self):
+        """Returns the 'chat' class for this script."""
+
+        return chat.Chat(self, [])
+
+    def setupInputEventHandlers(self):
+        """Defines InputEventHandler fields for this script that can be
+        called by the key and braille bindings. Here we need to add the
+        handlers for chat functionality.
+        """
+
+        default.Script.setupInputEventHandlers(self)
+        self.inputEventHandlers.update(self.chat.inputEventHandlers)
+
+    def getKeyBindings(self):
+        """Defines the key bindings for this script. Here we need to add
+        the keybindings associated with chat functionality.
+
+        Returns an instance of keybindings.KeyBindings.
+        """
+
+        keyBindings = default.Script.getKeyBindings(self)
+
+        bindings = self.chat.keyBindings
+        for keyBinding in bindings.keyBindings:
+            keyBindings.add(keyBinding)
+
+        return keyBindings
+
+    def getAppPreferencesGUI(self):
+        """Return a GtkVBox contain the application unique configuration
+        GUI items for the current application. The chat-related options
+        get created by the chat module.
+        """
+
+        return self.chat.getAppPreferencesGUI()
+
+    def setAppPreferences(self, prefs):
+        """Write out the application specific preferences lines and set the
+        new values. The chat-related options get written out by the chat
+        module.
+
+        Arguments:
+        - prefs: file handle for application preferences.
+        """
+
+        self.chat.setAppPreferences(prefs)
+
+    def onTextInserted(self, event):
+        """Called whenever text is added to an object."""
+
+        if self.chat.presentInsertedText(event):
+            return
+
+        default.Script.onTextInserted(self, event)



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