Mini Shell
3
�2[4 � @ sl d Z dZdZdZdZddlZddlZddlmZ dd lm Z dd
l
mZmZ G dd� d�Z
e
� Zd
d� ZdS )z$Id$z
$Revision$z$Date$zCopyright (c) 2011. Orca Team.ZLGPL� N� )�debug)�
orca_state)�apps�toolkitsc @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d
� Zdd� Zd
d� Z ddd�Z
d dd�Zdd� Zd!dd�Z
d"dd�Zdd� Zdd� ZdS )#�
ScriptManagerc C s� t jt jdd� i | _i | _i | _tj| _t j| _
d | _ddddg| _ddd d
ddd
d�| _
| jd d� tjjd�| _d| _t jt jdd� d S )NzSCRIPT MANAGER: InitializingTzorca-scriptszorca.scriptszorca.scripts.appszorca.scripts.toolkitsZMozillaZThunderbirdZempathyZ gcalctoolZmetacityZBansheeznotification-daemon)ZFirefoxZIcedovezempathy-chatzgnome-calculatorZmarcoZNereidzmate-notification-daemon�__init__r FzSCRIPT MANAGER: Initialized)r �println�
LEVEL_INFO�
appScripts�toolkitScripts�
customScriptsr �__all__�_appModulesr �_toolkitModules�_defaultScript�_scriptPackages� _appNames�setActiveScript�pyatspiZRegistryZ
getDesktop�_desktop�_active)�self� r �$/usr/lib/python3.6/script_manager.pyr $ s,
zScriptManager.__init__c C sN t jt jdd� | jd�| _| jj� | j| jd� d| _t jt jdd� dS )z-Called when this script manager is activated.zSCRIPT MANAGER: ActivatingTN�activatezSCRIPT MANAGER: Activated)r r r
� getScriptr ZregisterEventListenersr r )r r r r r @ s
zScriptManager.activatec C s^ t jt jdd� | jr | jj� d| _| jdd� i | _i | _i | _d| _ t jt jdd� dS )z/Called when this script manager is deactivated.zSCRIPT MANAGER: DectivatingTN�
deactivateFzSCRIPT MANAGER: Deactivated)
r r r
r ZderegisterEventListenersr r r r
r )r r r r r J s
zScriptManager.deactivatec s� y|dk o|j dk}W n4 ttfk
rJ d}d| }tjtj|d� Y nX |sTdS |j jd�d � t| jj � �}� fdd �|D �}|r�| jj
|d �� n6x4| j| jfD ]$}� fd
d �|D �}|r�|d � P q�W d|j � f }tjtj|d� � S )zAReturns the module name of the script to use for application app.N� FzERROR: %s no longer existsT�.r c s g | ]}|j � � j � kr|�qS r )�lower)�.0�n)�namer r �
<listcomp>j s z/ScriptManager.getModuleName.<locals>.<listcomp>c s g | ]}|j � � j � kr|�qS r )r )r! r"