Ë
    g
fði  ã            	       óh  — d Z dZdZdZdZdZddlZddlZddlm	Z	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 	 e	j,                  j/                  e	j0                  j2                  e	j4                  j6                  ddddd«      Z G d„ de«      Z e«       Z d„ Z!y# e$ r dZY Œw xY w)z\Settings manager module. This will load/save user settings from a 
defined settings backend.z$Id$z
$Revision$z$Date$z2Copyright (c) 2010 Consorcio Fernando de los Rios.ÚLGPLé    N)ÚGioÚGLibé   )Údebug)Ú	orca_i18n)Úsettings)Úpronunciation_dict)ÚACSS)ÚAXObject)Ú
KeyBindingzorg.a11y.Busz/org/a11y/buszorg.freedesktop.DBus.Propertiesc                   ó,  — e Zd ZdZdZd„ Zd-d„Zdi f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/d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd/d„Zd„ Zd0d„Zd„ Zd„ Zd„ Zd.d„Z d.d„Z!d.d „Z"d!„ Z#d"„ Z$d#„ Z%d$„ Z&d%„ Z'd&„ Z(d1d'„Z)d(„ Z*d2d)„Z+d*„ Z,d1d+„Z-d,„ Z.y)3ÚSettingsManagerz^Settings backend manager. This class manages orca user's settings
    using different backendsNc                 óp   — dt        | «      vrt        j                  | g|¢­i |¤Ž| _        | j                  S )NÚ
__instance)ÚvarsÚobjectÚ__new__Ú_SettingsManager__instance)ÚclsÚargsÚkwargss      ú7/usr/lib/python3/dist-packages/orca/settings_manager.pyr   zSettingsManager.__new__=   s2   € Øœt C›yÑ(Ü#Ÿ^™^¨CÐA°$ÒA¸&ÑAˆCŒNØ�~‰~Ðó    c                 óö  — t        j                  t         j                  dd«       d| _        d| _        d| _        || _        d| _        i | _        i | _	        i | _
        i | _        i | _        i | _        i | _        i | _        i | _        d| _        i | _        i | _        i | _        | j+                  «       st-        d«      ‚i | _        d| _        dg| _        t        j                  t         j                  dd«       y)	zØInitialize a SettingsManager Object.
        If backend isn't defined then uses default backend, in this
        case json-backend.
        backend parameter can use the follow values:
        backend='json'
        zSETTINGS MANAGER: InitializingTNÚ z$SettingsManager._loadBackend failed.Fúapp-settingszSETTINGS MANAGER: Initialized)r   ÚprintMessageÚ
LEVEL_INFOÚbackendModuleÚ_backendÚprofileÚbackendNameÚ	_prefsDirÚdefaultGeneralÚdefaultPronunciationsÚdefaultKeybindingsÚprofileGeneralÚprofilePronunciationsÚprofileKeybindingsÚgeneralÚpronunciationsÚkeybindingsÚ
_activeAppÚ_appGeneralÚ_appPronunciationsÚ_appKeybindingsÚ_loadBackendÚ	ExceptionÚcustomizedSettingsÚ_customizationCompletedÚsettingsPackages©ÚselfÚbackends     r   Ú__init__zSettingsManager.__init__B   sü   € ô 	×Ñœ5×+Ñ+Ð-MÈtÔTà!ˆÔØˆŒØˆŒØ"ˆÔØˆŒð
 !ˆÔØ%'ˆÔ"Ø"$ˆÔð
 !ˆÔØ%'ˆÔ"Ø"$ˆÔð
 ˆŒØ ˆÔØˆÔàˆŒØˆÔØ"$ˆÔØ!ˆÔà× Ñ Ô"ÜÐBÓCÐCà"$ˆÔØ',ˆÔ$ð "0Ð 0ˆÔä×Ñœ5×+Ñ+Ð-LÈdÕSr   c                 ó¸  — t        j                  t         j                  dd«       | j                  j	                  |«       |xs2 t
        j                  j                  t        j                  «       d«      | _
        | j                  j                  | j                  «      | _        | j                  «        | j                  «        | j!                  «        | j"                  j%                  «       | _        | j)                  «       s3| j&                  j	                  | j                  j+                  «       «       | j,                  j%                  «       | _        | j0                  j%                  «       | _        | j5                  «        t        j                  t         j                  dd«       d| j6                  g}t        j8                  t         j                  |d«       | j6                  €V| j&                  j;                  d«      d   | _        d| j6                  g}t        j8                  t         j                  |d«       | j=                  | j6                  «       y )	NzSETTINGS MANAGER: ActivatingTÚorcazSETTINGS MANAGER: Activatedz$SETTINGS MANAGER: Current profile isÚstartingProfiler   z(SETTINGS MANAGER: Current profile is now)r   r   r   r4   ÚupdateÚosÚpathÚjoinr   Úget_user_data_dirr$   r    ÚBackendr!   Ú_setDefaultGeneralÚ_setDefaultPronunciationsÚ_setDefaultKeybindingsr%   Úcopyr+   ÚisFirstStartÚ
