+
    Qi  c                   sZ    R t RtRtRtRtRt^ RIHtHt ^ RI	t	^ RI
HtHt  ! R	 R
4      tR# )zJSON backend for Orca settingsz$Id$z
$Revision$z$Date$z7Copyright (c) 2010-2011 Consorcio Fernando de los Rios.ZLGPL)loaddumpN)settingsacssc                   sz   a  ] tR t^"t o R tR tR tR tR tR t	RR lt
RR	 ltRR
 ltR tR tR tR tRtV tR# )Backendc                s   / V n         / V n        / V n        / V n        \        P
                  P                  VR4      V n        \        P
                  P                  VR4      V n        RR\        P                  R/ R/ //V n        R# )z%Initialize the JSON Backend.
        zuser-settings.confzapp-settingsdefaultprofilepronunciationskeybindingsN)generalr   r   profilesospathjoinsettingsFileappPrefsDirr   r   _defaultProfiles)selfZprefsDirs   &&?/usr/lib/python3.14/site-packages/orca/backends/json_backend.py__init__ZBackend.__init__$   sw      GGLL3GH77<<.A!*i(:J:J:JB:G-. !"    c                s    RVRV P                   RVRV/pWn        V P                   V n        W n        W0n        \        V P                  R4      p\        WE^R7       VP                  4        R# )zASave default settings for all the properties from
orca.settings. r	   r
   r   r   wZindentN)	r   r	   r
   r   r   openr   r   close)r   r	   r   r   prefsr   s   &&&&  r   saveDefaultSettingsZBackend.saveDefaultSettings4   sm     GT22!>-
 --,&D--s3U+r   c                s    \         P                  P                  V P                  V R 24      p\         P                  P	                  V4      '       d*   \        VR4      p\        V4      pVP                  4        V# / pV# ).confZr)r   r   r   r   existsr   r    r   )r   appNamefileNamer   r   s   &&   r   get_app_settingsZBackend.get_app_settingsE   sk    77<< 0 0WIU2CD77>>(###.L&E   Er   c                s   V P                  V4      pVP                  R / 4      pRVRVRV/Wr&   WvR &   \        P                  P	                  V P
                  V R24      p\        VR4      p	\        Wi^R7       V	P                  4        R# )r
   r	   r   r   r   r   r   N)	r   getr   r   r   r   r   r   r   )
r   r   r   r	   r   r   r   r
   r   r   s
   &&&&&&    r   saveAppSettingsZBackend.saveAppSettingsP   s    %%g.99Z,&-~*K9 %j77<< 0 0WIU2CDHc*U+r   c                s    Vf   RpW2R&   WBR&   \        V P                  R4      ;_uu_ 4       p\        V4      pW&R,          V&   VP                  ^ 4       VP	                  4        \        We^R7       RRR4       R#   + '       g   i     R# ; i)zFSave minimal subset defined in the profile against current 
defaults. Nr   r   r   r+r
   r   )r   r   r    seektruncater   )r   r   r	   r   r   r   r   s   &&&&&  r   saveProfileSettingsZBackend.saveProfileSettings]   s~     ?G$2 !!,$##T**l&E)0*g&a !!#Q/ +***   AA<<B	c                s   \        V P                  4      p \        V4      pTR,          P	                  4       T n        TR,          T n        TR,          T n        TR,          P	                  4       T n        R#   \         d     R# i ; i)z#Load from config file all settings Nr	   r   r   r
   )	r   r   r    Z
ValueErrorcopyr	   r   r   r
   )r   r   r   s   &  r   _getSettingsZBackend._getSettingsn   s|    D--.	&E Y',,.#$45 /j)..0  		s   A8 8BBNc                s   V P                  4        V P                  P                  4       pVP                  RRR.4      pVf
   V^,          pV P                  V,          P                  4       pVP                  4        FJ  w  rVVR8X  d2   VP                  4        F  w  rx\        P                  ! V4      Wg&   K  	  VR9  g   KF  WbV&   KL  	   VR,          VR&   V#   \         d	    Y2R&    T# i ; i)zMGet general settings from default settings and
