
    g
f2                         d Z dZdZdZdZdZddlmZ ddlm	Z	 ddl
mc mc mZ ddlmZ dd	lmZ  G d
 dej$                        Zy)zCustom script for Eclipse.z$Id$z
$Revision$z$Date$z-Copyright (c) 2010 Informal Informatica LTDA.LGPL    N)AXText)AXUtilitiesc                   X     e Zd Z fdZd fd	Z fdZ fdZ fdZd Z fdZ	 xZ
S )	Scriptc                 6    t         |   |       g d| _        y)z/Creates a new script for the given application.)UpDownLeftRightPage_Up	Page_DownHomeEndN)super__init__movementKeys)selfapp	__class__s     B/usr/lib/python3/dist-packages/orca/scripts/apps/Eclipse/script.pyr   zScript.__init__*   s    /    c                    t         
|   ||       | j                  j                         \  }}|| j                  v ry|xs |j
                  }t        j                  |      ryd}|dv rt        j                  |      \  }}}	|	dkD  }|r| j                  |	       n| j                  |       | j                  |       y)zUpdates braille and outputs speech for the event.source or the
        otherObj. Overridden here so that we can give more feedback to user.
        NF)TabISO_Left_Tabr   )r   _presentTextAtNewCaretPosition	utilitieslastKeyAndModifiersr   sourcer   is_single_liner   get_selected_text	sayPhrasesayLine_saveLastTextPosition)r   eventotherObjlastKeymodsobjhasSelectiontextstartOffset	endOffsetr   s             r   r   z%Script._presentTextAtNewCaretPosition0   s     	.uh? ::<d'''&%,,%%c*
 --+1+C+CC+H(D+y$q=LNN3Y7LL""3'r   c                    t        j                  |j                        r/t        j                         j                  ||j                         yt        j                  |j                        r\| j                  j                         rB| j                  j                         r(d}t        j                  t        j                  |d       yt        | 9  |       y)z)Callback for focus: accessibility events.Nz!ECLIPSE: Ignoring event. In menu.T)r   is_panelr   focus_manager
getManagerset_locus_of_focusis_textr    lastInputEventWasUnmodifiedArrowinMenudebugprintMessage
LEVEL_INFOr   onFocus)r   r%   msgr   s      r   r9   zScript.onFocusR   s    
 -$$&99%Nu||,~~>>@~~$$&5Cu//d;r   c                    | j                   j                  |j                        rg|j                  dk(  r-|j                  t        j                  |j                        k(  ryt        | !  |       | j                  |j                         yy)zCalled whenever text is inserted into an object. Overridden here
        so that we can avoid speaking text when caret moves after new text
        is inserted.

        Arguments:
        - event: the Event
        r   N)
r   
isTextArear   detail1detail2r   get_character_countr   onTextInsertedr$   r   r%   r   s     r   r@   zScript.onTextInsertedd   sm     >>$$U\\2}}!emmv7Q7QRWR^R^7_&_ G"5)&&u||4 3r   c                 Z    t         |   |       | j                  |j                         y)zCalled whenever text is deleted from an object.  Overridden here
        so that we can avoid speaking text when caret moves after new text
        is deleted.

        Arguments:
        - event: the Event
        N)r   onTextDeletedr$   r   rA   s     r   rC   zScript.onTextDeletedw   s$     	e$""5<<0r   c                     | j                   j                  |      r&| j                  |t        j                  |             y y N)r   r<   _saveLastCursorPositionr   get_caret_offset)r   r)   s     r   r$   zScript._saveLastTextPosition   s4    >>$$S)((f.E.Ec.JK *r   c                     t        j                  |j                        s t        j                  |j                        syt        |   |       y)z;Callback for object:selection-changed accessibility events.N)r   
is_focusedr   is_menu_barr   onSelectionChangedrA   s     r   rK   zScript.onSelectionChanged   s;    
 &&u||48O8OPUP\P\8]"5)r   rE   )__name__
__module____qualname__r   r   r9   r@   rC   r$   rK   __classcell__)r   s   @r   r   r   (   s-    / (D$5&1L* *r   r   )__doc____id____version____date____copyright____license__
orca.debugr6   orca.focus_managerr0   orca.scripts.toolkits.gtkscriptstoolkitsgtkorca.ax_textr   orca.ax_utilitiesr   r    r   r   <module>r_      sI   * !?  * ' '  )i*SZZ i*r   