getGeneralr&   r,   r'   r-   Ú_createDefaultsr"   ÚprintTokensÚgetÚ
setProfile)r8   ÚprefsDirÚcustomSettingsÚtokenss       r   ÚactivatezSettingsManager.activatew   sµ  € Ü×Ñœ5×+Ñ+Ð-KÈTÔRà×Ñ×&Ñ& ~Ô6Ø!ò >Ü�w‰w�|‰|œD×2Ñ2Ó4°fÓ=ð 	Œð ×*Ñ*×2Ñ2°4·>±>ÓBˆŒØ×ÑÔ!Ø×&Ñ&Ô(Ø×#Ñ#Ô%Ø×*Ñ*×/Ñ/Ó1ˆŒØ× Ñ Ô"Ø�L‰L×Ñ §¡× 8Ñ 8Ó :Ô;Ø"×8Ñ8×=Ñ=Ó?ˆÔØ×2Ñ2×7Ñ7Ó9ˆÔð 	×ÑÔä×Ñœ5×+Ñ+Ð-JÈDÔQð 9¸$¿,¹,ÐGˆÜ×Ñœ%×*Ñ*¨F°DÔ9à�<‰<ÐØŸ<™<×+Ñ+Ð,=Ó>¸qÑAˆDŒLØ@À$Ç,Á,ÐOˆFÜ×Ñœe×.Ñ.°¸Ô=à�‰˜Ÿ™Õ%r   c                 óz   — 	 d| j                   › d�}t        j                  |d«      | _        y# t        $ r Y yw xY w)z.Load specific backend for manage user settingsz
.backends.r!   r<   TF)r#   Ú	importlibÚimport_moduler    r3   r7   s     r   r2   zSettingsManager._loadBackendœ   sF   € ð	Ø" 4×#3Ñ#3Ð"4°HÐ=ˆGÜ!*×!8Ñ!8¸À&Ó!IˆDÔØøÜò 	Ùð	ús   ‚+. ®	:¹:c                 ó„  — d„ }| j                   } ||«       t        j                  j                  |d«      } ||«       t        j                  j                  |d«      }t        j                  j	                  |«      s8t        j
                  t        j                  |t        j                  d«      «       t        j                  j                  |d«      } ||«       t        j                  j                  |d«      } ||«       t        j                  j                  |d«      }t        j                  j	                  |«      s8t        j
                  t        j                  |t        j                  d«      «       t        j                  j                  |d«      }t        j                  j	                  |«      s8t        j
                  t        j                  |t        j                  d«      «       | j                  «       r<| j                  j                  | j                  | j                  | j                  «       yy)	zŒLet the active backend to create the initial structure
        for storing the settings and save the default ones from
        orca.settingsc                 ón   — t         j                  j                  | «      st        j                  | «       y y ©N)r?   r@   ÚisdirÚmakedirs)ÚdirNames    r   Ú
_createDirz3SettingsManager._createDefaults.<locals>._createDirª   s#   € Ü—7‘7—=‘= Ô)Ü—‘˜GÕ$ð *r   zorca-scriptsz__init__.pyiÀ  r   Úsoundszorca-customizations.pyN)r$   r?   r@   rA   ÚexistsÚcloseÚopenÚO_CREATrH   r!   ÚsaveDefaultSettingsr%   r&   r'   )r8   r[   ÚorcaDirÚorcaScriptDirÚinitFileÚorcaSettingsDirÚorcaSoundsDirÚuserCustomFiles           r   rJ   zSettingsManager._createDefaults¦   st  € ò	%ð —.‘.ˆÙ�7Ôô Ÿ™Ÿ™ W¨nÓ=ˆÙ�=Ô!Ü—7‘7—<‘< ¨}Ó=ˆÜ�w‰w�~‰~˜hÔ'Ü�H‰H”R—W‘W˜X¤r§z¡z°5Ó9Ô:äŸ'™'Ÿ,™, w°Ó?ˆÙ�?Ô#äŸ™Ÿ™ W¨hÓ7ˆÙ�=Ô!ô —7‘7—<‘< ¨Ó7ˆÜ�w‰w�~‰~˜hÔ'Ü�H‰H”R—W‘W˜X¤r§z¡z°5Ó9Ô:äŸ™Ÿ™ gÐ/GÓHˆÜ�w‰w�~‰~˜nÔ-Ü�H‰H”R—W‘W˜^¬R¯Z©Z¸Ó?Ô@à×ÑÔØ�M‰M×-Ñ-¨d×.AÑ.AØ.2×.HÑ.HØ.2×.EÑ.EõGð r   c                 ó   — i | _         y)z4Get the pronunciations by default from orca.settingsN)r&   ©r8   s    r   rE   z)SettingsManager._setDefaultPronunciationsÑ   s
   € à%'ˆÕ"r   c                 ó   — i | _         y)z1Get the keybindings by default from orca.settingsN)r'   ri   s    r   rF   z&SettingsManager._setDefaultKeybindingsÕ   s
   € à"$ˆÕr   c                 óô   — | j                  «        i | _        t        j                  D ]?  }| j                  j                  |«      }|€	 t        t        |«      }|| j                  |<   ŒA y# t        $ r Y Œw xY w)z6Get the general settings by default from orca.settingsN)Ú_getCustomizedSettingsr%   r	   ÚuserCustomizableSettingsr4   rL   Úgetattrr3   )r8   ÚkeyÚvalues      r   rD   z"SettingsManager._setDefaultGeneralÙ   s}   € à×#Ñ#Ô%Ø ˆÔÜ×4Ñ4ò 	-ˆCØ×+Ñ+×/Ñ/°Ó4ˆEØˆ}ðÜ#¤H¨cÓ2�Eð (-ˆD×Ñ Ò$ñ	-øô
 !ò Ùðús   Á	A+Á+	A7Á6A7c                 óP  — | j                   r| j                  S i }t        j                  j	                  «       D ]
  \  }}|||<   Œ | j                  «       | _         |j	                  «       D ]9  \  }}t        j                  j                  |«      }||k7  sŒ+|| j                  |<   Œ; y rW   )r5   r4   r	   Ú__dict__ÚitemsÚ_loadUserCustomizationsrL   )r8   ÚoriginalSettingsro   rp   ÚcustomValues        r   rl   z&SettingsManager._getCustomizedSettingsæ   s§   € Ø×'Ò'Ø×*Ñ*Ð*àÐÜ"×+Ñ+×1Ñ1Ó3ò 	*‰JˆC�Ø$)Ð˜SÒ!ð	*ð (,×'CÑ'CÓ'EˆÔ$à*×0Ñ0Ó2ò 	;‰JˆC�Ü"×+Ñ+×/Ñ/°Ó4ˆKØ˜Ó#Ø/:�×'Ñ'¨Ò,ñ	;r   c                 ó(  — d}| j                   g}dg}|d   dz   }	 t        j                  j                  d|«      }|�Qt        j                  j	                  |«      }|j
                  j                  |«       |j                  d|dg«       d	}n|j                  d|d
