[orca/570658] Have asString add the delimiters instead of requiring space()



commit e56ee013fd70a6cfa28ca71fed827b3350f2c221
Author: Willie Walker <william walker sun com>
Date:   Wed Jun 24 21:32:15 2009 -0400

    Have asString add the delimiters instead of requiring space()
    
    This simplifies the formatting strings somewhat.

 src/orca/braille_generator.py |    6 ++++--
 src/orca/formatting.py        |   18 +++++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 45e1323..b38adfa 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -118,7 +118,7 @@ class BrailleGenerator(generator.Generator):
         else:
             return [Space(delimiter)]
 
-    def asString(self, content):
+    def asString(self, content, delimiter=" "):
         combined = ""
         prior = None
         if isinstance(content, basestring):
@@ -136,5 +136,7 @@ class BrailleGenerator(generator.Generator):
                     prior = None
                 else:
                     prior = self.asString(element)
-                    combined += prior
+                    combined = self._script.appendString(combined,
+                                                         prior,
+                                                         delimiter)
         return combined
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 3f67c2c..f60f3fb 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -282,19 +282,27 @@ formatting = {
             'unfocused': '[]',
             },
         'default': {
-            'unfocused': '[Component(obj, asString(label + space() + displayedText + space() + value + space() + roleName + space() + required))]',
+            'unfocused': '[Component(obj,\
+                                     asString(label + displayedText + value + roleName + required))]',
             },
         pyatspi.ROLE_ANIMATION: {
-            'unfocused': '[Component(obj, asString(label + space() + displayedText + space() + roleName + space(": ") + description))]',
+            'unfocused': '[Component(obj,\
+                                     asString(label + displayedText + roleName + (description and space(": ") + description)))]',
             },
         pyatspi.ROLE_CHECK_BOX: {
-            'unfocused': '[Component(obj, asString(label + space() + displayedText + space() + roleName), indicator="".join(checkedState))]'
+            'unfocused': '[Component(obj,\
+                                     asString(label + displayedText + roleName),\
+                                     indicator=asString(checkedState))]'
             },
         pyatspi.ROLE_CHECK_MENU_ITEM: {
-            'unfocused': '[Component(obj, asString(label + space() + displayedText + space() + roleName + space() + availability + accelerator), indicator="".join(checkedState))]'
+            'unfocused': '[Component(obj,\
+                                     asString(label + displayedText + roleName + availability) + asString(accelerator),\
+                                     indicator=asString(checkedState))]'
             },
         pyatspi.ROLE_MENU_ITEM: {
-            'unfocused': '[Component(obj, asString(label + space() + displayedText + space() + availability + accelerator), indicator="".join(menuItemCheckedState))]'
+            'unfocused': '[Component(obj,\
+                                     asString(label + displayedText + availability) + asString(accelerator),\
+                                     indicator=asString(menuItemCheckedState))]'
             },
     }
 }



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