
    g
f                         d Z dZdZdZdZdZddlZ ej                  dd	       dd
lm	Z	 ddl
mc mc mZ ddlmZ ddlmZ ddlmZ  G d dej(                        Zy)z'Provides a custom script for gcalctool.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2008 Sun Microsystems Inc.LGPL    NAtspiz2.0)r   )AXObject)AXUtilitiesc                       e Zd Zd Zd Zd Zy)Scriptc                 `    t         j                  j                  | |       d| _        d| _        y)zCreates a new script for the given application.  Callers
        should use the getScript factory method instead of calling
        this constructor directly.

        Arguments:
        - app: the application to create a script for.
        N)gtkr   __init___resultsDisplay_statusLine)selfapps     D/usr/lib/python3/dist-packages/orca/scripts/apps/gcalctool/script.pyr   zScript.__init__-   s(     	

D#&#    c                 x   | j                   r-| j                  r!t        j                  j	                  | |       yt        j                  |j                        t        j                  j                  k7  r!t        j                  j	                  | |       yt        j                  |j                  t        j                        | _         | j                   s| j                  t        j                          d }t        j                  |j                  |      | _        t        j                  j	                  | |       y)zCalled whenever one of gcalctool's toplevel windows is activated.

        Arguments:
        - event: the window activated Event
        Nc                     t        j                  |       t        j                  j                  k(  xr t        j                  |        S )N)r   get_roler   RoleTEXTr   is_editable)xs    r   isStatusLinez.Script.onWindowActivated.<locals>.isStatusLineN   s4    $$Q'5::??:];CZCZ[\C]?]]r   )r   r   r
   r   onWindowActivatedr   r   sourcer   r   FRAMEfind_descendantr   
is_editbarpresentMessagemessagesCALCULATOR_DISPLAY_NOT_FOUND)r   eventr   s      r   r   zScript.onWindowActivated;   s     D$4$4JJ((u5U\\*ejj.>.>>JJ((u5'77kF\F\]## E EF	^ $33ELL,O

$$T51r   c                    | j                   j                  |j                  | j                        r5| j	                  | j                   j                  | j                               yt        j                  j                  | |       y)zCalled whenever text is inserted into gcalctool's text display.

        Arguments:
        - event: the text inserted Event
        N)		utilitiesisSameObjectr   r   r   displayedTextr
   r   onTextInserted)r   r"   s     r   r'   zScript.onTextInsertedT   s\     >>&&u||T5E5EF < <T=M=M NO

!!$.r   N)__name__
__module____qualname__r   r   r'    r   r   r   r   +   s     22/r   r   )__doc____id____version____date____copyright____license__girequire_versiongi.repositoryr   orca.scripts.toolkits.gtkscriptstoolkitsr
   orca.messagesr    orca.ax_objectr   orca.ax_utilitiesr   r   r+   r   r   <module>r;      sZ   ( .? 	   7E "  ' '   # )4/SZZ 4/r   