g«       t        j                  t        j                  |d	«       |S # t        $ r |j                  d|dg«       Y ŒFt        $ r }d	}|j                  d|dg«       Y d}~Œid}~ww xY w)zØAttempt to load the user's orca-customizations. Returns a boolean
        indicating our success at doing so, where success is measured by the
        likelihood that the results won't be different if we keep trying.Fz5SETTINGS MANAGER: Attempt to load orca-customizationsr   z/orca-customizations.pyzorca-customizationsNÚfromz
succeeded.Tzfailed. Spec not found.zfailed. File not found.zfailed due to:z. Not loading customizations.)r$   rS   ÚutilÚspec_from_file_locationÚmodule_from_specÚloaderÚexec_moduleÚextendÚFileNotFoundErrorr3   r   rK   Ú	LEVEL_ALL)r8   ÚsuccessÚpathListrP   Úmodule_pathÚspecÚmoduleÚerrors           r   rt   z'SettingsManager._loadUserCustomizationsõ   s  € ð
 ˆØ—N‘NÐ#ˆØIÐJˆØ˜q‘kÐ$=Ñ=ˆð	VÜ—>‘>×9Ñ9Ð:OÐQ\Ó]ˆDØÐÜ"Ÿ™×8Ñ8¸Ó>�Ø—‘×'Ñ'¨Ô/Ø—‘˜v {°LÐAÔBØ‘à—‘˜v {Ð4MÐNÔOô 	×Ñœ%Ÿ/™/¨6°4Ô8Øˆøô !ò 	LØ�M‰M˜6 ;Ð0IÐJÖKÜò 	VàˆGØ�M‰MÐ+¨UÐ4SÐT×UÑUûð	Vús   œBC
 Ã
DÃ)DÃ1DÄDc                 ó   — | j                   S rW   )r$   ri   s    r   ÚgetPrefsDirzSettingsManager.getPrefsDir  s   € Ø�~‰~Ðr   c                 ó*   — | j                  ||i«       y rW   )Ú_setSettingsRuntime)r8   ÚsettingNameÚsettingValues      r   Ú
setSettingzSettingsManager.setSetting  s   € Ø× Ñ  +¨lÐ!;Õ<r   c                 ó$   — t        t        |d «      S rW   )rn   r	   )r8   r‹   s     r   Ú
getSettingzSettingsManager.getSetting  s   € Ü”x ¨dÓ3Ð3r   c                 óú   — | j                  d«      }t        |j                  |i «      «      }|j                  «       }|j	                  «       }|r,t        t        |«      «      dk(  r|› d|j                  «       › �}|S )NÚvoicesé   Ú_)r�   r   rL   Ú	getLocaleÚ
getDialectÚlenÚstrÚupper)r8   Úvoicer‘   ÚvÚlangÚdialects         r   ÚgetVoiceLocalezSettingsManager.getVoiceLocale  sj   € Ø—‘ Ó*ˆÜ�—‘˜E 2Ó&Ó'ˆØ�{‰{‹}ˆØ—,‘,“.ˆÙ”sœ3˜w›<Ó(¨AÒ-Ø�V˜1˜WŸ]™]›_Ð-Ð.ˆDØˆr   c                 óL  — g }| j                  d«      D ]U  }	 t        j                  d|› �«      }|j                  |«       d|g}t	        j
                  t        j                  |d«       ŒW |S # t        $ r, d|g}t	        j
                  t        j                  |d«       Y ŒŽw xY w)z/Imports all known SpeechServer factory modules.ÚspeechFactoryModuleszorca.z.SETTINGS MANAGER: Valid speech server factory:Tz0SETTINGS MANAGER: Invalid speech server factory:)r�   rS   rT   Úappendr   rK   r   r3   )r8   Ú	factoriesÚ
