[orca] Only present placeholder text if the entry lacks a value



commit b7ea52b1e3e382185a5e7d5c1961e3af2b7f928b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Apr 3 11:11:05 2015 -0400

    Only present placeholder text if the entry lacks a value

 src/orca/formatting.py |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 44dc4a3..eeb5c30 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -37,7 +37,7 @@ from . import settings
 TUTORIAL = '(tutorial and (pause + tutorial) or [])'
 MNEMONIC = '(mnemonic and (pause + mnemonic + lineBreak) or [])'
 
-BRAILLE_TEXT = '[Text(obj, asString(labelOrName + placeholderText), asString(eol), startOffset, endOffset)]\
+BRAILLE_TEXT = '[Text(obj, asString(labelOrName or placeholderText), asString(eol), startOffset, endOffset)]\
                 + (required and [Region(" " + asString(required))])\
                 + (readOnly and [Region(" " + asString(readOnly))])'
 
@@ -153,10 +153,10 @@ formatting = {
             'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection 
+ ' + MNEMONIC + ' + ' + TUTORIAL
             },
         pyatspi.ROLE_ENTRY: {
-            'focused': 'labelOrName + placeholderText + readOnly + textRole + currentLineText + 
allTextSelection',
-            'unfocused': 'labelOrName + placeholderText + readOnly + textRole + currentLineText + 
allTextSelection + ' + MNEMONIC,
-            'basicWhereAmI': 'labelOrName + placeholderText + readOnly + textRole + textContent + 
anyTextSelection + ' + MNEMONIC,
-            'detailedWhereAmI': 'labelOrName + placeholderText + readOnly + textRole + 
textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
+            'focused': 'labelOrName + readOnly + textRole + (currentLineText or placeholderText) + 
allTextSelection',
+            'unfocused': 'labelOrName + readOnly + textRole + (currentLineText or placeholderText) + 
allTextSelection + ' + MNEMONIC,
+            'basicWhereAmI': 'labelOrName + readOnly + textRole + (textContent or placeholderText) + 
anyTextSelection + ' + MNEMONIC,
+            'detailedWhereAmI': 'labelOrName + readOnly + textRole + (textContentWithAttributes or 
placeholderText) + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
             },
         pyatspi.ROLE_FORM: {
             'focused': 'labelOrName + readOnly + textRole + currentLineText + allTextSelection',
@@ -336,10 +336,10 @@ formatting = {
             'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection 
+ ' + MNEMONIC + ' + ' + TUTORIAL
             },
         pyatspi.ROLE_TEXT: {
-            'focused': 'labelOrName + placeholderText + readOnly + textRole + textIndentation + 
currentLineText + allTextSelection',
-            'unfocused': 'labelOrName + placeholderText + readOnly + textRole + textIndentation + 
currentLineText + allTextSelection + ' + MNEMONIC,
-            'basicWhereAmI': 'label + placeholderText + readOnly + textRole + textContent + anyTextSelection 
+ ' + MNEMONIC,
-            'detailedWhereAmI': 'label + placeholderText + readOnly + textRole + textContentWithAttributes + 
anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
+            'focused': 'labelOrName + readOnly + textRole + textIndentation + (currentLineText or 
placeholderText) + allTextSelection',
+            'unfocused': 'labelOrName + readOnly + textRole + textIndentation + (currentLineText or 
placeholderText) + allTextSelection + ' + MNEMONIC,
+            'basicWhereAmI': 'labelOrName + readOnly + textRole + (textContent or placeholderText) + 
anyTextSelection + ' + MNEMONIC,
+            'detailedWhereAmI': 'labelOrName + readOnly + textRole + (textContentWithAttributes or 
placeholderText) + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
             },
         pyatspi.ROLE_TOGGLE_BUTTON: {
             'focused': 'expandableState or toggleState',
@@ -690,13 +690,13 @@ if settings.useExperimentalSpeechProsody:
     formatting['speech'][pyatspi.ROLE_TERMINAL]['detailedWhereAmI'] = \
         'label + readOnly + pause + textRole + pause + textContentWithAttributes + anyTextSelection + ' + 
MNEMONIC + ' + ' + TUTORIAL
     formatting['speech'][pyatspi.ROLE_TEXT]['focused'] = \
-        'labelOrName + placeholderText + readOnly + textRole + pause + textIndentation + currentLineText + 
allTextSelection'
+        'labelOrName + readOnly + textRole + pause + textIndentation + (currentLineText or placeholderText) 
+ allTextSelection'
     formatting['speech'][pyatspi.ROLE_TEXT]['unfocused'] = \
-        'labelOrName + placeholderText + readOnly + textRole + pause + textIndentation + currentLineText + 
allTextSelection + ' + MNEMONIC
+        'labelOrName + readOnly + textRole + pause + textIndentation + (currentLineText or placeholderText) 
+ allTextSelection + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_TEXT]['basicWhereAmI'] = \
-        'label + placeholderText + readOnly + textRole + pause + textContent + anyTextSelection + pause + ' 
+ MNEMONIC
+        'labelOrName + readOnly + textRole + pause + (textContent or placeholderText) + anyTextSelection + 
pause + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_TEXT]['detailedWhereAmI'] = \
-        'label + placeholderText + readOnly + textRole + pause + textContentWithAttributes + 
anyTextSelection + pause + ' + MNEMONIC + ' + ' + TUTORIAL
+        'labelOrName + readOnly + textRole + pause + (textContentWithAttributes or placeholderText) + 
anyTextSelection + pause + ' + MNEMONIC + ' + ' + TUTORIAL
 
 class Formatting(dict):
 


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