[orca/570658] Add formatting for ROLE_FRAME



commit 6ba7d3579626e6f95f9fb2b0aeb734f8b1426d4b
Author: Willie Walker <william walker sun com>
Date:   Thu Jun 25 10:56:54 2009 -0400

    Add formatting for ROLE_FRAME

 src/orca/braille.py           |    2 +-
 src/orca/braille_generator.py |   26 ++++++++++++++++++++++++++
 src/orca/formatting.py        |    5 ++++-
 3 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 7bd83a7..1e7f301 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -528,7 +528,7 @@ class Text(Region):
         """
 
         self.accessible = accessible
-        if orca_state.activeScript:
+        if orca_state.activeScript and self.accessible:
             [string, self.caretOffset, self.lineOffset] = \
                  orca_state.activeScript.getTextLineAtCaret(self.accessible,
                                                             startOffset)
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 8a7df9d..fd90a27 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -33,6 +33,8 @@ import orca_state
 import rolenames
 import settings
 
+from orca_i18n import ngettext  # for ngettext support
+
 class Space:
     """A dummy class to indicate we want to insert a space into an
     utterance, but only if there is text prior to the space."""
@@ -114,6 +116,30 @@ class BrailleGenerator(generator.Generator):
 
     #####################################################################
     #                                                                   #
+    # Hierarchy and related dialog information                          #
+    #                                                                   #
+    #####################################################################
+
+    def _generateAlertAndDialogCount(self, obj,  **args):
+        """Returns an array of strings that says how many alerts and dialogs
+        are associated with the application for this object.  [[[WDW -
+        I wonder if this string should be moved to settings.py.]]]
+        """
+        result = []
+        alertAndDialogCount = \
+            self._script.getUnfocusedAlertAndDialogCount(obj)
+        if alertAndDialogCount > 0:
+            # Translators: this tells the user how many unfocused
+            # alert and dialog windows plus the total number of
+            # windows that this application has.
+            #
+            result.append(ngettext("(%d dialog)",
+                                   "(%d dialogs)",
+                                   alertAndDialogCount) % alertAndDialogCount)
+        return result
+
+    #####################################################################
+    #                                                                   #
     # Other things for spacing                                          #
     #                                                                   #
     #####################################################################
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index a19a213..3ed6da5 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -332,7 +332,10 @@ formatting = {
             'unfocused': '[Component(obj,\
                                      asString(label + displayedText) or asString(applicationName))]'
             },
-        #pyatspi.ROLE_FRAME: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_FRAME: {
+            'unfocused': '[Component(obj,\
+                                     asString(label + displayedText + value + roleName + alertAndDialogCount))]'
+            },
         #pyatspi.ROLE_HTML_CONTAINER: 'default'
         pyatspi.ROLE_ICON: {
             'unfocused': '[Component(obj,\



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