Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/LanguageSelector/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pyc


S/Oc@sddlZddlZddlZdefdYZedkreZdGHejGHdGejGHej	ddGej
d	GHdGejGHd
GejGHdGejGHndS(iNtImSwitchcBseZdZejjdZdZdZdZ	dZ
dZdZdZ
d	Zd
ZdZdZd
ZddZddZddZRS(s/etc/X11/xinit/xinput.d/s~/.xinput.d/s/usr/bin/im-switchtibuss5/usr/share/language-selector/data/im-switch.blacklistcCsdS(N((tself((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pyt__init__scCstjj|jS(s. return True if im-switch is available at all (tostpathtexiststbin(R((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pyt	availablescCsx|j|jfD]k}tjj|rxPtj|D]<}tjjd||fs;tjd||fq;q;WqqWdS(Ns%s/%s(t
local_confdirtglobal_confdirRRRtlistdirtunlink(Rtdirtdentry((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytremoveDanglingSymlinkss
cCsx|j|jfD]v}xm|dfD]_}tjj||}tjj|r&tjjtjj|}|dkrtSt	Sq&WqWtS(s@ check if we have a config for this specifc locale (e.g. ja_JP) tall_ALLtnonetdefault(Rsdefault(
R	R
RRtjoinRtbasenametrealpathtFalsetTrue(RtlocaleR
tnamettargettim_name((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytenabledForLocale!scCsNtjdd|dg|j|sJtjdd|d|jgndS(s  enable input methods for locales	im-switchs-zs-as-sN(t
subprocesstcallRtdefault_method(RR((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytenable0scCsxtjjtjj|j|rFtjtjj|j|n|j|rttjdd|ddgndS(s! disable input method for locale s	im-switchs-zs-sRN(	RRRRR	RRRR(RR((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytdisable9s$"cCsx|j|jfD]u}tjj|rxZ|dfD]I}tjj||}tjj|r8tjjtjj|Sq8WqqWdS(NR(	R	R
RRRRRRtNone(RRR
RR((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytgetInputMethodForLocaleBs'cCsHtjj|js(tj|jntjdd|d|gdS(Ns	im-switchs-zs-s(RRRR	tmkdirRR(RtimR((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytsetInputMethodForLocaleKscCsg}xIt|jD]8}|j}|r|jdr|j|qqWg}xPtj|jD]<}tjj	|j|rk||krk|j|qkqkWdgt
|S(s2 return the input methods available via im-switch t#R(topentblacklist_filetstript
startswithtappendRRR
Rtislinktsorted(Rt	blacklisttltinputMethodsR((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytgetAvailableInputMethodsPsRcCsJ|j|}tjj|r/tj|ntj|j||tS(sX sets the default input method for the given locale
            (in ll_CC form)
        (tconfdirRRR-RtsymlinkR(RtmethodRR0((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytsetDefaultInputMethod`s

cCsTd|}|j|}tjj|r9tj|ntj||j|tS(sU reset the default input method to auto (controlled by
            im-switch
        s/etc/alternatives/xinput-%s(R3RRR-RR4R(RRtdR0((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytresetDefaultInputMethodjs

cCs#tjjtjj|j|S(sb get the current default input method for the selected
            locale (in ll_CC form)
        (RRRRR	(RR((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pytgetCurrentInputMethodus(t__name__t
__module__R
RRt
expanduserR	RRR)RRRRR R!R#R&R2R6R8R9(((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pyR
s"												
t__main__savailable input methods: scurrent method: isswitching to 'th-xim': sth-ximsreset default: (RtsysRtobjectRR:R%R2R9texitR6R8(((s=/usr/lib/python2.7/dist-packages/LanguageSelector/ImSwitch.pyt<module>s$q