Mini Shell
3
�2[�N � @ s
d Z dZdZdZdZdZddlZdd lmZ dd
lm Z ddlm
Z
ddlmZ dd
lmZ ddlm
Z
ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ e
j� Zej� Zej� ZG dd� d�ZdS )a$ Each script maintains a set of key bindings, braille bindings, and
AT-SPI event listeners. The key bindings are an instance of
KeyBindings. The braille bindings are also a dictionary where the
keys are BrlTTY command integers and the values are instances of
InputEventHandler. The listeners field is a dictionary where the keys
are AT-SPI event names and the values are function pointers.
Instances of scripts are intended to be created solely by the
script manager.
This Script class is not intended to be instantiated directly.
Instead, it is expected that subclasses of the Script class will be
created in their own module. The module defining the Script subclass
is also required to have a 'getScript(app)' method that returns an
instance of the Script subclass. See default.py for an example.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.ZLGPL� N� )�braille_generator)�debug)�
event_manager)�
formatting)�label_inference)�keybindings)�
orca_state)�script_manager)�script_utilities)�settings)�settings_manager)�sound_generator)�speech_generator)�structural_navigation)� bookmarks)�tutorialgeneratorc @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Zd:d;� Z d<d=� Z!d>d?� Z"d@dA� Z#dBdC� Z$dDdE� Z%dFdG� Z&dHdI� Z'dJdK� Z(dLS )M�Scriptz:The specific focus tracking scripts for applications.
c C s\ || _ |rNy| j j| _W qT ttfk
rJ d}tjtj|d� d| _Y qTX nd| _| jd| j d 7 _| j� | _ d| _
| j� | _| j
� | _| j� | _| j� | _| j� | _| j� | _| j� | _i | _i | _| j� | j� | _| j� | _| j � | _!| j"� | _#| j$� | _%| j&� | _'i | _(i | _)| j*� | _+| j,� | _-d| _.d| _/d| j }tjtj|d� dS ) z�Creates a script for the given application, if necessary.
This method should not be called by anyone except the
script manager.
Arguments:
- app: the Python Accessible application to create a script for
z*ERROR: Could not get name of script app %sT�defaultz (module=�)FzSCRIPT: %s initializedN)0�app�name�LookupError�RuntimeErrorr �println�
LEVEL_INFO�
__module__�getListeners� listeners�presentIfInactive�getUtilitiesZ utilities�getLabelInferenceZlabelInference�getStructuralNavigation�structuralNavigation�getCaretNavigationZcaretNavigation�getBookmarksr �getLiveRegionManagerZliveRegionManager�getChatZchatZinputEventHandlersZpointOfReference�setupInputEventHandlers�getKeyBindings�keyBindings�getBrailleBindings�brailleBindings�
getFormattingr �getBrailleGeneratorZbrailleGenerator�getSoundGeneratorZsoundGenerator�getSpeechGeneratorZspeechGenerator�generatorCache�
eventCache�
getSpellCheckZ
spellcheck�getTutorialGeneratorZtutorialGeneratorZfindCommandRun�_lastCommandWasStructNav)�selfr �msg� r8 �/usr/lib/python3.6/script.py�__init__E sH
zScript.__init__c C s i S )z�Sets up the AT-SPI event listeners for this script.
Returns a dictionary where the keys are AT-SPI event names
and the values are script methods.
r8 )r6 r8 r8 r9 r ~ s zScript.getListenersc C s dS )zlDefines InputEventHandler fields for this script that can be
called by the key and braille bindings.Nr8 )r6 r8 r8 r9 r( � s zScript.setupInputEventHandlersc C s t j� S )zkDefines the key bindings for this script.
Returns an instance of keybindings.KeyBindings.
)r �KeyBindings)r6 r8 r8 r9 r) � s zScript.getKeyBindingsc C s t j� S )z9Returns the toolkit-specific keybindings for this script.)r r; )r6 r8 r8 r9 �getToolkitKeyBindings� s zScript.getToolkitKeyBindingsc C s t j� S )z=Returns the application-specific keybindings for this script.)r r; )r6 r8 r8 r9 �getAppKeyBindings� s zScript.getAppKeyBindingsc C s i S )z�Defines the braille bindings for this script.
Returns a dictionary where the keys are BrlTTY commands and the
values are InputEventHandler instances.
r8 )r6 r8 r8 r9 r+ � s zScript.getBrailleBindingsc C s
t j| �S )z/Returns the formatting strings for this script.)r Z
Formatting)r6 r8 r8 r9 r- � s zScript.getFormattingc C s
t j| �S )z7Returns the braille generator for this script.
)r ZBrailleGenerator)r6 r8 r8 r9 r. � s zScript.getBrailleGeneratorc C s
t j| �S )z,Returns the sound generator for this script.)r ZSoundGenerator)r6 r8 r8 r9 r/ � s zScript.getSoundGeneratorc C s
t j| �S )z6Returns the speech generator for this script.
)r ZSpeechGenerator)r6 r8 r8 r9 r0 � s zScript.getSpeechGeneratorc C s
t j| �S )z8Returns the tutorial generator for this script.
)r ZTutorialGenerator)r6 r8 r8 r9 r4 � s zScript.getTutorialGeneratorc C s dS )z2Returns the 'chat' class for this script.
Nr8 )r6 r8 r8 r9 r'