__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Orca
#
# Copyright 2004-2009 Sun Microsystems Inc.
# Copyright 2010-2011 The Orca Team
# Copyright 2012 Igalia, S.L.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
# Boston MA 02110-1301 USA.
"""The main module for the Orca screen reader."""
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
__copyright__ = "Copyright (c) 2004-2009 Sun Microsystems Inc." \
"Copyright (c) 2010-2011 The Orca Team" \
"Copyright (c) 2012 Igalia, S.L."
__license__ = "LGPL"
import gi
import os
import signal
import sys
gi.require_version("Atspi", "2.0")
gi.require_version("Gdk", "3.0")
from gi.repository import Atspi
from gi.repository import Gdk
from gi.repository.Gio import Settings
from . import braille
from . import clipboard
from . import debug
from . import debugging_tools_manager
from . import event_manager
from . import focus_manager
from . import input_event_manager
from . import messages
from . import mouse_review
from . import orca_modifier_manager
from . import script_manager
from . import settings
from . import settings_manager
from . import speech_and_verbosity_manager
from . import sound
from .ax_utilities import AXUtilities
# The user-settings module (see loadUserSettings).
#
_userSettings = None
def loadUserSettings(script=None, skipReloadMessage=False):
"""(Re)Loads the user settings module, re-initializing things such as speech if necessary."""
debug.print_message(debug.LEVEL_INFO, 'ORCA: Loading User Settings', True)
global _userSettings
# Shutdown the output drivers and give them a chance to die.
player = sound.getPlayer()
player.shutdown()
speech_and_verbosity_manager.get_manager().shutdown_speech()
braille.shutdown()
mouse_review.get_reviewer().deactivate()
event_manager.get_manager().pause_queuing(True, True, "Loading user settings.")
reloaded = False
if _userSettings:
_profile = settings_manager.get_manager().get_setting('activeProfile')[1]
_userSettings = settings_manager.get_manager().get_general_settings(_profile)
settings_manager.get_manager().set_profile(_profile)
reloaded = True
else:
_profile = settings_manager.get_manager().profile
_userSettings = settings_manager.get_manager().get_general_settings(_profile)
if not script:
script = script_manager.get_manager().get_default_script()
settings_manager.get_manager().load_app_settings(script)
if settings_manager.get_manager().get_setting('enableSpeech'):
speech_and_verbosity_manager.get_manager().start_speech()
if reloaded and not skipReloadMessage:
script.speakMessage(messages.SETTINGS_RELOADED)
if settings_manager.get_manager().get_setting('enableBraille'):
braille.init(input_event_manager.get_manager().process_braille_event)
# TODO - JD: This ultimately belongs in an extension manager.
if settings_manager.get_manager().get_setting('enableMouseReview'):
mouse_review.get_reviewer().activate()
if settings_manager.get_manager().get_setting('enableSound'):
player.init()
# Handle the case where a change was made in the Orca Preferences dialog.
orca_modifier_manager.get_manager().refresh_orca_modifiers("Loading user settings.")
event_manager.get_manager().pause_queuing(False, False, "User settings loaded.")
debug.print_message(debug.LEVEL_INFO, "ORCA: User Settings Loaded", True)
def timeout(signum=None, frame=None):
msg = 'TIMEOUT: something has hung. Aborting.'
debug.print_message(debug.LEVEL_SEVERE, msg, True)
debugging_tools_manager.get_manager().print_running_applications(force=True)
os.kill(os.getpid(), signal.SIGKILL)
def shutdown(script=None, inputEvent=None, signum=None):
"""Exits Orca. Returns True if shutdown ran to completion."""
debug.print_message(debug.LEVEL_INFO, "ORCA: Shutting down", True)
signal.signal(signal.SIGALRM, timeout)
signal.alarm(5)
orca_modifier_manager.get_manager().unset_orca_modifiers("Shutting down.")
script = script_manager.get_manager().get_active_script()
if script is not None:
script.presentationInterrupt()
script.presentMessage(messages.STOP_ORCA, resetStyles=False)
if signum == signal.SIGSEGV:
sys.exit(1)
# Pause event queuing first so that it clears its queue and will not accept new
# events. Then let the script manager unregister script event listeners as well
# as key grabs. Finally deactivate the event manager, which will also cause the
# Atspi.Device to be set to None.
event_manager.get_manager().pause_queuing(True, True, "Shutting down.")
script_manager.get_manager().deactivate()
event_manager.get_manager().deactivate()
# TODO - JD: This ultimately belongs in an extension manager.
clipboard.get_presenter().deactivate()
mouse_review.get_reviewer().deactivate()
# Shutdown all the other support.
#
if settings.enableSpeech:
speech_and_verbosity_manager.get_manager().shutdown_speech()
if settings.enableBraille:
braille.shutdown()
if settings.enableSound:
player = sound.getPlayer()
player.shutdown()
signal.alarm(0)
debug.print_message(debug.LEVEL_INFO, 'ORCA: Quitting Atspi main event loop', True)
Atspi.event_quit()
debug.print_message(debug.LEVEL_INFO, 'ORCA: Shutdown complete', True)
return True
def shutdownOnSignal(signum, frame):
signalString = f'({signal.strsignal(signum)})'
msg = f"ORCA: Shutting down and exiting due to signal={signum} {signalString}"
debug.print_message(debug.LEVEL_INFO, msg, True)
shutdown(signum=signum)
def main():
"""The main entry point for Orca. The exit codes for Orca will
loosely be based on signals, where the exit code will be the
signal used to terminate Orca (if a signal was used). Otherwise,
an exit code of 0 means normal completion and an exit code of 50
means Orca exited because of a hang."""
manager = debugging_tools_manager.get_manager()
manager.print_session_details()
manager.print_running_applications(force=False)
signal.signal(signal.SIGHUP, shutdownOnSignal)
signal.signal(signal.SIGINT, shutdownOnSignal)
signal.signal(signal.SIGTERM, shutdownOnSignal)
signal.signal(signal.SIGQUIT, shutdownOnSignal)
# TODO - JD: Handling was added for this signal so that we could restore CapsLock during a
# crash. But handling this signal is generally not recommended. If there's a crash, fixing
# that seems more important than cleaning up CapsLock.
signal.signal(signal.SIGSEGV, shutdownOnSignal)
debug.print_message(debug.LEVEL_INFO, "ORCA: Enabling accessibility (if needed).", True)
if not settings_manager.get_manager().is_accessibility_enabled():
settings_manager.get_manager().set_accessibility(True)
loadUserSettings()
def _on_enabled_changed(gsetting, key):
enabled = gsetting.get_boolean(key)
msg = f"ORCA: {key} changed to {enabled}."
debug.print_message(debug.LEVEL_INFO, msg, True)
if key == "screen-reader-enabled" and not enabled:
shutdown()
try:
_a11y_applications_gsetting = Settings(schema_id="org.gnome.desktop.a11y.applications")
connection = _a11y_applications_gsetting.connect("changed", _on_enabled_changed)
msg = f"ORCA: Connected to a11y applications gsetting: {bool(connection)}"
debug.print_message(debug.LEVEL_INFO, msg, True)
except Exception as error:
msg = f"ORCA: Exception connecting to a11y applications gsetting: {error}"
debug.print_message(debug.LEVEL_SEVERE, msg, True)
script = script_manager.get_manager().get_default_script()
script.presentMessage(messages.START_ORCA)
event_manager.get_manager().activate()
window = AXUtilities.find_active_window()
if window and not focus_manager.get_manager().get_locus_of_focus():
app = AXUtilities.get_application(window)
# TODO - JD: Consider having the focus tracker update the active script.
script = script_manager.get_manager().get_script(app, window)
script_manager.get_manager().set_active_script(script, "Launching.")
focus_manager.get_manager().set_active_window(
window, app, set_window_as_focus=True, notify_script=True)
# TODO - JD: Consider having the focus tracker update the active script.
focusedObject = focus_manager.get_manager().find_focused_object()
if focusedObject:
focus_manager.get_manager().set_locus_of_focus(None, focusedObject)
script = script_manager.get_manager().get_script(
AXUtilities.get_application(focusedObject), focusedObject)
script_manager.get_manager().set_active_script(script, "Found focused object.")
script_manager.get_manager().activate()
clipboard.get_presenter().activate()
Gdk.notify_startup_complete()
try:
debug.print_message(debug.LEVEL_INFO, "ORCA: Starting Atspi main event loop", True)
Atspi.event_main()
except Exception as error:
msg = f"ORCA: Exception starting ATSPI registry: {error}"
debug.print_message(debug.LEVEL_SEVERE, msg, True)
os.kill(os.getpid(), signal.SIGKILL)
return 0
if __name__ == "__main__":
sys.exit(main())
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| backends | Folder | 0755 |
|
|
| scripts | Folder | 0755 |
|
|
| __init__.py | File | 115 B | 0644 |
|
| acss.py | File | 3.85 KB | 0644 |
|
| action_presenter.py | File | 8.65 KB | 0644 |
|
| ax_collection.py | File | 6.16 KB | 0644 |
|
| ax_component.py | File | 14.93 KB | 0644 |
|
| ax_document.py | File | 9.36 KB | 0644 |
|
| ax_event_synthesizer.py | File | 17.39 KB | 0644 |
|
| ax_hypertext.py | File | 8.36 KB | 0644 |
|
| ax_object.py | File | 47.84 KB | 0644 |
|
| ax_selection.py | File | 4.54 KB | 0644 |
|
| ax_table.py | File | 47.98 KB | 0644 |
|
| ax_text.py | File | 45.13 KB | 0644 |
|
| ax_utilities.py | File | 28.24 KB | 0644 |
|
| ax_utilities_application.py | File | 7.17 KB | 0644 |
|
| ax_utilities_collection.py | File | 86.79 KB | 0644 |
|
| ax_utilities_debugging.py | File | 10.12 KB | 0644 |
|
| ax_utilities_event.py | File | 32.78 KB | 0644 |
|
| ax_utilities_relation.py | File | 15.2 KB | 0644 |
|
| ax_utilities_role.py | File | 91.79 KB | 0644 |
|
| ax_utilities_state.py | File | 11.63 KB | 0644 |
|
| ax_value.py | File | 6.83 KB | 0644 |
|
| bookmarks.py | File | 11.95 KB | 0644 |
|
| braille.py | File | 74.03 KB | 0644 |
|
| braille_generator.py | File | 55.79 KB | 0644 |
|
| braille_rolenames.py | File | 10.23 KB | 0644 |
|
| brlmon.py | File | 6.53 KB | 0644 |
|
| brltablenames.py | File | 7.3 KB | 0644 |
|
| bypass_mode_manager.py | File | 4.79 KB | 0644 |
|
| caret_navigation.py | File | 19.51 KB | 0644 |
|
| chat.py | File | 32.03 KB | 0644 |
|
| clipboard.py | File | 20.45 KB | 0644 |
|
| cmdnames.py | File | 61.77 KB | 0644 |
|
| colornames.py | File | 39.22 KB | 0644 |
|
| debug.py | File | 3.95 KB | 0644 |
|
| debugging_tools_manager.py | File | 10.69 KB | 0644 |
|
| event_manager.py | File | 36.07 KB | 0644 |
|
| flat_review.py | File | 48.89 KB | 0644 |
|
| flat_review_finder.py | File | 20.2 KB | 0644 |
|
| flat_review_presenter.py | File | 45.94 KB | 0644 |
|
| focus_manager.py | File | 11.52 KB | 0644 |
|
| generator.py | File | 67.07 KB | 0644 |
|
| guilabels.py | File | 56.38 KB | 0644 |
|
| highlighter.py | File | 6.95 KB | 0644 |
|
| input_event.py | File | 30.05 KB | 0644 |
|
| input_event_manager.py | File | 35.66 KB | 0644 |
|
| keybindings.py | File | 24.87 KB | 0644 |
|
| keynames.py | File | 9.55 KB | 0644 |
|
| label_inference.py | File | 19.77 KB | 0644 |
|
| learn_mode_presenter.py | File | 14.72 KB | 0644 |
|
| liveregions.py | File | 25.77 KB | 0644 |
|
| mathsymbols.py | File | 88.65 KB | 0644 |
|
| messages.py | File | 152.28 KB | 0644 |
|
| mouse_review.py | File | 23.34 KB | 0644 |
|
| notification_presenter.py | File | 14.17 KB | 0644 |
|
| object_navigator.py | File | 13.24 KB | 0644 |
|
| object_properties.py | File | 33.86 KB | 0644 |
|
| orca.py | File | 9.83 KB | 0644 |
|
| orca_gtkbuilder.py | File | 5.42 KB | 0644 |
|
| orca_gui_navlist.py | File | 6.51 KB | 0644 |
|
| orca_gui_prefs.py | File | 141.9 KB | 0644 |
|
| orca_gui_profile.py | File | 3.98 KB | 0644 |
|
| orca_i18n.py | File | 3.13 KB | 0644 |
|
| orca_modifier_manager.py | File | 13.76 KB | 0644 |
|
| orca_platform.py | File | 1.43 KB | 0644 |
|
| phonnames.py | File | 2.76 KB | 0644 |
|
| pronunciation_dict.py | File | 2.55 KB | 0644 |
|
| script.py | File | 11.11 KB | 0644 |
|
| script_manager.py | File | 14.68 KB | 0644 |
|
| script_utilities.py | File | 64.21 KB | 0644 |
|
| settings.py | File | 10.66 KB | 0644 |
|
| settings_manager.py | File | 27.13 KB | 0644 |
|
| sleep_mode_manager.py | File | 5.04 KB | 0644 |
|
| sound.py | File | 5.51 KB | 0644 |
|
| sound_generator.py | File | 48.88 KB | 0644 |
|
| speech.py | File | 8.87 KB | 0644 |
|
| speech_and_verbosity_manager.py | File | 27.71 KB | 0644 |
|
| speech_generator.py | File | 163.53 KB | 0644 |
|
| speechdispatcherfactory.py | File | 24.68 KB | 0644 |
|
| speechserver.py | File | 8 KB | 0644 |
|
| spellcheck.py | File | 18.11 KB | 0644 |
|
| spiel.py | File | 25.59 KB | 0644 |
|
| ssml.py | File | 6.71 KB | 0644 |
|
| structural_navigation.py | File | 77.63 KB | 0644 |
|
| system_information_presenter.py | File | 7.44 KB | 0644 |
|
| table_navigator.py | File | 29.78 KB | 0644 |
|
| text_attribute_names.py | File | 27.31 KB | 0644 |
|
| where_am_i_presenter.py | File | 21.59 KB | 0644 |
|