Change sound priority a bit for the web.
This commit is contained in:
@@ -1394,7 +1394,8 @@ class Script(default.Script):
|
|||||||
self.utilities.setCaretContext(AXObject.get_parent(parent), -1)
|
self.utilities.setCaretContext(AXObject.get_parent(parent), -1)
|
||||||
if not self._loadingDocumentContent:
|
if not self._loadingDocumentContent:
|
||||||
self.presentMessage(messages.MODE_BROWSE)
|
self.presentMessage(messages.MODE_BROWSE)
|
||||||
sound_theme_manager.getManager().playBrowseModeSound()
|
if not self._shouldSuppressBrowseModeSound(obj, inputEvent):
|
||||||
|
sound_theme_manager.getManager().playBrowseModeSound()
|
||||||
else:
|
else:
|
||||||
if not self.utilities.grabFocusWhenSettingCaret(obj) \
|
if not self.utilities.grabFocusWhenSettingCaret(obj) \
|
||||||
and (self._lastCommandWasCaretNav \
|
and (self._lastCommandWasCaretNav \
|
||||||
@@ -1409,6 +1410,49 @@ class Script(default.Script):
|
|||||||
self._browseModeIsSticky = False
|
self._browseModeIsSticky = False
|
||||||
self.refreshKeyGrabs()
|
self.refreshKeyGrabs()
|
||||||
|
|
||||||
|
def _shouldSuppressBrowseModeSound(self, obj, inputEvent):
|
||||||
|
if inputEvent is not None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if _settingsManager.getSetting('roleSoundPresentation') \
|
||||||
|
== settings.ROLE_SOUND_PRESENTATION_SPEECH_ONLY:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not _settingsManager.getSetting('enableSound'):
|
||||||
|
return False
|
||||||
|
|
||||||
|
icon = self._getControlSoundIcon(obj)
|
||||||
|
return icon is not None and icon.isValid()
|
||||||
|
|
||||||
|
def _getControlSoundIcon(self, obj):
|
||||||
|
if not obj:
|
||||||
|
return None
|
||||||
|
|
||||||
|
role = AXObject.get_role(obj)
|
||||||
|
manager = sound_theme_manager.getManager()
|
||||||
|
icon = manager.getRoleSoundIcon(role)
|
||||||
|
if icon:
|
||||||
|
return icon
|
||||||
|
|
||||||
|
stateKey = None
|
||||||
|
if AXUtilities.is_checkable(obj) or AXUtilities.is_check_menu_item(obj):
|
||||||
|
if AXUtilities.is_indeterminate(obj):
|
||||||
|
stateKey = "mixed"
|
||||||
|
elif AXUtilities.is_checked(obj):
|
||||||
|
stateKey = "checked"
|
||||||
|
else:
|
||||||
|
stateKey = "unchecked"
|
||||||
|
elif AXUtilities.is_radio_button(obj):
|
||||||
|
stateKey = "checked" if AXUtilities.is_checked(obj) else "unchecked"
|
||||||
|
elif AXUtilities.is_toggle_button(obj) or AXUtilities.is_switch(obj):
|
||||||
|
stateKey = "checked" if (AXUtilities.is_checked(obj) or AXUtilities.is_pressed(obj)) \
|
||||||
|
else "unchecked"
|
||||||
|
|
||||||
|
if stateKey:
|
||||||
|
return manager.getRoleStateSoundIcon(role, stateKey)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def _tryClickableActivation(self, keyboardEvent):
|
def _tryClickableActivation(self, keyboardEvent):
|
||||||
"""Try to activate clickable element - returns True if we should consume the event."""
|
"""Try to activate clickable element - returns True if we should consume the event."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user