[orca/570658-whereami] Continued work on the whereAmI refactor.



commit 2243ceeb649eb1fa90a69f48248221ef60b36b4f
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Fri Jun 5 11:44:25 2009 -0400

    Continued work on the whereAmI refactor.
    
    1. Deleted the gcalctool where_am_i.py. We are reading the
       status bar correctly now.
    2. Modified _getDescription in speech_generator.py to
       use the script's getDisplayedLabel rather than _getLabel.
    3. Moved the formatting string for links out of the Gecko
       formatting.py.
---
 src/orca/formatting.py                        |    4 ++
 src/orca/scripts/apps/gcalctool/Makefile.am   |    3 +-
 src/orca/scripts/apps/gcalctool/where_am_i.py |   49 -------------------------
 src/orca/scripts/toolkits/Gecko/formatting.py |    4 --
 src/orca/speech_generator.py                  |   14 +-------
 5 files changed, 6 insertions(+), 68 deletions(-)

diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index bebeea9..3f0d631 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -100,6 +100,10 @@ formatting = {
             'basicWhereAmI': 'labelAndName + roleName + selectedItemCount',
             'detailedWhereAmI': 'labelAndName + roleName + selectedItemCount + selectedItems'
             },
+        pyatspi.ROLE_LINK: {
+            'unfocused': 'labelAndName + roleName + availability',
+            'basicWhereAmI': 'linkInfo + siteDescription + fileSize'
+            },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState + availability',
             'unfocused': 'labelAndName + allTextSelection + expandableState + availability',
diff --git a/src/orca/scripts/apps/gcalctool/Makefile.am b/src/orca/scripts/apps/gcalctool/Makefile.am
index 26dc31a..02dbea3 100644
--- a/src/orca/scripts/apps/gcalctool/Makefile.am
+++ b/src/orca/scripts/apps/gcalctool/Makefile.am
@@ -3,8 +3,7 @@ orca_pathdir=$(pyexecdir)
 orca_python_PYTHON = \
 	__init__.py \
 	script.py \
-	speech_generator.py \
-	where_am_i.py
+	speech_generator.py
 
 orca_pythondir=$(pyexecdir)/orca/scripts/apps/gcalctool
 
diff --git a/src/orca/scripts/apps/gcalctool/where_am_i.py b/src/orca/scripts/apps/gcalctool/where_am_i.py
deleted file mode 100644
index 45bbfb9..0000000
--- a/src/orca/scripts/apps/gcalctool/where_am_i.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Orca
-#
-# Copyright 2004-2008 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.
-
-"""Provides a custom script for gcalctool."""
-
-__id__        = "$Id$"
-__version__   = "$Revision$"
-__date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
-__license__   = "LGPL"
-
-import orca.speech as speech
-import orca.where_am_I as where_am_I
-
-class WhereAmI(where_am_I.WhereAmI):
-
-    def __init__(self, script):
-        """Create a new WhereAmI that will be used to speak information
-        about the current object of interest.
-        """
-
-        where_am_I.WhereAmI.__init__(self, script)
-
-    def _speakStatusBar(self):
-        """Speaks the status bar."""
-
-        if not self._statusBar:
-            return
-
-        utterances = []
-        text = self.getObjLabelAndName(self._statusBar)
-        utterances.append(text)
-        speech.speak(utterances)
diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index c0a5c9f..c02b0cf 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -44,10 +44,6 @@ formatting = {
         pyatspi.ROLE_DOCUMENT_FRAME: {
             'unfocused': 'name + roleName'
             },
-        pyatspi.ROLE_LINK: {
-            'unfocused': 'labelAndName + roleName + availability',
-            'basicWhereAmI': 'linkInfo + siteDescription + fileSize'
-            },
         pyatspi.ROLE_LIST: {
             'focused': 'focusedItem',
             'unfocused': 'labelOrName + focusedItem + multiselectableState + numberOfChildren'
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 994550e..20c12a0 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -185,11 +185,7 @@ class SpeechGenerator:
         label.
         """
         result = []
-        try:
-            label = self._getLabel(obj)[0]
-            print label
-        except:
-            label = ""
+        label = self._script.getDisplayedLabel(obj)
         if obj.description and not obj.description in [obj.name, label]:
             result.append(obj.description)
         return result
@@ -507,14 +503,6 @@ class SpeechGenerator:
     #                                                                   #
     #####################################################################
 
-    # [[[TODO/Question - JD for WDW: In the original whereAmI code,
-    # link handling was done in the main class; not in Gecko. In
-    # addition, there are other applications which have links which
-    # we want to handle. Yet, in the first part of the refactor,
-    # pyatspi.ROLE_LINK was placed in the Gecko formatting.py only.
-    # Why? For now, I'm leaving that as it is, but putting all of
-    # the link methods here.
-    #
     def _getLinkInfo(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) that represent the protocol of the URI of



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