
    g
fuK                       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
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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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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d#lm$Z$ dd$l%m&Z& 	 ddl'Z'dd%l)m*Z* e're*sdZ' e+ e,d&            \
  Z-Z.Z/Z0Z1Z2Z3Z4Z5Z6 e+ e,d'            \  Z7Z8Z9Z: e+ e,d(            \  Z;Z< e+ e,d'            \  Z=Z>Z?Z@ e+ e,d)            \  ZAZBZCZDZEZFZG e+ e,d*            \  ZHZIZJZKZLZMZNZOZPZQZRZSZTZUZVZW G d+ d,ej                        ZYy# e($ r dZ'Y w xY w)-z4Displays a GUI for the user to set Orca preferences.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.LGPL    NAtspiz2.0)r   )Gdk)GLib)Gtk)GObject)Pango   )acss)debug)event_manager)	guilabels)messages)orca)orca_gtkbuilder)orca_gui_profile)
orca_state)script_manager)settings)settings_manager)input_event)keybindings)pronunciation_dict)braille)speech)speechserver)text_attribute_names)AXObject)	tablesdir
               c                      e Zd Zd Zd Zd Zd Zd{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d Zd Zd Zd Zd Zd Z	 d|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&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/d}d.Z0d/ Z1d{d0Z2d1 Z3d2 Z4d3 Z5d4 Z6d|d5Z7d6 Z8d7 Z9d8 Z:d~d:Z;	 d~d;Z<d< Z=d{d=Z>d> Z?d? Z@d@ ZAdA ZBdB ZCdC ZDdD ZEdE ZFdF ZGdG ZHdH ZIdI ZJdJ ZKdK ZLdL ZMdM ZNdN ZOdO ZPdP ZQdQ ZRdR ZSdS ZTdT ZUdU ZVdV ZWdW ZXdX ZYdY ZZdZ Z[d[ Z\d\ Z]d] Z^d^ Z_d_ Z`d` Zada Zbdb Zcdc Zddd Zede Zfdf Zgdg Zhdh Zidi Zjdj Zkdk Zldl Zmdm Zndn Zodo ZpddpZqdq Zrdr Zsds Ztdt Zudu Zvdv Zwdw Zxdx Zydy Zzdz Z{y9)OrcaSetupGUIc                    t         j                  j                  | ||       || _        ddg| _        d| _        d| _        d| _        d| _        d| _	        d| _
        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        g | _        d| _        d| _        d| _        d| _         d| _!        d| _"        d| _#        d| _$        d| _%        d| _&        d| _'        d| _(        d| _)        d| _*        i | _+        i | _,        d| _-        d| _.        d| _/        g | _0        d| _1        y)a  Initialize the Orca configuration GUI.

        Arguments:
        - fileName: name of the GtkBuilder file.
        - windowName: name of the component to get from the GtkBuilder file.
        - prefsDict: dictionary of preferences to use during initialization
        DefaultdefaultNF)2r   GtkBuilderWrapper__init__	prefsDict_defaultProfile	bbindingscellRendererTextdefaultVoicedisableKeyGrabPrefgetTextAttributesViewhyperlinkVoiceinitializingSpeech	kbindingskeyBindingsModelkeyBindView
newBindingpendingKeyBindingsplaneCellRendererTextpronunciationModelpronunciationViewscreenHeightscreenWidthspeechFamiliesChoicespeechFamiliesChoicesspeechFamiliesModelspeechLanguagesChoicespeechLanguagesChoicesspeechLanguagesModelspeechFamiliesspeechServersChoicespeechServersChoicesspeechServersModelspeechSystemsChoicespeechSystemsChoicesspeechSystemsModelsystemVoiceuppercaseVoicewindowworkingFactories	savedGain
savedPitch	savedRate_isInitialSetupselectedFamilyChoicesselectedLanguageChoicesprofilesComboprofilesComboModelstartingProfileCombo_capturedKeyscript)selffileName
windowNamer,   s       5/usr/lib/python3/dist-packages/orca/orca_gui_prefs.pyr+   zOrcaSetupGUI.__init__a   s    	))224:N" )95 $ "&%)"""& $"&%)""&!% $(!%)"#' %)"&*#$(! #' $(!"&#' $(!"&" $$%'"')$!"&$(!    c                    || _         	 t        j                         j                  d      }|t        j
                     }	 |t        j                  j                     | _
        	 |t        j                  j                     | _        	 |t        j                  j                     | _        | j                  d      | _        | j                   j#                         r:| j                   j#                         D ]  }| j                   j%                  |        t'        j(                  t*        j,                  t*        j,                  t*        j,                  t*        j,                  t*        j,                  t*        j,                  t*        j,                  t*        j,                  t*        j.                  t*        j.                  
      | _        t'        j2                         | _        t'        j2                         | _        | j6                  j9                  dt:        j<                  j>                         t'        j@                  d| j4                  tB              }|jE                  d	       |jG                  d
       |jI                  tB               | j                   jK                  |       t'        j@                  tL        jN                  | j6                  tP              }|jE                  d	       |jS                  d       |jI                  tP               | j                   jK                  |       t'        j@                  d| j4                  tT              }|jG                  d
       |jE                  d	       |jI                  tT               | j                   jK                  |       t'        j@                  d| j4                  tV              }|jG                  d
       |jE                  d	       |jI                  tV               | j                   jK                  |       t'        j@                  d| j4                  tX              }|jE                  d	       |jG                  d
       |jI                  tX               | j                   jK                  |       t'        j@                  d| j4                  tZ              }|jE                  d	       |jG                  d
       |jI                  tZ               | j                   jK                  |       t'        j@                  d| j4                  t\              }|jE                  d	       |jG                  d
       |jI                  t\               | j                   jK                  |       t'        j2                         }|j_                  d| j`                  | j0                         |j_                  d| jb                         |j_                  d| jd                  | j0                  tT        tV        tX        tZ        tf               t'        j@                  tL        jh                  |tf        tj              }|jE                  d	       |jI                  t\               | j                   jK                  |       t'        jl                         }|j_                  d| jn                  | j0                  tp               t'        j@                  tL        jr                  |tp        tj              }|jE                  d	       |jI                  tp               | j                   jK                  |       t'        jl                         }|j9                  dd
       t'        j@                  d|tj              }|jG                  d
       |jE                  d	       |jI                  tj               | j                   jK                  |       | ju                          | j                  d      | _;        | jy                          | j{                  | j                  d            | _>        | j{                  | j                  d            | _?        | j{                  | j                  d            | _@        | j{                  | j                  d            | _A        | j                          t        j                  j                  t        j                         j                                | _G        | j                   j                         }|r^t'        j                  t        j                  | j                   j                              }| j                  d       j                  ||       | j                          y!# t        $ r i }Y 	Aw xY w# t        $ r d| _
        Y 	5w xY w# t        $ r d| _        Y 	)w xY w# t        $ r d| _        Y 	w xY w)"zInitialize the Orca configuration GUI. Read the users current
        set of preferences and set the GUI state to match. Setup speech
        support and populate the combo box lists on the Speech Tab pane
        accordingly.
        voices      $@      @      I@keyBindingsTreeview	ellipsizeHandler)textTFi|  z
Mod.Mask 1z	Use Mod.1Key1ClickCount1OldText1zediting-startedzediting-cancelededited)rh   editabletoggled)activeactivatablerp   Modified)ro   orcaSetupWindowspeechSystemsspeechServersspeechLanguagesrE   )labelnotebookN)OrZ   r   
getManager
getSettingr   DEFAULT_VOICEKeyErrorr   ACSSGAINrP   AVERAGE_PITCHrQ   RATErR   
get_widgetr7   get_columnsremove_columnr   	TreeStorer   TYPE_STRINGTYPE_BOOLEANr6   CellRendererTextr:   r/   set_propertyr	   EllipsizeModeENDTreeViewColumnHANDLERset_resizableset_visibleset_sort_column_idappend_columnr   KB_HEADER_FUNCTIONDESCRIPset_min_width	MOD_MASK1	MOD_USED1KEY1CLICK_COUNT1OLDTEXT1connect
editingKeyeditingCanceledKey	editedKeyTEXT1KB_HEADER_KEY_BINDINGEDITABLECellRendererTogglekeyModifiedToggleMODIFKB_MODIFIED_populateKeyBindingsrN   _setKeyEchoItems_initComboBoxrK   rH   rD   rA   _initSpeechStateospathexistsgetPrefsDirrS   getAppPreferencesGUILabelr   get_nameappappend_page_initGUIState)	r[   rZ   ra   r0   columnrendererTextrendererToggleappPagerv   s	            r^   initzOrcaSetupGUI.init   s    
	%002==hGF!("8"89L	")$))..9DN	"*499+B+BCDO	")$))..9DN  ??+@A'')**668 7  ..v67 !$    
!" &)%9%9%;" # 4 4 6**;8K8K8O8OP ##I$($>$>)02 	T"5!!!'*&&v. ##I$@$@$($9$9)02 	T"S!!!'*&&v. ##L$($>$>)24 	5!T"!!),&&v. ##K$($>$>)24 	5!T"!!),&&v. ##F$($>$>)-/ 	T"5!!!$'&&v. ##M$($>$>)57 	T"5!!!,/&&v. ##J$($>$>)13 	T"5!!!(+&&v. ++-.!__!22	4 	/!44	6X!^^!22&	4u	N
 ##I$C$C$0).-57
 	T"!!(+&&v. //1y#55#44$	& ##I$9$9$2+008:
 	T"!!%(&&v. //1##M59##J$2+35 	5!T"!!(+&&v. 	!!#oo&78 **4???+KL 	 **4???+KL 	 **4??;L+MN 	! **4??;K+LM 	  /::<HHJKK 	 ++224IIH$5$5dkkoo$FGEOOJ'33GUC}  	L	  	"!DN	"  	"!DO	"  	"!DN	"sG   6e2  "f #"f "f2 2f ffff/.f/2ggc                     |t         k(  r| j                  }|S |t        k(  r| j                  }|S |t        k(  r| j
                  }|S |t        k(  r| j                  }|S | j                  }|S )zReturn the ACSS value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM

        Returns the voice dictionary for the given voice type.
        DEFAULTr0   	UPPERCASErM   	HYPERLINKr3   SYSTEMrL   )r[   	voiceType	voiceACSSs      r^   _getACSSForVoiceTypez!OrcaSetupGUI._getACSSForVoiceTypek  s     ))I  )#++I  )#++I  & ((I  ))Ir_   c                 `   dt         _        | j                  | j                        }| j	                  | j
                        }| j                  j                  | j                  j                                t        j                         j                  | j                  | j                  ||       y)z7Write out the user's generic Orca preferences.
        N)r   speechSystemOverridegetModelDictr;   getKeyBindingsModelDictr6   r,   updaterZ   getPreferencesFromGUIr   rx   saveSettings)r[   pronunciationDictkeyBindingsDicts      r^   writeUserPreferencesz!OrcaSetupGUI.writeUserPreferences  s     )-% --d.E.EF66t7L7LMdkk??AB##%224;;&*nn&7&5	7r_   c                 P   |t         k(  r| j                  }n|t        k(  r | j                  }||vrn|sy| j                  }n^|t        k(  r | j
                  }||vrE|sy| j                  }n5|t        k(  r | j                  }||vr|sy| j                  }n| j                  }||v r||   S y)a  Look for the value of the given key in the voice dictionary
           for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM
        - key: the key to look for in the voice dictionary.
        - useDefault: if True, and the key isn't found for the given voice
                      type, the look for it in the default voice dictionary
                      as well.

        Returns the value of the given key, or None if it's not set.
        Nr   )r[   r   key
useDefaultvoices        r^   _getKeyValueForVoiceTypez%OrcaSetupGUI._getKeyValueForVoiceType  s     %%E)#''E%!)))#''E%!))& $$E%!))%%E%<:r_   c                     d}| j                  |t        j                  j                        }|r9t        j
                  j                  |v r|t        j
                  j                     }|S )zGets the name of the voice family for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM

        Returns the name of the voice family for the given voice type,
        or None if not set.
        N)r   r   r|   FAMILYr   VoiceFamilyNAME)r[   r   
familyNamefamilys       r^   _getFamilyNameForVoiceTypez'OrcaSetupGUI._getFamilyNameForVoiceType  sW     
..y$)):J:JKl..33v= 8 8 = =>Jr_   c                 n   | j                  |t        j                  j                  d      }| j	                  |      }|ru||t
        j                  j                  <   ||t
        j                  j                  <   ||t
        j                  j                  <   ||t
        j                  j                  <   ni |t        j                  j                  <   ||t        j                  j                     t
        j                  j                  <   ||t        j                  j                     t
        j                  j                  <   ||t        j                  j                     t
        j                  j                  <   ||t        j                  j                     t
        j                  j                  <   d|d<   y)aE  Sets the name of the voice family for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM
        - name: the name of the voice family to set.
        - language: the locale of the voice family to set.
        - dialect: the dialect of the voice family to set.
        FTestablishedN)r   r   r|   r   r   r   r   r   LANGDIALECTVARIANT)r[   r   namelanguagedialectvariantr   r   s           r^   _setFamilyNameForVoiceTypez'OrcaSetupGUI._setFamilyNameForVoiceType  sE    ..y/3yy/?/?/46 --i8	48F<++0014<F<++0017>F<++3347>F<++334*,Idii&&'IMIdii&&'(@(@(E(EFIQIdii&&'(@(@(E(EFLSIdii&&'(@(@(H(HILSIdii&&'(@(@(H(HI#'	- r_   c                 V    | j                  |t        j                  j                        S )zGets the speaking rate value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM

        Returns the rate value for the given voice type, or None if
        not set.
        )r   r   r|   r   r[   r   s     r^   _getRateForVoiceTypez!OrcaSetupGUI._getRateForVoiceType       ,,Y		GGr_   c                 j    | j                  |      }||t        j                  j                  <   d|d<   y)zSets the speaking rate value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM
        - value: the rate value to set.
        Tr   N)r   r   r|   r   r[   r   valuer   s       r^   _setRateForVoiceTypez!OrcaSetupGUI._setRateForVoiceType  0     --i8	$)	$))..!#'	- r_   c                 V    | j                  |t        j                  j                        S )zGets the pitch value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM

        Returns the pitch value for the given voice type, or None if
        not set.
        )r   r   r|   r~   r   s     r^   _getPitchForVoiceTypez"OrcaSetupGUI._getPitchForVoiceType   s(     ,,Y-1YY-D-DF 	Fr_   c                 j    | j                  |      }||t        j                  j                  <   d|d<   y)zSets the pitch value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM
        - value: the pitch value to set.
        Tr   N)r   r   r|   r~   r   s       r^   _setPitchForVoiceTypez"OrcaSetupGUI._setPitchForVoiceType  s2     --i8	-2	$))))*#'	- r_   c                 V    | j                  |t        j                  j                        S )zGets the volume (gain) value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM

        Returns the volume (gain) value for the given voice type, or
        None if not set.
        )r   r   r|   r}   r   s     r^   _getVolumeForVoiceTypez#OrcaSetupGUI._getVolumeForVoiceType  r   r_   c                 j    | j                  |      }||t        j                  j                  <   d|d<   y)zSets the volume (gain) value for the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM
        - value: the volume (gain) value to set.
        Tr   N)r   r   r|   r}   r   s       r^   _setVolumeForVoiceTypez#OrcaSetupGUI._setVolumeForVoiceType&  r   r_   c                 @   | j                  |      }| j                  |       | j                  |      }|!| j                  d      j	                  |       n | j                  d      j	                  d       | j                  |      }|!| j                  d      j	                  |       n | j                  d      j	                  d       | j                  |      }|!| j                  d      j	                  |       y| j                  d      j	                  d       y)zSets the family, rate, pitch and volume GUI components based
        on the given voice type.

        Arguments:
        - voiceType: one of DEFAULT, UPPERCASE, HYPERLINK, SYSTEM
        N	rateScalerd   
pitchScalerc   volumeScalerb   )r   _setSpeechFamiliesChoicer   r   	set_valuer   r   )r[   r   r   ratepitchvolumes         r^   _setVoiceSettingsForVoiceTypez*OrcaSetupGUI._setVoiceSettingsForVoiceType3  s     44Y?
%%j1((3OOK(2248OOK(2248**95OOL)33E:OOL)33C8,,Y7OOM*44V<OOM*44T:r_   c                    t        | j                        dk(  ryd}d}| j                  D ]D  }|t        j                  j                     }||k(  s'|t        j                  j
                     }|t        j                  j                     }|r	|dz   |z   }n|}d}	| j                  D ]  }
|
|k(  r| j                  d      j                  |	       | j                  |	   | _
        d}| j                          d}	| j                  D ]a  }|t        j                  j                     }||k(  r8| j                  d      j                  |	       | j                  |	   | _        d} n|	dz  }	c  n|	dz  }	  n |s]d	|g}t        j                  t        j                   |d       | j                  d      j                  d       | j                  d   | _
        |r	| j"                  | j$                  <   |s]d
|g}t        j                  t        j                   |d       | j                  d      j                  d       | j                  d   | _        |r&	| j&                  | j$                  | j                  f<   yy)zSets the active item in the families ("Person:") combo box
        to the given family name.

        Arguments:
        - familyName: the family name to use to set the active combo box item.
        r   NF-ru   TrE   r
   <PREFERENCES DIALOG: Could not find speech language match forz:PREFERENCES DIALOG: Could not find speech family match for)lenrE   r   r   r   r   r   rC   r   
set_activerB   _setupFamiliesr@   r?   r   printTokens
LEVEL_INFOrU   rF   rT   )r[   r   languageSet	familySetr   r   langr   r   ilanguageChoicefamilyChoicetokenss                r^   r   z%OrcaSetupGUI._setSpeechFamiliesChoiceP  sp    t""#q(	)) "	F,22778Dz!l66;;< !9!9!A!AB#czG3H#H&*&A&A N%1(9:EEaH595P5PQR5S2&*++-,0,F,F #L#/0H0H0M0M#ND#z1 $0@ A L LQ O<@<V<VWX<Y 9,0	 %FA# FA), E"	H TV`aFe..=OO-.99!<)-)D)DQ)GD&EFD(()A)ABRT^_Fe..=OO,-88;(,(B(B1(ED%23 &&t'?'?..(/ 0 r_   c                    | j                  d      }|j                  d       | j                  j                          | j                  }d}g | _        | j                  D ]  }|t        j                  j                     }|t        j                  j                     }|r	|dz   |z   }n|}||k7  rP|t        j                  j                     }| j
                  j                  |       | j                  j                  ||f       |dz  } |j                  | j                         |dk(  r^dt        |      dg}	t        j                  t        j                   |	d       t        j"                  t        j$                         d| _        yd}
| j(                  | j                  f| j*                  v r%| j*                  | j(                  | j                  f   }
| j                  d      j-                  |
       y)	a  Gets the list of voice variants for the current speech server and
        current language.
        If there are variants, get the information associated with
        each voice variant and add an entry for it to the variants
        GtkComboBox list.
        rE   Nr   r   r
   z"No speech family was available for.T)r   	set_modelrA   clearrB   r@   rE   r   r   r   r   r   appendstrr   r   LEVEL_SEVERE
printStackLEVEL_FINESTr?   rF   rT   r   )r[   comboboxcurrentLanguager  r   r  r   r   r   r  selectedIndexs              r^   r   zOrcaSetupGUI._setupFamilies  s    ??#344   &&(44%'")) 	F,22778D\55==>G#:/?*,22778D&&--f5$$++QI6FA	" 	43346:C<PRUVFe00&$?U//0(,D% $$d&@&@A--. 66t7O7O..8/ 0M 	()44]Cr_   c                    t        | j                        dk(  ryd}d}| j                  D ]D  }||k(  r8| j                  d      j                  |       | j                  |   | _        d} n|dz  }F |s]d|g}t        j                  t
        j                  |d       | j                  d      j                  d       | j                  d   | _        |r|| j                  | j                  <   | j                          y)zSets the active item in the languages ("Language:") combo box
        to the given language name.

        Arguments:
        - languageName: the language name to use to set the active combo box item.
        r   NFru   Tr
   r   )r   rC   r   r   rB   r   r   r  rU   rF   r   )r[   languageNamevalueSetr  r   r  s         r^   _setSpeechLanguagesChoicez&OrcaSetupGUI._setSpeechLanguagesChoice  s     t**+q033 	H<' 12==a@-1-H-H-K*FA	 TVbcFe..=OO-.99!<)-)D)DQ)GD&EFD(()A)ABr_   c                 `   | j                  d      }|j                  d       | j                  j                          | j                  j                         | _        g | _        t        | j                        dk(  rOt        j                  t        j                  d       t        j                  t        j                         d| _        yi }d}| j                  D ]  }|t        j                   j"                     }|t        j                   j$                     }||f|v rDd|||f<   |r	|dz   |z   }n|}|}|dk(  rd}| j                  j'                  |       | j                  j'                  ||f       |d	z  } d}	| j                  | j(                  v r| j(                  | j                     }	|j                  | j                         | j                  d      j+                  |	       | j,                  r| j                  |	   | _        | j/                          | j                  d
      }
t0        j2                  t0        j4                  t0        j6                  t0        j8                  g}| j;                  |
|       |
j+                  t<               |
j?                         }| jA                  |       y)zGets the list of voices for the current speech server.
        If there are families, get the information associated with
        each voice family and add an entry for it to the families
        GtkComboBox list.
        ru   Nr   zNo speech voice was available.Tr    zdefault languager
   voiceTypesCombo)!r   r  rD   r  rF   getVoiceFamiliesrE   rC   r   r   printMessager  r  r  rB   r   r   r   r   r  rU   r   r4   r   r   SPEECH_VOICE_TYPE_DEFAULTSPEECH_VOICE_TYPE_UPPERCASESPEECH_VOICE_TYPE_HYPERLINKSPEECH_VOICE_TYPE_SYSTEMpopulateComboBoxr   
get_activer   )r[   r  doner  r   r  r   r   msgr  comboBoxtypesr   s                r^   _setupVoiceszOrcaSetupGUI._setupVoices  s^    ??#454 !!'')"66GGI&(#t""#q(u113STU//0)-D&)) 	F,22778D\55==>GW~%!%Dg#:/ Cby(''..x8%%,,aX6FA)	4 ##t'C'CC 889Q9QRM4445)*55mD"")-)D)D])SD& ??#45446666335 	h.G$'')	**95r_   c                    t        | j                        dk(  ry|st        j                         }d}d}| j                  D ]E  }||j                         k(  r+| j	                  d      j                  |       || _        d} n|dz  }G |s]d|g}t        j                  t        j                  |d       | j	                  d      j                  d       | j                  d   | _        | j                          y)a  Sets the active item in the speech servers combo box to the
        given server.

        Arguments:
        - serversChoices: the list of available speech servers.
        - serverInfo: the speech server to use to set the active combo
        box item.
        r   NFrt   Tr
   z:PREFERENCES DIALOG: Could not find speech server match for)r   rG   r   getInfor   r   rF   r   r   r  r(  )r[   
serverInfor  r  serverr  s         r^   _setSpeechServersChoicez$OrcaSetupGUI._setSpeechServersChoice2  s     t(()Q.
 )J// 	FV^^--0;;A>+1(FA	 RT^_Fe..=OOO,77:'+'@'@'CD$r_   c                 p   | j                  d      }|j                  d       | j                  j                          | j                  j
                  j                         | _        t        | j                        dk(  rt        j                  t        j                  d       t        j                  t        j                         d| _        g | _        d| _        g | _        d| _        |j                  | j                         yd}| j                  D ]7  }|j'                         d   }| j                  j)                  ||f       |dz  }9 |j                  | j                         t*        j,                  r"| j/                  t0        j2                  dg       y| j/                  | j4                  d          y)a  Gets the list of speech servers for the current speech factory.
        If there are servers, get the information associated with each
        speech server and add an entry for it to the speechServers
        GtkComboBox list.  Set the current choice to be the first item.
        rt   Nr   Speech not available.r
   r)   speechServerInfo)r   r  rH   r  rI   SpeechServergetSpeechServersrG   r   r   r  r  r  r  rF   rC   rB   r@   r?   r*  r  r   r   r-  r   DEFAULT_SYNTHESIZERr,   )r[   r  r  r,  r   s        r^   _setupSpeechServersz OrcaSetupGUI._setupSpeechServersW  sk    ???34 %%'((55FFH 	!t(()Q.u113JKU//0'+D$*,D')-D&)+D&(,D%t667// 	F>>#A&D##**At95FA	
 	4223(((()*G*G)ST((8J)KLr_   c                 "   |j                  d      }t        | j                        dk(  rd| _        yd}d}| j                  D ]\  }|j                  }|j                  |      r8| j                  d      j                  |       | j                  |   | _        d} n|dz  }^ |s]d|g}t        j                  t        j                  |d       | j                  d      j                  d       | j                  d   | _        | j                          y)	a  Set the active item in the speech systems combo box to the
        given system name.

        Arguments:
        - factoryChoices: the list of available speech factories (systems).
        - systemName: the speech system name to use to set the active combo
        box item.
        'r   NFrs   Tr
   z:PREFERENCES DIALOG: Could not find speech system match for)stripr   rJ   rI   __name__endswithr   r   r   r   r  r4  )r[   
systemNamer  r  speechSystemr   r  s          r^   _setSpeechSystemsChoicez$OrcaSetupGUI._setSpeechSystemsChoicez  s     %%c*
t(()Q.'+D$ 55 	L((D}}Z(0;;A>+/+D+DQ+G(FA	 RT^_Fe..=OOO,77:'+'@'@'CD$  "r_   c                    | j                  d      }|j                  d       | j                  j                          g | _        |D ]C  }	 |j
                  j                         }t        |      r| j                  j                  |       E g | _        t        | j                        dk(  rt        j                  t        j                  d       t        j                   t        j                         d| _        g | _        d| _        g | _        d| _        g | _        d| _        |j                  | j                         yd}| j                  D ]Y  }| j                  j                  |       |j
                  j1                         }| j                  j                  ||f       |dz  }[ |j                  | j                         t2        j4                  r | j7                  t2        j4                         y| j8                  d   r| j7                  | j8                  d          yd| _        y# t        $ r' t        j                  t        j                         Y w xY w)zSets up the speech systems combo box and sets the selection
        to the preferred speech system.

        Arguments:
        -factories: the list of known speech factories (working or not)
        rs   Nr   r/  r
   speechServerFactory)r   r  rK   r  rO   r1  r2  r   r  	Exceptionr   printExceptionr  rJ   r  r  r  rI   rG   rF   rC   rB   r@   r?   getFactoryNamer   r   r<  r,   )r[   	factoriesr  factoryserversr  workingFactoryr   s           r^   _setupSpeechSystemsz OrcaSetupGUI._setupSpeechSystems  s    ???34 %%' "  	9G9!..??Aw<))009		9 %'!t$$%*u113JKU//0'+D$(*D%'+D$*,D')-D&)+D&(,D%t667"33 	N%%,,^<!..==?D##**At95FA		 	4223(((()F)FG^^12((8M)NO'+D$=  9$$U%7%789s   
A H**,IIc                    | j                   d   }t        j                  |j                  t        j
                              | _        t        j                  |j                  t        j                              | _        t        j                  |j                  t        j                              | _
        t        j                  |j                  t        j                              | _        t        j                         j                         }t!        |      dk(  s| j                   j                  dd      s9g | _        d| _        g | _        d| _        g | _        d| _        g | _        d| _        y	 t3        j4                          d| _        | j;                  |       d| _        y# t6        $ r; g | _        d| _        g | _        d| _        g | _        d| _        g | _        d| _        Y yw xY w)z2Initialize the various speech components.
        ra   r   enableSpeechTNF)r,   r   r|   getr   rz   r0   UPPERCASE_VOICErM   HYPERLINK_VOICEr3   SYSTEM_VOICErL   r   rx   getSpeechServerFactoriesr   rO   rI   rG   rF   rC   rB   r@   r?   r   r   r?  r4   rF  )r[   ra   rB  s      r^   r   zOrcaSetupGUI._initSpeechState  s    )"ii

83I3I(JK"ii

83K3K(LM"ii

83K3K(LM"ii

83H3H(IJ %//1JJL	y>Qdnn&8&8&N$&D!'+D$(*D%'+D$*,D')-D&)+D&(,D%	KKM #'  +"'  		$&D!'+D$(*D%'+D$*,D')-D&)+D&(,D%		s   2F& &AG*)G*c                    |j                         }|j                  d       | j                  j                  j	                  |      \  }}| j                  j                  j	                  t        j                         j                  d            \  }}	t        dt        |            D ]  }
t        dt        |            D ]  }t        j                  ||
   | j                        }t        j                  |||
      | j                        }|||   t           k(  s\|j                  |      }|j                  |t        |       |j                  |t        |       |j                  |t         |       |r4|j                  |      }|j                  |
      }|j#                  ||          |j                  |       y)a  Given a set of spoken text attributes, update the model used by the
        text attribute tree view.

        Arguments:
        - view: the text attribute tree view.
        - setAttributes: the list of spoken text attributes to update.
        - state: the state (True or False) that they all should be set to.
        - moveToTop: if True, move these attributes to the top of the list.
        NallTextAttributesr   )	get_modelr  rZ   	utilitiesstringToKeysAndDictr   rx   ry   ranger   r   getTextAttributeNamer   get_iterr   	IS_SPOKENVALUEmove_before)r[   viewsetAttributesstate	moveToTopmodelattrListattrDictallAttrListallAttrDictr  r   localizedKeylocalizedValuethisIter	otherIters                   r^   _setSpokenTextAttributesz%OrcaSetupGUI._setSpokenTextAttributes   s|     t ;;  44]C 	8%)[[%:%:%N%N'')445HI&K"k q#h-( 	Aa[!12 3HHQK .!5!J!JXa[)4;;"85;t#44$~~d3HOOHdLAOOHi?OOHe^D #(>>$#7$)NN1$5	))(I>	" 	ur_   c                 j   |j                         }|j                  d       | j                  j                  j	                  |      \  }}| j                  j                  j	                  t        j                         j                  d            \  }}t        dt        |            D ]x  }	t        dt        |            D ]^  }
t        j                  ||	   | j                        }|||
   t           k(  s6|j                  |
      }|j                  |t        |        x z |j                  |       y)aF  Given a set of brailled text attributes, update the model used
        by the text attribute tree view.

        Arguments:
        - view: the text attribute tree view.
        - setAttributes: the list of brailled text attributes to update.
        - state: the state (True or False) that they all should be set to.
        NrO  r   )rP  r  rZ   rQ  rR  r   rx   ry   rS  r   r   rT  r   rU  r   IS_BRAILLED)r[   rY  rZ  r[  r]  r^  r_  r`  ra  r  r   rb  rd  s                r^   _setBrailledTextAttributesz'OrcaSetupGUI._setBrailledTextAttributes'  s     t KK!!55mD 	8%)[[%:%:%N%N ++-889LM&O"k q#h-( 	Aa[!12 3HHQK .5;t#44$~~d3HOOHk5A	 	ur_   c                 L    | j                   j                  j                  |      S )a  Converts the given Atk attribute name into the application's
        equivalent. This is necessary because an application or toolkit
        (e.g. Gecko) might invent entirely new names for the same text
        attributes.

        Arguments:
        - attribName: The name of the text attribute

        Returns the application's equivalent name if found or attribName
        otherwise.
        )rZ   rQ  getAppNameForAttribute)r[   attributeNames     r^   _getAppNameForAttributez$OrcaSetupGUI._getAppNameForAttributeD  s     {{$$;;MJJr_   c                    | j                   j                         }d}d}|j                  d      }t        d|      D ]  }||   t           }t        j                  |      }| j                  |      }||   t           }t        j                  |      }	||   t           r||dz   |	z   dz   z  }||   t           s}||dz   |	z   dz   z  } || j                  d<   || j                  d<   y)a  The user has updated the text attribute list in some way. Update
        the "enabledSpokenTextAttributes" and "enabledBrailledTextAttributes"
        preference strings to reflect the current state of the corresponding
        text attribute lists.
        r  Nr   :z; enabledSpokenTextAttributesenabledBrailledTextAttributes)r2   rP  iter_n_childrenrS  r   r   getTextAttributeKeyrm  rW  rV  rh  r,   )
r[   r]  spokenAttrStrbrailledAttrStrnoRowsr   rb  r   rc  r   s
             r^   _updateTextDictEntryz!OrcaSetupGUI._updateTextDictEntryS  s     **446&&t,!V$ 	<D ;t,L&::<HC
 ..s3C"4[/N(<<^LET{9%sU!2T!99T{;'39u#4t#;;	<" 9F45:I67r_   c                     | j                  d      }|j                  |j                                |j                         | j                  d<   y )NcontractionTableGridenableContractedBrailler   set_sensitiver#  r,   r[   checkboxgrids      r^   contractedBrailleToggledz%OrcaSetupGUI.contractedBrailleToggledr  s@    568..014<4G4G4I01r_   c                 n    |j                         }|j                         }||   d   | j                  d<   y )Nr
   brailleContractionTable)rP  get_active_iterr,   )r[   r  r]  myIters       r^   contractionTableComboChangedz)OrcaSetupGUI.contractionTableComboChangedw  s6    ""$))+49&M!4D01r_   c                     | j                  d      }|j                  |j                                 |j                         | j                  d<   y )NflashMessageDurationGridflashIsPersistentr{  r}  s      r^   flashPersistenceToggledz$OrcaSetupGUI.flashPersistenceToggled|  sC    9:x22445.6.A.A.C*+r_   c                     |j                  |      }|j                  |t        ||   t                   | j                          y)ag  The user has toggled the state of one of the text attribute
        checkboxes to be spoken. Update our model to reflect this, then
        update the "enabledSpokenTextAttributes" preference string.

        Arguments:
        - cell: the cell that changed.
        - path: the path of that cell.
        - model: the model that the cell is part of.
        N)rU  setrV  rw  r[   cellr   r]  rd  s        r^   textAttributeSpokenToggledz'OrcaSetupGUI.textAttributeSpokenToggled  s:     >>$'		(I5;y+A'AB!!#r_   c                     |j                  |      }|j                  |t        ||   t                   | j                          y)ak  The user has toggled the state of one of the text attribute
        checkboxes to be brailled. Update our model to reflect this,
        then update the "enabledBrailledTextAttributes" preference string.

        Arguments:
        - cell: the cell that changed.
        - path: the path of that cell.
        - model: the model that the cell is part of.
        N)rU  r  rh  rw  r  s        r^   textAttributeBrailledToggledz)OrcaSetupGUI.textAttributeBrailledToggled  s:     >>$'		(KU4[-E)EF!!#r_   c                 t    |j                  |      }|j                  |t        |       | j                          y)a  The user has edited the value of one of the text attributes.
        Update our model to reflect this, then update the
        "enabledSpokenTextAttributes" and "enabledBrailledTextAttributes"
        preference strings.

        Arguments:
        - cell: the cell that changed.
        - path: the path of that cell.
        - new_text: the new text attribute value string.
        - model: the model that the cell is part of.
        N)rU  r  rW  rw  r[   r  r   new_textr]  rd  s         r^   textAttrValueEditedz OrcaSetupGUI.textAttrValueEdited  s.     >>$'		(E8,!!#r_   c                 &   | j                   j                         \  }}|rrt        | j                   j                               }t	        d|      D ]?  }| j                   j                  |      }||k(  s$| j                   j                  |        y yy)zSet the search column in the text attribute tree view
        depending upon which column the user currently has the cursor in.
        r   N)r2   
get_cursorr   r   rS  
get_columnset_search_columnr[   widgetr   focusColumn	noColumnsr  cols          r^   textAttrCursorChangedz"OrcaSetupGUI.textAttrCursorChanged  s    
 #88CCE{D66BBDEI1i( 00;;A>#%..@@C	 r_   c                 b
   | j                  d      | _        | j                  j                         r:| j                  j                         D ]  }| j                  j                  |        t	        j
                  t        j                  t        j                  t        j                  t        j                        }| j                  j                  j                  t        j                         j                  d            \  }}t        dt!        |            D ]  }|j#                         }t%        j&                  ||   | j                        }t%        j&                  |||      | j                        }|j)                  |t*        |       |j)                  |t,        d       |j)                  |t.        d       |j)                  |t0        |        | j                  j3                  |       t	        j4                  t6        j8                        }|j;                  d       |j=                  d       t	        j>                         }	|jA                  |	d       |jC                  |	dt*               | j                  jE                  |d       t6        jF                  }
t	        j4                  |
      }t	        jH                         }	|jK                  |	d       |jC                  |	dt,               |	jM                  d	| jN                  |       | j                  jE                  |d
       |jQ                          t6        jR                  }t	        j4                  |      }t	        jH                         }	|jK                  |	d       |jC                  |	dt.               |	jM                  d	| jT                  |       | j                  jE                  |d       |jQ                          t	        j4                  t6        jV                        }t	        j>                         }	|	jY                  dd       |jA                  |	d       |jC                  |	dt0               |	jM                  d| jZ                  |       | j                  jE                  |d       | j]                  | j                  t        j                         j                  d      dd       | j_                  | j                  t        j                         j                  d      d       | j                  jM                  d| j`                         y)a  Create the text attributes tree view. The view is the
        textAttributesTreeView GtkTreeView widget. The view will consist
        of a list containing three columns:
          IS_SPOKEN - a checkbox whose state indicates whether this text
                      attribute will be spoken or not.
          NAME      - the text attribute name.
          VALUE     - if set, (and this attributes is enabled for speaking),
                      then this attribute will be spoken unless it equals
                      this value.
        textAttributesTreeViewrO  r   F   Trh   ro   rn   r
   r"   rm   rl   r!   rp  rq  cursor_changedN)1r   r2   r   r   r   	ListStorer   r   r   rZ   rQ  rR  r   rx   ry   rS  r   r  r   rT  r   r   rV  rh  rW  r  r   r   TEXT_ATTRIBUTE_NAMEr   r   r   pack_endadd_attributeinsert_columnPRESENTATION_SPEAKr   
pack_startr   r  clickedPRESENTATION_MARK_IN_BRAILLEr  PRESENTATION_PRESENT_UNLESSr   r  rf  ri  r  )r[   r   r]  r`  ra  r  rd  rb  rc  rendererspeakAttrColumnLabelmarkAttrColumnLabels               r^   _createTextAttributesTreeViewz*OrcaSetupGUI._createTextAttributesTreeView  s'    &*__5M%N"%%11344@@B A**88@A g11%22%22%113 &*[[%:%:%N%N'')445HI&K"kq#k*+ 		=A||~H/DDA-L1FFKN+T[[:NOOHdL9OOHi7OOHk59OOHe^<		= 	"",,U3 ##I$A$ABS!T"'')$'Xvt4""00;  );;##$89))+(E*Xx;88	  	""00; (DD##$78))+(E*Xx=::	  	""00; ##I$I$IJ'')j$/$'Xvu54#;#;UC""00; 	%%&&'')445RS$	 	''&&'')445TU	 	""**+;+/+E+E	Gr_   c                 T    |j                  |      }|j                  |t        |       y)ai  The user has edited the value of one of the actual strings in
        the pronunciation dictionary. Update our model to reflect this.

        Arguments:
        - cell: the cell that changed.
        - path: the path of that cell.
        - new_text: the new pronunciation dictionary actual string.
        - model: the model that the cell is part of.
        N)rU  r  ACTUALr  s         r^   pronActualValueEditedz"OrcaSetupGUI.pronActualValueEdited&  s"     >>$'		(FH-r_   c                 T    |j                  |      }|j                  |t        |       y)as  The user has edited the value of one of the replacement strings
        in the pronunciation dictionary. Update our model to reflect this.

        Arguments:
        - cell: the cell that changed.
        - path: the path of that cell.
        - new_text: the new pronunciation dictionary replacement string.
        - model: the model that the cell is part of.
        N)rU  r  REPLACEMENTr  s         r^   pronReplacementValueEditedz'OrcaSetupGUI.pronReplacementValueEdited4  s"     >>$'		(K2r_   c                 N    t        j                         j                  d|        y)zBCallback for the pronunciation tree's focus-{in,out}-event signal.usePronunciationDictionaryN)r   rx   
setSetting)r[   r  event	isFocuseds       r^   pronunciationFocusChangez%OrcaSetupGUI.pronunciationFocusChangeB  s!     	##%001MS\}]r_   c                 &   | j                   j                         \  }}|rrt        | j                   j                               }t	        d|      D ]?  }| j                   j                  |      }||k(  s$| j                   j                  |        y yy)zSet the search column in the pronunciation dictionary tree view
        depending upon which column the user currently has the cursor in.
        r   N)r<   r  r   r   rS  r  r  r  s          r^   pronunciationCursorChangedz'OrcaSetupGUI.pronunciationCursorChangedG  s    
 #44??A{D22>>@AI1i( ,,77:#%**<<Q?	 r_   c                    | j                  d      | _        | j                  j                         r:| j                  j                         D ]  }| j                  j                  |        t	        j
                  t        j                  t        j                        }| j                  j                  sB| j                  j                  d      d   }t        j                         j                  |      }nt        j                  }t!        |j#                               D ]8  }|j%                         }	 ||   \  }}|j)                  |t*        |t,        |       : | j                  j/                  |       t	        j0                  t2        j4                        }|j7                  d       |j9                  d       t	        j:                         }	|	j=                  dd       |j?                  |	d       |jA                  |	dt*               |	jC                  d| jD                  |       | j                  jG                  |d	       t	        j0                  t2        jH                        }t	        j:                         }	|	j=                  dd       |j?                  |	d       |jA                  |	dt,               |	jC                  d| jJ                  |       | j                  jG                  |d       || _&        | j                  jC                  d
| jN                         | j                  jC                  d| jP                  d       | j                  jC                  d| jP                  d       y# t&        $ r |}||   }Y Aw xY w)a8  Create the pronunciation dictionary tree view. The view is the
        pronunciationTreeView GtkTreeView widget. The view will consist
        of a list containing two columns:
          ACTUAL      - the actual text string (word).
          REPLACEMENT - the string that is used to pronounce that word.
        pronunciationTreeViewactiveProfiler
   r  Trm   rh   rl   r   r  focus_in_eventfocus_out_eventFN))r   r<   r   r   r   r  r   r   rZ   r   r,   rI  r   rx   getPronunciationsr   sortedkeysr  r?  r  r  r  r  r   r   DICTIONARY_ACTUAL_STRINGr   r   r   r   r  r  r   r  r  DICTIONARY_REPLACEMENT_STRINGr  r;   r  r  )
r[   r   r]  _profilepronDictpronKeyrd  actualreplacementr  s
             r^   _createPronunciationTreeViewz)OrcaSetupGUI._createPronunciationTreeViewU  s    "&1H!I!!--/00<<> =&&44V<= g11%113 {{~~))/:1=H'224FFxPH)<<Hhmmo. 	0G||~H0&.w&7# IIhf!;0	0 	((/ ##I$F$FGS!T"'')j$/$'Xvv64#=#=uE,,VQ7 ##I$K$KL'')j$/$'Xv{;4#B#BEJ,,VQ7"'
 	&&'7'+'F'F	H 	&&d;;T	C&&t<<e	EW  0
 !&w/0s   2M((M<;M<c                 3   | j                   }|d   }| j                  d      j                  |       | j                  d      j                  |       |d   }| j                  d      j                  |       | j                  d      j                  |        |d   t        j
                  k(  r!| j                  d      j                  d	       n|d   t        j                  k(  r!| j                  d
      j                  d	       nW|d   t        j                  k(  r!| j                  d      j                  d	       n | j                  d      j                  d	       |d   t        j                  k(  r!| j                  d      j                  d	       n | j                  d      j                  d	       | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |j                  dt        j                               | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d       j                  |j                  d!t        j                               | j                  d"      j                  |j                  d#t        j                               | j                  d$      j                  |j                  d%t        j                               | j                  d&      j                  |j                  d't        j                               | j                  d(      j                  |j                  d)t        j                               | j                  d*      j                  |j                  d+t        j                               | j                  d,      j                  |j                  d-t        j                                | j                  d.      j                  |j                  d/t        j"                               |j                  d0t        j$                        }| j                  d1      j                  |       |j                  d2t        j&                        }| j                  d3      j                  |       |j                  d4t        j(                        }| j                  d5      j                  |       |j                  d6t        j*                        }| j                  d7      j                  |       |j                  d8t        j,                        }| j                  d9      j                  |       |j                  d:t        j.                        }| j                  d:      }t0        j2                  t0        j4                  t0        j6                  g}| j9                  ||       |t        j4                  k(  rt0        j4                  }n4|t        j6                  k(  rt0        j6                  }nt0        j2                  }|j                  |j;                  |             | j                  d;      }t<        j>                  }t<        j@                  }	| j9                  | |tB        jD                   |	              |tB        jF                   |	              |tB        jH                   |	              |tB        jJ                   |	              |tB        jL                   |	              |tB        jN                   |	              |tB        jP                   |	              |tB        jR                   |	              |tB        jT                   |	              |tB        jV                   |	              |tB        jX                   |	              |tB        jZ                   |	              |tB        j\                   |	              |tB        j^                   |	              |tB        j`                   |	              |tB        jb                   |	             g       tD        }
| j                   d<   }|tB        jD                  k(  rtD        }
n|tB        jF                  k(  rtF        }
no|tB        jH                  k(  rtH        }
nT|tB        jJ                  k(  rtJ        }
n9|tB        jL                  k(  rtL        }
n|tB        jN                  k(  rtN        }
n|tB        jP                  k(  rtP        }
n|tB        jR                  k(  rtR        }
n|tB        jT                  k(  rtT        }
n|tB        jV                  k(  rtV        }
n|tB        jX                  k(  rtX        }
n|tB        jZ                  k(  rtZ        }
ng|tB        j\                  k(  rt\        }
nM|tB        j^                  k(  rt^        }
n3|tB        j`                  k(  rt`        }
n|tB        jb                  k(  rtb        }
|j                  |
       | j                  d=      }| j9                  | |tB        jd                   |	              |tB        jf                   |	              |tB        jh                   |	              |tB        jj                   |	              |tB        jl                   |	              |tB        jn                   |	              |tB        jp                   |	             g       td        }| j                   d>   }|tB        jd                  k(  rtd        }n|tB        jf                  k(  rtf        }n|tB        jh                  k(  rth        }ng|tB        jj                  k(  rtj        }nM|tB        jl                  k(  rtl        }n3|tB        jn                  k(  rtn        }n|tB        jp                  k(  rtp        }|j                  |       | j                  d?      j                  |j                  d@t        jr                               | j                  dA      j                  |j                  dBt        jt                               | j                  dC      j                  |j                  dDt        jv                               |dE   }| j                  dF      jy                  |       | j                  dG      }t0        jz                  t0        j|                  t0        j~                  g}| j9                  ||       |j                  |dG          |dH   }| j                  dI      j                  |       | j                  dJ      j                  |dK          |dL   t        j                  k(  }| j                  dM      j                  |       | j                  dN      j                  |dO          t        "| j                  dQ      j                  dR       n{| j                  dQ      j                  |dS          | j                  dT      }t        j                         }dP}|dU   xs t        j                         }|rt        j                  t        t              }t        |j                               }|D ]N  }||   }|j                  ||g      }t        j                  j                  t        j                  |      |k(  sM|}P | j                  }|j                          |j                  |d	       |j                  |dVdW       |j                  |       |r|j                  |       n#|j                  dW       n|j                  dR       |dX   t        j                  k(  r!| j                  dY      j                  d	       n | j                  dZ      j                  d	       | j                  d[      j                  |j                  d\t        j                               |d]   }|t        j                  k(  r!| j                  d^      j                  d	       n|t        j                  k(  r!| j                  d_      j                  d	       nT|t        j                  k(  r!| j                  d`      j                  d	       n | j                  da      j                  d	       |db   }|t        j                  k(  r!| j                  dc      j                  d	       n|t        j                  k(  r!| j                  dd      j                  d	       nT|t        j                  k(  r!| j                  de      j                  d	       n | j                  df      j                  d	       |j                  dgt        j                        }| j                  dh      j                  |       |j                  dit        j                        }| j                  dj      j                  |       |j                  dkt        j                        }| j                  dl      j                  |       |dm   }| j                  dn      jy                  |doz         | j                  dp      j                  |dq          | j                  dr      j                  |j                  dst        j                               | j                  dt      j                  |j                  dut        j                               | j                  dv      j                  |j                  dwt        j                               | j                  dx      j                  |j                  dyt        j                               | j                  dz      j                  |d{          | j                  d|      j                  |d}          | j                  d~      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                  d      j                  |d          | j                          |d   } | t        j                  k(  r!| j                  d      j                  d	       n| t        j                  k(  r!| j                  d      j                  d	       nT| t        j                  k(  r!| j                  d      j                  d	       n | j                  d      j                  d	       | j                          | j                  d      j                  |d          |d   t        j                  k(  r!| j                  d      j                  d	       n | j                  d      j                  d	       | j                  d      }| j9                  |t0        j                  t0        j                  g       |j                  |d          | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      j                  |j                  dt        j                               | j                  d      | _m        | j                  d      | _n        | j                  d      | _o        | j                          | j                  j                  r!| j                  d      j                  dR       yPyP)z}Adjust the settings of the various components on the
        configuration GUI depending upon the users preferences.
        rH  speechSupportCheckButtonspeechOptionsGridonlySpeakDisplayedText!onlySpeakDisplayedTextCheckButtoncontextOptionsGridverbalizePunctuationStyle
noneButtonT
someButton
mostButton	allButtonspeechVerbosityLevelspeechBriefButtonspeechVerboseButton"enableSpeechIndentationCheckButtonenableSpeechIndentationspeakBlankLinesCheckButtonspeakBlankLines'speakMultiCaseStringsAsWordsCheckButtonspeakMultiCaseStringsAsWordsspeakNumbersAsDigitsCheckButtonspeakNumbersAsDigits!enableTutorialMessagesCheckButtonenableTutorialMessagesenablePauseBreaksCheckButtonenablePauseBreaks!enablePositionSpeakingCheckButtonenablePositionSpeaking!enableMnemonicSpeakingCheckButtonenableMnemonicSpeaking#speakMisspelledIndicatorCheckButtonspeakMisspelledIndicatorspeakDescriptionCheckButtonspeakDescription!speakContextBlockquoteCheckButtonspeakContextBlockquotespeakContextLandmarkCheckButtonspeakContextLandmark&speakContextNonLandmarkFormCheckButtonspeakContextNonLandmarkFormspeakContextListCheckButtonspeakContextListspeakContextPanelCheckButtonspeakContextPanelspeakContextTableCheckButtonspeakContextTablemessagesAreDetailedmessagesAreDetailedCheckButtonuseColorNamesuseColorNamesCheckButtonreadFullRowInGUITable readFullRowInGUITableCheckButtonreadFullRowInDocumentTable%readFullRowInDocumentTableCheckButtonreadFullRowInSpreadSheet#readFullRowInSpreadSheetCheckButtoncapitalizationStyledateFormatCombopresentDateFormattimeFormatCombopresentTimeFormat"speakProgressBarUpdatesCheckButtonspeakProgressBarUpdates$brailleProgressBarUpdatesCheckButtonbrailleProgressBarUpdates!beepProgressBarUpdatesCheckButtonbeepProgressBarUpdatesprogressBarUpdateInterval#progressBarUpdateIntervalSpinButtonprogressBarVerbosityenableMouseReviewenableMouseReviewCheckButtonenableBrailleCheckButtonenableBraillebrailleRolenameStyleabbrevRolenamesdisableBrailleEOLCheckButtondisableBrailleEOLNcontractedBrailleCheckButtonFrz  contractionTableCombor  rh   r   brailleVerbosityLevelbrailleBriefButtonbrailleVerboseButton enableBrailleWordWrapCheckButtonenableBrailleWordWrapbrailleSelectorIndicatorbrailleSelection7ButtonbrailleSelection8ButtonbrailleSelectionBothButtonbrailleSelectionNoneButtonbrailleLinkIndicatorbrailleLink7ButtonbrailleLink8ButtonbrailleLinkBothButtonbrailleLinkNoneButtonenableFlashMessagesenableFlashMessagesCheckButtonr  flashIsPersistentCheckButtonflashIsDetailedflashIsDetailedCheckButtonbrailleFlashTimebrailleFlashTimeSpinButton  keyEchoCheckButtonenableKeyEchoenableAlphabeticKeysCheckButtonenableAlphabeticKeysenableNumericKeysCheckButtonenableNumericKeys enablePunctuationKeysCheckButtonenablePunctuationKeysenableSpaceCheckButtonenableSpaceenableModifierKeysCheckButtonenableModifierKeysenableFunctionKeysCheckButtonenableFunctionKeysenableActionKeysCheckButtonenableActionKeysenableNavigationKeysCheckButtonenableNavigationKeys enableDiacriticalKeysCheckButtonenableDiacriticalKeys enableEchoByCharacterCheckButtonenableEchoByCharacterenableEchoByWordCheckButtonenableEchoByWordenableEchoBySentenceCheckButtonenableEchoBySentencetextAttributesBrailleIndicatortextBraille7ButtontextBraille8ButtontextBrailleBothButtontextBrailleNoneButtonpresentToolTipsCheckButtonpresentToolTipskeyboardLayoutgeneralDesktopButtongeneralLaptopButtonsayAllStyle'rewindAndFastForwardInSayAllCheckButtonrewindAndFastForwardInSayAllstructNavInSayAllCheckButtonstructNavInSayAll"sayAllContextBlockquoteCheckButtonsayAllContextBlockquote sayAllContextLandmarkCheckButtonsayAllContextLandmark'sayAllContextNonLandmarkFormCheckButtonsayAllContextNonLandmarkFormsayAllContextListCheckButtonsayAllContextListsayAllContextPanelCheckButtonsayAllContextPanelsayAllContextTableCheckButtonsayAllContextTableavailableProfilesComboBox1availableProfilesComboBox2model9profilesFrame)sr,   r   r   r|  r   PUNCTUATION_STYLE_NONEPUNCTUATION_STYLE_SOMEPUNCTUATION_STYLE_MOSTVERBOSITY_LEVEL_BRIEFrI  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   CAPITALIZATION_STYLE_NONECAPITALIZATION_STYLE_ICONCAPITALIZATION_STYLE_SPELLr"  indextimestrftime	localtimer   DATE_FORMAT_LOCALEDATE_FORMAT_NUMBERS_DMDATE_FORMAT_NUMBERS_MDDATE_FORMAT_NUMBERS_DMYDATE_FORMAT_NUMBERS_MDYDATE_FORMAT_NUMBERS_YMDDATE_FORMAT_FULL_DMDATE_FORMAT_FULL_MDDATE_FORMAT_FULL_DMYDATE_FORMAT_FULL_MDYDATE_FORMAT_FULL_YMDDATE_FORMAT_ABBREVIATED_DMDATE_FORMAT_ABBREVIATED_MDDATE_FORMAT_ABBREVIATED_DMYDATE_FORMAT_ABBREVIATED_MDYDATE_FORMAT_ABBREVIATED_YMDTIME_FORMAT_LOCALETIME_FORMAT_12_HMTIME_FORMAT_12_HMSTIME_FORMAT_24_HMSTIME_FORMAT_24_HMS_WITH_WORDSTIME_FORMAT_24_HMTIME_FORMAT_24_HM_WITH_WORDSr  r  r  r   PROGRESS_BAR_ALLPROGRESS_BAR_APPLICATIONPROGRESS_BAR_WINDOWBRAILLE_ROLENAME_STYLE_SHORTlouisr   
listTablesgetDefaultTabler   r  r  r  r  r  r   r   joinr   r:   r  r  r  r  set_active_iterr#  BRAILLE_UNDERLINE_7BRAILLE_UNDERLINE_8BRAILLE_UNDERLINE_BOTHr.  r  r1  r9  r;  r=  r?  r  r  GENERAL_KEYBOARD_LAYOUT_DESKTOPSAY_ALL_STYLE_LINESAY_ALL_STYLE_SENTENCEr\  r^  r`  rb  rd  rf  rh  rj  rV   rX   rW   _OrcaSetupGUI__initProfileComborZ   r   )!r[   prefsenablestyler  optionsr   	combobox2sdtimeltime	indexdate
dateFormat	combobox3	indextime
timeFormatintervalr&  levelsr[  tablesCombo	tableDictselectedTableIterselectedTabletablesModelnamesr   fnameitr  selectionIndicatorlinkIndicatordurationbrailleIndicators!                                    r^   r   zOrcaSetupGUI._initGUIState  s(   
  ~&23>>vF+,::6B/0;<GGO,-;;JG,-'>>?OOL)44T:./'>>?OOL)44T:./'>>?OOL)44T:OOK(33D9'(H,J,JJOO/0;;DAOO12==dC;<GG*+	- 	<=HH+,	. 	45@@#$	&ABMM01	39:EEII,h.K.KL	N;<GG*+	-67BB%&	(;<GG*+	-;<GG*+	-=>IIII0(2S2ST	V56AAII((*C*CD	F;<GGII.0I0IJ	L9:EEII,h.K.KL	N@ALLII3X5Y5YZ	\56AAII((*C*CD	F67BBII)8+E+EF	H67BBII)8+E+EF	H 0(2N2NO89DDVL?H,B,BC23>>vF2H4R4RS:;FFvN79\9\]?@KKFS5x7X7XY=>II&Q		/1M1MN??#896666779 	h0H66677Eh99988E77EGMM%01OO$56	i(--uw7(1157;(1157;(22EG<(22EG<(22EG<(..8(..8(//9(//9(//9(55uw?(55uw?(66@(66@(66@	& '	^^$78
444*I8:::.I8:::.I8;;;/I8;;;/I8;;;/I8777+I8777+I8888,I8888,I8888,I8>>>2I8>>>2I8???3I8???3I8???3Ii(OO$56	i(--uw7(,,eg6(--uw7(--uw7(88%'B(,,eg6(77AC	D '	^^$78
444*I8555)I8666*I8666*I8AAA5I8555)I8@@@4Ii(<=HHII/1Q1QR	T>?JJII183U3UV	X;<GGII.0O0OP	R 45=>HHR??#9:,,44//1 	h/E"89:*+67BB6J 	23>>o.	0,-$AAB)*55e<67BB%&	( =OO.00=e0DOO:;FF/02
 //*ABK**,I $!";< 7$446 !mmC5y~~/0! /D%dOE$++T5M:Bww||G$5$5u=)*,.)/ 11!!#&&tT2))$:%%k2$//0AB**1-))%0()X-K-KKOO01<<TBOO23>>tD:;FFII-x/M/MN	P ##=>!=!==OO56AA$G8#?#??OO56AA$G8#B#BBOO89DDTJOO89DDTJ45H888OO01<<TBh:::OO01<<TBh===OO34??EOO34??E0(2N2NO89DDVL.0J0JK67BB6J,h.F.FG45@@H+,45??4P 	,-88o.	09:EE		"8(:W:WX	Z67BB		"5x7Q7QR	T:;FF		"98;Y;YZ	\01<<		-1E1EF	H78CC23	578CC23	556AA01	39:EE45	7:;FF56	8:;FF56	856AA01	39:EE45	7
 	**, !ABx;;;OO01<<TB!=!==OO01<<TB!@!@@OO34??EOO34??E 	))+ 	45@@#$	& !"h&N&NNOO23>>tDOO12==dC??=1h)E)E)2)I)I)K 	LE-01ABMMII4h6[6[\	^67BBII)8+E+EF	H<=HHII/1Q1QR	T:;FFII-x/M/MN	PABMMII4h6[6[\	^67BBII)8+E+EF	H78CCII*H,G,GH	J78CCII*H,G,GH	J
 "__-IJ$(OO4P$Q!"&//(";!;;??OOO,::5A r_   c                    | j                         }| j                  j                          t        |      s&| j                  j	                  | j
                         n"|D ]  }| j                  j	                  |        | j                  j                  d      xs | j
                  }| j                  j                  d      xs | j
                  }| j                  | j                  |d         }| j                  | j                  |d         }| j                  j                  |       | j                  j                  |       y)z>Adding available profiles and setting active as the active oner  startingProfiler   N)#_OrcaSetupGUI__getAvailableProfilesrW   r  r   r  r-   r,   rI  getComboBoxIndexrV   rX   r   )r[   availableProfilesprofiler  r  activeProfileIterstartingProfileIters          r^   __initProfileCombozOrcaSetupGUI.__initProfileCombo  s    !779%%'$%##**4+?+?@, 8''..w78 **?;St?S?S..,,->?W4CWCW 11$2D2D2?2BD"33D4M4M2A!2DF%%&78!!,,-@Ar_   c                 F    t        j                         j                         S )zGet available user profiles.)r   rx   r  )r[   s    r^   __getAvailableProfilesz#OrcaSetupGUI.__getAvailableProfiles0  s    **,>>@@r_   c                     | j                  d      }dj                  | j                  d         }|j                  | j	                  ||             y )NorcaModifierComboBox, orcaModifierKeys)r   r  r,   r   r  )r[   r  	keystrings      r^   _updateOrcaModifierz OrcaSetupGUI._updateOrcaModifier4  sD    ??#9:IIdnn-?@A	D11(IFGr_   c                     t        j                  t              }|D ]  }|j                  |g        |j	                  |       y)zPopulates the combobox with the items provided.

        Arguments:
        - combobox: the GtkComboBox to populate
        - items: the list of strings with which to populate it
        N)r   r  r  r  r  )r[   r  itemsr]  items        r^   r"  zOrcaSetupGUI.populateComboBox9  s=     c" 	!DLL$ 	!5!r_   c                     |j                         }|j                         }t        dt        |            D ].  }|j	                  ||      }||k(  r|c S |j                  |      }0 y)ae   For each of the entries in the given combo box, look for searchStr.
            Return the index of the entry if searchStr is found.

        Arguments:
        - combobox: the GtkComboBox to search.
        - searchStr: the string to search for.

        Returns the index of the first entry in combobox with searchStr, or
        0 if not found.
        r   )rP  get_iter_firstrS  r   	get_value	iter_next)r[   r  	searchStrr  r]  myiterr  r   s           r^   r  zOrcaSetupGUI.getComboBoxIndexF  sj     ""$%%'q#e*% 	-A??63/Dy __V,F		- r_   c                     |j                         }|j                         }|j                  |      }|j                  |d      }|j                  |d      }||gS )z6Get the list of values from the active combox
        r   r
   )r#  rP  rU  r  )r[   r  ro   r]  
activeIteractiveLabel
activeNames          r^   getComboBoxListzOrcaSetupGUI.getComboBoxList\  sY     $$&""$^^F+
ooj!4__Z3
Z((r_   c                 p   i }|j                         }|r|j                  |      }|rz|j                  |t        t              \  }}|s|sDg }|j                  t        |j                  |t        t        t        t                           |||<   |j                  |      }|rz|j                  |      }|r|S N)r  iter_childrenrI  r   r   r  listr   r   r   r   r  )	r[   r]  modifiedOnly	modelDictnodechildr   modifiedr   s	            r^   r   z$OrcaSetupGUI.getKeyBindingsModelDictf  s    	##%''-E %		%% @X<ELLeii!4I|'M "N O%*IcN.  ??4(D  r_   c                     i t         _         |j                         }|L|j                  |t        t              \  }}|r|rt        j
                  ||       |j                  |      }|Lt         j                   }|S )z:Get the list of values from a list[str,str] model
        )r   r  rI  r  r  setPronunciationr  )r[   r]  currentIterr   r   r  s         r^   r   zOrcaSetupGUI.getModelDictw  su     13-**,%;DJCu"33C?//+6K	 %
 '99	r_   c                    | j                  d      }t        j                         }|j                  |       | j                  d      }t        j                  d      \  }}|j                  d|||d       	 t        j                  j                  }|dk(  rt        j                         }|j                  |       | j                  | j                  t        j                         j!                  d      dd       | j"                  j$                  rKt&        j(                  t+        j,                  | j"                  j$                        z  }|j/                  |       |j1                          y# t        $ r d}Y w xY w)	zlShow the Orca configuration GUI window. This assumes that
        the GUI has already been created.
        rr   
helpButtonF1r  r   rp  TN)r   r   
AccelGroupadd_accel_groupaccelerator_parseadd_acceleratorr   lastInputEvent	timestampr?  get_current_event_timepresent_with_timerf  r2   r   rx   ry   rZ   r   r   PREFERENCES_APPLICATION_TITLEr   r   	set_titleshow)r[   rr   
accelGroupr  keyValmodifierMasktstitles           r^   showGUIzOrcaSetupGUI.showGUI  sB   
 //*;<^^%
''
3__\2
!$!6!6t!<""9#-#)#/#$		&	**44B 7++-B))"-
 	%%** ++-889VWd	
 ;;??;;h>O>OPTP[P[P_P_>``E%%e,%  	B	s   6E+ +E98E9c                    t        j                         }|j                  |d       	 |j                         d   }|j	                  |dd       t        j                  t        t              }|j                  |       t        |t         j                        r(|j                         }|j                  |d   dz
  d       |S # t
        $ r |j	                  |dd       Y w xY w)zInitialize the given combo box to take a list of int/str pairs.

        Arguments:
        - combobox: the GtkComboBox to initialize.
        Tr   rh   r
      )r   r   r  	get_cellsr  r?  r  intr  r  
isinstanceComboBoxTextsize_requestset_fixed_size)r[   r  r  columnToDisplayr]  sizes         r^   r   zOrcaSetupGUI._initComboBox  s     ##%D$'	4&00215O""?FA> c3'5! h 0 01((*DQ"b1  	4""43	4s   &C C C c                    | j                  d      j                         }| j                  d      j                  |       | j                  d      j                  |       | j                  d      j                  |       | j                  d      j                  |       | j                  d      j                  |       | j                  d      j                  |       | j                  d      j                  |       | j                  d	      j                  |       | j                  d
      j                  |       y)z[In]sensitize the checkboxes for the various types of key echo,
        depending upon whether the value of the key echo check button is set.
        r6  r8  r:  r<  r>  r@  rB  rD  rF  rH  N)r   r#  r|  r[   r  s     r^   r   zOrcaSetupGUI._setKeyEchoItems  s    
 !56AAC9:HHP67EEfM:;II&Q01??G78FFvN78FFvN56DDVL9:HHP:;II
	r_   c                     | j                   j                  ||       	 | j                   j                  |d       y# t        $ r Y yw xY w)a  If the text field is not None, presents the given text, optionally
        interrupting anything currently being spoken.

        Arguments:
        - text: the text to present
        - interrupt: if True, interrupt any speech currently being spoken
        )	interruptr  )	flashTimeN)rZ   speakMessagedisplayBrailleMessager?  )r[   rh   r  s      r^   _presentMessagezOrcaSetupGUI._presentMessage  sI     	   ;	KK--db-A 		s   = 	A	A	c                     | j                   }|j                  d      }|j                  |t        |       |j                  |t        d       |S )zCreate a new root node in the TreeStore model with the name of the
            application.

        Arguments:
        - appName: the name of the TreeStore Node (the same of the application)
        NF)r6   r  r   r   r   )r[   appNamer]  r  s       r^   _createNodezOrcaSetupGUI._createNode  sB     %%d#1u-r_   c                     | j                   }|D ];  }|j                  |j                        dk(  s"|t           |k(  s/|j                  c S  y)a)  Returns the Gtk.TreeIter of the TreeStore model
        that matches the application name passed as argument

        Arguments:
        - appName: a string with the name of the application of the node wanted
                    it's the same that the field DESCRIP of the model treeStore
        r   N)r6   
iter_depthiterr   )r[   r  r]  rows       r^   
_getIterOfzOrcaSetupGUI._getIterOf  sO     %% 	 C!!#((+q0\W,xx	 
 r_   c                 r    d}|dk(  rdt         j                   d}|S |dk(  rdt         j                   d}|S )zGiven a numeric clickCount, returns a string for inclusion
        in the list of keybindings.

        Argument:
        - clickCount: the number of clicks associated with the keybinding.
        r  r"   z ()   )r   CLICK_COUNT_DOUBLECLICK_COUNT_TRIPLE)r[   
clickCountclickCountStrings      r^   _clickCountToStringz OrcaSetupGUI._clickCountToString  sT     ?!#I$@$@#AC   1_!#I$@$@#ACr_   Nc                    | j                   }|j                  sy|| j                  t        j                        }||j                  |      }|j                  sd}nL| j                  |j                        }|j                  }	t        j                  |j                        |	z   |z   }|j                  |t        |       |j                  |t        |j                  j                         |j                  |t         t#        |j$                               |j                  |t&        t#        |j                               |j                  |t(        |j                         |j                  |t*        t#        |j                               |.|j                  |t,        |       |j                  |t.        |       |j                  |t0        |       |j                  |t2        d       |S y)a  Appends a new row with the new keybinding data to the treeview

        Arguments:
        - handl:  the name of the handler associated to the keyBinding
        - kb:     the new keybinding.
        - parent: the parent node of the treeview, where to append the kb
        - modif:  whether to check the modified field or not.

        Returns a Gtk.TreeIter pointing at the new row.
        NT)r6   handlerr  r   KB_GROUP_DEFAULTr  keysymstringr  click_countr   getModifierNames	modifiersr   r   r   descriptionr   r  modifier_maskr   r   r   r   r   r   r   )
r[   handlkbparentmodifr]  r  rh   r  r   s
             r^   
_insertRowzOrcaSetupGUI._insertRow  sn    %%zz>__Y%?%?@F\\&)F??!55bnnE
!"33BLLA%&#$ OOFGU3OOFGRZZ-C-CDOOFIs23C3C/DEOOFIs2<</@AOOFD"//:OOFL#bnn2EF$7t4OOFE51OOFHd3Mr_   c                    | j                   }|| j                  t        j                        }||j	                  |      }|j                  |t        |       |j                  |t        |j                         |j                  |t        t        |             |j                  |t        t        j                  |          |j                  |t        |       |j                  |t        d       |S y)a  Appends a new row with the new braille binding data to the treeview

        Arguments:
        - handl:       the name of the handler associated to the brailleBinding
        - com:         the BrlTTY command
        - inputEvHand: the inputEventHandler with the new brailleBinding
        - parent:      the parent node of the treeview, where to append the kb
        - modif:       whether to check the modified field or not.

        Returns a Gtk.TreeIter pointing at the new row.
        NF)r6   r  r   KB_GROUP_BRAILLEr  r   r   r   r$  r   r  r   r   command_namer   r   )r[   r&  cominputEvHandr(  r)  r]  r  s           r^   _insertRowBraillezOrcaSetupGUI._insertRowBrailleG  s     %%>__Y%?%?@F\\&)FOOFGU3OOFG[-D-DEOOFD#c(3OOFE7+?+?+DEOOFE51OOFHe4Mr_   c                    	 | j                   j                          t        j                         }t	        j
                         j                  | j                   j                  |d      }t        j                  dddd      }| j                  }|j                         }||j                  |      }|o|j                  |t              }t        j                  d|      |_        |j#                  |d      r|j%                  |t&        d       |j)                  |      }|o|j)                  |      }|yy# t*        $ r& t-        j.                  t,        j0                         Y yw xY w)z8 Mark as modified the user custom key bindings:
        F)enabledOnlyNr$  )typeOfSearchT)rZ   setupInputEventHandlersr   KeyBindingsr   rx   overrideKeyBindingsinputEventHandlers
KeyBindingr6   r  r  r  r   r   InputEventHandlerr  hasKeyBindingr   r   r  r?  r   r@  r  )r[   keyBindskeyBind	treeModelr  	iterChilddescrips          r^   _markModifiedzOrcaSetupGUI._markModifiedf  sL   	5KK//1"..0H'224HH..e I MH!,,T4tDG--I--/F$%33F;	+'11)WEG#55dGD O--g;H . J!++IudC ) 3 3I >I  + #,,V4 $  	5  !3!34	5s   DD8 "D8 8,E'&E'c                    | j                   j                  d       | j                   j                  d       | j                   j                          |r!| j                  j                          d| _        t        j                  | j                  j                        }| j                  |      }| j                  t        j                        }| j                  t        j                        }| j                  t        j                        }| j                  t        j                         }| j                  t        j"                        }| j                  t        j$                        }	| j                  t        j&                        }
| j                  t        j(                        }| j                  t        j*                        }| j                  t        j,                        }| j                  t        j.                        }| j                  t        j0                        }| j                  t        j2                        }| j                  t        j4                        }| j                  s.t7        j8                         j;                  d      }|t<        j>                  k(  }tA        jB                         | _        | j                  jE                          | j                  jG                  d      }| j                  jI                         }| j                  jK                         jM                  |      }| j                  jO                         jM                  |      }| j                  jQ                         jM                  |      }| j                  jS                         jM                  |      }| j                  jU                         jM                  |      }| j                  jW                         jM                  |      }| j                  jY                         jM                  |      }| j                  j[                         jM                  |      }| j                  j]                         jM                  |      }| j                  j_                         jM                  |      }| j                  ja                         jM                  |      } | j                  jc                         jM                  |      }!|jd                  D ]  }"| j                  jg                  |"d      r!| j                  ji                  |"jj                        }#|jg                  |"d      r| jm                  |#|"|       n|jg                  |"d      r| jm                  |#|"|       n|jg                  |"d      r| jm                  |#|"|       n| jg                  |"d      r| jm                  |#|"|       n|!jg                  |"d      r| jm                  |#|"|       ne|jg                  |"d      r| jm                  |#|"|       n>|jg                  |"d      r| jm                  |#|"|	       n|jg                  |"d      r| jm                  |#|"|
       n|jg                  |"d      r| jm                  |#|"|       n|jg                  |"d      r| jm                  |#|"|       n|jg                  |"d      r| jm                  |#|"|       n|jg                  |"d      r| jm                  |#|"|       nY|jg                  |"d      s| jm                  |#|"|       n3|"jn                  r| jm                  |#|"|       n| jm                  |#|"|       | j                  jq                  |"        | j                  js                  |      s| j                  ju                  |       | j                  js                  |      s| j                  ju                  |       | jw                          | jy                          | j                  t        jz                        }$| j                  j}                         | _?        | j~                  j                         D ]4  \  }%}&| j                  ji                  |&      }#| j                  |#|%|&|$       6 | j                   j                  | j                         | j                   j                  d       | j                  j                  t        t        j                  j                         | j                   j                          i | _H        y)zFills the TreeView with the list of Orca keybindings

        Arguments:
        - clearModel: if True, initially clear out the key bindings model.
        NFrW  )
is_desktopstrictr$  T)Ir7   r  set_headers_visiblehider6   r  r5   r   r   rZ   r   r  r   r  KB_GROUP_UNBOUNDKB_GROUP_NOTIFICATIONSKB_GROUP_FLAT_REVIEWKB_GROUP_SPEECH_VERBOSITYKB_GROUP_SYSTEM_INFORMATIONKB_GROUP_SLEEP_MODEKB_GROUP_BOOKMARKSKB_GROUP_OBJECT_NAVIGATIONKB_GROUP_TABLE_NAVIGATIONKB_GROUP_WHERE_AM_IKB_GROUP_LEARN_MODEKB_GROUP_MOUSE_REVIEWKB_GROUP_ACTIONSr   rx   ry   r   r  r   r5  r4  getKeyBindingsgetDefaultKeyBindingsgetNotificationPresenterget_bindingsgetSpeechAndVerbosityManagergetSystemInformationPresentergetSleepModeManagergetBookmarksgetObjectNavigatorgetTableNavigatorgetLearnModePresentergetMouseReviewergetActionPresentergetFlatReviewPresentergetWhereAmIPresenterkeyBindingsr:  getInputEventHandlerKeyr  r*  r   additer_has_childremover  r@  r,  getBrailleBindingsr.   r  r0  r   r   r   SortType	ASCENDINGr  r9   )'r[   
clearModelr  iterAppiterOrcaiterUnbounditerNotificationPresenteriterFlatReviewPresenteriterSpeechAndVerbosityiterSystemInfoiterSleepModeiterBookmarksiterObjectNaviterTableNaviterWhereAmIPresenteriterLearnModeiterMouseRevieweriterActionPresenterlayout	isDesktopallKeyBindingsdefKeyBindingsnpKeyBindingssvKeyBindingssysKeyBindingssmKeyBindingsbmKeyBindingsonKeyBindingstnKeyBindingslmKeyBindingsmrKeyBindingsacKeyBindingsfrKeyBindingswaiKeyBindingsr'  r&  iterBBr.  r/  s'                                          r^   r   z!OrcaSetupGUI._populateKeyBindings  sj    	""4(,,U3!!'')!DN##DKKOO4""7+##I$>$>?&&y'A'AB$($4$4Y5U5U$V!"&"2"293Q3Q"R!%!1!1)2U2U!V)))*O*OP(()F)FG(()E)EF(()M)MN''	(K(KL $ 0 01N1N O(()F)FG ,,Y-L-LM"..y/I/IJ~~%002==>NOF("J"JJI(446DNKK//1![[77>N![[>>@N KK@@BOO$ P &M KKDDFSS$ T &M![[FFHUU$ V &N KK;;=JJ$ K &M KK446CC$ D &M KK::<II$ J &M KK99;HH$ I &M KK==?LL$ M &M KK88:GG$ H &M KK::<II$ J &M KK>>@MM$ N &M![[==?LL$ M &N %00 !+~~33BA KK??

KE$222}Er3LM&44RGr=A&44RGr<@&44RGr3JK'55b-Hr3HI&44RGr3IJ'55b-Hr>B&44RGr=A&44RGr=A&44RGr=A&44RGr3FG&44RGr3DE+99"mLr7;r8<r;?NN&&r*C!+F $$33G<!!((1$$33K@!!((5  "!!)"<"<=779 $ 4 4 6 	DCKK77DE""5#{FC	D 	""4#8#89,,T2003<<;Q;QR #%r_   c                     | j                   D ]m  }|| j                  k(  s|j                  j                          -|j                  j	                         }|D ]"  }|| j
                  k(  r|j                          $ o y)zRemove unwanted factories and drivers for the current active
        factory, when the user dismisses the Orca Preferences dialog.N)rO   rI   r1  shutdownActiveServersr2  rF   shutdown)r[   rE  rD  r,  s       r^   _cleanupSpeechServersz"OrcaSetupGUI._cleanupSpeechServers  st     #33 	*N"d&>&>>++AAC(55FFH% *F"d&>&>>)*	*r_   c                     |j                         }|| j                  d<   | j                  d      j                  |       y)a  Signal handler for the "toggled" signal for the
           speechSupportCheckButton GtkCheckButton widget. The user has
           [un]checked the 'Enable Speech' checkbox. Set the 'enableSpeech'
           preference to the new value. Set the rest of the speech pane items
           [in]sensensitive depending upon whether this checkbox is checked.

        Arguments:
        - widget: the component that generated the signal.
        rH  r  Nr#  r,   r   r|  r[   r  r  s      r^   speechSupportCheckedz!OrcaSetupGUI.speechSupportChecked	  s8     ""$)/~&+,::6Br_   c                     |j                         }|| j                  d<   | j                  d      j                  |        y)a  Signal handler for the "toggled" signal for the GtkCheckButton
        onlySpeakDisplayedText. In addition to updating the preferences,
        set the sensitivity of the contextOptionsGrid.

        Arguments:
        - widget: the component that generated the signal.
        r  r  Nr  r  s      r^   onlySpeakDisplayedTextToggledz*OrcaSetupGUI.onlySpeakDisplayedTextToggled	  s;     ""$39/0,-;;JGr_   c                     | j                   ry|j                         }| j                  |   | _        | j	                          y)a  Signal handler for the "changed" signal for the speechSystems
           GtkComboBox widget. The user has selected a different speech
           system. Clear the existing list of speech servers, and setup
           a new list of speech servers based on the new choice. Setup a
           new list of voices for the first speech server in the list.

        Arguments:
        - widget: the component that generated the signal.
        N)r4   r#  rJ   rI   r4  r[   r  r  s      r^   speechSystemsChangedz!OrcaSetupGUI.speechSystemsChanged$	  s=     ""))+#'#<#<]#K   "r_   c                    | j                   ry|j                         }| j                  |   | _        	 | j                  t
        j                  j                  = | j                  t
        j                  j                  = | j                  t
        j                  j                  = | j                  t
        j                  j                  = | j                          y# t        $ r Y w xY w)aV  Signal handler for the "changed" signal for the speechServers
           GtkComboBox widget. The user has selected a different speech
           server. Clear the existing list of voices, and setup a new
           list of voices based on the new choice.

        Arguments:
        - widget: the component that generated the signal.
        N)r4   r#  rG   rF   r0   r   r|   r   rM   r3   rL   r?  r(  r  s      r^   speechServersChangedz!OrcaSetupGUI.speechServersChanged6	  s     ""))+#'#<#<]#K 	!!$))"2"23##DII$4$45##DII$4$45  !1!12 	  		s   BC 	C$#C$c                 (   | j                   ry|j                         }	 | j                  |   | _        | j                  | j                  f| j
                  v r| j
                  | j                  | j                  f   }| j                  |   }|t        j                  j                     }|t        j                  j                     }|t        j                  j                     }|t        j                  j                     }| j                  d      j                         }	| j                  |	||||       |dk(  s|| j&                  | j                  <   | j)                          y# t        $ r& t!        j"                  t         j$                         Y ]w xY w)a-  Signal handler for the "value_changed" signal for the languages
           GtkComboBox widget. The user has selected a different voice
           language. Save the new voice language name based on the new choice.

        Arguments:
        - widget: the component that generated the signal.
        Nr  r  )r4   r#  rC   rB   rF   rT   r@   r   r   r   r   r   r   r   r   r?  r   r@  r  rU   r   )
r[   r  r  r  r   r   r   r   r   r   s
             r^   speechLanguagesChangedz#OrcaSetupGUI.speechLanguagesChangedV	  sf    ""))+	5)-)D)D])SD&(($*D*DE../..t/G/G2203 433A6l66;;<!,":":"?"?@ !9!9!A!AB !9!9!A!AB OO,=>IIK	//	47T[\ "ERD(()A)AB  	5  !3!34	5s   DE" ",FFc                 h   | j                   ry|j                         }	 | j                  |   }|t        j                  j
                     }|t        j                  j                     }|t        j                  j                     }|t        j                  j                     }| j                  d      j                         }| j                  |||||       |dk(  s&|| j                  | j                   | j"                  f<   yy# t        $ r& t        j                  t        j                         Y Zw xY w)a(  Signal handler for the "value_changed" signal for the families
           GtkComboBox widget. The user has selected a different voice
           family. Save the new voice family name based on the new choice.

        Arguments:
        - widget: the component that generated the signal.
        Nr  r  )r4   r#  r@   r   r   r   r   r   r   r   r   r?  r   r@  r  rT   rF   rB   )	r[   r  r  r   r   r   r   r   r   s	            r^   speechFamiliesChangedz"OrcaSetupGUI.speechFamiliesChanged{	  s    ""))+		5//>F,22778Dl66;;<H\55==>G\55==>G(9:EEGI++ItXwPWX "2? &&t'?'?..(/ 0 #  	5  !3!34	5s   B7D ,D10D1c                 `    | j                   ry|j                         }| j                  |       y)aL  Signal handler for the "changed" signal for the voiceTypes
           GtkComboBox widget. The user has selected a different voice
           type. Setup the new family, rate, pitch and volume component
           values based on the new choice.

        Arguments:
        - widget: the component that generated the signal.
        N)r4   r#  r   )r[   r  r   s      r^   voiceTypesChangedzOrcaSetupGUI.voiceTypesChanged	  s,     ""%%'	**95r_   c                    |j                         }| j                  d      j                         }| j                  ||       t	        j
                         j                  d      }||j                  t        j                  i       t        j                  j                  <   t	        j
                         j                  d|       y)a:  Signal handler for the "value_changed" signal for the rateScale
           GtkScale widget. The user has changed the current rate value.
           Save the new rate value based on the currently selected voice
           type.

        Arguments:
        - widget: the component that generated the signal.
        r  ra   N)r  r   r#  r   r   rx   ry   rI  r   rz   r   r|   r   r  )r[   r  r   r   ra   s        r^   rateValueChangedzOrcaSetupGUI.rateValueChanged	  s     !OO$56AAC	!!)T2!,,.99(CAE

8))2.tyy~~>##%006Br_   c                    |j                         }| j                  d      j                         }| j                  ||       t	        j
                         j                  d      }||j                  t        j                  i       t        j                  j                  <   t	        j
                         j                  d|       y)a=  Signal handler for the "value_changed" signal for the pitchScale
           GtkScale widget. The user has changed the current pitch value.
           Save the new pitch value based on the currently selected voice
           type.

        Arguments:
        - widget: the component that generated the signal.
        r  ra   N)r  r   r#  r   r   rx   ry   rI  r   rz   r   r|   r~   r  )r[   r  r   r   ra   s        r^   pitchValueChangedzOrcaSetupGUI.pitchValueChanged	  s       "OO$56AAC	""9e4!,,.99(CJO

8))2.tyy/F/FG##%006Br_   c                    |j                         }| j                  d      j                         }| j                  ||       t	        j
                         j                  d      }||j                  t        j                  i       t        j                  j                  <   t	        j
                         j                  d|       y)a?  Signal handler for the "value_changed" signal for the voiceScale
           GtkScale widget. The user has changed the current volume value.
           Save the new volume value based on the currently selected voice
           type.

        Arguments:
        - widget: the component that generated the signal.
        r  ra   N)r  r   r#  r   r   rx   ry   rI  r   rz   r   r|   r}   r  )r[   r  r   r   ra   s        r^   volumeValueChangedzOrcaSetupGUI.volumeValueChanged	  s     !!#OO$56AAC	##Iv6!,,.99(CAG

8))2.tyy~~>##%006Br_   c                     t         j                  j                  |      }|dd }|j                         | j                  |<   y)a	  Signal handler for "toggled" signal for basic GtkCheckButton 
           widgets. The user has altered the state of the checkbox.
           Set the preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        Ni)r   	Buildabler   r#  r,   )r[   r  settingNames      r^   checkButtonToggledzOrcaSetupGUI.checkButtonToggled	  s;     mm,,V4!$3'&,&7&7&9{#r_   c                 ^    |j                         | j                  d<   | j                          y)a  Signal handler for the "toggled" signal for the
           keyEchoCheckbutton GtkCheckButton widget. The user has
           [un]checked the 'Enable Key Echo' checkbox. Set the
           'enableKeyEcho' preference to the new value. [In]sensitize
           the checkboxes for the various types of key echo, depending
           upon whether this value is checked or unchecked.

        Arguments:
        - widget: the component that generated the signal.
        r7  N)r#  r,   r   r[   r  s     r^   keyEchoCheckedzOrcaSetupGUI.keyEchoChecked	  s'     +1*;*;*='r_   c                    |j                         r|j                         t        j                  k(  rt        j
                  | j                  d<   y|j                         t        j                  k(  rt        j                  | j                  d<   y|j                         t        j                  k(  rt        j                  | j                  d<   yt        j                  | j                  d<   yy)aV  Signal handler for the "toggled" signal for the
           brailleSelectionNoneButton, brailleSelection7Button,
           brailleSelection8Button or brailleSelectionBothButton
           GtkRadioButton widgets. The user has toggled the braille
           selection indicator value. If this signal was generated
           as the result of a radio button getting selected (as
           opposed to a radio button losing the selection), set the
           'brailleSelectorIndicator' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r$  Nr#  	get_labelr   BRAILLE_DOT_7r   r  r,   BRAILLE_DOT_8r  BRAILLE_DOT_7_8r  BRAILLE_UNDERLINE_NONEr  s     r^   brailleSelectionChangedz$OrcaSetupGUI.brailleSelectionChanged	  s     !Y%<%<<00 9:!!#y'>'>>00 9:!!#y'@'@@33 9: 33 9: r_   c                    |j                         r|j                         t        j                  k(  rt        j
                  | j                  d<   y|j                         t        j                  k(  rt        j                  | j                  d<   y|j                         t        j                  k(  rt        j                  | j                  d<   yt        j                  | j                  d<   yy)a9  Signal handler for the "toggled" signal for the
           brailleLinkNoneButton, brailleLink7Button,
           brailleLink8Button or brailleLinkBothButton
           GtkRadioButton widgets. The user has toggled the braille
           link indicator value. If this signal was generated
           as the result of a radio button getting selected (as
           opposed to a radio button losing the selection), set the
           'brailleLinkIndicator' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r)  Nr  r  s     r^   brailleLinkChangedzOrcaSetupGUI.brailleLinkChanged
  s     !Y%<%<<00 56!!#y'>'>>00 56!!#y'@'@@33 56 33 56 r_   c                    |j                         r|j                         t        j                  k(  rt        j
                  | j                  d<   y|j                         t        j                  k(  rt        j                  | j                  d<   y|j                         t        j                  k(  rt        j                  | j                  d<   yt        j                  | j                  d<   yy)aC  Signal handler for the "toggled" signal for the
           textBrailleNoneButton, textBraille7Button, textBraille8Button
           or textBrailleBothButton GtkRadioButton widgets. The user has
           toggled the text attributes braille indicator value. If this signal
           was generated as the result of a radio button getting selected
           (as opposed to a radio button losing the selection), set the
           'textAttributesBrailleIndicator' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        rP  Nr  r  s     r^   brailleIndicatorChangedz$OrcaSetupGUI.brailleIndicatorChanged6
  s     !Y%<%<<00 ?@!!#y'>'>>00 ?@!!#y'@'@@33 ?@ 33 ?@ r_   c                    |j                         r|j                         t        j                  k(  rt        j                  | j
                  d<   y|j                         t        j                  k(  rt        j                  | j
                  d<   y|j                         t        j                  k(  rt        j                  | j
                  d<   yt        j                  | j
                  d<   yy)a  Signal handler for the "toggled" signal for the noneButton,
           someButton or allButton GtkRadioButton widgets. The user has
           toggled the speech punctuation level value. If this signal
           was generated as the result of a radio button getting selected
           (as opposed to a radio button losing the selection), set the
           'verbalizePunctuationStyle' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r  N)	r#  r  r   ro  r   r,   rp  rq  PUNCTUATION_STYLE_ALLr  s     r^   punctuationLevelChangedz$OrcaSetupGUI.punctuationLevelChangedQ
  s     !Y%E%EE33 :;!!#y'G'GG33 :;!!#y'G'GG33 :; 22 :; r_   c                     |j                         }|j                         }||   d   }|j                  d      | j                  d<   y)zSignal handler for the changed signal for the orcaModifierComboBox
           Set the 'orcaModifierKeys' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r   r  r  N)rP  r  splitr,   )r[   r  r]  r  orcaModifiers        r^   orcaModifierChangedz OrcaSetupGUI.orcaModifierChangedk
  sH       "'')V}Q'-9-?-?-E)*r_   c                 R   |j                         }|j                         }||   d   }|t        j                  k(  rt        j                  | j
                  d<   y|t        j                  k(  rt        j                  | j
                  d<   yt        j                  | j
                  d<   y)a   Signal handler for the changed signal for the progressBarVerbosity
           GtkComboBox widget. Set the 'progressBarVerbosity' preference to
           the new value.

        Arguments:
        - widget: the component that generated the signal.
        r   r  N)rP  r  r   r  r   r,   r  r  )r[   r  r]  r  r  s        r^   progressBarVerbosityChangedz(OrcaSetupGUI.progressBarVerbosityChangedx
  s       "'')$V}Q/9#=#==)) NN12!Y%B%BB,, NN12 11 NN12r_   c                    |j                         }|j                         }||   d   }|t        j                  k(  rt        j                  | j
                  d<   nN|t        j                  k(  rt        j                  | j
                  d<   nt        j                  | j
                  d<   | j                  j                  j                          y )Nr   r  )rP  r  r   rt  r   r,   ru  rs  rZ   speechAndVerbosityManagerupdate_capitalization_style)r[   r  r]  r  r  s        r^   capitalizationStyleChangedz'OrcaSetupGUI.capitalizationStyleChanged
  s      "'')#FmA.)"E"EE4<4V4VDNN01 I$H$HH4<4W4WDNN014<4V4VDNN01--IIKr_   c                    |j                         }|j                         }||   d   }|t        j                  k(  rt        j
                  | j                  d<   y|t        j                  k(  rt        j                  | j                  d<   yy)zSignal handler for the "changed" signal for the sayAllStyle
           GtkComboBox widget. Set the 'sayAllStyle' preference to the
           new value.

        Arguments:
        - widget: the component that generated the signal.
        r   rZ  N)	rP  r  r   r  r   SAYALL_STYLE_LINEr,   r  SAYALL_STYLE_SENTENCE)r[   r  r]  r  rZ  s        r^   sayAllStyleChangedzOrcaSetupGUI.sayAllStyleChanged
  sw       "'')FmA&)666,4,F,FDNN=)I<<<,4,J,JDNN=) =r_   c                    |j                         }|t        k(  rt        j                  }n|t        k(  rt        j                  }no|t        k(  rt        j                  }nT|t
        k(  rt        j
                  }n9|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }ng|t        k(  rt        j                  }nM|t        k(  rt        j                  }n3|t         k(  rt        j                   }n|t"        k(  rt        j"                  }| j$                  d<   y)zSignal handler for the "changed" signal for the dateFormat
           GtkComboBox widget. Set the 'dateFormat' preference to the
           new value.

        Arguments:
        - widget: the component that generated the signal.
        r	  N)r#  rz  r   r{  r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r,   )r[   r  r  	newFormats       r^   dateFormatChangedzOrcaSetupGUI.dateFormatChanged
  sa    !++-00 33I 66 77I 66 77I 77 88I 77 88I 77 88I 33 44I 33 44I 44 55I 44 55I 44 55I :: ;;I :: ;;I ;; <<I ;; <<I ;; <<I.7*+r_   c                    |j                         }|t        k(  rt        j                  }n|t        k(  rt        j                  }n|t        k(  rt        j                  }ng|t
        k(  rt        j
                  }nM|t        k(  rt        j                  }n3|t        k(  rt        j                  }n|t        k(  rt        j                  }| j                  d<   y)zSignal handler for the "changed" signal for the timeFormat
           GtkComboBox widget. Set the 'timeFormat' preference to the
           new value.

        Arguments:
        - widget: the component that generated the signal.
        r  N)
r#  r  r   r  r  r  r  r  r  r,   )r[   r  r
  r  s       r^   timeFormatChangedzOrcaSetupGUI.timeFormatChanged
  s     !++-00 33I 11 22I 22 33I 22 33I == >>I 11 22I <<!>>I/8*+r_   c                     |j                         r]|j                         t        j                  k(  rt        j                  | j
                  d<   yt        j                  | j
                  d<   yy)a  Signal handler for the "toggled" signal for the speechBriefButton,
           or speechVerboseButton GtkRadioButton widgets. The user has
           toggled the speech verbosity level value. If this signal was
           generated as the result of a radio button getting selected
           (as opposed to a radio button losing the selection), set the
           'speechVerbosityLevel' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r  Nr#  r  r   rr  r   r,   VERBOSITY_LEVEL_VERBOSEr  s     r^   speechVerbosityChangedz#OrcaSetupGUI.speechVerbosityChanged
  s^     !Y%D%DD22 56 44 56 r_   c                 >    |j                         | j                  d<   y)zSignal handler for the "value_changed" signal for the
           progressBarUpdateIntervalSpinButton GtkSpinButton widget.

        Arguments:
        - widget: the component that generated the signal.
        r  Nget_value_as_intr,   r  s     r^   %progressBarUpdateIntervalValueChangedz2OrcaSetupGUI.progressBarUpdateIntervalValueChanged  s     7=6M6M6O23r_   c                 D    |j                         dz  | j                  d<   y )Nr5  r3  r  r  s     r^   brailleFlashTimeValueChangedz)OrcaSetupGUI.brailleFlashTimeValueChanged  s    -3-D-D-F-M)*r_   c                     |j                         rt        j                  | j                  d<   yt        j                  | j                  d<   y)aJ  Signal handler for the "toggled" signal for the abbrevRolenames
           GtkCheckButton widget. The user has [un]checked the 'Abbreviated
           Rolenames' checkbox. Set the 'brailleRolenameStyle' preference
           to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r  N)r#  r   r  r,   BRAILLE_ROLENAME_STYLE_LONGr  s     r^   abbrevRolenamesCheckedz#OrcaSetupGUI.abbrevRolenamesChecked  sB     55 NN12 44 NN12r_   c                     |j                         r]|j                         t        j                  k(  rt        j                  | j
                  d<   yt        j                  | j
                  d<   yy)a  Signal handler for the "toggled" signal for the brailleBriefButton,
           or brailleVerboseButton GtkRadioButton widgets. The user has
           toggled the braille verbosity level value. If this signal was
           generated as the result of a radio button getting selected
           (as opposed to a radio button losing the selection), set the
           'brailleVerbosityLevel' preference to the new value.

        Arguments:
        - widget: the component that generated the signal.
        r  Nr  r  s     r^   brailleVerbosityChangedz$OrcaSetupGUI.brailleVerbosityChanged#  s^     !Y%D%DD22 67 44 67 r_   c                 "    ||   |    ||   |<   y)z6When the user changes a checkbox field (boolean field)N )r[   r  r   r]  r  s        r^   r   zOrcaSetupGUI.keyModifiedToggle7  s!      %T{3//dCr_   c                     | j                  t        j                         dt        _        t        j                         j                         j                          |j                  d| j                         y)z5Starts user input of a Key for a selected key bindingTzkey-press-eventN)r  r   KB_ENTER_NEW_KEYr   capturingKeysr   rx   getActiveScriptremoveKeyGrabsr   kbKeyPressed)r[   r  rm   r   r=  s        r^   r   zOrcaSetupGUI.editingKey=  sX     	X667#'
 !!#335DDF*D,=,=>r_   c                     dt         _        g | _        t        j                         j                         j                  d       y)z4Stops user input of a Key for a selected key bindingFDone capturing keysN)r   r  rY   r   rx   r  refreshKeyGrabs)r[   rm   s     r^   r   zOrcaSetupGUI.editingCanceledKeyF  s8     $)
 !!#335EEF[\r_   c                 &   |j                   }t        j                  j                         }|j	                  |      }|d   }t        j
                  |d         }|j                  }t        j                  }||v rdt        j                  dg| _        yg d}	||	v ry|t        j                         z  }| j                  r|dv r||dg| _        y| j                  \  }
}}|t        j                  z  }|r |t        j                  z  }|||dz   g| _        y)	ztCalled when a new key event arrives and we are capturing keys.
        (used for key bindings redefinition)
        r  r   r  F)Alt_LAlt_R	Control_L	Control_RShift_LShift_RMeta_LMeta_RNum_Lock	Caps_Lock
Shift_LockReturnEscaper
   T)hardware_keycoder   Keymapget_defaultget_entries_for_keycodekeyval_namer[  r   r  r   ORCA_MODIFIER_MASKrY   r    accelerator_get_default_mod_mask)r[   keyPressedEventkeycodekeymapentries_for_keycodeentrieseventString
eventStateorcaModsmodifierKeysstringr#  r  isOrcaModifiers                 r^   _processKeyCapturedz OrcaSetupGUI._processKeyCapturedN  s    "22'')$<<WE%b)oogaj1$**
,,("!#[%C%CQ GD@ ,&#"F"F"HH
  11!,j! <D(,(9(9%	:"[%C%CC+888J!,j*q. IDr_   c                    | j                  |      }|sy| j                  sy| j                  \  rdv ryt        j                  z  }dv rA|s?|j	                  d       | j                  t        j                         g | _        d| _        yt        j                  t        j                  d      | _        t        j                        }| j                        }|z   |z   }| j                  j                  |      }|Kfd}	t        t!        |	| j"                  j$                              }
|
r|
d   j&                  j(                  }|rQt        j*                  |z  }t-        d	t.        j0                  z        }t3        j4                  || j
                  |       yt        j6                  |z  }|j	                  |       | j                  |       y)
zSpecial handler for the key_pressed events when editing the
        keybindings.  This lets us control what gets inserted into the
        entry.
        TFr  )Delete	BackSpacer  Nc                     | j                   k(  xr. | j                  k(  xr | j                  k(  xr | j                  S r  )r   r#  r!  r  )xr  keyNamer#  s    r^   matchz(OrcaSetupGUI.kbKeyPressed.<locals>.match  sE    ~~0 BQ[[I5M B3B89		Br_   r   r5  )r
  rY   r   r  set_textr  r   
KB_DELETEDr8   r8  defaultModifierMaskr"  r  r9   rI  r  filterr5   rb  r  r$  KB_ALREADY_BOUNDr  r   doubleClickTimeoutr   timeout_addKB_CAPTURED)r[   rm   r  keyProcessedr	  modifierNamesr  	newStringr$  r  matchesr%  delayr  r  r#  s                @@@r^   r  zOrcaSetupGUI.kbKeyPressedw  s    //6  )-):):&J'%99"[%C%CC--nb!  !4!45 "D"DO%001<1P1P1:151;	=
 $44Y?33J?!G+.>>	--11)<B 6%)C)CDEG%aj00<<++k9Cx:::;EUD$8$8#> 	 &&2Ci(  %r_   c
                 :   dt         _        g | _        t        j                         j                         j                  d       |j                  |      }
	 |j                  |
|	      }||k7  }	 | j                  j                  }| j                  j                  }| j                  j                  }|t        j                  j                   z  }|dt"        j                  j$                  z  z  r3|t&        j(                  z  r |dt"        j                  j$                  z  z  }|j+                  |
|t-        t&        j.                        |t-        t1        |            |||	||t-        |      t2        |       t5        j6                          |r9t8        j:                  |z  }|j                  |
t<              }|| j>                  |<   nt8        j@                  }|r | jC                  |       d| j>                  |<   y# t        $ r d}Y w xY w# t        $ r
 d}d}d}Y iw xY w)z]The user changed the key for a Keybinding: update the model of
        the treeview.
        Fr  r  r   r
   N)"r   r  rY   r   rx   r  r  get_iter_from_stringr  r?  r8   r   r#  r!  r   ModifierTypeMODIFIER_MASKr   	SHIFTLOCKr   r  r  r  r  r  r   r   stopr   KB_CAPTURED_CONFIRMATIONr   r9   KB_DELETED_CONFIRMATIONr  )r[   r  r   r  r=  modMaskmodUsedr   r!  rh   r  originalBindingr  r  modsr  messager$  s                     r^   r   zOrcaSetupGUI.editedKey  s    $)
 !!#335EEF[\//5	!'11&$?O $x/	__11F??,,D44J c&&4441**4445k444Q%,,6667Dfs;#B#BCs3t9~6H!3z?X	' 	77(BG#--fg>K0;D##H-66G  )79D##O4K  	! O	!  	FDJ	s%   G5 .AH 5HHHHc                 >    |j                         | j                  d<   y)aw  Signal handler for the "toggled" signal for the
           presentToolTipsCheckButton GtkCheckButton widget.
           The user has [un]checked the 'Present ToolTips'
           checkbox. Set the 'presentToolTips'
           preference to the new value if the user can present tooltips.

        Arguments:
        - widget: the component that generated the signal.
        rV  N)r#  r,   r  s     r^   presentToolTipsCheckedz#OrcaSetupGUI.presentToolTipsChecked  s     -3,=,=,?()r_   c                 R   |j                         r|j                         t        j                  k(  r;t        j
                  | j                  d<   t        j                  | j                  d<   yt        j                  | j                  d<   t        j                  | j                  d<   yy)a(  Signal handler for the "toggled" signal for the generalDesktopButton,
           or generalLaptopButton GtkRadioButton widgets. The user has
           toggled the keyboard layout value. If this signal was
           generated as the result of a radio button getting selected
           (as opposed to a radio button losing the selection), set the
           'keyboardLayout' preference to the new value. Also set the
           matching list of Orca modifier keys

        Arguments:
        - widget: the component that generated the signal.
        rW  r  N)
r#  r  r   KEYBOARD_LAYOUT_DESKTOPr   r  r,   DESKTOP_MODIFIER_KEYSGENERAL_KEYBOARD_LAYOUT_LAPTOPLAPTOP_MODIFIER_KEYSr  s     r^   keyboardLayoutChangedz"OrcaSetupGUI.keyboardLayoutChanged  s     !Y%F%FF<< /0 22 12 ;; /0 11 12 r_   c                 X   | j                   j                         }|j                         }|j                  |t        dt
        d       |j                  |      }| j                   j                  d      }| j                   j                          | j                   j                  ||d       y)a  Signal handler for the "clicked" signal for the
        pronunciationAddButton GtkButton widget. The user has clicked
        the Add button on the Pronunciation pane. A new row will be 
        added to the end of the pronunciation dictionary list. Both the
        actual and replacement strings will initially be set to an empty
        string. Focus will be moved to that row.

        Arguments:
        - widget: the component that generated the signal.
        r  r   TN)
r<   rP  r  r  r  r  get_pathr  
grab_focus
set_cursor)r[   r  r]  rd  r   r  s         r^   pronunciationAddButtonClickedz*OrcaSetupGUI.pronunciationAddButtonClicked  s     &&002<<>		(FBR8~~h'$$//2))+))$T:r_   c                 |    | j                   j                         j                         \  }}|j                  |       y)aW  Signal handler for the "clicked" signal for the
        pronunciationDeleteButton GtkButton widget. The user has clicked
        the Delete button on the Pronunciation pane. The row in the 
        pronunciation dictionary list with focus will be deleted.

        Arguments:
        - widget: the component that generated the signal.
        N)r<   get_selectionget_selectedrf  )r[   r  r]  oldIters       r^    pronunciationDeleteButtonClickedz-OrcaSetupGUI.pronunciationDeleteButtonClicked  s1     //==?LLNwWr_   c                     t        j                         j                  d      }| j                  | j                  |d       | j                  | j                  |d       | j                          y)a  Signal handler for the "clicked" signal for the
        textSelectAllButton GtkButton widget. The user has clicked
        the Speak all button.  Check all the text attributes and
        then update the "enabledSpokenTextAttributes" and
        "enabledBrailledTextAttributes" preference strings.

        Arguments:
        - widget: the component that generated the signal.
        rO  TNr   rx   ry   rf  r2   ri  rw  r[   r  
attributess      r^   textSelectAllButtonClickedz'OrcaSetupGUI.textSelectAllButtonClicked)  s`     &002==>QR
%%&&
D	:''&&
D	:!!#r_   c                     t        j                         j                  d      }| j                  | j                  |d       | j                  | j                  |d       | j                          y)a  Signal handler for the "clicked" signal for the
        textUnselectAllButton GtkButton widget. The user has clicked
        the Speak none button. Uncheck all the text attributes and
        then update the "enabledSpokenTextAttributes" and
        "enabledBrailledTextAttributes" preference strings.

        Arguments:
        - widget: the component that generated the signal.
        rO  FNr?  r@  s      r^   textUnselectAllButtonClickedz)OrcaSetupGUI.textUnselectAllButtonClicked;  s`     &002==>QR
%%&&
E	;''&&
E	;!!#r_   c                    t        j                         j                  d      }| j                  | j                  |d       | j                  | j                  |d       t        j                         j                  d      }| j                  | j                  |d       t        j                         j                  d      }| j                  | j                  |d       | j                          y)a  Signal handler for the "clicked" signal for the
        textResetButton GtkButton widget. The user has clicked
        the Reset button. Reset all the text attributes to their
        initial state and then update the "enabledSpokenTextAttributes"
        and "enabledBrailledTextAttributes" preference strings.

        Arguments:
        - widget: the component that generated the signal.
        rO  Frp  Trq  Nr?  r@  s      r^   textResetButtonClickedz#OrcaSetupGUI.textResetButtonClickedM  s     &002==>QR
%%&&
E	;''&&
E	; &002==>[\
%%&&
D	: '')445TU 	''&&
D	: 	!!#r_   c                     | j                   j                         }|j                         \  }}|D ]%  }|j                  |      }|j	                  |d       ' | j                          y)a  Signal handler for the "clicked" signal for the
        textMoveToTopButton GtkButton widget. The user has clicked
        the Move to top button. Move the selected rows in the text
        attribute view to the very top of the list and then update
        the "enabledSpokenTextAttributes" and "enabledBrailledTextAttributes"
        preference strings.

        Arguments:
        - widget: the component that generated the signal.
        N)r2   r:  get_selected_rowsrU  
move_afterrw  r[   r  textSelectionr]  pathsr   rd  s          r^   textMoveToTopButtonClickedz'OrcaSetupGUI.textMoveToTopButtonClickedi  se     22@@B&88: 	-D~~d+HXt,	- 	!!#r_   c                 .   | j                   j                         }|j                         \  }}|D ]S  }|j                  |      }|j	                         }|d   s*|j                  d|d   dz
        }|j                  ||       U | j                          y)a  Signal handler for the "clicked" signal for the
        textMoveUpOneButton GtkButton widget. The user has clicked
        the Move up one button. Move the selected rows in the text
        attribute view up one row in the list and then update the
        "enabledSpokenTextAttributes" and "enabledBrailledTextAttributes"
        preference strings.

        Arguments:
        - widget: the component that generated the signal.
        r   Nr
   )r2   r:  rH  rU  get_indicesiter_nth_childswaprw  )	r[   r  rK  r]  rL  r   rd  indicesre  s	            r^   textMoveUpOneButtonClickedz'OrcaSetupGUI.textMoveUpOneButtonClicked|  s     22@@B&88: 	0D~~d+H&&(Gqz!00wqz!|D	

8Y/	0 	!!#r_   c                 N   | j                   j                         }|j                         \  }}|j                  d      }|D ]R  }|j	                  |      }|j                         }|d   |dz
  k  s0|j                  |      }	|j                  ||	       T | j                          y)a  Signal handler for the "clicked" signal for the
        textMoveDownOneButton GtkButton widget. The user has clicked
        the Move down one button. Move the selected rows in the text
        attribute view down one row in the list and then update the
        "enabledSpokenTextAttributes" and "enabledBrailledTextAttributes"
        preference strings.

        Arguments:
        - widget: the component that generated the signal.
        Nr   r
   )	r2   r:  rH  rr  rU  rO  r  rQ  rw  )
r[   r  rK  r]  rL  rv  r   rd  rR  re  s
             r^   textMoveDownOneButtonClickedz)OrcaSetupGUI.textMoveDownOneButtonClicked  s     22@@B&88:&&t, 	0D~~d+H&&(GqzF1H$!OOH5	

8Y/	0 	!!#r_   c                     | j                   j                         }|j                         \  }}|D ]%  }|j                  |      }|j	                  |d       ' | j                          y)a  Signal handler for the "clicked" signal for the
        textMoveToBottomButton GtkButton widget. The user has clicked
        the Move to bottom button. Move the selected rows in the text
        attribute view to the bottom of the list and then update the
        "enabledSpokenTextAttributes" and "enabledBrailledTextAttributes"
        preference strings.

        Arguments:
        - widget: the component that generated the signal.
        N)r2   r:  rH  rU  rX  rw  rJ  s          r^   textMoveToBottomButtonClickedz*OrcaSetupGUI.textMoveToBottomButtonClicked  se     22@@B&88: 	.D~~d+Hh-	. 	!!#r_   c                 P    | j                   j                  j                  d       y)zSignal handler for the "clicked" signal for the helpButton
           GtkButton widget. The user has clicked the Help button.

        Arguments:
        - widget: the component that generated the signal.
        preferences)pageN)rZ   learnModePresenter	show_helpr  s     r^   helpButtonClickedzOrcaSetupGUI.helpButtonClicked  s     	&&00m0Dr_   c                 x   t        j                         j                  d      }|j                  t        j
                        }|v| j                  |t        j                  j                  <   | j                  |t        j                  j                  <   | j                  |t        j                  j                  <   yy)zRRestore the settings we saved away when opening the preferences
           dialog.ra   N)r   rx   ry   rI  r   rz   rP   r   r|   r}   rQ   r~   rR   r   )r[   ra   r0   s      r^   restoreSettingszOrcaSetupGUI.restoreSettings  s     ",,.99(Czz("8"89#+/>>L(48OOL001+/>>L( $r_   c           
         | j                   s| j                          | j                  d      j                         }|| j                  d<   | j
                  r#| j
                  j                  | j                  d<   | j                  r'| j                  j                         | j                  d<   | j                  t        j                  t        j                  | j                        t        j                  t        j                  | j                        t        j                   t        j                  | j"                        t        j$                  t        j                  | j&                        i| j                  d<   y y )Nr  rH  r>  r0  ra   )rS   r_  r   r#  r,   rI   r8  rF   r*  r0   r   rz   r   r|   rJ  rM   rK  r3   rL  rL   r  s     r^   saveBasicSettingszOrcaSetupGUI.saveBasicSettings  s   ##  "!;<GGI)/~&##((11 NN01 ##((002 NN-. (&&		$2C2C(D(($))D4G4G*H(($))D4G4G*H%%tyy1A1A'B	(DNN8$ )r_   c                    d}t        j                  t         j                  |d       | j                          | j	                  | j
                        }| j	                  | j                        }|| j                  d<   || j                  d<   || j                  d<   t        j                         j                  |       | j                          t        j                  | j                         t        j                           | j#                          | j%                          | j'                          d}t        j                  t         j                  |d       y)a^  Signal handler for the "clicked" signal for the applyButton
           GtkButton widget. The user has clicked the Apply button.
           Write out the users preferences. If GNOME accessibility hadn't
           previously been enabled, warn the user that they will need to
           log out. Shut down any active speech servers that were started.
           Reload the users preferences to get the new speech, braille and
           key echo value to take effect. Do not dismiss the configuration
           window.

        Arguments:
        - widget: the component that generated the signal.
        z(PREFERENCES DIALOG: Apply button clickedTr  r  r  z8PREFERENCES DIALOG: Handling Apply button click completeN)r   r  	LEVEL_ALLra  r  rV   rX   r,   r   rx   setStartingProfiler   r   loadUserSettingsrZ   r   checkBrailleSettingr   r   r  )r[   r  r%  r  r  s        r^   applyButtonClickedzOrcaSetupGUI.applyButtonClicked  s    95??C6 ,,T-?-?@..t/H/HI$1y!*7',;()##%88I!!#dkk*##%!!#!H5??C6r_   c                     d}t        j                  t         j                  |d       | j                  |       | j	                  d      j                          d}t        j                  t         j                  |d       y)a'  Signal handler for the "clicked" signal for the cancelButton
           GtkButton widget. The user has clicked the Cancel button.
           Don't write out the preferences. Destroy the configuration window.

        Arguments:
        - widget: the component that generated the signal.
        z)PREFERENCES DIALOG: Cancel button clickedTrr   z9PREFERENCES DIALOG: Handling Cancel button click completeN)r   r  rc  windowClosedr   destroyr[   r  r%  s      r^   cancelButtonClickedz OrcaSetupGUI.cancelButtonClicked  s^     :5??C6&!)*224I5??C6r_   c                     d}t        j                  t         j                  |d       | j                  |       | j	                          | j                  d      j                          d}t        j                  t         j                  |d       y)aC  Signal handler for the "clicked" signal for the okButton
           GtkButton widget. The user has clicked the OK button.
           Write out the users preferences. If GNOME accessibility hadn't
           previously been enabled, warn the user that they will need to
           log out. Shut down any active speech servers that were started.
           Reload the users preferences to get the new speech, braille and
           key echo value to take effect. Hide the configuration window.

        Arguments:
        - widget: the component that generated the signal.
        z%PREFERENCES DIALOG: OK button clickedTrr   z5PREFERENCES DIALOG: Handling OK button click completeN)r   r  rc  rg  r  r   rj  rk  s      r^   okButtonClickedzOrcaSetupGUI.okButtonClicked   sj     65??C6'""$)*224E5??C6r_   c                 8   d}t        j                  t         j                  |d       | j                          t        j
                  slt        j                         j                  d      }|r| j                  |       t        j                         j                  d      }|r| j                  |       | j                          | j                          t        j                  d| j                         d}t        j                  t         j                  |d       y)a!  Signal handler for the "closed" signal for the orcaSetupWindow
           GtkWindow widget. This is effectively the same as pressing the
           cancel button, except the window is destroyed for us.

        Arguments:
        - widget: the component that generated the signal.
        z*PREFERENCES DIALOG: Window is being closedTr>  r0  r5  z+PREFERENCES DIALOG: Window closure completeN)r   r  rc  suspendEventsr   r   r   rx   ry   r<  r-  r  r_  r   r  resumeEvents)r[   r  r%  rC  r,  s        r^   ri  zOrcaSetupGUI.windowClosed7  s     ;5??C6,,&113>>?TUG,,W5%002==>PQF,,V4""$D$"3"34;5??C6r_   c                    d}t        j                  t         j                  |d       | j                  j	                  d       | j
                  j	                  d       | j                  j	                  d       | j                  j                  d       | j
                  j                  d       | j                  j                  d       | j                  j                          | j
                  j                          | j                  j                          dt        _
        d}t        j                  t         j                  |d       y)ae  Signal handler for the "destroyed" signal for the orcaSetupWindow
           GtkWindow widget. Reset orca_state.orcaOS to None, so that the 
           GUI can be rebuilt from the GtkBuilder file the next time the user
           wants to display the configuration GUI.

        Arguments:
        - widget: the component that generated the signal.
        z-PREFERENCES DIALOG: Window is being destroyedTNFz/PREFERENCES DIALOG: Window destruction complete)r   r  rc  r7   r  r2   r<   rD  rE  r   orcaOSrk  s      r^   windowDestroyedzOrcaSetupGUI.windowDestroyedV  s     >5??C6""4("",,T2((.,,U3""66u=2259""'')##% 
?5??C6r_   c                    d}t        j                  t         j                  |d       t        j                         }|j                  d       |j                  d       |j                  d       |j                  d       y )Nz1PREFERENCES DIALOG: Re-registering floody events.Tobject:state-changed:showingobject:children-changed:removeobject:selection-changed&object:property-change:accessible-name)r   r  rc  r   rx   registerListenerr[   r%  managers      r^   rq  zOrcaSetupGUI.resumeEventsq  sg    A5??C6**,  !?@  !AB  !;<  !IJr_   c                    d}t        j                  t         j                  |d       t        j                         }|j                  d       |j                  d       |j                  d       |j                  d       y )Nz0PREFERENCES DIALOG: Deregistering floody events.Trv  rw  rx  ry  )r   r  rc  r   rx   deregisterListenerr{  s      r^   rp  zOrcaSetupGUI.suspendEvents{  sg    @5??C6**,""#AB""#CD""#=>""#KLr_   c                 .    t        j                  |        y)z$Show profile Dialog to add a new oneN)r   showProfileUIr  s     r^   showProfileGUIzOrcaSetupGUI.showProfileGUI  s     	&&t,r_   c                    	 |sy|j                  dd      j                         }||g	d	 fd	} j                         D cg c]  }|d   	 }}t        |t              r#|dk7  r||vr| j
                  d   k7  r |        y|5t        j                  dt        j                  |       dz  }t        j                  dt        j                  j                  t        j                  j                  t        j                   j"                  	      }|j%                  dt        j&                   d       |j)                  |       |j+                  t        j,                         |j/                         }|t        j0                  j2                  k(  r|j5                           |d
       y|j5                          yyc c}w )z~Creates a new profile based on the name profileToSaveLabel and
        updates the Preferences dialog combo boxes accordingly.N _c                     | r6j                   j                        }j                  j                  |       j                  d<   j                  d<   j                          j                          y )Nr  r  )rW   r  rV   r  r,   ra  r   )
newProfiler  r  r[   s     r^   saveActiveProfilez3OrcaSetupGUI.saveProfile.<locals>.saveActiveProfile  sf    $($;$;$B$B7$K!""223DE(/DNN9%.5DNN?+""$%%'r_   r
   r  <b></b>typebuttonsFT)replacelowerr  r  r  r-   r   PROFILE_CONFLICT_MESSAGEr   markup_escape_textr   MessageDialogDialogFlagsMODALMessageTypeINFOButtonsTypeYES_NO
set_markupPROFILE_CONFLICT_LABELformat_secondary_markupr  PROFILE_CONFLICT_TITLErunResponseTypeYESrj  )
r[   profileToSaveLabelprofileToSaver  pr  r+  dialogresponser  s
   `        @r^   saveProfilezOrcaSetupGUI.saveProfile  s}    "*223<BBD%}5	( ,0+F+F+HIaQqTIImS)!R'!)::!T%9%9!%<<(#<<$112DEFdKL**4-- __11 # 6 68 !!C	(H(H'I"NO..w7  !A!AB!::<s//333NN$%e,NN$ ) Js   F=c                 b   | j                  | j                        }t        j                  dt	        j
                  |d          dz  }t        j                  | j                  t        j                  j                  t        j                  j                  t        j                  j                        }|j                  dt        j                    d       |j#                  |       |j%                         t        j&                  j(                  k(  r| j*                  j-                  d      }|r||k(  r+| j.                  }| j0                  D ]  }|dd }||k7  s|} n | j*                  j-                  d      }|r||k(  r|}t3        j4                         j7                  |d          | j9                  |       | j*                  j-                  d      }	|	r|	|k(  rB|| j*                  d<   t3        j4                         j;                  |       | j=                          |j?                          y)	zRemove profile button clicked handler

        If we removed the last profile, a default one will automatically get
        added back by the settings manager.
        r  r   r  r  r  Nr  r
   ) r  rV   r   PROFILE_REMOVE_MESSAGEr   r  r   r  rN   r  r  r  r  r  r  r  PROFILE_REMOVE_LABELr  r  r  r  r,   rI  r-   rW   r   rx   removeProfileloadProfilerd  r   rj  )
r[   r  
oldProfiler+  r  newStartingProfiler  
rowProfiler  r  s
             r^   removeProfileButtonClickedz'OrcaSetupGUI.removeProfileButtonClicked  s    ))$*<*<=
22$))*Q-89>?""4;;0E0E(+(<(<+.??+A+AC 	C	 > >?tDE&&w/::<3++/// "&!3!34E!F%);z)I%)%9%9"22 C!$QJ!Z/-7*	 ++O<Jz!9/
'')77
1FZ( #nn001BCO"o&C4F01 ++-@@AST))+r_   c                     | j                   ryt        j                  dt        j                  j                  t        j
                  j                  t        j                  j                        }|j                  dt        j                   d       |j                  t        j                         |j                         }|t        j                  j                   k(  r!|j#                          | j%                          y|j#                          y)z#Load profile button clicked handlerNr  r  r  )rS   r   r  r  r  r  r  r  r  r  r   PROFILE_LOAD_LABELr  PROFILE_LOAD_MESSAGEr  r  r  rj  loadSelectedProfile)r[   r  r  r  s       r^   loadProfileButtonClickedz%OrcaSetupGUI.loadProfileButtonClicked  s     ""4%%__))..0
 	C	 < <=TBC&&y'E'EF::<s''+++NN$$&NNr_   c                 \    | j                  | j                        }| j                  |       y)zLoad selected profileN)r  rV   r  )r[   r  s     r^   r  z OrcaSetupGUI.loadSelectedProfile  s(     ,,T-?-?@'r_   c                    | j                          || j                  d<   t        j                         j	                  |d          t        j                         j                  |d         | _        t        j                  d       | j                          t        j                          | j                          | j                          | j                          y)zLoad profiler  r
   T)skipReloadMessageN)ra  r,   r   rx   
setProfilegetGeneralSettingsr   re  r   r   rf  r   r   r  )r[   r  s     r^   r  zOrcaSetupGUI.loadProfile  s     	 *1'##%00<)446II'RS*U5##%!!#!r_   r  )F)r   )NFr  )|r8  
__module____qualname__r+   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r(  r-  r4  r<  rF  r   rf  ri  rm  rw  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r"  r  r  r   r   r  r   r   r  r  r  r  r*  r0  r@  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r
  r  r   r-  r3  r8  r=  rB  rD  rF  rM  rS  rU  rW  r]  r_  ra  rg  rl  rn  ri  rt  rq  rp  r  r  r  r  r  r  r  r_   r^   r&   r&   _   s   9vM^,
7(T$(<
H
(F
(
H
(;:B4H3Dj@G6R#J!MF!#F/,b0(f 38%N:KJ>J
E
D
$$$"fGP.3^
JEXwBrB,AH
",)"%N6" $  -` .3>56x%t*CH#$@#J@>6 C"C"C":$ 48484634F2,
LK"*8X945(PN5"5('R6p1f@22;($$$$$8$&$,$.$&E:."7H7$7.7>76KM-
)%X-^(("r_   r&   )Z__doc____id____version____date____copyright____license__girequire_versiongi.repositoryr   r   r   r   r   r   r	   rw  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	ax_objectr   r  ImportErrororca_platformr   r  rS  r   r   r   r   r   r   r   r   r   r   r   rV  rh  rW  r  r  r   r   r   r   r  r  r  r  r  r  r  rz  r{  r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r*   r&   r  r_   r^   <module>r     s  ( ;? 	   7E "  	    !                      "  %E  b	?'9i|Xx(,U1X %y+uU1X  +/uQx. ')Y "&eAh&(:<N 1 >B%)_;+-C13J)+?+-G89s6"?44 s6"A  Es   	E4 4E>=E>