Skip to content

Commit

Permalink
Merge 3213e4f into 5a0b42e
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonarddeR authored Oct 26, 2019
2 parents 5a0b42e + 3213e4f commit 67ea95b
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 7 deletions.
5 changes: 3 additions & 2 deletions source/aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import controlTypes

ariaRolesToNVDARoles={
"description":controlTypes.ROLE_STATICTEXT,
"search":controlTypes.ROLE_SECTION,
"alert":controlTypes.ROLE_ALERT,
"alertdialog":controlTypes.ROLE_DIALOG,
"application":controlTypes.ROLE_APPLICATION,
Expand All @@ -17,9 +15,11 @@
"columnheader":controlTypes.ROLE_TABLECOLUMNHEADER,
"combobox":controlTypes.ROLE_COMBOBOX,
"definition":controlTypes.ROLE_LISTITEM,
"description":controlTypes.ROLE_STATICTEXT,
"dialog":controlTypes.ROLE_DIALOG,
"directory":controlTypes.ROLE_LIST,
"document":controlTypes.ROLE_DOCUMENT,
"figure":controlTypes.ROLE_FIGURE,
"form":controlTypes.ROLE_FORM,
"grid":controlTypes.ROLE_TABLE,
"gridcell":controlTypes.ROLE_TABLECELL,
Expand All @@ -42,6 +42,7 @@
"row":controlTypes.ROLE_TABLEROW,
"rowgroup":controlTypes.ROLE_GROUPING,
"rowheader":controlTypes.ROLE_TABLEROWHEADER,
"search":controlTypes.ROLE_SECTION,
"separator":controlTypes.ROLE_SEPARATOR,
"scrollbar":controlTypes.ROLE_SCROLLBAR,
"slider":controlTypes.ROLE_SLIDER,
Expand Down
6 changes: 6 additions & 0 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
# grouping.
controlTypes.ROLE_GROUPING: _("grp"),
# Translators: Displayed in braille for an object which is a
# caption.
controlTypes.ROLE_CAPTION: _("cap"),
# Translators: Displayed in braille for an object which is a
# embedded object.
controlTypes.ROLE_EMBEDDEDOBJECT: _("embedded"),
# Translators: Displayed in braille for an object which is a
Expand Down Expand Up @@ -171,6 +174,9 @@
controlTypes.ROLE_INSERTED_CONTENT: _("ins"),
# Translators: Displayed in braille for a landmark.
controlTypes.ROLE_LANDMARK: _("lmk"),
# Translators: Displayed in braille for an object which is a
# figure.
controlTypes.ROLE_FIGURE: _("fig"),
}

positiveStateLabels = {
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
reportLists = boolean(default=true)
reportHeadings = boolean(default=true)
reportBlockQuotes = boolean(default=true)
reportGroupings = boolean(default=true)
reportLandmarks = boolean(default=true)
reportFrames = boolean(default=true)
reportClickable = boolean(default=true)
Expand Down
3 changes: 3 additions & 0 deletions source/controlTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
ROLE_DELETED_CONTENT=147
ROLE_INSERTED_CONTENT=148
ROLE_LANDMARK = 149
ROLE_FIGURE = 151

STATE_UNAVAILABLE=0X1
STATE_FOCUSED=0X2
Expand Down Expand Up @@ -495,6 +496,8 @@
ROLE_INSERTED_CONTENT:_("inserted"),
# Translators: Identifies a landmark.
ROLE_LANDMARK: _("landmark"),
# Translators: Identifies a figure (commonly seen on some websites).
ROLE_FIGURE: _("figure"),
}

