
    g
f                         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c mc mZ ddlmZ ddlmZ dd	lmZ d
dlmZ d
dlmZ d
dlmZ  G d dej8                  ej8                        Zy)zCustom script for Evolution.z$Id$z
$Revision$z$Date$zLCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2013 Igalia, S.L.LGPL    N)AXObject)AXUtilities   BrailleGeneratorSpeechGenerator	Utilitiesc                   ^     e Zd Z fdZd Zd Zd Zd Zd Z fdZ	d Z
d	 Zd
 Zd Z xZS )Scriptc                     t        j                         j                  d      $t        j                         j                  dd       t        |   |       d| _        y)zCreates a new script for the given application.

        Arguments:
        - app: the application to create a script for.
        sayAllOnLoadNF)settings_manager
getManager
getSetting
setSettingsuper__init__presentIfInactive)selfapp	__class__s     D/usr/lib/python3/dist-packages/orca/scripts/apps/evolution/script.pyr   zScript.__init__4   sM     &&(33NCK'')44^UK!&    c                     t        |       S Nr   r   s    r   getBrailleGeneratorzScript.getBrailleGeneratorA   s    %%r   c                     t        |       S r   r	   r   s    r   getSpeechGeneratorzScript.getSpeechGeneratorD   s    t$$r   c                     t        |       S r   r   r   s    r   getUtilitieszScript.getUtilitiesG   s    r   c                     |j                   j                  d      r t        j                  |j                        ry| j
                  j                  |j                        }t        j                  |      syy)a  Returns True if the given event is one that should cause this
        script to become the active script.  This is only a hint to
        the focus tracking manager and it is not guaranteed this
        request will be honored.  Note that by the time the focus
        tracking manager calls this method, it thinks the script
        should become active.  This is an opportunity for the script
        to say it shouldn't.
        zfocus:TF)type
startswithr   is_menusource	utilitiestopLevelObject	is_active)r   eventwindows      r   isActivatableEventzScript.isActivatableEventJ   sV     ::  *{/B/B5<</P..u||<$$V,r   c                      y)zWhether or not speech should be stopped prior to setting the
        locusOfFocus in onActiveDescendantChanged.

        Arguments:
        - event: the Event

        Returns True if speech should be stopped; False otherwise.
        F r   r-   s     r   #stopSpeechOnActiveDescendantChangedz*Script.stopSpeechOnActiveDescendantChanged]   s     r   c                    |j                   s(d}t        j                  t        j                  |d       y| j                  j                  |j                        rt        j                  |j                         rVd}t        j                  t        j                  |d       t        j                         j                  ||j                          yd}t        j                  t        j                  |d       t        j                         j                  ||j                         yt        j                         j                         }t        j                  |      r]t        j                  |t        j                         }|7||j                  k7  r(d}t        j                  t        j                  |d       yt        j"                  |j                  |j                         }|]||j                   k7  rNd|g}t        j$                  t        j                  |d       t        j                         j                  ||       yd}t        j                  t        j                  |d       t&        | Q  |       y)	zCCallback for object:active-descendant-changed accessibility events.z'EVOLUTION: Ignoring event. No any_data.TNz>EVOLUTION: Source is compose autocomplete with selected child.zAEVOLUTION: Source is compose autocomplete without selected child.z8EVOLUTION: Event is from a different tree or tree table.z5EVOLUTION: Bogus any_data suspected. Setting focus toz7EVOLUTION: Passing event to super class for processing.)any_datadebugprintMessage
LEVEL_INFOr*   isComposeAutocompleter)   r   is_selectedfocus_managerr   set_locus_of_focusget_locus_of_focusis_table_cellr   find_ancestoris_tree_or_tree_tableget_active_descendant_checkedprintTokensr   onActiveDescendantChanged)r   r-   msgfocustablechildtokensr   s          r   rC   z Script.onActiveDescendantChangedo   s    ~~;Cu//d;>>//=&&u~~6V""5#3#3S$?((*==eU^^T
  Z""5#3#3S$?((*==eU\\R((*==?$$U+**5+2S2STE Uell%:P""5#3#3S$?66u||U^^T%..!8MuUFe..=$$&99%GG5++S$7)%0r   c                      y)z<Callback for object:state-changed:busy accessibility events.Nr1   r2   s     r   onBusyChangedzScript.onBusyChanged   s    r   c                 b   | j                   j                  |j                        ryt        j                  |j                        rJ| j                   j                  |j                        }t        j                         j                  ||       yt        j                  j                  | |       y)z)Callback for focus: accessibility events.N)r*   isWebKitGtkr)   r   is_layered_panerealActiveDescendantr;   r   r<   gtkr   onFocus)r   r-   objs      r   rP   zScript.onFocus   sy     >>%%ell3 &&u||4..55ellCC$$&99%E

4'r   c                     | j                   j                  |j                        ryt        j                  j                  | |       y)z;Callback for object:property-change:accessible-name events.N)r*   rL   r)   rO   r   onNameChangedr2   s     r   rS   zScript.onNameChanged   s1     >>%%ell3

  u-r   c                     t        j                  |j                        r t        j                  |j                        syt        j
                  j                  | |       y)z;Callback for object:selection-changed accessibility events.N)r   is_combo_boxr)   
is_focusedrO   r   onSelectionChangedr2   s     r   rW   zScript.onSelectionChanged   s?     ##ELL1))%,,7

%%dE2r   )__name__
__module____qualname__r   r    r"   r$   r/   r3   rC   rJ   rP   rS   rW   __classcell__)r   s   @r   r   r   2   s;    '&%&
$$1L(.3r   r   )__doc____id____version____date____copyright____license__
orca.debugr6   orca.focus_managerr;   orca.scripts.toolkits.gtkscriptstoolkitsrO   orca.scripts.toolkits.WebKitGtk	WebKitGtkorca.settings_managerr   orca.ax_objectr   orca.ax_utilitiesr   braille_generatorr   speech_generatorr
   script_utilitiesr   r   r1   r   r   <module>ro      se   * #2  * ' ' 3 3 0 # ) / - 'E3Yszz E3r   