moduleNamer…   rP   s        r   ÚgetSpeechServerFactoriesz(SettingsManager.getSpeechServerFactories$  s®   € ð ˆ	ØŸ/™/Ð*@ÓAò 	BˆJðBÜ"×0Ñ0°5¸¸Ð1EÓF�Ø× Ñ  Ô(ØJÈJÐW�Ü×!Ñ!¤%×"2Ñ"2°F¸DÕAð	Bð Ðøô	 ò BØLÈjÐY�Ü×!Ñ!¤%×"2Ñ"2°F¸DÖAðBús   ˜AA.Á.2B#Â"B#c                 ód  — d|dg}t        j                  t         j                  |d«       |€| j                  }| j	                  |«      xs i | _        | j                  |«      xs i | _        | j                  |«      xs i | _	        d|dg}t        j                  t         j                  |d«       y)zìGet from the active backend all the settings for the current
        profile and store them in the object's attributes.
        A profile can be passed as a parameter. This could be useful for
        change from one profile to another.z&SETTINGS MANAGER: Loading settings forr"   TNúSETTINGS MANAGER: Settings forzprofile loaded)
r   rK   r   r"   ÚgetGeneralSettingsr(   ÚgetPronunciationsr)   ÚgetKeybindingsr*   )r8   r"   rP   s      r   Ú_loadProfileSettingsz$SettingsManager._loadProfileSettings4  s£   € ð ;¸GÀYÐOˆÜ×Ñœ%×*Ñ*¨F°DÔ9àˆ?Ø—l‘lˆGØ"×5Ñ5°gÓ>ÒDÀ"ˆÔØ%)×%;Ñ%;¸GÓ%DÒ%JÈˆÔ"Ø"&×"5Ñ"5°gÓ">Ò"DÀ"ˆÔà2°GÐ=MÐNˆÜ×Ñœ%×*Ñ*¨F°DÕ9r   c                 ó\  — d}t        j                  t         j                  |d«       | j                  j	                  | j
                  «       | j                  j	                  | j                  «       | j                  j	                  | j                  «       | j                  j	                  | j                  «       | j                  j	                  | j                  «       | j                  j	                  | j                  «       d}t        j                  t         j                  |d«       y)z^Update the changed values on the profile settings
        over the current and active settingsz#SETTINGS MANAGER: Merging settings.Tz"SETTINGS MANAGER: Settings merged.N)r   r   r   r(   r>   r/   r)   r0   r*   r1   r+   r,   r-   )r8   Úmsgs     r   Ú_mergeSettingszSettingsManager._mergeSettingsF  sØ   € ð 4ˆÜ×Ñœ5×+Ñ+¨S°$Ô7à×Ñ×"Ñ" 4×#3Ñ#3Ô4Ø×"Ñ"×)Ñ)¨$×*AÑ*AÔBØ×Ñ×&Ñ& t×';Ñ';Ô<à�‰×Ñ˜D×/Ñ/Ô0Ø×Ñ×"Ñ" 4×#=Ñ#=Ô>Ø×Ñ×Ñ × 7Ñ 7Ô8à2ˆÜ×Ñœ5×+Ñ+¨S°$Õ7r   c                 óN   — | j                  «       }|s| j                  d«       | S )zâEnables the GNOME accessibility flag.  Users need to log out and
        then back in for this to take effect.

        Returns True if an action was taken (i.e., accessibility was not
        set prior to this call).
        T)ÚisAccessibilityEnabledÚsetAccessibility)r8   ÚalreadyEnableds     r   Ú_enableAccessibilityz$SettingsManager._enableAccessibilityX  s,   € ð ×4Ñ4Ó6ˆÙØ×!Ñ! $Ô'à!Ð!Ð!r   c                 ó  — d}t        j                  t         j                  |d«       d}t        sd}|dz  }n%t        j	                  ddd«      }|t        |«      z  }t        j                  t         j                  |d«       |S )	Nz7SETTINGS MANAGER: Checking if accessibility is enabled.Tz)SETTINGS MANAGER: Accessibility enabled: FúError (no proxy)ú(ss)úorg.a11y.StatusÚ	IsEnabled)r   r   r   Ú_proxyÚGetr—   ©r8   r«   Úrvs      r   r®   z&SettingsManager.isAccessibilityEnabledf  st   € ØGˆÜ×Ñœ5×+Ñ+¨S°$Ô7à9ˆÝØˆBØÐ%Ñ%‰Cä—‘˜FÐ$5°{ÓCˆBØ”3�r“7‰NˆCä×Ñœ5×+Ñ+¨S°$Ô7Øˆ	r   c                 óh  — d|› d�}t        j                  t         j                  |d«       t        s(d}t        j                  t         j                  |d«       yt	        j
                  d|«      }t        j                  ddd	|«       d
