
    g
ft                          d Z dZdZdZdZdZddlZddlZddlm	Z	 ddl
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 da G d dej&                        Zd Zd Zedk(  r e        yy)z'Displays a GUI for the Orca Find windowz$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.LGPL    N)Gtk   )find)	guilabels)orca_gtkbuilder)
orca_state)orca_platform)script_managerc                   T    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)OrcaFindGUIc                     t         j                  j                  | ||       d| _        d| _        d| _        d| _        d| _        d| _        d| _	        y)zInitialize the Orca configuration GUI.

        Arguments:
        - fileName: name of the GtkBuilder file.
        - windowName: name of the component to get from the GtkBuilder file.
        N)
r   GtkBuilderWrapper__init__activeScriptcaseSensitivematchEntireWordsearchBackwardssearchString
startAtTop
windowWrap)selffileName
windowNames      4/usr/lib/python3/dist-packages/orca/orca_gui_find.pyr   zOrcaFindGUI.__init__,   sR     	))224:N !##     c                     d| _         d| _        d| _        d| _        d| _        d| _        t        j                         j                         | _	        y )N FT)
r   r   r   r   r   r   r   
getManagergetActiveScriptr   )r   s    r   initzOrcaFindGUI.init=   sJ    $"$*557GGIr   c                    | j                  d      }t        j                  j                  }|dk(  rt	        j
                         }|j                  |       	 | j                  d      }|j                  t        j                  j                         |j                  dt        |j                                      t        j                  j                  r | j                  d      j                  d       | j                  d      j                  t        j                  j                         | j                  d      j                  t        j                  j                          | j                  d      j                  t        j                  j"                         | j                  d	      j                  t        j                  j$                         y
# t&        $ r Y y
w xY w)z_Show the Orca Find dialog. This assumes that the GUI has
        already been created.
        
findDialogr   searchForEntrytopRadioButtonTmatchCaseCheckboxmatchEntireWordCheckboxwrapAroundCheckboxsearchBackwardsCheckboxN)
get_widgetr	   lastInputEvent	timestampr   get_current_event_timepresent_with_timeset_textsearchQueryr   select_regionlenget_textr   
set_activer   r   r   r   	Exception)r   r#   tsr$   s       r   showGUIzOrcaFindGUI.showGUIH   sg   
 __\2
&&007++-B$$R(	!__-=>N##J$:$:$G$GH((C0G0G0I,JK%%00 01<<TBOO/0;;&&446OO56AA&&668OO01<<&&113OO56AA&&668 		s   E=G 	G! G!c                     |j                         | _        | j                  d      }t        | j                        dkD  r|j	                  d       y|j	                  d       y)zSignal handler for the "changed" signal for the
           searchForEntry GtkEntry widget. The user has changed
           the string to be searched for.

        Arguments:
        - widget: the component that generated the signal.
        
findButtonr   TFN)r3   r   r*   r2   set_sensitive)r   widgetr9   s      r   searchForEntryChangedz!OrcaFindGUI.searchForEntryChangedi   sP     #OO-__\2
t  !A%$$T*$$U+r   c                     |j                         r1|j                         t        j                  k(  rd| _        yd| _        yy)a  Signal handler for the "toggled" signal for the
           currentLocationRadioButton or topRadioButton GtkRadioButton
           widgets. The user has toggled the starting point for the search.

        Arguments:
        - widget: the component that generated the signal.
        FTN)
get_active	get_labelr   FIND_START_AT_CURRENT_LOCATIONr   r   r;   s     r   startingPointChangedz OrcaFindGUI.startingPointChangedy   s:     !Y%M%MM"'"&	 r   c                 .    |j                         | _        y)zSignal handler for the "toggled" signal for the
           matchCaseCheckbox GtkCheckButton widget. The user has
           [un]checked the "Match Case" checkbox.

        Arguments:
        - widget: the component that generated the signal.
        N)r>   r   rA   s     r   matchCaseCheckedzOrcaFindGUI.matchCaseChecked   s     $..0r   c                 .    |j                         | _        y)a  Signal handler for the "toggled" signal for the
           matchEntireWordCheckbox GtkCheckButton widget.
           The user has [un]checked the "Match entire word"
           checkbox.

        Arguments:
        - widget: the component that generated the signal.
        N)r>   r   rA   s     r   matchEntireWordCheckedz"OrcaFindGUI.matchEntireWordChecked         &002r   c                 .    |j                         | _        y)a  Signal handler for the "toggled" signal for the
           searchBackwardsCheckbox GtkCheckButton widget.
           The user has [un]checked the "Search backwards"
           checkbox.

        Arguments:
        - widget: the component that generated the signal.
        N)r>   r   rA   s     r   searchBackwardsCheckedz"OrcaFindGUI.searchBackwardsChecked   rG   r   c                 .    |j                         | _        y)zSignal handler for the "toggled" signal for the
           wrapAroundCheckbox GtkCheckButton widget. The user has
           [un]checked the "Wrap around" checkbox.

        Arguments:
        - widget: the component that generated the signal.
        N)r>   r   rA   s     r   wrapAroundCheckedzOrcaFindGUI.wrapAroundChecked   s     !++-r   c                 B    | j                  d      j                          y)zSignal handler for the "clicked" signal for the cancelButton
           GtkButton widget. The user has clicked the Cancel button.
           Hide the dialog.

        Arguments:
        - widget: the component that generated the signal.
        r#   N)r*   hiderA   s     r   closeButtonClickedzOrcaFindGUI.closeButtonClicked   s     	%**,r   c                    t        j                         t        _        | j                  t        j                  _        | j
                  t        j                  _        | j                  t        j                  _        | j                  t        j                  _        | j                  t        j                  _        | j                  t        j                  _	        d| j                  _        | j                  d      j                          y)a  Signal handler for the "clicked" signal for the findButton
           GtkButton widget. The user has clicked the Find button.
           Call the method to begin the search.

        Arguments:
        - widget: the component that generated the signal.
        Tr#   N)r   SearchQueryr	   r0   r   r   r   r   r   r   r   findCommandRunr*   destroyrA   s     r   findButtonClickedzOrcaFindGUI.findButtonClicked   s     "&!1!1!3
.2.?.?
+151E1E
./3/A/A
,151E1E
.,0OO
),0OO
)+/( 	%--/r   c                     da y)zSignal handler for the "destroyed" signal for the findDialog
           GtkWindow widget. Reset OS to None.

        Arguments:
        - widget: the component that generated the signal.
        N)OSrA   s     r   findDialogDestroyedzOrcaFindGUI.findDialogDestroyed   s	     r   N)__name__
__module____qualname__r   r!   r7   r<   rB   rD   rF   rI   rK   rN   rS   rV    r   r   r   r   *   s@    "	JB, '	1
3
3	.	-00
r   r   c                      t         s^t        j                  j                  t        j
                  t        j                  dd      } t        | d      a t         j                          t         j                          y )Nuizorca-find.uir#   )
rU   ospathjoinr
   datadirpackager   r!   r7   )uiFiles    r   
showFindUIrc      sP     m33+33",. .
	JJLr   c                      t        j                  t         j                  d       t                t	        j
                          t        j                  d       y )Nr   r   )locale	setlocaleLC_ALLrc   r   mainsysexitrZ   r   r   rh   rh      s/    
V]]B'LHHJHHQKr   __main__)__doc____id____version____date____copyright____license__r]   ri   gi.repositoryr   re   r   r   r   r   r	   r
   r   rU   r   r   rc   rh   rW   rZ   r   r   <module>rs      sy   ( .? 	 
        	y/33 yv zF r   