[orca/570658] Move some strings to settings.py; move some speech_generator.py methods to generator.py



commit 018454e94e47a22e0c3b83dee16fc79b29cfaf92
Author: Willie Walker <william walker sun com>
Date:   Tue Jun 23 19:24:44 2009 -0400

    Move some strings to settings.py; move some speech_generator.py methods to generator.py
    
    This is in preparation for the braille refactor

 src/orca/formatting.py       |   39 ++++++++-
 src/orca/generator.py        |  191 ++++++++++++++++++++++++++++++++++++++++
 src/orca/settings.py         |  131 ++++++++++++++++++++--------
 src/orca/speech_generator.py |  198 ++----------------------------------------
 4 files changed, 328 insertions(+), 231 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 95eb798..4ba9ec3 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -29,12 +29,37 @@ import copy
 
 import pyatspi
 
+import settings
+
 # pylint: disable-msg=C0301
 
 TUTORIAL = '(tutorial and (pause + tutorial) or [])'
 MNEMONIC = '(mnemonic and (pause + mnemonic + lineBreak) or [])'
 
 formatting = {
+    'strings' : {
+        'speech' : {
+            'required'     : settings.speechRequiredStateString,
+            'readonly'     : settings.speechReadOnlyString,
+            'insensitive'  : settings.speechInsensitiveString,
+            'checkbox'     : settings.speechCheckboxIndicators,
+            'radiobutton'  : settings.speechRadioButtonIndicators,
+            'togglebutton' : settings.speechToggleButtonIndicators,
+            'expansion'    : settings.speechExpansionIndicators,
+            'multiselect'  : settings.speechMultiSelectString,
+        },
+        'braille' : {
+            'eol'          : settings.brailleEOLIndicator,
+            'required'     : settings.brailleRequiredStateString,
+            'readonly'     : settings.brailleReadOnlyString,
+            'insensitive'  : settings.brailleInsensitiveString,
+            'checkbox'     : settings.brailleCheckBoxIndicators,
+            'radiobutton'  : settings.brailleRadioButtonIndicators,
+            'togglebutton' : settings.brailleToggleButtonIndicators,
+            'expansion'    : settings.brailleExpansionIndicators,
+        },
+    },
+
     'speech': {
         'prefix': {
             'focused': '[]',
@@ -298,9 +323,19 @@ class Formatting(dict):
         suffix = self[args['mode']]['suffix'][args['formatType']]
         return suffix
 
+    def getString(self, **args):
+        """Gets a human consumable string for a specific value
+        (e.g., an indicator for a checkbox state).
+
+        Arguments expected in args:
+        - mode: output mode, such as 'speech', 'braille'.
+        - stringType: the type of the string to get (see the dictionary above).
+        """
+        return self['strings'][args['mode']][args['stringType']]
+
     def getFormat(self, **args):
-        """Get a formatting string for the given mode and
-        formatType.
+        """Get a formatting string for the given mode and formatType for a
+        role (e.g., a where am I string for a text object).
 
         Arguments expected in args:
         - mode: output mode, such as 'speech', 'braille'.
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 561a6b5..164b7ad 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -30,6 +30,7 @@ import traceback
 
 import debug
 import pyatspi
+import settings
 
 def _formatExceptionInfo(maxTBlevel=5):
     cla, exc, trbk = sys.exc_info()
@@ -241,3 +242,193 @@ class Generator:
                       "generate %s generated '%s'" % (self._mode, repr(result)))
 
         return result
+
+    #####################################################################
+    #                                                                   #
+    # Name, role, and label information                                 #
+    #                                                                   #
+    #####################################################################
+
+    def _generateLabel(self, obj, **args):
+        """Returns the label for an object as an array of strings for use by
+        speech and braille.  The label is determined by the
+        getDisplayedLabel of the script, and an empty array will be
+        returned if no label can be found.
+        """
+        result = []
+        label = self._script.getDisplayedLabel(obj)
+        if label:
+            result.append(label)
+        return result
+
+    #####################################################################
+    #                                                                   #
+    # State information                                                 #
+    #                                                                   #
+    #####################################################################
+
+    def _generateAvailability(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the grayed/sensitivity/availability state of the
+        object, but only if it is insensitive (i.e., grayed out and
+        inactive).  Otherwise, and empty array will be returned.
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'insensitive'
+        if not obj.getState().contains(pyatspi.STATE_SENSITIVE):
+            result.append(self._script.formatting.getString(**args))
+        return result
+
+    def _generateRequired(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the required state of the object, but only if it is
+        required (i.e., it is in a dialog requesting input and the
+        user must give it a value).  Otherwise, and empty array will
+        be returned.
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'required'
+        if obj.getState().contains(pyatspi.STATE_REQUIRED) \
+           or (obj.getRole() == pyatspi.ROLE_RADIO_BUTTON \
+               and obj.parent.getState().contains(pyatspi.STATE_REQUIRED)):
+            result.append(self._script.formatting.getString(**args))
+        return result
+
+    def _generateReadOnly(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the read only state of this object, but only if it
+        is read only (i.e., it is a text area that cannot be edited).
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'readonly'
+        if settings.presentReadOnlyText \
+           and self._script.isReadOnlyTextArea(obj):
+            result.append(self._script.formatting.getString(**args))
+        return result
+
+    def _generateCheckedState(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the checked state of the object.  This is typically
+        for check boxes. [[[WDW - should we return an empty array if
+        we can guarantee we know this thing is not checkable?]]]
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'checkbox'
+        [no, yes, indeterminate] = self._script.formatting.getString(**args)
+        state = obj.getState()
+        if state.contains(pyatspi.STATE_INDETERMINATE):
+            result.append(indeterminate)
+        elif state.contains(pyatspi.STATE_CHECKED):
+            result.append(yes)
+        else:
+            result.append(no)
+        return result
+
+    def _generateRadioState(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the checked state of the object.  This is typically
+        for check boxes. [[[WDW - should we return an empty array if
+        we can guarantee we know this thing is not checkable?]]]
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'radiobutton'
+        [no, yes] = self._script.formatting.getString(**args)
+        state = obj.getState()
+        if state.contains(pyatspi.STATE_CHECKED):
+            result.append(yes)
+        else:
+            result.append(no)
+        return result
+
+    def _generateToggleState(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the checked state of the object.  This is typically
+        for check boxes. [[[WDW - should we return an empty array if
+        we can guarantee we know this thing is not checkable?]]]
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'togglebutton'
+        [no, yes] = self._script.formatting.getString(**args)
+        state = obj.getState()
+        if state.contains(pyatspi.STATE_CHECKED) \
+           or state.contains(pyatspi.STATE_PRESSED):
+            result.append(yes)
+        else:
+            result.append(no)
+        return result
+
+    def _generateMenuItemCheckedState(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the checked state of the menu item, only if it is
+        checked. Otherwise, and empty array will be returned.
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'checkbox'
+        [no, yes, indeterminate] = self._script.formatting.getString(**args)
+        if obj.getState().contains(pyatspi.STATE_CHECKED):
+            # Translators: this represents the state of a checked menu item.
+            #
+            result.append(yes)
+        return result
+
+    def _generateExpandableState(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represent the expanded/collapsed state of an object, such as a
+        tree node. If the object is not expandable, an empty array
+        will be returned.
+        """
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'expansion'
+        [no, yes] = self._script.formatting.getString(**args)
+        state = obj.getState()
+        if state.contains(pyatspi.STATE_EXPANDABLE):
+            if state.contains(pyatspi.STATE_EXPANDED):
+                result.append(yes)
+            else:
+                result.append(no)
+        return result
+
+    #####################################################################
+    #                                                                   #
+    # Text interface information                                        #
+    #                                                                   #
+    #####################################################################
+
+    def _generateDisplayedText(self, obj, **args ):
+        """Returns an array of strings for use by speech and braille that
+        represents all the text being displayed by the object. [[[WDW
+        - consider returning an empty array if this is not a text
+        object.]]]
+        """
+        return [self._script.getDisplayedText(obj)]
+
+    #####################################################################
+    #                                                                   #
+    # Value interface information                                       #
+    #                                                                   #
+    #####################################################################
+
+    def _generateValue(self, obj, **args):
+        """Returns an array of strings for use by speech and braille that
+        represents the value of the object.  This is typically the
+        numerical value, but may also be the text of the 'value'
+        attribute if it exists on the object.  [[[WDW - we should
+        consider returning an empty array if there is no value.
+        """
+        return [self._script.getTextForValue(obj)]
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 6ab25df..38755f2 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2004-2008 Sun Microsystems Inc.
+# Copyright 2004-2009 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
@@ -24,7 +24,7 @@ case of gdm) or doesn't have the specified attribute."""
 __id__        = "$Id$"
 __version__   = "$Revision$"
 __date__      = "$Date$"
-__copyright__ = "Copyright (c) 2004-2008 Sun Microsystems Inc."
+__copyright__ = "Copyright (c) 2004-2009 Sun Microsystems Inc."
 __license__   = "LGPL"
 
 import os
@@ -303,7 +303,7 @@ if os.getenv("DBUS_SESSION_BUS_ADDRESS"):
 else:
     useDBus = False
 
-# Whether or not recording is enabled via the HTTP server. 
+# Whether or not recording is enabled via the HTTP server.
 #
 enableRemoteLogging     = False
 
@@ -359,16 +359,6 @@ enableBrailleGrouping   = False
 #
 enableBrailleMonitor    = False
 
-# string to indicate end of printed line for braille displays:
-#
-disableBrailleEOL = False
-brailleEOLIndicator = " $l"
-
-# Strings used to indicate checkbox/radio button states in braille:
-#
-brailleCheckBoxIndicators = ["< >", "<x>", "<->"]
-brailleRadioButtonIndicators = ["& y", "&=y"]
-
 # If True, enable magnification.
 #
 enableMagnifier                  = False
@@ -609,7 +599,7 @@ keyboardLayout                  = GENERAL_KEYBOARD_LAYOUT_DESKTOP
 #
 outlineColor = [ 0xFFFF, 0x0000, 0x0000 ]
 
-# Thickness in pixels of the outline around the the current item in flat 
+# Thickness in pixels of the outline around the the current item in flat
 # review mode.
 #
 outlineThickness = 4
@@ -653,17 +643,6 @@ progressBarUpdateInterval = 10
 #
 presentReadOnlyText = True
 
-# Translators: this is used to indicate the user is in a text
-# area that is not editable.  It is meant to be spoken to the user.
-#
-speechReadOnlyString = C_("text", "read only")
-
-# Translators: this is used to indicate the user is in a text
-# area that is not editable.  It is meant to be a short abbreviation
-# to be presented on the braille display.
-#
-brailleReadOnlyString = C_("text", "rdonly")
-
 # The complete list of possible text attributes.
 #
 allTextAttributes = \
@@ -875,7 +854,7 @@ def setAccessibilityEnabled(enable):
     except:
         return False
 
-# Obtain/set information regarding whether Orca is autostarted for this 
+# Obtain/set information regarding whether Orca is autostarted for this
 # user at login time.
 #
 def isOrcaAutostarted():
@@ -943,7 +922,7 @@ settingsPackages          = ["app-settings"]
 # REMEMBER: to make something a package, the directory has to
 # have a __init__.py file in it.
 #
-scriptPackages          = ["orca-scripts", "scripts", 
+scriptPackages          = ["orca-scripts", "scripts",
                            "scripts.apps", "scripts.toolkits"]
 
 # A list that helps us map application names to script module
@@ -1092,7 +1071,7 @@ setScriptMapping(re.compile('gnome-help'), "yelp")
 #
 deprecatedMessages = False
 
-# Focus history length. We keep a reference to past focused accessibles to 
+# Focus history length. We keep a reference to past focused accessibles to
 # maximize on caching.
 #
 focusHistoryLength = 5
@@ -1106,22 +1085,22 @@ listenAllEvents = False
 #
 ignoredEventsList = ['object:bounds-changed']
 
-# Listen to Live Region events.  Tells Gecko.onChildrenChanged() and 
+# Listen to Live Region events.  Tells Gecko.onChildrenChanged() and
 # onTextInserted() event handlers to monitor these events for live region
-# changes.  
+# changes.
 #
 inferLiveRegions = True
 
 # Contracted braille support.
-# 
+#
 enableContractedBraille = False
 
 # Contracted braille table.
-# 
+#
 brailleContractionTable = ''
 
 # Use Collection Interface?
-# 
+#
 useCollection = True
 
 # Whether or not to speak the cell's coordinates when navigating
@@ -1156,13 +1135,13 @@ wrappedStructuralNavigation = True
 #
 enableMouseReview = False
 
-# Mouse dwell delay in milliseconds for mouse review mode. 
+# Mouse dwell delay in milliseconds for mouse review mode.
 # If the value is zero, the review will be read time.
 #
 mouseDwellDelay = 0
 
 # Maximum allowed drift while pointer is dwelling in mouse review mode.
-# 
+#
 mouseDwellMaxDrift = 3
 
 # The different modifiers/modifier masks associated with keybindings
@@ -1214,13 +1193,68 @@ defaultModifierMask = NON_LOCKING_MODIFIER_MASK
 #
 presentRequiredState = False
 
+########################################################################
+#                                                                      #
+# Strings for speech and braille                                       #
+#                                                                      #
+########################################################################
+
+# Translators: "blank" is a short word to mean the
+# user has navigated to an empty line.
+#
+speechBlankString = _("blank")
+
 # Translators: Certain objects (such as form controls on web pages)
 # can have STATE_REQUIRED set on them to inform the user that this
 # field must be filled out. This string is the default string which
 # will be spoken and displayed in braille to indicate this state is
 # present.
 #
-brailleRequiredStateString = _("required")
+speechRequiredStateString = _("required")
+
+# Translators: this is used to indicate the user is in a text
+# area that is not editable.  It is meant to be spoken to the user.
+#
+speechReadOnlyString = C_("text", "read only")
+
+# Translators: this represents an item on the screen that has
+# been set insensitive (or grayed out).
+#
+speechInsensitiveString = _("grayed")
+
+# Translators: this represents the state of a checkbox.  It is meant
+# to be spoken to the user.
+#
+speechCheckboxIndicators = [_("not checked"),
+                            _("checked"),
+                            _("partially checked")]
+
+# Translators: this represents the state of a radio button.  It is
+# meant to be spoken to the user.
+#
+speechRadioButtonIndicators = [C_("radiobutton", "not selected"),
+                               C_("radiobutton", "selected")]
+
+# Translators: this represents the state of a toggle button.  It is
+# meant to be spoken to the user.
+#
+speechToggleButtonIndicators = [_("not pressed"), _("pressed")]
+
+# Translators: this represents the state of a node in a tree.
+# 'expanded' means the children are showing.  'collapsed' means the
+# children are not showing.
+#
+speechExpansionIndicators = [_("collapsed"), _("expanded")]
+
+# Translators: "multi-select" refers to a web form list
+# in which more than one item can be selected at a time.
+#
+speechMultiSelectString = _("multi-select")
+
+# string to indicate end of printed line for braille displays:
+#
+disableBrailleEOL = False
+brailleEOLIndicator = " $l"
 
 # Translators: Certain objects (such as form controls on web pages)
 # can have STATE_REQUIRED set on them to inform the user that this
@@ -1228,4 +1262,27 @@ brailleRequiredStateString = _("required")
 # will be spoken and displayed in braille to indicate this state is
 # present.
 #
-speechRequiredStateString = _("required")
+brailleRequiredStateString = _("required")
+
+# Translators: this is used to indicate the user is in a text
+# area that is not editable.  It is meant to be a short abbreviation
+# to be presented on the braille display.
+#
+brailleReadOnlyString = C_("text", "rdonly")
+
+# Translators: this represents an item on the screen that has
+# been set insensitive (or grayed out).
+#
+brailleInsensitiveString = _("grayed")
+
+# Strings used to indicate checkbox/radio button states in braille:
+#
+brailleCheckBoxIndicators = ["< >", "<x>", "<->"]
+brailleRadioButtonIndicators = ["& y", "&=y"]
+brailleToggleButtonIndicators = ["& y", "&=y"]
+
+# Translators: this represents the state of a node in a tree.
+# 'expanded' means the children are showing.  'collapsed' means the
+# children are not showing.
+#
+brailleExpansionIndicators = [_("collapsed"), _("expanded")]
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 844a992..318f6da 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -17,9 +17,7 @@
 # Free Software Foundation, Inc., Franklin Street, Fifth Floor,
 # Boston MA  02110-1301 USA.
 
-"""Utilities for obtaining speech utterances for objects.  In general,
-there probably should be a singleton instance of the SpeechGenerator
-class."""
+"""Utilities for obtaining speech utterances for objects."""
 
 __id__        = "$Id:$"
 __version__   = "$Revision:$"
@@ -166,18 +164,6 @@ class SpeechGenerator(generator.Generator):
         """
         return self._generateRoleName(obj, **args)
 
-    def _generateLabel(self, obj, **args):
-        """Returns the label for an object as an array of strings (and
-        possibly voice and audio specifications).  The label is
-        determined by the getDisplayedLabel of the script, and an
-        empty array will be returned if no label can be found.
-        """
-        result = []
-        label = self._script.getDisplayedLabel(obj)
-        if label:
-            result = [label]
-        return result
-
     def _generateLabelAndName(self, obj, **args):
         """Returns the label and the name as an array of strings (and possibly
         voice and audio specifications).  The name will only be
@@ -239,37 +225,12 @@ class SpeechGenerator(generator.Generator):
     #                                                                   #
     #####################################################################
 
-    def _generateCheckedState(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the checked state of the
-        object.  This is typically for check boxes. [[[WDW - should we
-        return an empty array if we can guarantee we know this thing
-        is not checkable?]]]  [[[WDW - I wonder if we should put these
-        strings in settings.py.]]]
-        """
-        result = []
-        state = obj.getState()
-        if state.contains(pyatspi.STATE_INDETERMINATE):
-            # Translators: this represents the state of a checkbox.
-            #
-            result.append(_("partially checked"))
-        elif state.contains(pyatspi.STATE_CHECKED):
-            # Translators: this represents the state of a checkbox.
-            #
-            result.append(_("checked"))
-        else:
-            # Translators: this represents the state of a checkbox.
-            #
-            result.append(_("not checked"))
-        return result
-
     def _generateCellCheckedState(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) that represent the checked state of the
         object.  This is typically for check boxes that are in a
         table. An empty array will be returned if this is not a
-        checkable cell.  [[[WDW - I wonder if we can roll this into
-        _generateCheckedState somehow.]]]
+        checkable cell.
         """
         result = []
         try:
@@ -289,147 +250,20 @@ class SpeechGenerator(generator.Generator):
                     self._restoreRole(oldRole, args)
         return result
 
-    def _generateRadioState(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the checked state of the
-        object.  This is typically for check boxes. [[[WDW - should we
-        return an empty array if we can guarantee we know this thing
-        is not checkable?]]] [[[WDW - I wonder if we can roll this
-        into _generateCheckedState somehow and provide some sort of
-        settings.py string to let you specify the wording to be used
-        for different roles.]]]
-        """
-        result = []
-        state = obj.getState()
-        if state.contains(pyatspi.STATE_CHECKED):
-            # Translators: this is in reference to a radio button being
-            # selected or not.
-            #
-            result.append(C_("radiobutton", "selected"))
-        else:
-            # Translators: this is in reference to a radio button being
-            # selected or not.
-            #
-            result.append(C_("radiobutton", "not selected"))
-        return result
-
-    def _generateToggleState(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the checked state of the
-        object.  This is typically for check boxes. [[[WDW - should we
-        return an empty array if we can guarantee we know this thing
-        is not checkable?]]] [[[WDW - I wonder if we can roll this
-        into _generateCheckedState somehow and provide some sort of
-        settings.py string to let you specify the wording to be used
-        for different roles.]]]
-        """
-        result = []
-        state = obj.getState()
-        if state.contains(pyatspi.STATE_CHECKED) \
-           or state.contains(pyatspi.STATE_PRESSED):
-            # Translators: the state of a toggle button.
-            #
-            result.append(_("pressed"))
-        else:
-            # Translators: the state of a toggle button.
-            #
-            result.append(_("not pressed"))
-        return result
-
-    def _generateExpandableState(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the expanded/collapsed state of
-        an object, such as a tree node. If the object is not
-        expandable, an empty array will be returned.  [[[WDW - I
-        wonder if these strings should be placed in settings.py.]]]
-        """
-        result = []
-        state = obj.getState()
-        if state.contains(pyatspi.STATE_EXPANDABLE):
-            if state.contains(pyatspi.STATE_EXPANDED):
-                # Translators: this represents the state of a node in a tree.
-                # 'expanded' means the children are showing.
-                # 'collapsed' means the children are not showing.
-                #
-                result.append(_("expanded"))
-            else:
-                # Translators: this represents the state of a node in a tree.
-                # 'expanded' means the children are showing.
-                # 'collapsed' means the children are not showing.
-                #
-                result.append(_("collapsed"))
-        return result
-
     def _generateMultiselectableState(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) that represent the multiselectable state of
         the object.  This is typically for check boxes. If the object
         is not multiselectable, an empty array will be returned.
-        [[[WDW - I wonder if this string should be placed in
-        settings.py.]]]
         """
         result = []
         if obj.getState().contains(pyatspi.STATE_MULTISELECTABLE):
             # Translators: "multi-select" refers to a web form list
             # in which more than one item can be selected at a time.
             #
-            result.append(_("multi-select"))
-        return result
-
-    def _generateMenuItemCheckedState(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the checked state of the menu
-        item, only if it is checked. Otherwise, and empty array will
-        be returned.  [[[WDW - I wonder if we can roll this into
-        _generateCheckedState somehow.]]]
-        """
-        result = []
-        if obj.getState().contains(pyatspi.STATE_CHECKED):
-            # Translators: this represents the state of a checked menu item.
-            #
-            result.append(_("checked"))
-        return result
-
-    def _generateAvailability(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the
-        grayed/sensitivity/availability state of the object, but only
-        if it is insensitive (i.e., grayed out and inactive).
-        Otherwise, and empty array will be returned.  [[[WDW - I
-        wonder if we should put this string into settings.py.]]]
-        """
-        result = []
-        if not obj.getState().contains(pyatspi.STATE_SENSITIVE):
-            # Translators: this represents an item on the screen that has
-            # been set insensitive (or grayed out).
-            #
-            result.append(_("grayed"))
-        return result
-
-    def _generateRequired(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the required state of the
-        object, but only if it is required (i.e., it is in a dialog
-        requesting input and the user must give it a value).
-        Otherwise, and empty array will be returned.
-        """
-        result = []
-        if obj.getState().contains(pyatspi.STATE_REQUIRED) \
-           or (obj.getRole() == pyatspi.ROLE_RADIO_BUTTON \
-               and obj.parent.getState().contains(pyatspi.STATE_REQUIRED)):
-            result = [settings.speechRequiredStateString]
-        return result
-
-    def _generateReadOnly(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represent the read only state of this
-        object, but only if it is read only (i.e., it is a text area
-        that cannot be edited).
-        """
-        result = []
-        if settings.presentReadOnlyText \
-           and self._script.isReadOnlyTextArea(obj):
-            result.append(settings.speechReadOnlyString)
+            result.append(self._script.formatting.getString(
+                mode='speech',
+                stringType='multiselect'))
         return result
 
     #####################################################################
@@ -884,8 +718,6 @@ class SpeechGenerator(generator.Generator):
         the code.  This method is used to return an array of strings
         (and possibly voice and audio specifications) for a single table
         cell itself.  The string, 'blank', is added for empty cells.
-        [[[WDW - I wonder if this string and whether it is used or not
-        should be put in settings.py.]]]
         """
         result = []
         oldRole = self._overrideRole('REAL_ROLE_TABLE_CELL', args)
@@ -896,7 +728,7 @@ class SpeechGenerator(generator.Generator):
             # Translators: "blank" is a short word to mean the
             # user has navigated to an empty line.
             #
-            result = [_("blank")]
+            result.append(_("blank"))
         return result
 
     def _generateTableCellRow(self, obj, **args):
@@ -1357,14 +1189,6 @@ class SpeechGenerator(generator.Generator):
         [text, caretOffset, startOffset] = self._script.getTextLineAtCaret(obj)
         return [text]
 
-    def _generateDisplayedText(self, obj, **args ):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represents all the text being displayed
-        by the object. [[[WDW - consider returning an empty array if
-        this is not a text object.]]]
-        """
-        return [self._script.getDisplayedText(obj)]
-
     def _generateAnyTextSelection(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) that says if any of the text for the entire
@@ -1460,16 +1284,6 @@ class SpeechGenerator(generator.Generator):
     #                                                                   #
     #####################################################################
 
-    def _generateValue(self, obj, **args):
-        """Returns an array of strings (and possibly voice and audio
-        specifications) that represents the value of the object.  This
-        is typically the numerical value, but may also be the text
-        of the 'value' attribute if it exists on the object.  [[[WDW -
-        we should consider returning an empty array if there is no
-        value.
-        """
-        return [self._script.getTextForValue(obj)]
-
     def _generatePercentage(self, obj, **args ):
         """Returns an array of strings (and possibly voice and audio
         specifications) that represents the percentage value of the



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