config root man

Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/idlelib/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/idlelib/configHandler.pyc

hRc@sBdZddkZddkZddkZddkZddklZlZlZdefdYZ	defdYZ
defd	YZd
efdYZdefd
YZ
de
fdYZdfdYZeZedjo?dZeeieeieididdGHndS(sProvides access to stored IDLE configuration information.

Refer to the comments at the beginning of config-main.def for a description of
the available configuration files and the design implemented to update user
configuration information.  In particular, user configuration choices which
duplicate the defaults will be removed from the user's configuration files,
and if a file becomes empty, it will be deleted.

The contents of the user files may be altered using the Options/Configure IDLE
menu to access the configuration GUI (configDialog.py), or manually.

Throughout this module there is an emphasis on returning useable defaults
when a problem occurs in returning a requested configuration value back to
idle. This is to allow IDLE to continue to function in spite of errors in
the retrieval of config information. When a default is returned instead of
a requested config value, a message is printed to stderr to aid in
configuration problem notification and resolution.

iN(tConfigParsert
NoOptionErrortNoSectionErrortInvalidConfigTypecBseZRS((t__name__t
__module__(((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRstInvalidConfigSetcBseZRS((RR(((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRstInvalidFgBgcBseZRS((RR(((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRstInvalidThemecBseZRS((RR(((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRstIdleConfParsercBs;eZdZddZdddZdZdZRS(sI
    A ConfigParser specialised for idle configuration file handling
    cCs ||_ti|d|dS(sK
        cfgFile - string, fully specified configuration file name
        tdefaultsN(tfileRt__init__(tselftcfgFiletcfgDefaults((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR#s	cCsi|djo
|i}n$|djo
|i}n
|i}|i||o|||Sn|SdS(s
        Get an option value for given section/option or return default.
        If type is specified, return as type.
        tbooltintN(t
getbooleantgetinttgett
has_option(R
tsectiontoptionttypetdefaulttgetVal((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGet*s



	cCs)|i|o|i|SngSdS(s6
        Get an option list for given section
        N(thas_sectiontoptions(R
R((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
GetOptionList;scCs|i|idS(s7
        Load the configuration file from disk
        N(treadR(R
((s1/usr/local/lib/python2.5/idlelib/configHandler.pytLoadDsN(RRt__doc__tNoneRRRR (((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR	s
		tIdleUserConfParsercBsMeZdZdZdZdZdZdZdZdZ	RS(sG
    IdleConfigParser specialised for user configuration handling.
    cCs%|i|p|i|ndS(s2
        if section doesn't exist, add it
        N(Rtadd_section(R
R((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
AddSectionOscCs<x5|iD]'}|i|p|i|q
q
WdS(s:
        remove any sections that have no options
        N(tsectionsRtremove_section(R
R((s1/usr/local/lib/python2.5/idlelib/configHandler.pytRemoveEmptySectionsVs
cCs'|i|iodSndSdS(sp
        Remove empty sections and then return 1 if parser has no sections
        left, else return 0.
        iiN(R(R&(R
((s1/usr/local/lib/python2.5/idlelib/configHandler.pytIsEmpty^s

cCs(|i|o|i||SndS(sl
        If section/option exists, remove it.
        Returns 1 if option was removed, 0 otherwise.
        N(Rt
remove_option(R
RR((s1/usr/local/lib/python2.5/idlelib/configHandler.pytRemoveOptioniscCs|i||o<|i|||jodSq|i|||dSn9|i|p|i|n|i|||dSdS(s
        Sets option to value, adding section if required.
        Returns 1 if option was added or changed, otherwise 0.
        iiN(RRtsetRR$(R
RRtvalue((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt	SetOptionqscCs.tii|ioti|indS(sF
        Removes the user config file from disk if it exists.
        N(tostpathtexistsRtremove(R
((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
RemoveFilescCsz|ip_|i}yt|d}Wn/tj
o#ti|t|d}nX|i|n|idS(sUpdate user configuration file.

        Remove empty sections. If resulting config isn't empty, write the file
        to disk. If config is empty, remove the file from disk if it exists.

        twN(R)RtopentIOErrorR/tunlinktwriteR3(R
tfnameR((s1/usr/local/lib/python2.5/idlelib/configHandler.pytSaves
	
(
RRR!R%R(R)R+R.R3R:(((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR#Js						tIdleConfcBseZdZdZdZdZddedZdZ	dZ
ddZdZd	Z
d
ZeeedZdZd
ZdZdZdZdZdZdZdZddZdZdZdZdZdZRS(s
    holds config parsers for all idle config files:
    default config files
        (idle install dir)/config-main.def
        (idle install dir)/config-extensions.def
        (idle install dir)/config-highlight.def
        (idle install dir)/config-keys.def
    user config  files
        (user home dir)/.idlerc/config-main.cfg
        (user home dir)/.idlerc/config-extensions.cfg
        (user home dir)/.idlerc/config-highlight.cfg
        (user home dir)/.idlerc/config-keys.cfg
    cCs3h|_h|_h|_|i|idS(N(t
defaultCfgtuserCfgtcfgtCreateConfigHandlerstLoadCfgFiles(R
((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRs
			
cCstdjotiit}ntiitid}|i}d}h}h}xP|D]H}tii|d|d||<tii|d|d	||<qaWx<|D]4}t	|||i
|<t|||i|<qWd
S(sp
        set up a dictionary of config parsers for default and user
        configurations respectively
        t__main__itmaint
extensionst	highlighttkeyssconfig-s.defs.cfgN(smainRCs	highlightskeys(
RR/R0tdirnamet__file__tabspathtsyst
GetUserCfgDirtjoinR	R<R#R=(R
tidleDirtuserDirtconfigTypestdefCfgFilestusrCfgFilestcfgType((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR?s
!%c	Csd}tiid}|djoYtii|pBd|d}ytii|Wntj
onXd}q~n|djoti}ntii	||}tii|pUyti
|Wqttfj
o+d|d}tii|tqXn|S(sr
        Creates (if required) and returns a filesystem directory for storing
        user config files.

        s.idlerct~s.
 Warning: os.path.expanduser("~") points to
 s ,
 but the path does not exist.
s2
 Warning: unable to create user config directory
s)
 Check path and permissions.
 Exiting!

(
R/R0t
expanduserR1RItstderrR8R6tgetcwdRKtmkdirtOSErrort
SystemExit(R
tcfgDirRMtwarn((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRJs*

cCs|i|i||o!|i|i||d|Sn|i|i||o!|i|i||d|SnM|oAd|||f}ytii|Wqtj
oqXn|SdS(sf
        Get an option value for given config type and given general
        configuration section/option or return a default. If type is specified,
        return as type. Firstly the user configuration is checked, with a
        fallback to the default configuration, and a final 'catch all'
        fallback to a useable passed-in default if the option isn't present in
        either the user or the default configuration.
        configType must be one of ('main','extensions','highlight','keys')
        If a default is returned, and warn_on_default is True, a warning is
        printed to stderr.

        Rs
 Warning: configHandler.py - IdleConf.GetOption -
 problem retrieving configration option %r
 from section %r.
 returning default value: %r
N(R=RRR<RIRTR8R6(R
t
configTypeRRRRtwarn_on_defaulttwarning((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt	GetOptions!!	cCs|i|i|||dS(s?In user's config file, set section's option to value.

        N(R=R.(R
R[RRR-((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR.scCsi|d	jo
tdn|djo|i|}n(|djo|i|}n
td|iS(
s
        Get a list of sections from either the user or default config for
        the given config type.
        configSet must be either 'user' or 'default'
        configType must be one of ('main','extensions','highlight','keys')
        RBRCRDREsInvalid configType specifiedtuserRsInvalid configSet specified(smains
extensionss	highlightskeys(RR=R<RR&(R
t	configSetR[t	cfgParser((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGetSectionList
s



	cCs|idi|o|id|}n|id|}||d}|djo|d}n||d}h|d<|d	<}|p|Sn<|d
jo|dSn|djo|d	Sn
tdd
S(s$
        return individual highlighting theme elements.
        fgBg - string ('fg'or'bg') or None, if None return a dictionary
        containing fg and bg colours (appropriate for passing to Tkinter in,
        e.g., a tag_config call), otherwise fg or bg colour only as specified.
        RDRR_s-foregroundtcursorsnormal-backgrounds-backgroundt
foregroundt
backgroundtfgtbgsInvalid fgBg specifiedN(R<RtGetThemeDictR(R
tthemetelementtfgBgt	themeDicttforetbackRD((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGetHighlights


c
Cs|djo|id}n(|djo|id}n
tdhdd<dd<dd	<dd
<dd<dd<dd
<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd <dd!<dd"<}x|iD]}|i||pEd#||||f}ytii|Wqtj
oqXn|i	||d||}|||<qKW|S($sj
        type - string, 'default' or 'user' theme type
        themeName - string, theme name
        Returns a dictionary which holds {option:value} for each element
        in the specified theme. Values are loaded over a set of ultimate last
        fallback defaults to guarantee that all theme elements are present in
        a newly created theme.
        R_RDRsInvalid theme type specifieds#000000snormal-foregrounds#ffffffsnormal-backgroundskeyword-foregroundskeyword-backgroundsbuiltin-foregroundsbuiltin-backgroundscomment-foregroundscomment-backgroundsstring-foregroundsstring-backgroundsdefinition-foregroundsdefinition-backgroundshilite-foregroundtgrayshilite-backgroundsbreak-foregroundsbreak-backgroundshit-foregroundshit-backgroundserror-foregroundserror-backgroundscursor-foregroundsstdout-foregroundsstdout-backgroundsstderr-foregroundsstderr-backgroundsconsole-foregroundsconsole-backgrounds
 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element %r
 from theme %r.
 returning default value: %r
(
R=R<RRERRIRTR8R6R(R
Rt	themeNameRaRiRjR]tcolour((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRh6sX	

	
																									
	cCs|idddddS(s@
        Returns the name of the currently active theme
        RBtThemetnameRt(R^(R
((s1/usr/local/lib/python2.5/idlelib/configHandler.pytCurrentThemevscCs|idddddS(sB
        Returns the name of the currently active key set
        RBtKeysRtRRu(R^(R
((s1/usr/local/lib/python2.5/idlelib/configHandler.pytCurrentKeys|sc	
Cs(|i|idd}|i|idd}x,|D]$}||jo|i|q=q=W|og}x|D]}|id|ddtddos|p|oT|o
d}nd}|id||dtddd	to|i|qq|i|qyqyW|Sn|Sd
S(s
        Gets a list of all idle extensions declared in the config files.
        active_only - boolean, if true only return active (enabled) extensions
        RRCR_tenableRRt
enable_editortenable_shellR\N(tRemoveKeyBindNamesRbtappendR^tTruetFalse(	R
tactive_onlyteditor_onlyt
shell_onlytextnst	userExtnstextntactiveExtnsR((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
GetExtensionss2



cCsw|}g}x8|D]0}|ido|i|i|qqW|i|ix|D]
}||=qbW|S(Nt	_bindingst_cfgBindings(RR(tendswithR}tindextsorttreverse(R
textnNameListtnamestkbNameIndiciesRtR((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR|s

cCsld}d|d}xQ|iddD]=}x4|i|iD]}||jo
|}qCqCWq'W|S(s
        Returns the name of the extension that virtualEvent is bound in, or
        None if not bound in any extension.
        virtualEvent - string, name of the virtual event to test for, without
                       the enclosing '<< >>'
        s<<s>>RiN(R"RtGetExtensionKeysRE(R
tvirtualEventtextNametvEventRtevent((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGetExtnNameForEvents
c	Cs|d}|i}h}|idi|oM|idi|}x4|D](}d|d}||}|||<qPWn|S(s
        returns a dictionary of the configurable keybindings for a particular
        extension,as they exist in the dictionary returned by GetCurrentKeySet;
        that is, where previously used bindings are disabled.
        RRCs<<s>>(tGetCurrentKeySetR<RR(	R
t
extensionNametkeysNamet
activeKeystextKeyst
eventNamest	eventNameRtbinding((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRs

cCs|d}h}|idi|od|idi|}xK|D]?}|id||ddi}d|d}|||<qDWn|S(s
        returns a dictionary of the configurable keybindings for a particular
        extension, as defined in the configuration files, or an empty dictionary
        if no bindings are found
        RRCRRus<<s>>(R<RRR^tsplit(R
RRRRRRR((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt__GetRawExtensionKeyss
cCs|d}|i|}|idi|od|idi|}xK|D]?}|id||ddi}d|d}|||<qMWn|S(s

        Returns a dictionary of all the event bindings for a particular
        extension. The configurable keybindings are returned as they exist in
        the dictionary returned by GetCurrentKeySet; that is, where re-used
        keybindings are disabled.
        RRCRRus<<s>>(RR<RRR^R(R
Rt	bindsNametextBindsRRRR((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGetExtensionBindingss
cCs2|dd!}|id||ddi}|S(s
        returns the keybinding for a specific event.
        keySetName - string, name of key binding set
        eventStr - string, the virtual event we want the binding for,
                   represented as a string, eg. '<<event>>'
        iiRERRu(R^R(R
t
keySetNameteventStrRR((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
GetKeyBindings
!cCs|i|i}tioixf|iD]T\}}g}|D]}||iddqF~}||jo|||<q/q/Wn|S(Ns<Alt-s<Option-(t	GetKeySetRxt
macosxSupporttrunningAsOSXApptitemstreplace(R
tresulttktvt_[1]txtv2((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRs

-
cCs|i|}|idd}xr|D]j}|i|}|oNxK|iD]9}|||ijod||<n||||<qQWq(q(W|S(s
        Returns a dictionary of: all requested core keybindings, plus the
        keybindings for all currently active extensions. If a binding defined
        in an extension is already in use, that binding is disabled.
        RiRu(tGetCoreKeysRt_IdleConf__GetRawExtensionKeysREtvalues(R
RtkeySetRRRR((s1/usr/local/lib/python2.5/idlelib/configHandler.pyRs
cCsd|d|iijS(s
        returns true if the virtual event is bound in the core idle keybindings.
        virtualEvent - string, name of the virtual event to test for, without
                       the enclosing '<< >>'
        s<<s>>(RRE(R
R((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
IsCoreBinding scCshddgd<ddgd<ddgd	<d
dgd<d
gd<dgd<dgd<dgd<dgd<dgd<dgd<dgd<dgd<dgd<dgd <d!gd"<d#gd$<d%gd&<d'gd(<d)gd*<d+gd,<d-gd.<d/gd0<d1gd2<d3gd4<d5gd6<d7gd8<d9gd:<d;gd<<d=gd><d?d@gdA<dBgdC<dDgdE<dFgdG<dHgdI<dJgdK<dLgdM<dNgdO<dPgdQ<dRgdS<dTgdU<dVgdW<dXgdY<dZgd[<d\gd]<d^gd_<d`gda<dbgdc<ddgde<}|ox|iD]n}|i||}|o|||<qudf||||f}ytii|Wqutj
oquXquWn|S(gsZ
        returns the requested set of core keybindings, with fallbacks if
        required.
        Keybindings loaded from the config file(s) are loaded _over_ these
        defaults, so if there is a problem getting any core binding there will
        be an 'ultimate last resort fallback' to the CUA-ish bindings
        defined here.
        s<Control-c>s<Control-C>s<<copy>>s<Control-x>s<Control-X>s<<cut>>s<Control-v>s<Control-V>s	<<paste>>s<Control-a>s<Home>s<<beginning-of-line>>s<Control-l>s<<center-insert>>s<Control-q>s<<close-all-windows>>s<Alt-F4>s<<close-window>>s<<do-nothing>>s<Control-d>s<<end-of-file>>s<F1>s<<python-docs>>s
<Shift-F1>s<<python-context-help>>s<Alt-n>s<<history-next>>s<Alt-p>s<<history-previous>>s<<interrupt-execution>>s<F6>s<<view-restart>>s<Control-F6>s<<restart-shell>>s<Alt-c>s<<open-class-browser>>s<Alt-m>s<<open-module>>s<Control-n>s<<open-new-window>>s<Control-o>s<<open-window-from-file>>s<Control-j>s<<plain-newline-and-indent>>s<Control-p>s<<print-window>>s<Control-y>s<<redo>>s<Escape>s<<remove-selection>>s
<Alt-Shift-S>s<<save-copy-of-window-as-file>>s<Alt-s>s<<save-window-as-file>>s<Control-s>s<<save-window>>s<Alt-a>s<<select-all>>s<Control-slash>s<<toggle-auto-coloring>>s<Control-z>s<<undo>>s<Control-g>s<F3>s<<find-again>>s<Alt-F3>s<<find-in-files>>s<Control-F3>s<<find-selection>>s<Control-f>s<<find>>s<Control-h>s<<replace>>s<Alt-g>s
<<goto-line>>s<Key-BackSpace>s<<smart-backspace>>s<Key-Return> <Key-KP_Enter>s<<newline-and-indent>>s	<Key-Tab>s<<smart-indent>>s<Control-Key-bracketright>s<<indent-region>>s<Control-Key-bracketleft>s<<dedent-region>>s<Alt-Key-3>s<<comment-region>>s<Alt-Key-4>s<<uncomment-region>>s<Alt-Key-5>s<<tabify-region>>s<Alt-Key-6>s<<untabify-region>>s<Alt-Key-t>s<<toggle-tabs>>s<Alt-Key-u>s<<change-indentwidth>>s<Control-Key-BackSpace>s<<del-word-left>>s<Control-Key-Delete>s<<del-word-right>>s
 Warning: configHandler.py - IdleConf.GetCoreKeys -
 problem retrieving key binding for event %r
 from key set %r.
 returning default value: %r
(RERRIRTR8R6(R
RtkeyBindingsRRR]((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR(s~	

c	Csg}|djo|id}n(|djo|id}n
td|id}x|D]}|id|dd}|iddjod}d}n3ti|d}|d	i}|d
i}|o!|o|i	|||fqaqaW|i
|i|S(sFetch list of extra help sources from a given configSet.

        Valid configSets are 'user' or 'default'.  Return a list of tuples of
        the form (menu_item , path_to_help_file , option), or return the empty
        list.  'option' is the sequence number of the help resource.  'option'
        values determine the position of the menu items on the Help menu,
        therefore the returned list must be sorted by 'option'.

        R_RBRsInvalid configSet specifiedt	HelpFilest;iRuii(R=R<RRRtfindtstringRtstripR}Rt_IdleConf__helpsort(	R
R`thelpSourcesRaRRR-tmenuItemthelpPath((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGetExtraHelpSourceListus(


	
cCsZt|dt|djodSn.t|dt|djodSndSdS(Niiii(R(R
th1th2((s1/usr/local/lib/python2.5/idlelib/configHandler.pyt
__helpsorts
!!cCs |id|id}|S(s
        Returns a list of tuples containing the details of all additional help
        sources configured, or an empty list if there are none. Tuples are of
        the format returned by GetExtraHelpSourceList.
        RR_(R(R
tallHelpSources((s1/usr/local/lib/python2.5/idlelib/configHandler.pytGetAllExtraHelpSourcesListscCs@x9|iiD](}|i|i|i|iqWdS(s/
        load all configuration files.
        N(R<RER R=(R
tkey((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR@scCs/x(|iiD]}|i|iqWdS(sH
        write all loaded user configuration files back to disk
        N(R=RER:(R
R((s1/usr/local/lib/python2.5/idlelib/configHandler.pytSaveUserCfgFilessN( RRR!RR?RJR"R~R^R.RbRoRhRvRxRRR|RRRRRRRRRRRRR@R(((s1/usr/local/lib/python2.5/idlelib/configHandler.pyR;s8
						@		!	
								M	 		
	RAcCsdG|GdGHx|iD]|}||i}|GH|GHxY|D]Q}||i|}|GH|GHx+|D]#}|GdG||i||GHqkWqAWqWdS(Ns
t=(RER&RR(R>RR&RRR((s1/usr/local/lib/python2.5/idlelib/configHandler.pytdumpCfgs

RBRsRt(R!R/RIRRRRRt	ExceptionRRRRR	R#R;tidleConfRRR<R=R(((s1/usr/local/lib/python2.5/idlelib/configHandler.pys<module>s(+Q	
	



Man Man