override with profile values. startingProfileZDefaultr   ZvoicesactiveProfiler   )r)   r*   )	r(   r	   r'   r    r
   Zitemsr   ZACSSZKeyError)	r   r   ZgeneralSettingsZdefaultProfileprofileSettingskeyvalueZ	voiceTypeZvoiceDefs	   &&       r   
getGeneralZBackend.getGeneralz   s     	,,++-(,,->.7-CE?$Q'G--0557)//1JCh+0;;='I'+yy':E$ ,9>>',$ 2	>/>y/IOO,   	>/=O,	>s   C C-,C-c                    V P                  4        V P                  P                  4       pV P                  V,          P                  4       pRV9   d
   VR,          pV# )zSGet pronunciation settings from default settings and
override with profile values. r   )r(   r   r'   r
   )r   r   r   r+      &&  r   get_pronunciationsZBackend.get_pronunciations   sT     	,,113--0557.,-=>Nr   c                r/   )zQGet keybindings settings from default settings and
override with profile values. r   )r(   r   r'   r
   )r   r   r   r+   r0   r   get_keybindingsZBackend.get_keybindings   sS     	&&++---0557O+)-8Kr   c                s^    \         P                  P                  V P                  4      '       * # )zCheck if we're in first start. )r   r   r   r   )r   s   &r   is_first_startZBackend.is_first_start   s      77>>$"3"3444r   c                s    W P                   V&   \        V P                  R 4      ;_uu_ 4       p\        V4      pW$R,          V&   VP	                  ^ 4       VP                  4        \        WC^R7       RRR4       R#   + '       g   i     R# ; i)r"   r	   r   N)r	   r   r   r    r#   r$   r   )r   r,   r-   r   r   s   &&&  r   _setProfileKeyZBackend._setProfileKey   sm    !S$##T**l&E$))S!a !!#Q/ +***r&   c                s    V P                  4        . pV P                  P                  4        FD  pV P                  V,          P                  4       pVP	                  VP                  R4      4       KF  	  V# )zList available profiles. r   )r(   r
   Zkeysr'   Zappendr    )r   r
   profileNameZprofileDicts   &   r   available_profilesZBackend.available_profiles   s]    ==--/K--499;KOOKOOI67 0 r   c                s  a a VV 3R lpSS P                   9   d   V! S P                   4       \        S P                  R4      ;_uu_ 4       p\        V4      pSVR,          9   d>   V! VR,          4       VP	                  ^ 4       VP                  4        \        WC^R7       RRR4       R#   + '       g   i     R# ; i)zRemove an existing profilec                 s   < V S \        V 4      ^ 8X  d9   SP                   F&  pSP                  V,          P                  4       W&   K(  	  R# R# )i    N)Zlenr   r'   )Zdictr5   r   r   s   & r   removeProfileFromZ1Backend.remove_profile.<locals>.removeProfileFrom   sF    W4yA~#'#8#8K(,(=(=k(J(O(O(QD% $9 r   r"   r
   r   N)r
   r   r   r    r#   r$   r   )r   r   r7   r   r   s   ff   r   remove_profileZBackend.remove_profile   s    	R dmm#dmm,$##T**l&E%
++!%
"34!!!$%%'U3 +***s   AB,,B=	)r   r   r	   r   r
   r   r   )N)r   )Z__name__Z
__module__Z__qualname__Z__firstlineno__r   r   r   r!   r%   r(   r.   r1   r2   r3   r4   r6   r8   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   "   sK     " "	0"
1,5
0	4 4r   r   )Z__doc__Z__id__Z__version__Z__date__Z__copyright__Z__license__Zjsonr    r   r   Zorcar   r   r   ) r   r   <module>r9      s8   , %I  	 n4 n4r   