Fall back to speech if sound for an item is unavailable or doesn't exist.
This commit is contained in:
@@ -558,8 +558,13 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
|
||||
|
||||
role = args.get('role', AXObject.get_role(obj))
|
||||
roleSoundPresentation = _settingsManager.getSetting('roleSoundPresentation')
|
||||
soundEnabled = _settingsManager.getSetting('enableSound')
|
||||
roleSoundIcon = None
|
||||
if roleSoundPresentation != settings.ROLE_SOUND_PRESENTATION_SPEECH_ONLY \
|
||||
and soundEnabled:
|
||||
roleSoundIcon = sound_theme_manager.getManager().getRoleSoundIcon(role)
|
||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY \
|
||||
and _settingsManager.getSetting('enableSound'):
|
||||
and soundEnabled and roleSoundIcon:
|
||||
if AXUtilities.is_check_box(obj) \
|
||||
or AXUtilities.is_check_menu_item(obj) \
|
||||
or AXUtilities.is_radio_button(obj) \
|
||||
@@ -678,9 +683,10 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
|
||||
if not _settingsManager.getSetting('enableSound'):
|
||||
return result
|
||||
|
||||
roleSoundIcon = sound_theme_manager.getManager().getRoleSoundIcon(role)
|
||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY:
|
||||
return [roleSoundIcon] if roleSoundIcon else []
|
||||
if roleSoundIcon:
|
||||
return [roleSoundIcon]
|
||||
return result
|
||||
|
||||
if not roleSoundIcon:
|
||||
return result
|
||||
|
||||
@@ -666,8 +666,13 @@ class SpeechGenerator(generator.Generator):
|
||||
result = []
|
||||
role = args.get('role', AXObject.get_role(obj))
|
||||
roleSoundPresentation = _settingsManager.getSetting('roleSoundPresentation')
|
||||
soundEnabled = _settingsManager.getSetting('enableSound')
|
||||
roleSoundIcon = None
|
||||
if roleSoundPresentation != settings.ROLE_SOUND_PRESENTATION_SPEECH_ONLY \
|
||||
and soundEnabled:
|
||||
roleSoundIcon = sound_theme_manager.getManager().getRoleSoundIcon(role)
|
||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY \
|
||||
and _settingsManager.getSetting('enableSound'):
|
||||
and soundEnabled and roleSoundIcon:
|
||||
if AXUtilities.is_check_box(obj) \
|
||||
or AXUtilities.is_check_menu_item(obj) \
|
||||
or AXUtilities.is_radio_button(obj) \
|
||||
@@ -675,10 +680,6 @@ class SpeechGenerator(generator.Generator):
|
||||
or AXUtilities.is_toggle_button(obj) \
|
||||
or AXUtilities.is_switch(obj):
|
||||
return []
|
||||
roleSoundIcon = None
|
||||
if roleSoundPresentation != settings.ROLE_SOUND_PRESENTATION_SPEECH_ONLY \
|
||||
and _settingsManager.getSetting('enableSound'):
|
||||
roleSoundIcon = sound_theme_manager.getManager().getRoleSoundIcon(role)
|
||||
|
||||
doNotPresent = [Atspi.Role.UNKNOWN,
|
||||
Atspi.Role.REDUNDANT_OBJECT,
|
||||
@@ -722,7 +723,9 @@ class SpeechGenerator(generator.Generator):
|
||||
result.extend(self.voice(SYSTEM, obj=obj, **args))
|
||||
|
||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY:
|
||||
return [roleSoundIcon] if roleSoundIcon else []
|
||||
if roleSoundIcon:
|
||||
return [roleSoundIcon]
|
||||
return result
|
||||
|
||||
if result and roleSoundIcon:
|
||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_AND_SPEECH:
|
||||
|
||||
Reference in New Issue
Block a user