| | |
- ConfigParser.ConfigParser(ConfigParser.RawConfigParser)
-
- IdleConfParser
-
- IdleUserConfParser
- exceptions.Exception(exceptions.BaseException)
-
- InvalidConfigSet
- InvalidConfigType
- InvalidFgBg
- InvalidTheme
- IdleConf
class IdleConf |
| |
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 |
| |
Methods defined here:
- CreateConfigHandlers(self)
- set up a dictionary of config parsers for default and user
configurations respectively
- CurrentKeys(self)
- Returns the name of the currently active key set
- CurrentTheme(self)
- Returns the name of the currently active theme
- GetAllExtraHelpSourcesList(self)
- 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.
- GetCoreKeys(self, keySetName=None)
- 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.
- GetCurrentKeySet(self)
- GetExtensionBindings(self, extensionName)
- 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.
- GetExtensionKeys(self, extensionName)
- 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.
- GetExtensions(self, active_only=True, editor_only=False, shell_only=False)
- Gets a list of all idle extensions declared in the config files.
active_only - boolean, if true only return active (enabled) extensions
- GetExtnNameForEvent(self, virtualEvent)
- 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 '<< >>'
- GetExtraHelpSourceList(self, configSet)
- Fetch 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'.
- GetHighlight(self, theme, element, fgBg=None)
- 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.
- GetKeyBinding(self, keySetName, eventStr)
- 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>>'
- GetKeySet(self, keySetName)
- 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.
- GetOption(self, configType, section, option, default=None, type=None, warn_on_default=True)
- 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.
- GetSectionList(self, configSet, configType)
- 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')
- GetThemeDict(self, type, themeName)
- 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.
- GetUserCfgDir(self)
- Creates (if required) and returns a filesystem directory for storing
user config files.
- IsCoreBinding(self, virtualEvent)
- 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 '<< >>'
- LoadCfgFiles(self)
- load all configuration files.
- RemoveKeyBindNames(self, extnNameList)
- SaveUserCfgFiles(self)
- write all loaded user configuration files back to disk
- SetOption(self, configType, section, option, value)
- In user's config file, set section's option to value.
- __init__(self)
|
class IdleConfParser(ConfigParser.ConfigParser) |
| |
A ConfigParser specialised for idle configuration file handling |
| |
- Method resolution order:
- IdleConfParser
- ConfigParser.ConfigParser
- ConfigParser.RawConfigParser
Methods defined here:
- Get(self, section, option, type=None, default=None)
- Get an option value for given section/option or return default.
If type is specified, return as type.
- GetOptionList(self, section)
- Get an option list for given section
- Load(self)
- Load the configuration file from disk
- __init__(self, cfgFile, cfgDefaults=None)
- cfgFile - string, fully specified configuration file name
Methods inherited from ConfigParser.ConfigParser:
- get(self, section, option, raw=False, vars=None)
- Get an option value for a given section.
All % interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. Additional substitutions may be provided using the
`vars' argument, which must be a dictionary whose contents overrides
any pre-existing defaults.
The section DEFAULT is special.
- items(self, section, raw=False, vars=None)
- Return a list of tuples with (name, value) for each option
in the section.
All % interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. Additional substitutions may be provided using the
`vars' argument, which must be a dictionary whose contents overrides
any pre-existing defaults.
The section DEFAULT is special.
Methods inherited from ConfigParser.RawConfigParser:
- add_section(self, section)
- Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
already exists.
- defaults(self)
- getboolean(self, section, option)
- getfloat(self, section, option)
- getint(self, section, option)
- has_option(self, section, option)
- Check for the existence of a given option in a given section.
- has_section(self, section)
- Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
- options(self, section)
- Return a list of option names for the given section name.
- optionxform(self, optionstr)
- read(self, filenames)
- Read and parse a filename or a list of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing
configuration files in the list will be read. A single
filename may also be given.
Return list of successfully read files.
- readfp(self, fp, filename=None)
- Like read() but the argument must be a file-like object.
The `fp' argument must have a `readline' method. Optional
second argument is the `filename', which if not given, is
taken from fp.name. If fp has no `name' attribute, `<???>' is
used.
- remove_option(self, section, option)
- Remove an option.
- remove_section(self, section)
- Remove a file section.
- sections(self)
- Return a list of section names, excluding [DEFAULT]
- set(self, section, option, value)
- Set an option.
- write(self, fp)
- Write an .ini-format representation of the configuration state.
Data and other attributes inherited from ConfigParser.RawConfigParser:
- OPTCRE = <_sre.SRE_Pattern object at 0xb75c2ef8>
- SECTCRE = <_sre.SRE_Pattern object at 0xb72134a0>
|
class IdleUserConfParser(IdleConfParser) |
| |
IdleConfigParser specialised for user configuration handling. |
| |
- Method resolution order:
- IdleUserConfParser
- IdleConfParser
- ConfigParser.ConfigParser
- ConfigParser.RawConfigParser
Methods defined here:
- AddSection(self, section)
- if section doesn't exist, add it
- IsEmpty(self)
- Remove empty sections and then return 1 if parser has no sections
left, else return 0.
- RemoveEmptySections(self)
- remove any sections that have no options
- RemoveFile(self)
- Removes the user config file from disk if it exists.
- RemoveOption(self, section, option)
- If section/option exists, remove it.
Returns 1 if option was removed, 0 otherwise.
- Save(self)
- Update 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.
- SetOption(self, section, option, value)
- Sets option to value, adding section if required.
Returns 1 if option was added or changed, otherwise 0.
Methods inherited from IdleConfParser:
- Get(self, section, option, type=None, default=None)
- Get an option value for given section/option or return default.
If type is specified, return as type.
- GetOptionList(self, section)
- Get an option list for given section
- Load(self)
- Load the configuration file from disk
- __init__(self, cfgFile, cfgDefaults=None)
- cfgFile - string, fully specified configuration file name
Methods inherited from ConfigParser.ConfigParser:
- get(self, section, option, raw=False, vars=None)
- Get an option value for a given section.
All % interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. Additional substitutions may be provided using the
`vars' argument, which must be a dictionary whose contents overrides
any pre-existing defaults.
The section DEFAULT is special.
- items(self, section, raw=False, vars=None)
- Return a list of tuples with (name, value) for each option
in the section.
All % interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. Additional substitutions may be provided using the
`vars' argument, which must be a dictionary whose contents overrides
any pre-existing defaults.
The section DEFAULT is special.
Methods inherited from ConfigParser.RawConfigParser:
- add_section(self, section)
- Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
already exists.
- defaults(self)
- getboolean(self, section, option)
- getfloat(self, section, option)
- getint(self, section, option)
- has_option(self, section, option)
- Check for the existence of a given option in a given section.
- has_section(self, section)
- Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
- options(self, section)
- Return a list of option names for the given section name.
- optionxform(self, optionstr)
- read(self, filenames)
- Read and parse a filename or a list of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing
configuration files in the list will be read. A single
filename may also be given.
Return list of successfully read files.
- readfp(self, fp, filename=None)
- Like read() but the argument must be a file-like object.
The `fp' argument must have a `readline' method. Optional
second argument is the `filename', which if not given, is
taken from fp.name. If fp has no `name' attribute, `<???>' is
used.
- remove_option(self, section, option)
- Remove an option.
- remove_section(self, section)
- Remove a file section.
- sections(self)
- Return a list of section names, excluding [DEFAULT]
- set(self, section, option, value)
- Set an option.
- write(self, fp)
- Write an .ini-format representation of the configuration state.
Data and other attributes inherited from ConfigParser.RawConfigParser:
- OPTCRE = <_sre.SRE_Pattern object at 0xb75c2ef8>
- SECTCRE = <_sre.SRE_Pattern object at 0xb72134a0>
|
|