[orca] More work on bgo 608149 - Orca's caret navigation for Firefox is broken effective the 30th Sept buil



commit 75dd8d637430e6184a33fe6b06d49179941bd406
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sat Feb 13 15:21:15 2010 -0500

    More work on bgo 608149 - Orca's caret navigation for Firefox is broken effective the 30th Sept build of FF 3.6
    
    This gives yelp a separate grabFocusOnAncestor setting because we cannot count on the versions of Gecko being the same between these apps.

 configure.in                                      |    1 +
 src/orca/scripts/apps/Makefile.am                 |    6 +-
 src/orca/scripts/apps/yelp/Makefile.am            |    9 ++++
 src/orca/scripts/apps/yelp/__init__.py            |   29 +++++++++++++
 src/orca/scripts/apps/{yelp.py => yelp/script.py} |   46 ++++++++++++++++++++-
 src/orca/scripts/apps/yelp/script_settings.py     |   29 +++++++++++++
 6 files changed, 115 insertions(+), 5 deletions(-)
---
diff --git a/configure.in b/configure.in
index 1f42476..df9dcc2 100644
--- a/configure.in
+++ b/configure.in
@@ -86,6 +86,7 @@ src/orca/scripts/apps/Thunderbird/Makefile
 src/orca/scripts/apps/gedit/Makefile
 src/orca/scripts/apps/gnome-window-properties/Makefile
 src/orca/scripts/apps/Banshee/Makefile
+src/orca/scripts/apps/yelp/Makefile
 src/orca/scripts/toolkits/Makefile
 src/orca/scripts/toolkits/Gecko/Makefile
 src/orca/scripts/toolkits/J2SE-access-bridge/Makefile
diff --git a/src/orca/scripts/apps/Makefile.am b/src/orca/scripts/apps/Makefile.am
index 973766d..cbf7ad3 100644
--- a/src/orca/scripts/apps/Makefile.am
+++ b/src/orca/scripts/apps/Makefile.am
@@ -9,7 +9,8 @@ SUBDIRS = \
 	Thunderbird \
 	gedit \
 	gnome-window-properties \
-	Banshee
+	Banshee \
+	yelp
 
 orca_pathdir=$(pyexecdir)
 
@@ -33,8 +34,7 @@ orca_python_PYTHON = \
 	Mozilla.py \
 	nautilus.py \
 	notification-daemon.py \
-	notify-osd.py \
-	yelp.py
+	notify-osd.py
 
 orca_pythondir=$(pyexecdir)/orca/scripts/apps
 
diff --git a/src/orca/scripts/apps/yelp/Makefile.am b/src/orca/scripts/apps/yelp/Makefile.am
new file mode 100644
index 0000000..d748393
--- /dev/null
+++ b/src/orca/scripts/apps/yelp/Makefile.am
@@ -0,0 +1,9 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+	__init__.py \
+	script.py \
+	script_settings.py
+
+orca_pythondir=$(pyexecdir)/orca/scripts/apps/yelp
+
diff --git a/src/orca/scripts/apps/yelp/__init__.py b/src/orca/scripts/apps/yelp/__init__.py
new file mode 100644
index 0000000..bcf92c0
--- /dev/null
+++ b/src/orca/scripts/apps/yelp/__init__.py
@@ -0,0 +1,29 @@
+# Orca
+#
+# Copyright 2005-2010 Sun Microsystems Inc.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston MA
+# 02110-1301 USA
+
+""" Custom script for Yelp.
+"""
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2005-2010 Sun Microsystems Inc."
+__license__   = "LGPL"
+
+from script import Script
diff --git a/src/orca/scripts/apps/yelp.py b/src/orca/scripts/apps/yelp/script.py
similarity index 84%
rename from src/orca/scripts/apps/yelp.py
rename to src/orca/scripts/apps/yelp/script.py
index 77a1f85..ae94981 100644
--- a/src/orca/scripts/apps/yelp.py
+++ b/src/orca/scripts/apps/yelp/script.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2005-2008 Sun Microsystems Inc.
+# Copyright 2005-2010 Sun Microsystems Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -22,9 +22,10 @@
 __id__        = "$Id$"
 __version__   = "$Revision$"
 __date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
+__copyright__ = "Copyright (c) 2005-2010 Sun Microsystems Inc."
 __license__   = "LGPL"
 
+import gtk
 import pyatspi
 
 import orca.orca as orca
@@ -34,6 +35,8 @@ import orca.speech as speech
 
 import orca.scripts.toolkits.Gecko as Gecko
 
+import script_settings
+
 class Script(Gecko.Script):
 
     def __init__(self, app):
@@ -58,6 +61,40 @@ class Script(Gecko.Script):
         #
         self._lastFindContext = [None, -1]
 
+    def getAppPreferencesGUI(self):
+        """Return a GtkVBox contain the application unique configuration
+        GUI items for the current application.
+        """
+
+        vbox = Gecko.Script.getAppPreferencesGUI(self)
+
+        # We need to maintain a separate setting for grabFocusOnAncestor
+        # because the version of Gecko used by Yelp might be different
+        # from that used by Firefox. See bug 608149.
+        #
+        gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
+                                    script_settings.grabFocusOnAncestor)
+
+        return vbox
+
+    def setAppPreferences(self, prefs):
+        """Write out the application specific preferences lines and set the
+        new values.
+
+        Arguments:
+        - prefs: file handle for application preferences.
+        """
+
+        Gecko.Script.setAppPreferences(self, prefs)
+
+        # Write the Yelp specific settings.
+        #
+        prefix = "orca.scripts.apps.yelp.script_settings"
+
+        value = self.grabFocusOnAncestorCheckButton.get_active()
+        prefs.writelines("%s.grabFocusOnAncestor = %s\n" % (prefix, value))
+        script_settings.grabFocusOnAncestor = value
+
     def inFindToolbar(self, obj=None):
         """Returns True if the given object is in the Find toolbar.
 
@@ -203,6 +240,11 @@ class Script(Gecko.Script):
             else:
                 self._currentFrameName = event.source.name
                 self.setCaretPosition(obj, characterOffset)
+                # Pylint thinks that obj is an instance of a list. It most
+                # certainly is not. Silly pylint.
+                #
+                # pylint: disable-msg=E1103
+                #
                 if obj.getState().contains(pyatspi.STATE_FOCUSED):
                     speech.speak(self.speechGenerator.generateSpeech(obj))
                 elif not Gecko.script_settings.sayAllOnLoad:
diff --git a/src/orca/scripts/apps/yelp/script_settings.py b/src/orca/scripts/apps/yelp/script_settings.py
new file mode 100644
index 0000000..75e7962
--- /dev/null
+++ b/src/orca/scripts/apps/yelp/script_settings.py
@@ -0,0 +1,29 @@
+# Orca
+#
+# Copyright 2005-2010 Sun Microsystems Inc.
+#
+# 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.
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2005-2010 Sun Microsystems Inc."
+__license__   = "LGPL"
+
+# Whether we should grab focus on a focusable ancestor when setting
+# the caret position. See bug 608149.
+#
+grabFocusOnAncestor = True



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