|› d�}t        j                  t         j                  |d«       y )Nz5SETTINGS MANAGER: Attempting to set accessibility to ú.Tz"SETTINGS MANAGER: Error (no proxy)FÚbz(ssv)rµ   r¶   z4SETTINGS MANAGER: Finished setting accessibility to )r   r   r   r·   r   ÚVariantÚSet)r8   Úenabler«   ÚvEnables       r   r¯   z SettingsManager.setAccessibilityu  s”   € ØEÀfÀXÈQÐOˆÜ×Ñœ5×+Ñ+¨S°$Ô7åØ6ˆCÜ×Ñœu×/Ñ/°°dÔ;Øä—,‘,˜s FÓ+ˆÜ�
‰
�7Ð-¨{¸GÔDàDÀVÀHÈAÐNˆÜ×Ñœ5×+Ñ+¨S°$Õ7r   c                 óº   — d}t         sd}|dz  }n%t         j                  ddd«      }|t        |«      z  }t        j                  t        j
                  |d«       |S )z¯Returns True if the screen reader service is enabled. Note that
        this does not necessarily mean that Orca (or any other screen reader)
        is running at the moment.z4SETTINGS MANAGER: Is screen reader service enabled? Fr³   r´   rµ   ÚScreenReaderEnabledT)r·   r¸   r—   r   r   r   r¹   s      r   ÚisScreenReaderServiceEnabledz,SettingsManager.isScreenReaderServiceEnabled„  s[   € ð
 EˆåØˆBØÐ%Ñ%‰Cä—‘˜FÐ$5Ð7LÓMˆBØ”3�r“7‰NˆCä×Ñœ5×+Ñ+¨S°$Ô7Øˆ	r   c                 ó`   — |€t         j                  }| j                  j                  d|«       y )Nr=   )r	   r"   r!   Ú_setProfileKey©r8   r"   s     r   ÚsetStartingProfilez"SettingsManager.setStartingProfile•  s'   € Øˆ?Ü×&Ñ&ˆGØ�‰×$Ñ$Ð%6¸Õ@r   c                 ó   — | j                   S rW   )r"   ri   s    r   Ú
getProfilezSettingsManager.getProfileš  s   € Ø�|‰|Ðr   c                 ó   — d|g}t        j                  t         j                  |d«       | j                  d«      }|| _        | j                  |«       | j                  «        | j                  | j                  «       |sy| j                  d«      }||k7  r?t        j                  |«       t        j                  |«       t        j                  |«       d|g}t        j                  t         j                  |d«       y)z™Set a specific profile as the active one.
        Also the settings from that profile will be loading
        and updated the current settings with them.z%SETTINGS MANAGER: Setting profile to:TÚdefaultNz!SETTINGS MANAGER: Profile set to:)r   rK   r   r�   r"   r©   r¬   rŠ   r+   r   ÚsetLocaleForNamesÚsetLocaleForMessagesÚsetLocaleForGUI)r8   r"   ÚupdateLocalerP   ÚoldVoiceLocaleÚnewVoiceLocales         r   rM   zSettingsManager.setProfile�  sÓ   € ð
 :¸7ÐCˆÜ×Ñœ%×*Ñ*¨F°DÔ9à×,Ñ,¨YÓ7ˆØˆŒØ×!Ñ! 'Ô*Ø×ÑÔØ× Ñ  §¡Ô.áØà×,Ñ,¨YÓ7ˆØ˜^Ò+Ü×'Ñ'¨Ô7Ü×*Ñ*¨>Ô:Ü×%Ñ% nÔ5à5°wÐ?ˆÜ×Ñœ%×*Ñ*¨F°DÕ9r   c                 ó:   — | j                   j                  |«       y rW   )r!   ÚremoveProfilerÇ   s     r   rÔ   zSettingsManager.removeProfile·  s   € Ø�‰×#Ñ# GÕ,r   c                 óœ  — d}t        j                  t         j                  |d«       |j                  «       D ]  \  }}t	        t
        t        |«      |«       Œ! | j                  «        | j                  j                  «       D ]  \  }}t	        t
        t        |«      |«       Œ! d}t        j                  t         j                  |d«       y )Nz+SETTINGS MANAGER: Setting runtime settings.Tz'SETTINGS MANAGER: Runtime settings set.)	r   r   r   rs   Úsetattrr	   r—   rl   r4   )r8   ÚsettingsDictr«   ro   rp   s        r   rŠ   z#SettingsManager._setSettingsRuntimeº  s¨   € Ø;ˆÜ×Ñœ5×+Ñ+¨S°$Ô7à&×,Ñ,Ó.ò 	/‰JˆC�Ü”Hœc #›h¨Õ.ð	/à×#Ñ#Ô%Ø×1Ñ1×7Ñ7Ó9ò 	/‰JˆC�Ü”Hœc #›h¨Õ.ð	/ð 8ˆÜ×Ñœ5×+Ñ+¨S°$Õ7r   c                 ó‚   — i t         _         |j                  «       D ]!  \  }}|sŒ	|sŒt        j                  ||«       Œ# y rW   )r
   ÚvaluesÚsetPronunciation)r8   ÚpronunciationsDictro   rp   s       r   Ú_setPronunciationsRuntimez)SettingsManager._setPronunciationsRuntimeÇ  s>   € Ø02ÔÔ-Ø,×3Ñ3Ó5ò 	@‰JˆC�Ú’uÜ"×3Ñ3°C¸Õ?ñ	@r   c                 ó8   — | j                   j                  |«      S )z„Return the current general settings.
        Those settings comes from updating the default settings
        with the profiles' ones)r!   rI   rÇ   s     r   r¦   z"SettingsManager.getGeneralSettingsÍ  s   € ð �}‰}×'Ñ'¨Ó0Ð0r   c                 ó8   — | j                   j                  |«      S )z‹Return the current pronunciations settings.
        Those settings comes from updating the default settings
        with the profiles' ones)r!   r§   rÇ   s     r   r§   z!SettingsManager.getPronunciationsÓ  s   € ð �}‰}×.Ñ.¨wÓ7Ð7r   c                 ó8   — | j                   j                  |«      S )zˆReturn the current keybindings settings.
        Those settings comes from updating the default settings
        with the profiles' ones)r!   r¨   rÇ   s     r   r¨   zSettingsManager.getKeybindingsÙ  s   € ð �}‰}×+Ñ+¨GÓ4Ð4r   c                 óÊ  — d}t        j                  t         j                  |d«       i | _        |j	                  «       D ]{  \  }}|dv rŒ|dk(  r|| j                  |<   Œ || j
                  j                  |«      k7  r|| j                  |<   ŒN| j                  j                  |«      |k7  sŒm|| j                  |<   Œ} d}t        j                  t         j                  |d«       y)zRSet the changed general settings from the defaults' ones
        as the profile's.z6SETTINGS MANAGER: Setting general settings for profileT)r=   ÚactiveProfiler"   z2SETTINGS MANAGER: General settings for profile setN)r   r   r   r(   rs   r%   rL   r+   )r8   r+   r«   ro   rp   s        r   Ú_setProfileGeneralz"SettingsManager._setProfileGeneralß  s×   € ð GˆÜ×Ñœ5×+Ñ+¨S°$Ô7à ˆÔà!Ÿ-™-›/ò 	1‰JˆC�ØÐ:Ñ:ØØ˜	Ò!Ø+0�×#Ñ# CÒ(Ø˜$×-Ñ-×1Ñ1°#Ó6Ò6Ø+0�×#Ñ# CÒ(Ø—‘×!Ñ! #Ó&¨%Ó/Ø+0�×#Ñ# CÒ(ð	1ð CˆÜ×Ñœ5×+Ñ+¨S°$Õ7r   c                 ó  — d}t        j                  t         j                  |d«       | j                  j	                  «       | _        | j
                  j                  |«       d}t        j                  t         j                  |d«       y)zYSet the changed pronunciations settings from the defaults' ones
        as the profile's.z=SETTINGS MANAGER: Setting pronunciation settings for profile.Tz9SETTINGS MANAGER: Pronunciation settings for profile set.N)r   r   r   r&   rG   r)   r>   )r8   r,   r«   s      r   Ú_setProfilePronunciationsz)SettingsManager._setProfilePronunciationsõ  sj   € ð NˆÜ×Ñœ5×+Ñ+¨S°$Ô7à%)×%?Ñ%?×%DÑ%DÓ%FˆÔ"Ø×"Ñ"×)Ñ)¨.Ô9àIˆÜ×Ñœ5×+Ñ+¨S°$Õ7r   c                 ó  — d}t        j                  t         j                  |d«       | j                  j	                  «       | _        | j
                  j                  |«       d}t        j                  t         j                  |d«       y)zVSet the changed keybindings settings from the defaults' ones
        as the profile's.z;SETTINGS MANAGER: Setting keybindings settings for profile.Tz7SETTINGS MANAGER: Keybindings settings for profile set.N)r   r   r   r'   rG   r*   r>   )r8   r-   r«   s      r   Ú_setProfileKeybindingsz&SettingsManager._setProfileKeybindings  sj   € ð LˆÜ×Ñœ5×+Ñ+¨S°$Ô7à"&×"9Ñ"9×">Ñ">Ó"@ˆÔØ×Ñ×&Ñ& {Ô3àGˆÜ×Ñœ5×+Ñ+¨S°$Õ7r   c                 ó0  — i }| j                  | j                  «      }|j                  «       D ]  \  }}||j                  |«      k7  sŒ|||<   Œ! i }	| j	                  | j                  «      }
|j                  «       D ]  \  }}||
j                  |«      k7  sŒ||	|<   Œ! i }| j                  | j                  «      }|j                  «       D ]  \  }}||j                  |«      k7  sŒ|||<   Œ! | j                  j                  || j                  ||	|«       y rW   )r¦   r"   rs   rL   r§   r¨   r!   ÚsaveAppSettings)r8   ÚappNamer+   r,   r-   Ú
appGeneralr(   ro   rp   ÚappPronunciationsr)   ÚappKeybindingsr*   s                r   Ú_saveAppSettingsz SettingsManager._saveAppSettings  s$  € Øˆ
Ø×0Ñ0°·±Ó>ˆØ!Ÿ-™-›/ò 	(‰JˆC�Ø˜×*Ñ*¨3Ó/Ó/Ø"'�
˜3’ð	(ð ÐØ $× 6Ñ 6°t·|±|Ó DÐØ(×.Ñ.Ó0ò 	/‰JˆC�ØÐ-×1Ñ1°#Ó6Ó6Ø).Ð! #Ò&ð	/ð ˆØ!×0Ñ0°·±Ó>ÐØ%×+Ñ+Ó-ò 	,‰JˆC�ØÐ*×.Ñ.¨sÓ3Ó3Ø&+�˜sÒ#ð	,ð 	�‰×%Ñ% gØ&*§l¡lØ&0Ø&7Ø&4õ		6r   c                 óT  — d|d|j                   dg}t        j                  t        j                  |d«       |j                   }|r(| j	                  t        j                  |«      |||«       y|j                  dt        j                  «      }|d   }|| _	        |j                  d|«      | j                  d<   | j                  |«       | j                  |«       | j                  |«       d	| j                  g}t        j                  t        j                  |d«       | j                  j                  | j                  | j                   | j"                  | j$                  «       d
|d|j                   dg}t        j                  t        j                  |d«       | j'                  «       S )z3Save the settings provided for the script provided.z%SETTINGS MANAGER: Saving settings forz(app:ú)TNr"   r   r=   z$SETTINGS MANAGER: Saving for backendr¥   z) saved)Úappr   rK   r   rí   r   Úget_namerL   r	   r"   r%   râ   rä   ræ   r!   ÚsaveProfileSettingsr(   r)   r*   r±   )	r8   Úscriptr+   r,   r-   rP   rð   Ú_profileÚcurrentProfiles	            r   ÚsaveSettingszSettingsManager.saveSettings(  so  € ð :¸6À7ÈFÏJÉJÐX[Ð\ˆÜ×Ñœ%×*Ñ*¨F°DÔ9Ø�j‰jˆÙØ×!Ñ!¤(×"3Ñ"3°CÓ"8¸'À>ÐS^Ô_Øð —;‘;˜y¬(×*:Ñ*:Ó;ˆØ! !™ˆà%ˆŒð 29·±Ð=NØ>Fó2Hˆ×ÑÐ-Ñ.ð 	×Ñ Ô(Ø×&Ñ& ~Ô6Ø×#Ñ# KÔ0à8¸$¿-¹-ÐHˆÜ×Ñœ%×*Ñ*¨F°DÔ9à�‰×)Ñ)¨$¯,©,Ø*.×*=Ñ*=Ø*.×*DÑ*DØ*.×*AÑ*Aô	Cð
 3°F¸GÀVÇZÁZÐQZÐ[ˆÜ×Ñœ%×*Ñ*¨F°DÔ9Ø×(Ñ(Ó*Ð*r   c                 ób   — |\  }}}}|sd}|S |t        |«      t        |«      t        |«      f}|S )zAConverts the values of bindingTuple into KeyBinding-ready values.)r   r   r   r   )Úint)r8   ÚbindingTupleÚkeysymÚmaskÚmodsÚclickss         r   Ú_adjustBindingTupleValuesz)SettingsManager._adjustBindingTupleValuesL  sD   € ð &2Ñ"ˆ��d˜FÙØ(ˆLð Ðð #¤C¨£I¬s°4«y¼#¸f»+ÐFˆLàÐr   c           
      ó   — | j                   }|j                  «       D �]­  \  }}|j                  |«      }|sŒ|r‚|j                  |«      s+d|dg}t	        j
                  t        j                  |d«       ŒY|j                  |«      s5d|j                  dg}t	        j
                  t        j                  |d«       ŒŸ|j                  |«      }	d }
|	D ]‰  }d|g}t	        j
                  t        j                  |d«       |
�:|j                  «       |
k7  r'd}t	        j                  t        j                  |d«       |j                  «       }
|j                  |d«       Œ‹ |D ]i  }| j                  |«      }|\  }}}}t        ||||||
¬«      }|j                  |«       d|d|› �g}t	        j
                  t        j                  |d«       Œk �Œ° |S )	NzSETTINGS MANAGER:z is not in the bindings provided.Tzis not enabled. Not overriding.z*SETTINGS MANAGER: Removing old binding forzESETTINGS MANAGER: Warning, different enabled values found for binding)Úenabledzis rebound to )r*   rs   rL   Ú
hasHandlerr   rK   r   ÚhasEnabledHandlerÚfunctionÚgetBindingsForHandlerÚ
is_enabledr   Úremoverþ   r   Úadd)r8   ÚhandlersÚbindingsÚenabledOnlyÚkeybindingsSettingsÚhandlerStringÚbindingTuplesÚhandlerrP   ÚoldBindingsÚ
wasEnabledr½   r«   rù   rú   rû   rü   rý   Ú
newBindings                      r   ÚoverrideKeyBindingsz#SettingsManager.overrideKeyBindingsW  sÏ  € ð #×5Ñ5ÐØ,?×,EÑ,EÓ,Gó $	BÑ(ˆM˜=Ø—l‘l =Ó1ˆGÙØáØ×*Ñ*¨7Ô3Ø1°7Ð<^Ð_�FÜ×%Ñ%¤e×&6Ñ&6¸ÀÔEØà×1Ñ1°'Ô:Ø1°7×3CÑ3CØ?ðA�Fä×%Ñ%¤e×&6Ñ&6¸ÀÔEØà"×8Ñ8¸ÓAˆKØˆJØ ò 	)�ØFÈÐJ�Ü×!Ñ!¤%×"2Ñ"2°F¸DÔAàÐ)¨a¯l©l«nÀ
Ò.JØa�CÜ×&Ñ&¤u×'7Ñ'7¸¸dÔCàŸ\™\›^�
Ø—‘  4Õ(ð	)ð !.ò B�Ø#×=Ñ=¸lÓK�Ø-9Ñ*�˜˜d FÜ'¨°°d¸GÀVÐU_Ô`�
Ø—‘˜ZÔ(Ø-¨w¸.ÈÈÐ8WÐX�Ü×!Ñ!¤%×"2Ñ"2°F¸DÕAòBð=$	BðL ˆr   c                 ó6   — | j                   j                  «       S )z,Check if the firstStart key is True or false)r!   rH   ri   s    r   rH   zSettingsManager.isFirstStart„  s   € à�}‰}×)Ñ)Ó+Ð+r   c                 ó:   — | j                   j                  |«       y)z¤Set firstStart. This user-configurable setting is primarily
        intended to serve as an indication as to whether or not initial
        configuration is needed.N)r!   ÚsetFirstStart)r8   rp   s     r   r  zSettingsManager.setFirstStartˆ  s   € ð 	�‰×#Ñ# EÕ*r   c                 ó6   — | j                   j                  «       S )z*Get available profiles from active backend)r!   ÚavailableProfilesri   s    r   r  z!SettingsManager.availableProfilesŽ  s   € ð �}‰}×.Ñ.Ó0Ð0r   c                 ó~  — |sy | j                   j                  t        j                  |«      «      }|j	                  di «      }|j	                  | j
                  i «      }|j	                  di «      }|j	                  |«      }|€8|r6| j                   j                  | j
                  «      }|j	                  |«      }|S )NÚprofilesr+   )r!   ÚgetAppSettingsr   rñ   rL   r"   rI   )	r8   rð   r‹   ÚfallbackOnDefaultÚappPrefsr  ÚprofilePrefsr+   Ú
