[orca] Move Gecko list presentation code into general presentation code.
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Move Gecko list presentation code into general presentation code.
- Date: Tue, 7 Aug 2012 10:51:05 +0000 (UTC)
commit bed9337314c9dee7ae98b0204a3a05fe9ba22999
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Aug 7 12:47:55 2012 +0200
Move Gecko list presentation code into general presentation code.
src/orca/braille_generator.py | 16 ++++++++++++++++
src/orca/formatting.py | 12 +++++++++++-
.../scripts/toolkits/Gecko/braille_generator.py | 16 ----------------
src/orca/scripts/toolkits/Gecko/formatting.py | 13 -------------
.../scripts/toolkits/Gecko/speech_generator.py | 16 ----------------
src/orca/speech_generator.py | 16 ++++++++++++++++
6 files changed, 43 insertions(+), 46 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 4cc263e..5c3f8d0 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -280,6 +280,22 @@ class BrailleGenerator(generator.Generator):
result.reverse()
return result
+ def _generateFocusedItem(self, obj, **args):
+ result = []
+ role = args.get('role', obj.getRole())
+ if role != pyatspi.ROLE_LIST:
+ return result
+
+ s = obj.querySelection()
+ items = [s.getSelectedChild(i) for i in range(s.nSelectedChildren)]
+ if not items and obj.childCount:
+ items.append(obj[0])
+ items = list(map(self._generateName, items))
+ for item in items:
+ result.extend(item)
+
+ return result
+
#####################################################################
# #
# Unfortunate hacks. #
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 2b216a0..f3a24f8 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -173,6 +173,10 @@ formatting = {
'unfocused': 'labelAndName + roleName + availability + ' + MNEMONIC,
'basicWhereAmI': 'linkInfo + siteDescription + fileSize + ' + MNEMONIC
},
+ pyatspi.ROLE_LIST: {
+ 'focused': 'focusedItem',
+ 'unfocused': 'labelOrName + focusedItem + multiselectableState + numberOfChildren'
+ },
pyatspi.ROLE_LIST_ITEM: {
'focused': 'expandableState + availability',
'unfocused': 'labelAndName + allTextSelection + expandableState + availability + positionInList',
@@ -424,7 +428,11 @@ formatting = {
or asString(displayedText)\
or asString(name))]',
},
- #pyatspi.ROLE_LIST: 'default'
+ pyatspi.ROLE_LIST: {
+ 'unfocused': '[Component(obj,\
+ asString(label + focusedItem + roleName),\
+ asString(label) and (len(asString(label)) + 1) or 0)]'
+ },
pyatspi.ROLE_LIST_ITEM: {
'focused': '[Component(obj,\
asString(label + displayedText + expandableState + roleName + availability) + asString(accelerator))]\
@@ -563,6 +571,8 @@ if settings.useExperimentalSpeechProsody:
'labelAndName + pause + roleName + pause + selectedItemCount + pause+ selectedItems + pause'
formatting['speech'][pyatspi.ROLE_LINK]['basicWhereAmI'] = \
'linkInfo + pause + siteDescription + pause + fileSize + pause + ' + MNEMONIC
+ formatting['speech'][pyatspi.ROLE_LIST]['unfocused'] = \
+ 'labelOrName + pause + focusedItem + pause + multiselectableState + numberOfChildren + pause'
formatting['speech'][pyatspi.ROLE_LIST_ITEM]['unfocused'] = \
'labelAndName + allTextSelection + pause + expandableState + pause + availability + positionInList'
formatting['speech'][pyatspi.ROLE_LIST_ITEM]['basicWhereAmI'] = \
diff --git a/src/orca/scripts/toolkits/Gecko/braille_generator.py b/src/orca/scripts/toolkits/Gecko/braille_generator.py
index e7e9003..5252901 100644
--- a/src/orca/scripts/toolkits/Gecko/braille_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/braille_generator.py
@@ -217,22 +217,6 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
result.append(text)
return result
- def _generateFocusedItem(self, obj, **args):
- result = []
- role = args.get('role', obj.getRole())
- if role != pyatspi.ROLE_LIST:
- return result
-
- s = obj.querySelection()
- items = [s.getSelectedChild(i) for i in range(s.nSelectedChildren)]
- if not items and obj.childCount:
- items.append(obj[0])
- items = list(map(self._generateName, items))
- for item in items:
- result.extend(item)
-
- return result
-
def generateBraille(self, obj, **args):
result = []
# ARIA widgets get treated like regular default widgets.
diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index 5d2adfd..d800e26 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -64,10 +64,6 @@ formatting = {
pyatspi.ROLE_DOCUMENT_FRAME: {
'unfocused': 'name + roleName'
},
- pyatspi.ROLE_LIST: {
- 'focused': 'focusedItem',
- 'unfocused': 'labelOrName + focusedItem + multiselectableState + numberOfChildren'
- },
# [[[TODO: JD - We should decide if we want to provide
# information about the table dimensions, whether or not
# this is a layout table versus a data table, etc. For now,
@@ -116,11 +112,6 @@ formatting = {
or asString(displayedText)\
or asString(name))]',
},
- pyatspi.ROLE_LIST: {
- 'unfocused': '[Component(obj,\
- asString(label + focusedItem + roleName),\
- asString(label) and (len(asString(label)) + 1) or 0)]'
- },
# If we're in document content, we present the indicator followed
# immediately by the role, followed by the label/displayed text,
# etc. The label/displayed text is obtained as part of the line
@@ -137,10 +128,6 @@ formatting = {
}
}
-if orca.settings.useExperimentalSpeechProsody:
- formatting['speech'][pyatspi.ROLE_LIST]['unfocused'] = \
- 'labelOrName + pause + focusedItem + pause + multiselectableState + numberOfChildren + pause'
-
class Formatting(orca.formatting.Formatting):
# pylint: disable-msg=W0142
diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index 2bc16db..e939e21 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -306,22 +306,6 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
self, obj, **args))
return result
- def _generateFocusedItem(self, obj, **args):
- result = []
- role = args.get('role', obj.getRole())
- if role != pyatspi.ROLE_LIST:
- return result
-
- s = obj.querySelection()
- items = [s.getSelectedChild(i) for i in range(s.nSelectedChildren)]
- if not items and obj.childCount:
- items.append(obj[0])
- items = list(map(self._generateName, items))
- for item in items:
- result.extend(item)
-
- return result
-
def _generateAncestors(self, obj, **args):
result = []
priorObj = args.get('priorObj', None)
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index e9da595..e2687ef 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1445,6 +1445,22 @@ class SpeechGenerator(generator.Generator):
result.extend(acss)
return result
+ def _generateFocusedItem(self, obj, **args):
+ result = []
+ role = args.get('role', obj.getRole())
+ if role != pyatspi.ROLE_LIST:
+ return result
+
+ s = obj.querySelection()
+ items = [s.getSelectedChild(i) for i in range(s.nSelectedChildren)]
+ if not items and obj.childCount:
+ items.append(obj[0])
+ items = list(map(self._generateName, items))
+ for item in items:
+ result.extend(item)
+
+ return result
+
def _generateSelectedItemCount(self, obj, **args):
"""Returns an array of strings (and possibly voice and audio
specifications) indicating how many items are selected in this
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]