[orca] Fix for bug 658141 - Need to add support for the 'placeholder-text' object attribute
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bug 658141 - Need to add support for the 'placeholder-text' object attribute
- Date: Sat, 3 Sep 2011 19:24:47 +0000 (UTC)
commit d967f3ae4e44cf204c89d99a90d7842d2d908199
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Sat Sep 3 15:23:04 2011 -0400
Fix for bug 658141 - Need to add support for the 'placeholder-text' object attribute
src/orca/formatting.py | 26 +++++++++++++-------------
src/orca/generator.py | 13 +++++++++++++
src/orca/speech_generator.py | 14 ++++++++++++++
3 files changed, 40 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 4fa5ca8..c48981a 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -36,7 +36,7 @@ import settings
TUTORIAL = '(tutorial and (pause + tutorial) or [])'
MNEMONIC = '(mnemonic and (pause + mnemonic + lineBreak) or [])'
-BRAILLE_TEXT = '[Text(obj, asString(label), asString(eol))]\
+BRAILLE_TEXT = '[Text(obj, asString(label + placeholderText), asString(eol))]\
+ (required and [Region(" " + asString(required))])\
+ (readOnly and [Region(" " + asString(readOnly))])'
@@ -136,10 +136,10 @@ formatting = {
'unfocused': 'embedded'
},
pyatspi.ROLE_ENTRY: {
- 'focused': 'labelOrName + readOnly + textRole + currentLineText + allTextSelection',
- 'unfocused': 'labelOrName + readOnly + textRole + currentLineText + allTextSelection + ' + MNEMONIC,
- 'basicWhereAmI': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
- 'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
+ 'focused': 'labelOrName + placeholderText + readOnly + textRole + currentLineText + allTextSelection',
+ 'unfocused': 'labelOrName + placeholderText + readOnly + textRole + currentLineText + allTextSelection + ' + MNEMONIC,
+ 'basicWhereAmI': 'label + placeholderText + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
+ 'detailedWhereAmI': 'label + placeholderText + readOnly + textRole + textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
},
pyatspi.ROLE_FRAME: {
'focused': '[]',
@@ -292,10 +292,10 @@ formatting = {
'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
},
pyatspi.ROLE_TEXT: {
- 'focused': 'labelOrName + readOnly + textRole + textIndentation + currentLineText + allTextSelection',
- 'unfocused': 'labelOrName + readOnly + textRole + textIndentation + currentLineText + allTextSelection + ' + MNEMONIC,
- 'basicWhereAmI': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
- 'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
+ '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
},
pyatspi.ROLE_TOGGLE_BUTTON: {
'focused': 'toggleState',
@@ -587,13 +587,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 + readOnly + textRole + pause + textIndentation + currentLineText + allTextSelection'
+ 'labelOrName + placeholderText + readOnly + textRole + pause + textIndentation + currentLineText + allTextSelection'
formatting['speech'][pyatspi.ROLE_TEXT]['unfocused'] = \
- 'labelOrName + readOnly + textRole + pause + textIndentation + currentLineText + allTextSelection + ' + MNEMONIC
+ 'labelOrName + placeholderText + readOnly + textRole + pause + textIndentation + currentLineText + allTextSelection + ' + MNEMONIC
formatting['speech'][pyatspi.ROLE_TEXT]['basicWhereAmI'] = \
- 'label + readOnly + textRole + pause + textContent + anyTextSelection + pause + ' + MNEMONIC
+ 'label + placeholderText + readOnly + textRole + pause + textContent + anyTextSelection + pause + ' + MNEMONIC
formatting['speech'][pyatspi.ROLE_TEXT]['detailedWhereAmI'] = \
- 'label + readOnly + textRole + pause + textContentWithAttributes + anyTextSelection + pause + ' + MNEMONIC + ' + ' + TUTORIAL
+ 'label + placeholderText + readOnly + textRole + pause + textContentWithAttributes + anyTextSelection + pause + ' + MNEMONIC + ' + ' + TUTORIAL
class Formatting(dict):
diff --git a/src/orca/generator.py b/src/orca/generator.py
index eb577dd..79ccee9 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -310,6 +310,19 @@ class Generator:
return result
+ def _generatePlaceholderText(self, obj, **args):
+ """Returns an array of strings for use by speech and braille that
+ represent the 'placeholder' text. This is typically text that
+ serves as a functional label and is found in a text widget until
+ that widget is given focus at which point the text is removed,
+ the assumption being that the user was able to see the text prior
+ to giving the widget focus.
+ """
+ result = filter(lambda x:
+ x.startswith('placeholder-text:'),
+ obj.getAttributes())
+ return map(lambda x: x.replace('placeholder-text:', ''), result)
+
def _generateLabelAndName(self, obj, **args):
"""Returns the label and the name as an array of strings for speech
and braille. The name will only be present if the name is
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 842ac08..d5a4ee2 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -179,6 +179,20 @@ class SpeechGenerator(generator.Generator):
result.extend(acss)
return result
+ def _generatePlaceholderText(self, obj, **args):
+ """Returns an array of strings for use by speech and braille that
+ represent the 'placeholder' text. This is typically text that
+ serves as a functional label and is found in a text widget until
+ that widget is given focus at which point the text is removed,
+ the assumption being that the user was able to see the text prior
+ to giving the widget focus.
+ """
+ acss = self.voice(DEFAULT)
+ result = generator.Generator._generatePlaceholderText(self, obj, **args)
+ if result:
+ result.extend(acss)
+ return result
+
def _generateDescription(self, obj, **args):
"""Returns an array of strings fo use by speech and braille that
represent the description of the object, if that description
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]