appSettings	            r   ÚgetAppSettingzSettingsManager.getAppSetting“  s    € ÙØà—=‘=×/Ñ/´×0AÑ0AÀ#Ó0FÓGˆØ—<‘< 
¨BÓ/ˆØ—|‘| D§L¡L°"Ó5ˆØ×"Ñ" 9¨bÓ1ˆØ—[‘[ Ó-ˆ
ØÐÑ"3Ø—m‘m×.Ñ.¨t¯|©|Ó<ˆGØ Ÿ™ [Ó1ˆJàÐr   c                 óà  — |r|j                   sy| j                  j                  «       D ]  }| j                  j	                  |«       Œ | j
                  j                  t        j                  |j                   «      «      }|j                  di «      }|j                  | j                  i «      }|j                  di «      | _        |j                  di «      | _        |j                  di «      | _        t        j                  |j                   «      | _        | j                  «        | j                  «        | j!                  | j"                  «       | j%                  | j                  «       y)z‚Load the users application specific settings for an app.

        Arguments:
        - script: the current active script.
        Nr  r+   r-   r,   )rð   r0   Úkeysr,   Úpopr!   r  r   rñ   rL   r"   r/   r1   r.   r©   r¬   rŠ   r+   rÜ   )r8   ró   ro   Úprefsr  r  s         r   ÚloadAppSettingszSettingsManager.loadAppSettings¢  s  € ñ ˜6Ÿ:š:Øà×*Ñ*×/Ñ/Ó1ò 	)ˆCØ×Ñ×#Ñ# CÕ(ð	)ð —‘×,Ñ,¬X×->Ñ->¸v¿z¹zÓ-JÓKˆØ—9‘9˜Z¨Ó,ˆØ—|‘| D§L¡L°"Ó5ˆà'×+Ñ+¨I°rÓ:ˆÔØ+×/Ñ/°¸rÓBˆÔØ".×"2Ñ"2Ð3CÀRÓ"HˆÔÜ"×+Ñ+¨F¯J©JÓ7ˆŒà×!Ñ!Ô#Ø×ÑÔØ× Ñ  §¡Ô.Ø×&Ñ& t×':Ñ':Õ;r   )Újson)rÌ   rW   )rÌ   F)T)F)/Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	_instancer   r:   rQ   r2   rJ   rE   rF   rD   rl   rt   rˆ   r�   r�   r�   r£   r©   r¬   r±   r®   r¯   rÄ   rÈ   rÊ   rM   rÔ   rŠ   rÜ   r¦   r§   r¨   râ   rä   ræ   rí   rö   rþ   r  rH   r  r  r  r$  © r   r   r   r   8   sî   „ ñ à€Iòó
