
    ODg                         d dl mZmZmZmZ ddlmZ ddlmZ d dl	Z	 e	j                  dd      j                  Zd	Z G d
 dej                  ej                  ej                        Zy)    )GObjectGtkXviewerPeasGtk   )PythonConsole)PythonConsoleConfigWidgetNzxviewer-pluginsT)fallbacka  
    <ui>
        <menubar name="MainMenu">
            <menu name="ToolsMenu" action="Tools">
                <separator/>
                <menuitem name="PythonConsole" action="PythonConsole"/>
                <separator/>
            </menu>
        </menubar>
    </ui>
    c                   n    e Zd Z ej                  ej                        ZdZd Z	d Z
d Zd Zd Zd Zy)	PythonConsolePlugin)typeNc                 ^    t         j                  j                  |        d | _        d| _        y Nr   )r   Object__init__console_windowui_id)selfs    2/usr/lib/xviewer/plugins/pythonconsole/__init__.pyr   zPythonConsolePlugin.__init__7   s#    %"
    c                 Z   | j                   j                         }t        j                  d      | _        | j                  j                  dd t        d      d d | j                  fg| j                          |j                  | j                  d       |j                  t              | _        y )Nr   )namezP_ython Consoler   )windowget_ui_managerr   ActionGroupaction_groupadd_actions_
console_cbinsert_action_groupadd_ui_from_string_UI_STRr   r   
ui_managers     r   do_activatezPythonConsolePlugin.do_activate<   s    [[//1
OOA%% $doo(? '@AE	N&&t'8'8!<227;
r   c                 .   | j                   j                         }|j                  | j                         d| _        |j	                  | j
                         d | _        |j                          | j                  | j                  j                          y y r   )	r   r   	remove_uir   remove_action_groupr   ensure_updater   destroyr#   s     r   do_deactivatez!PythonConsolePlugin.do_deactivateD   sx    [[//1
TZZ(
&&t'8'89   "*'') +r   c                    | j                   st        j                         | _         t        t        t
        |d      }|j                  dd       |j                  dd       | j                   j                  t        d             | j                   j                  |       | j                   j                  d| j                         | j                   j                          | j                   j                  |       | j                   j                  d	       n| j                   j                          | j                   j!                          y )
N)__builtins__r   r   )	namespaceiX  i  zGprint("You can access the main window through 'window' :\n%s" % window)FzPython Consolezdelete-eventT)r   r   Windowr   r-   r   set_size_requesteval	set_titler   addconnecton_delete_cbshow_allset_transient_forset_destroy_with_parent
grab_focus)r   actionr   consoles       r   r   zPythonConsolePlugin.console_cbN   s   """%**,D#,=D<B1D EG $$S#.LL 89>@))!,<*=>##G,''8I8IJ((*11&977=((*&&(r   c                 2    |j                          d | _        y N)r*   r   )r   r   events      r   r5   z PythonConsolePlugin.on_delete_cbb   s    "r   c                 h    t        | j                  j                               }|j                         S r=   )r	   plugin_infoget_data_dirconfigure_widget)r   config_widgets     r   do_create_configure_widgetz.PythonConsolePlugin.do_create_configure_widgetf   s*    1$2B2B2O2O2QR--//r   )__name__
__module____qualname__r   propertyr   r/   r   r   r   r%   r+   r   r5   rD    r   r   r   r   1   s=     W7>>2FL
<*)(#0r   r   )gi.repositoryr   r   r   r   r;   r   configr	   gettexttranslationr   r"   r   WindowActivatableConfigurabler   rI   r   r   <module>rP      sX   8 9 8 " - G)D9AA
80'..'*C*CWEYEY 80r   