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))
|
role = args.get('role', AXObject.get_role(obj))
|
||||||
roleSoundPresentation = _settingsManager.getSetting('roleSoundPresentation')
|
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 \
|
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY \
|
||||||
and _settingsManager.getSetting('enableSound'):
|
and soundEnabled and roleSoundIcon:
|
||||||
if AXUtilities.is_check_box(obj) \
|
if AXUtilities.is_check_box(obj) \
|
||||||
or AXUtilities.is_check_menu_item(obj) \
|
or AXUtilities.is_check_menu_item(obj) \
|
||||||
or AXUtilities.is_radio_button(obj) \
|
or AXUtilities.is_radio_button(obj) \
|
||||||
@@ -678,9 +683,10 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
|
|||||||
if not _settingsManager.getSetting('enableSound'):
|
if not _settingsManager.getSetting('enableSound'):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
roleSoundIcon = sound_theme_manager.getManager().getRoleSoundIcon(role)
|
|
||||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY:
|
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY:
|
||||||
return [roleSoundIcon] if roleSoundIcon else []
|
if roleSoundIcon:
|
||||||
|
return [roleSoundIcon]
|
||||||
|
return result
|
||||||
|
|
||||||
if not roleSoundIcon:
|
if not roleSoundIcon:
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -666,8 +666,13 @@ class SpeechGenerator(generator.Generator):
|
|||||||
result = []
|
result = []
|
||||||
role = args.get('role', AXObject.get_role(obj))
|
role = args.get('role', AXObject.get_role(obj))
|
||||||
roleSoundPresentation = _settingsManager.getSetting('roleSoundPresentation')
|
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 \
|
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY \
|
||||||
and _settingsManager.getSetting('enableSound'):
|
and soundEnabled and roleSoundIcon:
|
||||||
if AXUtilities.is_check_box(obj) \
|
if AXUtilities.is_check_box(obj) \
|
||||||
or AXUtilities.is_check_menu_item(obj) \
|
or AXUtilities.is_check_menu_item(obj) \
|
||||||
or AXUtilities.is_radio_button(obj) \
|
or AXUtilities.is_radio_button(obj) \
|
||||||
@@ -675,10 +680,6 @@ class SpeechGenerator(generator.Generator):
|
|||||||
or AXUtilities.is_toggle_button(obj) \
|
or AXUtilities.is_toggle_button(obj) \
|
||||||
or AXUtilities.is_switch(obj):
|
or AXUtilities.is_switch(obj):
|
||||||
return []
|
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,
|
doNotPresent = [Atspi.Role.UNKNOWN,
|
||||||
Atspi.Role.REDUNDANT_OBJECT,
|
Atspi.Role.REDUNDANT_OBJECT,
|
||||||
@@ -722,7 +723,9 @@ class SpeechGenerator(generator.Generator):
|
|||||||
result.extend(self.voice(SYSTEM, obj=obj, **args))
|
result.extend(self.voice(SYSTEM, obj=obj, **args))
|
||||||
|
|
||||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY:
|
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_ONLY:
|
||||||
return [roleSoundIcon] if roleSoundIcon else []
|
if roleSoundIcon:
|
||||||
|
return [roleSoundIcon]
|
||||||
|
return result
|
||||||
|
|
||||||
if result and roleSoundIcon:
|
if result and roleSoundIcon:
|
||||||
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_AND_SPEECH:
|
if roleSoundPresentation == settings.ROLE_SOUND_PRESENTATION_SOUND_AND_SPEECH:
|
||||||
|
|||||||
Reference in New Issue
Block a user