3Tðj !%°Ró #&òJò)GòV(ò%ò-ò;òò:ò=ò4óòó :ò$8ò$"òò8òó"Aò
ó:ò4-ò8ò@ó1ó8ó5ò8ò,8ò8ò6ò2"+òH	ó+òZ,ó+ò1ó
ó<r   r   c                  ó   — t         S rW   )Ú_managerr+  r   r   Ú
getManagerr.  ¿  s   € Ü€Or   )"r)  Ú__id__Ú__version__Ú__date__Ú__copyright__Ú__license__rS   r?   Úgi.repositoryr   r   r   r   r   r	   r
   Úacssr   Ú	ax_objectr   r-   r   Ú	DBusProxyÚnew_for_bus_syncÚBusTypeÚSESSIONÚDBusProxyFlagsÚNONEr·   r3   r   r   r-  r.  r+  r   r   ú<module>r=     s¼   ðñ,ð €Ø€Ø€ØD€Ø€ã Û 	ß #å Ý Ý Ý  Ý Ý Ý #ð
Ø�]‰]×+Ñ+Ø�‰×ÑØ×Ñ×ÑØØØØ)Øó€FôC
<�fô C
<ñJ Ó€óøðW ò Ø‚Fðús   ÁA	B' Â'B1Â0B1