Skip to content

Commit

Permalink
speech: Fix several issues related to reporting of tables for NVDAObj…
Browse files Browse the repository at this point in the history
…ects:

* Don't report headers if reporting of headers is disabled.
* Report headers when reporting of coordinates is disabled.
* For REASON_QUERY, don't report table cell info when reporting is disabled.
  • Loading branch information
jcsteh committed Aug 12, 2012
1 parent 58bd5de commit 546409b
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions source/speech.py
Expand Up @@ -224,7 +224,10 @@ def speakObjectProperties(obj,reason=controlTypes.REASON_QUERY,index=None,**allo
newPropertyValues={}
positionInfo=None
for name,value in allowedProperties.iteritems():
if name.startswith('positionInfo_') and value:
if name=="includeTableCellCoords":
# This is verbosity info.
newPropertyValues[name]=value
elif name.startswith('positionInfo_') and value:
if positionInfo is None:
positionInfo=obj.positionInfo
elif value:
Expand Down Expand Up @@ -269,7 +272,7 @@ def speakObjectProperties(obj,reason=controlTypes.REASON_QUERY,index=None,**allo
def speakObject(obj,reason=controlTypes.REASON_QUERY,index=None):
from NVDAObjects import NVDAObjectTextInfo
isEditable=(reason!=controlTypes.REASON_FOCUSENTERED and obj.TextInfo!=NVDAObjectTextInfo and (obj.role in (controlTypes.ROLE_EDITABLETEXT,controlTypes.ROLE_TERMINAL) or controlTypes.STATE_EDITABLE in obj.states))
allowProperties={'name':True,'role':True,'states':True,'value':True,'description':True,'keyboardShortcut':True,'positionInfo_level':True,'positionInfo_indexInGroup':True,'positionInfo_similarItemsInGroup':True,"cellCoordsText":True,"rowNumber":True,"columnNumber":True,"columnCount":True,"rowCount":True,"rowHeaderText":True,"columnHeaderText":True}
allowProperties={'name':True,'role':True,'states':True,'value':True,'description':True,'keyboardShortcut':True,'positionInfo_level':True,'positionInfo_indexInGroup':True,'positionInfo_similarItemsInGroup':True,"cellCoordsText":True,"rowNumber":True,"columnNumber":True,"includeTableCellCoords":True,"columnCount":True,"rowCount":True,"rowHeaderText":True,"columnHeaderText":True}

if reason==controlTypes.REASON_FOCUSENTERED:
allowProperties["value"]=False
Expand All @@ -289,11 +292,19 @@ def speakObject(obj,reason=controlTypes.REASON_QUERY,index=None):
if reason!=controlTypes.REASON_QUERY:
allowProperties["rowCount"]=False
allowProperties["columnCount"]=False
if (not config.conf["documentFormatting"]["reportTables"]
or not config.conf["documentFormatting"]["reportTableCellCoords"]):
allowProperties['cellCoordsText']=False
allowProperties["rowNumber"]=False
allowProperties["columnNumber"]=False
formatConf=config.conf["documentFormatting"]
if not formatConf["reportTableCellCoords"]:
allowProperties["cellCoordsText"]=False
# rowNumber and columnNumber might be needed even if we're not reporting coordinates.
allowProperties["includeTableCellCoords"]=False
if not formatConf["reportTableHeaders"]:
allowProperties["rowHeaderText"]=False
allowProperties["columnHeaderText"]=False
if (not formatConf["reportTables"]
or (not formatConf["reportTableCellCoords"] and not formatConf["reportTableHeaders"])):
# We definitely aren't reporting any table info at all.
allowProperties["rowNumber"]=False
allowProperties["columnNumber"]=False
if isEditable:
allowProperties['value']=False

Expand Down

0 comments on commit 546409b

Please sign in to comment.