[orca/570658] Implement text-like objects in braille formatting



commit 5eb69fd42e02e341d1ce0bb50c945527ce76a697
Author: Willie Walker <william walker sun com>
Date:   Thu Jun 25 10:39:29 2009 -0400

    Implement text-like objects in braille formatting

 src/orca/braille.py           |    2 +
 src/orca/braille_generator.py |   10 +++++++++
 src/orca/formatting.py        |   42 +++++++++++++++++++++++++++++++++++-----
 3 files changed, 48 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 501f877..7bd83a7 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -534,6 +534,8 @@ class Text(Region):
                                                             startOffset)
         else:
             string = ""
+            self.caretOffset = 0
+            self.lineOffset = 0
 
         string = string.decode("UTF-8")
         if label:
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 01c50bd..8a7df9d 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -61,6 +61,8 @@ class BrailleGenerator(generator.Generator):
         generator.Generator._addGlobals(self, globalsDict)
         globalsDict['space'] = self.space
         globalsDict['Component'] = braille.Component
+        globalsDict['Region'] = braille.Region
+        globalsDict['Text'] = braille.Text
         globalsDict['asString'] = self.asString
 
     def generateBraille(self, obj, **args):
@@ -116,6 +118,14 @@ class BrailleGenerator(generator.Generator):
     #                                                                   #
     #####################################################################
 
+    def _generateEol(self, obj, **args):
+        result = []
+        if not args.get('mode', None):
+            args['mode'] = self._mode
+        args['stringType'] = 'eol'
+        result.append(self._script.formatting.getString(**args))
+        return result
+
     def space(self, delimiter=" "):
         if delimiter == " ":
             return SPACE
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index f38d84f..a19a213 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -339,7 +339,11 @@ formatting = {
                                      asString(label + displayedText + imageDescription + roleName))]'
             },
         #pyatspi.ROLE_IMAGE: 'default'
-        #pyatspi.ROLE_LABEL: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_LABEL: {
+            'unfocused': '[Text(obj,\
+                                asString(label),\
+                                asString(eol))]'
+            },
         #pyatspi.ROLE_LIST: 'default'
         #pyatspi.ROLE_LIST_ITEM: [[[TODO: WDW - needs to be done]]]
         #pyatspi.ROLE_MENU: [[[TODO: WDW - needs to be done]]]
@@ -349,7 +353,6 @@ formatting = {
                                      asString(label + displayedText + availability) + asString(accelerator),\
                                      indicator=asString(menuItemCheckedState))]'
             },
-        #pyatspi.ROLE_TEXT: [[[TODO: WDW - needs to be done]]]
         #pyatspi.ROLE_OPTION_PANE: 'default'
         pyatspi.ROLE_PAGE_TAB: {
             'focused':   '[Component(obj,\
@@ -362,8 +365,20 @@ formatting = {
             'unfocused': '[Component(obj,\
                                      asString((label or displayedText) + roleName))]'
             },
-        #pyatspi.ROLE_PARAGRAPH: [[[TODO: WDW - needs to be done]]]
-        #pyatspi.ROLE_PASSWORD_TEXT: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_PARAGRAPH: {
+            'unfocused': '[Text(obj,\
+                                asString(label),\
+                                asString(eol)),\
+                           (required and Region(" " + asString(required))) or [],\
+                           (readOnly and Region(" " + asString(readOnly))) or []]'
+            },
+        pyatspi.ROLE_PASSWORD_TEXT: {
+            'unfocused': '[Text(obj,\
+                                asString(label),\
+                                asString(eol)),\
+                           (required and Region(" " + asString(required))) or [],\
+                           (readOnly and Region(" " + asString(readOnly))) or []]'
+            },
         #pyatspi.ROLE_PROGRESS_BAR: 'default'
         pyatspi.ROLE_PUSH_BUTTON: {
             'unfocused': '[Component(obj,\
@@ -391,7 +406,13 @@ formatting = {
             'unfocused': '[Component(obj,\
                                      asString(label + value + roleName + required))]'
             },
-        #pyatspi.ROLE_SPIN_BUTTON: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_SPIN_BUTTON: {
+            'unfocused': '[Text(obj,\
+                                asString(label),\
+                                asString(eol)),\
+                           (required and Region(" " + asString(required))) or [],\
+                           (readOnly and Region(" " + asString(readOnly))) or []]'
+            },
         #pyatspi.ROLE_SPLIT_PANE: 'default'
         #pyatspi.ROLE_TABLE: 'default'
         #pyatspi.ROLE_TABLE_CELL: [[[TODO: WDW - needs to be done]]]
@@ -401,7 +422,16 @@ formatting = {
             'unfocused': '[Component(obj,\
                                      asString(roleName))]'
             },
-        #pyatspi.ROLE_TERMINAL: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_TERMINAL: {
+            'unfocused': '[Text(obj)]'
+            },
+        pyatspi.ROLE_TEXT: {
+            'unfocused': '[Text(obj,\
+                                asString(label),\
+                                asString(eol)),\
+                           (required and Region(" " + asString(required))) or [],\
+                           (readOnly and Region(" " + asString(readOnly))) or []]'
+            },
         pyatspi.ROLE_TOGGLE_BUTTON: {
             'unfocused': '[Component(obj,\
                                      asString(((label + displayedText) or description) + roleName),\



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