stateLabels={
Expand Down
16 changes: 16 additions & 0 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,22 @@ def script_toggleReportHeadings(self,gesture):
script_toggleReportHeadings.__doc__=_("Toggles on and off the reporting of headings")
script_toggleReportHeadings.category=SCRCAT_DOCUMENTFORMATTING

@script(
# Translators: Input help mode message for toggle report groupings command.
description=_("Toggles on and off the reporting of groupings"),
category=SCRCAT_DOCUMENTFORMATTING
)
def script_toggleReportGroupings(self, gesture):
if config.conf["documentFormatting"]["reportGroupings"]:
# Translators: The message announced when toggling the report block quotes document formatting setting.
state = _("report gorupings off")
config.conf["documentFormatting"]["reportGroupings"] = False
else:
# Translators: The message announced when toggling the report block quotes document formatting setting.
state = _("report groupings on")
config.conf["documentFormatting"]["reportGroupings"] = True
ui.message(state)

def script_toggleReportBlockQuotes(self,gesture):
if config.conf["documentFormatting"]["reportBlockQuotes"]:
# Translators: The message announced when toggling the report block quotes document formatting setting.
Expand Down
6 changes: 6 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,11 @@ def makeSettings(self, settingsSizer):
self.blockQuotesCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Block &quotes")))
self.blockQuotesCheckBox.SetValue(config.conf["documentFormatting"]["reportBlockQuotes"])

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

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
self.landmarksCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Lan&dmarks")))
Expand Down Expand Up @@ -1964,6 +1969,7 @@ def onSave(self):
config.conf["documentFormatting"]["reportHeadings"]=self.headingsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLists"]=self.listsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportBlockQuotes"]=self.blockQuotesCheckBox.IsChecked()
config.conf["documentFormatting"]["reportGroupings"] = self.groupingsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLandmarks"]=self.landmarksCheckBox.IsChecked()
config.conf["documentFormatting"]["reportFrames"]=self.framesCheckBox.Value
config.conf["documentFormatting"]["reportClickable"]=self.clickableCheckBox.Value
Expand Down
12 changes: 9 additions & 3 deletions source/speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,9 +1304,15 @@ def getControlFieldSpeech(attrs,ancestorAttrs,fieldType,formatConfig=None,extraD
),
levelText
))
elif nameText and reason==controlTypes.REASON_FOCUS and fieldType == "start_addedToControlFieldStack" and role in (controlTypes.ROLE_GROUPING, controlTypes.ROLE_PROPERTYPAGE):
# #3321, #709: Report the name of groupings (such as fieldsets) and tab pages for quicknav and focus jumps
return " ".join((nameText,roleText))
elif (
(nameText or descriptionText)
and reason == controlTypes.REASON_FOCUS
and fieldType == "start_addedToControlFieldStack"
and role in (controlTypes.ROLE_GROUPING, controlTypes.ROLE_PROPERTYPAGE)
):
# #10095, #3321, #709: Report the name and description of groupings (such as fieldsets) and tab pages
# for quicknav and focus jumps.
return " ".join((nameText, roleText, descriptionText))
elif fieldType in ("start_addedToControlFieldStack","start_relative") and role in (controlTypes.ROLE_TABLECELL,controlTypes.ROLE_TABLECOLUMNHEADER,controlTypes.ROLE_TABLEROWHEADER) and tableID:
# Table cell.
reportTableHeaders = formatConfig["reportTableHeaders"]
Expand Down
7 changes: 6 additions & 1 deletion source/textInfos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
table = None
if not table or (not formatConfig["includeLayoutTables"] and table.get("table-layout", None)) or table.get('isHidden',False):
return self.PRESCAT_LAYOUT
name = self.get("name")
landmark = self.get("landmark")
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_HEADING and not formatConfig["reportHeadings"])
or (role == controlTypes.ROLE_BLOCKQUOTE and not formatConfig["reportBlockQuotes"])
or (role == controlTypes.ROLE_GROUPING and (not name or not formatConfig["reportGroupings"]))
or (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLEROWHEADER, controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"])
or (role in (controlTypes.ROLE_LIST, controlTypes.ROLE_LISTITEM) and controlTypes.STATE_READONLY in states and not formatConfig["reportLists"])
or (role in (controlTypes.ROLE_FRAME, controlTypes.ROLE_INTERNALFRAME) and not formatConfig["reportFrames"])
Expand Down Expand Up @@ -100,7 +102,8 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
controlTypes.ROLE_MENUBUTTON,
controlTypes.ROLE_TREEVIEW,
controlTypes.ROLE_CHECKMENUITEM,
controlTypes.ROLE_RADIOMENUITEM
controlTypes.ROLE_RADIOMENUITEM,
controlTypes.ROLE_CAPTION,
)
or (role == controlTypes.ROLE_EDITABLETEXT and controlTypes.STATE_MULTILINE not in states and (controlTypes.STATE_READONLY not in states or controlTypes.STATE_FOCUSABLE in states))
or (role == controlTypes.ROLE_LIST and controlTypes.STATE_READONLY not in states)
Expand All @@ -125,6 +128,8 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
elif (
role in (
controlTypes.ROLE_BLOCKQUOTE,
controlTypes.ROLE_GROUPING,
controlTypes.ROLE_FIGURE,
controlTypes.ROLE_FRAME,
controlTypes.ROLE_INTERNALFRAME,
controlTypes.ROLE_TOOLBAR,
Expand Down
6 changes: 5 additions & 1 deletion source/virtualBuffers/gecko_ia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,15 @@ def _normalizeControlField(self,attrs):
# This is a named link destination, not a link which can be activated. The user doesn't care about these.
role=controlTypes.ROLE_TEXTFRAME
level=attrs.get('IAccessible2::attribute_level',"")

xmlRoles=attrs.get("IAccessible2::attribute_xml-roles", "").split(" ")
landmark = next((xr for xr in xmlRoles if xr in aria.landmarkRoles), None)
if landmark and role != controlTypes.ROLE_LANDMARK and landmark != xmlRoles[0]:
# Ignore the landmark role
landmark = None
if role == controlTypes.ROLE_GROUPING and xmlRoles[0] == "figure":
# This is a figure.
role = controlTypes.ROLE_FIGURE
attrs['role']=role
attrs['states']=states
if level is not "" and level is not None:
Expand Down Expand Up @@ -292,7 +296,7 @@ def _searchableAttribsForNodeType(self,nodeType):
]
elif nodeType=="embeddedObject":
attrs=[
{"IAccessible2::attribute_tag":self._searchableTagValues(["embed","object","applet","audio","video"])},
{"IAccessible2::attribute_tag":self._searchableTagValues(["embed","object","applet","audio","video","figure"])},
{"IAccessible::role":[oleacc.ROLE_SYSTEM_APPLICATION,oleacc.ROLE_SYSTEM_DIALOG]},
]
else:
Expand Down

0 comments on commit 67ea95b

Please sign in to comment.