Package kiwi :: Module desktopparser :: Class DesktopParser
[frames | no frames]

Class DesktopParser

RawConfigParser --+    
                  |    
       ConfigParser --+
                      |
                     DesktopParser


A DesktopParser for GNOME/KDE .desktop files. The API is similar to GKeyFile from glib.

Example:
>>> parser = DesktopParser()
>>> parser.read('/usr/share/applications/gnome-terminal.desktop')
>>> parser.get_locale('Desktop Entry', 'Comment', 'pt')

Method Summary
  get_boolean_list(self, section, option)
  get_integer_list(self, section, option)
  get_locale(self, section, option, locale)
  get_string_list(self, section, option)
  get_string_list_locale(self, section, option, locale)
  optionxform(self, optionstr)
  set_boolean_list(self, section, option, values)
  set_integer_list(self, section, option, values)
  set_list_separator(self, separator)
Sets the character which is used to separate values in lists.
  set_locale(self, section, option, locale, value)
  set_string_list(self, section, option, values)
  set_string_list_locale(self, section, option, locale, values)
    Inherited from ConfigParser
  get(self, section, option, raw, vars)
Get an option value for a given section.
  items(self, section, raw, vars)
Return a list of tuples with (name, value) for each option in the section.
    Inherited from RawConfigParser
  add_section(self, section)
Create a new section in the configuration.
  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.
  options(self, section)
Return a list of option names for the given section name.
  read(self, filenames)
Read and parse a filename or a list of filenames.
  readfp(self, fp, filename)
Like read() but the argument must be a file-like object.
  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.

Class Variable Summary
    Inherited from RawConfigParser
SRE_Pattern OPTCRE = ([^:=\s][^:=]*)\s*([:=])\s*(.*)$
SRE_Pattern SECTCRE = \[([^\]]+)\]

Method Details

get_boolean_list(self, section, option)

Parameters:
section - section name
option - an option

get_integer_list(self, section, option)

Parameters:
section - section name
option - an option

get_locale(self, section, option, locale)

Parameters:
section - section name
option - an option
locale - a locale

get_string_list(self, section, option)

Parameters:
section - section name
option - an option

get_string_list_locale(self, section, option, locale)

Parameters:
section - section name
option - an option
locale - a locale

set_boolean_list(self, section, option, values)

Parameters:
section - section name
option - an option
values - list of boolean values

set_integer_list(self, section, option, values)

Parameters:
section - section name
option - an option
values - list of integer values

set_list_separator(self, separator)

Sets the character which is used to separate values in lists. Typically ';' or ',' are used as separators. The default list separator is ';'.
Parameters:
separator - the separator

set_locale(self, section, option, locale, value)

Parameters:
section - section name
option - an option
locale - a locale
value - value to set

set_string_list(self, section, option, values)

Parameters:
section - section name
option - an option
values - list of string values

set_string_list_locale(self, section, option, locale, values)

Parameters:
section - section name
option - an option
locale - a locale
values - list of string values

Generated by Epydoc 2.1 on Thu Oct 19 03:18:13 2006 http://epydoc.sf.net