Skip to content

Commit

Permalink
Initial implementation of the possibility to enable/disable graphics …
Browse files Browse the repository at this point in the history
…reporting, re nvaccess#4837
  • Loading branch information
LeonarddeR authored and Leonard de Ruijter committed Mar 7, 2019
1 parent 2ed7dba commit 95d0c61
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
13 changes: 7 additions & 6 deletions source/NVDAObjects/window/winword.py
Expand Up @@ -319,14 +319,15 @@
"reportTables":0x200,
"reportLists":0x400,
"reportLinks":0x800,
"reportComments":0x1000,
"reportHeadings":0x2000,
"autoLanguageSwitching":0x4000,
"reportRevisions":0x8000,
"reportParagraphIndentation":0x10000,
"reportGraphics":0x1000,
"reportComments":0x2000,
"reportHeadings":0x4000,
"autoLanguageSwitching":0x8000,
"reportRevisions":0x10000,
"reportParagraphIndentation":0x20000,
"reportLineSpacing":0x40000,
}
formatConfigFlag_includeLayoutTables=0x20000
formatConfigFlag_includeLayoutTables=0x80000

# Map some characters from PUA to Unicode. Meant to be used with bullets only.
# Doesn't care about the actual font, so can give incorrect Unicode in rare cases.
Expand Down
2 changes: 2 additions & 0 deletions source/appModules/powerpnt.py
Expand Up @@ -937,6 +937,8 @@ def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):
formatField['color']=colors.RGB.fromCOLORREF(font.color.rgb)
if formatConfig["reportLinks"] and curRun.actionSettings(ppMouseClick).action==ppActionHyperlink:
formatField["link"]=True
if formatConfig["reportGraphics"]:
formatField["graphic"]=True
return formatField,(startOffset,endOffset)

class Table(Shape):
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Expand Up @@ -168,6 +168,7 @@
reportBorderStyle = boolean(default=False)
reportBorderColor = boolean(default=False)
reportLinks = boolean(default=true)
reportGraphics = boolean(default=true)
reportComments = boolean(default=true)
reportLists = boolean(default=true)
reportHeadings = boolean(default=true)
Expand Down
2 changes: 1 addition & 1 deletion source/globalCommands.py
Expand Up @@ -1301,7 +1301,7 @@ def _reportFormattingHelper(self, info, browseable=False):
"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False,
"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,
"reportPage":False,"reportLineNumber":False,"reportLineIndentation":True,"reportLineIndentationWithTones":False,"reportParagraphIndentation":True,"reportLineSpacing":True,"reportTables":False,
"reportLinks":False,"reportHeadings":False,"reportLists":False,
"reportLinks":False,"reportGraphics":False,"reportHeadings":False,"reportLists":False,
"reportBlockQuotes":False,"reportComments":False,
"reportBorderStyle":True,"reportBorderColor":True,
}
Expand Down
6 changes: 6 additions & 0 deletions source/gui/settingsDialogs.py
Expand Up @@ -1854,6 +1854,11 @@ def makeSettings(self, settingsSizer):
self.linksCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Lin&ks")))
self.linksCheckBox.SetValue(config.conf["documentFormatting"]["reportLinks"])

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
self.graphicsCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Report &graphics")))
self.graphicsCheckBox.SetValue(config.conf["documentFormatting"]["reportGraphics"])

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
self.listsCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("&Lists")))
Expand Down Expand Up @@ -1912,6 +1917,7 @@ def onSave(self):
config.conf["documentFormatting"]["reportBorderStyle"] = choice in (1,2)
config.conf["documentFormatting"]["reportBorderColor"] = (choice == 2)
config.conf["documentFormatting"]["reportLinks"]=self.linksCheckBox.IsChecked()
config.conf["documentFormatting"]["reportGraphics"]=self.graphicsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportHeadings"]=self.headingsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLists"]=self.listsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportBlockQuotes"]=self.blockQuotesCheckBox.IsChecked()
Expand Down
6 changes: 6 additions & 0 deletions source/speech.py
Expand Up @@ -1656,6 +1656,12 @@ def getFormatFieldSpeech(attrs,attrsCache=None,formatConfig=None,reason=None,uni
if (link or oldLink is not None) and link!=oldLink:
text=_("link") if link else _("out of %s")%_("link")
textList.append(text)
if formatConfig["reportGraphics"]:
graphic=attrs.get("graphic")
oldGraphic=attrsCache.get("graphic") if attrsCache is not None else None
if (graphic or oldGraphic is not None) and graphic!=oldGraphic:
text=_("graphic") if graphic else _("out of %s")%_("graphic")
textList.append(text)
if formatConfig["reportComments"]:
comment=attrs.get("comment")
oldComment=attrsCache.get("comment") if attrsCache is not None else None
Expand Down
1 change: 1 addition & 0 deletions source/textInfos/__init__.py
Expand Up @@ -64,6 +64,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
return self.PRESCAT_LAYOUT
if reason in (controlTypes.REASON_CARET, controlTypes.REASON_SAYALL, controlTypes.REASON_FOCUS) and (
(role == controlTypes.ROLE_LINK and not formatConfig["reportLinks"])
or (role == controlTypes.ROLE_GRAPHIC and not formatConfig["reportGraphics"])
or (role == controlTypes.ROLE_HEADING and not formatConfig["reportHeadings"])
or (role == controlTypes.ROLE_BLOCKQUOTE and not formatConfig["reportBlockQuotes"])
or (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLEROWHEADER, controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"])
Expand Down
3 changes: 1 addition & 2 deletions user_docs/en/userGuide.t2t
Expand Up @@ -1567,14 +1567,13 @@ You can configure reporting of:
- Cell borders [(Off, Styles, Both Colors and Styles)
- Elements
- Headings
- Links
- Link- Graphics
- Lists
- Block quotes
- Landmarks
- Frames
- Clickable
-
-

To toggle these settings from anywhere, please assign custom gestures using the [Input Gestures dialog #InputGestures].

Expand Down

0 comments on commit 95d0c61

Please sign in to comment.