2008-11-05 03:14:45 +00:00
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
2008-11-06 07:55:38 +00:00
< title > deluge.config — deluge v1.1.0 documentation< / title >
2008-11-05 03:14:45 +00:00
< link rel = "stylesheet" href = "../_static/default.css" type = "text/css" / >
< link rel = "stylesheet" href = "../_static/pygments.css" type = "text/css" / >
< script type = "text/javascript" >
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.1.0',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: ''
};
< / script >
< script type = "text/javascript" src = "../_static/jquery.js" > < / script >
< script type = "text/javascript" src = "../_static/interface.js" > < / script >
< script type = "text/javascript" src = "../_static/doctools.js" > < / script >
< link rel = "contents" title = "Global table of contents" href = "../contents.html" / >
< link rel = "index" title = "Global index" href = "../genindex.html" / >
< link rel = "search" title = "Search" href = "../search.html" / >
< link rel = "top" title = "deluge v1.1.0 documentation" href = "../index.html" / >
2008-11-06 07:55:38 +00:00
< link rel = "prev" title = "deluge.common" href = "common.html" / >
2008-11-05 03:14:45 +00:00
< / head >
< body >
< div class = "related" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../genindex.html" title = "General Index"
accesskey="I">index< / a > < / li >
< li class = "right" >
< a href = "../modindex.html" title = "Global Module Index"
accesskey="M">modules< / a > |< / li >
< li class = "right" >
2008-11-06 07:55:38 +00:00
< a href = "common.html" title = "deluge.common"
2008-11-05 03:14:45 +00:00
accesskey="P">previous< / a > |< / li >
< li > < a href = "../index.html" > deluge v1.1.0 documentation< / a > » < / li >
< / ul >
< / div >
< div class = "document" >
< div class = "documentwrapper" >
< div class = "bodywrapper" >
< div class = "body" >
< div class = "section" >
2008-11-06 07:55:38 +00:00
< h1 id = "module-deluge.config" > < tt class = "xref docutils literal" > < span class = "pre" > deluge.config< / span > < / tt > < a class = "headerlink" href = "#module-deluge.config" title = "Permalink to this headline" > ¶< / a > < / h1 >
< p > Deluge Config Module< / p >
2008-11-05 03:14:45 +00:00
< dl class = "class" >
< dt id = "deluge.config.Config" >
<!-- [deluge.config.Config] --> class < tt class = "descclassname" > deluge.config.< / tt > < tt class = "descname" > Config< / tt > < big > (< / big > < em > filename< / em > , < em > defaults=None< / em > , < em > config_dir=None< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config" title = "Permalink to this definition" > ¶< / a > < / dt >
2008-11-06 07:55:38 +00:00
< dd > < p > Bases: < tt class = "xref docutils literal" > < span class = "pre" > object< / span > < / tt > < / p >
< p > This class is used to access/create/modify config files< / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first last simple" >
< li > < em > filename< / em > – the name of the config file< / li >
< li > < em > defaults< / em > – dictionary of default values< / li >
< li > < em > config_dir< / em > – the path to the config directory< / li >
< / ul >
< / td >
< / tr >
< / tbody >
< / table >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
2008-11-06 07:55:38 +00:00
< dt id = "deluge.config.Config.__setitem__" >
<!-- [deluge.config.Config.__setitem__] --> < tt class = "descname" > __setitem__< / tt > < big > (< / big > < em > key< / em > , < em > value< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.__setitem__" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > See
< a title = "deluge.config.Config.set_item" class = "reference" href = "#deluge.config.Config.set_item" > < tt class = "xref docutils literal" > < span class = "pre" > set_item()< / span > < / tt > < / a > < / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
2008-11-06 07:55:38 +00:00
< dt id = "deluge.config.Config.__getitem__" >
<!-- [deluge.config.Config.__getitem__] --> < tt class = "descname" > __getitem__< / tt > < big > (< / big > < em > key< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.__getitem__" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > See
< a title = "deluge.config.Config.get_item" class = "reference" href = "#deluge.config.Config.get_item" > < tt class = "xref docutils literal" > < span class = "pre" > get_item()< / span > < / tt > < / a > < / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
2008-11-06 07:55:38 +00:00
< dt id = "deluge.config.Config.apply_all" >
<!-- [deluge.config.Config.apply_all] --> < tt class = "descname" > apply_all< / tt > < big > (< / big > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.apply_all" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Calls all set functions< / p >
< p > < strong > Usage< / strong > < / p >
< div class = "highlight" > < pre > < span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > =< / span > < span class = "n" > Config< / span > < span class = "p" > (< / span > < span class = "s" > " test.conf" < / span > < span class = "p" > ,< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s" > " test" < / span > < span class = "p" > :< / span > < span class = "mf" > 5< / span > < span class = "p" > })< / span >
< span class = "gp" > > > > < / span > < span class = "k" > def< / span > < span class = "nf" > cb< / span > < span class = "p" > (< / span > < span class = "n" > key< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ):< / span >
< span class = "gp" > ... < / span > < span class = "k" > print< / span > < span class = "n" > key< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span >
< span class = "gp" > ...< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > .< / span > < span class = "n" > register_set_function< / span > < span class = "p" > (< / span > < span class = "s" > " test" < / span > < span class = "p" > ,< / span > < span class = "n" > cb< / span > < span class = "p" > ,< / span > < span class = "n" > apply_now< / span > < span class = "o" > =< / span > < span class = "bp" > False< / span > < span class = "p" > )< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > .< / span > < span class = "n" > apply_all< / span > < span class = "p" > ()< / span >
< span class = "go" > test 5< / span >
< / pre > < / div >
< / dd > < / dl >
< dl class = "attribute" >
< dt id = "deluge.config.Config.config" >
<!-- [deluge.config.Config.config] --> < tt class = "descname" > config< / tt > < a class = "headerlink" href = "#deluge.config.Config.config" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > The config dictionary< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
2008-11-06 07:55:38 +00:00
< dt id = "deluge.config.Config.get_item" >
<!-- [deluge.config.Config.get_item] --> < tt class = "descname" > get_item< / tt > < big > (< / big > < em > key< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.get_item" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Gets the value of item ‘ key’ < / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first simple" >
< li > < em > key< / em > – the item for which you want it’ s value< / li >
< / ul >
< / td >
< / tr >
< tr class = "field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > < p class = "first" > the value of item ‘ key’ < / p >
< / td >
< / tr >
< tr class = "field" > < th class = "field-name" colspan = "2" > Raises KeyError:< / th > < / tr >
< tr > < td > < / td > < td class = "field-body" > < p class = "first last" > if ‘ key’ is not in the config dictionary< / p >
< / td >
< / tr >
< / tbody >
< / table >
< p > < strong > Usage< / strong > < / p >
< div class = "highlight" > < pre > < span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > =< / span > < span class = "n" > Config< / span > < span class = "p" > (< / span > < span class = "s" > " test.conf" < / span > < span class = "p" > ,< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s" > " test" < / span > < span class = "p" > :< / span > < span class = "mf" > 5< / span > < span class = "p" > })< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s" > " test" < / span > < span class = "p" > ]< / span >
< span class = "go" > 5< / span >
< / pre > < / div >
< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
< dt id = "deluge.config.Config.load" >
<!-- [deluge.config.Config.load] --> < tt class = "descname" > load< / tt > < big > (< / big > < em > filename=None< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.load" title = "Permalink to this definition" > ¶< / a > < / dt >
2008-11-06 07:55:38 +00:00
< dd > < p > Load a config file< / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first last simple" >
< li > < em > filename< / em > – if None, uses filename set in object initialization< / li >
< / ul >
< / td >
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
< dt id = "deluge.config.Config.register_change_callback" >
<!-- [deluge.config.Config.register_change_callback] --> < tt class = "descname" > register_change_callback< / tt > < big > (< / big > < em > callback< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.register_change_callback" title = "Permalink to this definition" > ¶< / a > < / dt >
2008-11-06 07:55:38 +00:00
< dd > < p > Registers a callback function that will be called when a value is changed in the config dictionary< / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first last simple" >
< li > < em > callback< / em > – the function, callback(key, value)< / li >
< / ul >
< / td >
< / tr >
< / tbody >
< / table >
< p > < strong > Usage< / strong > < / p >
< div class = "highlight" > < pre > < span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > =< / span > < span class = "n" > Config< / span > < span class = "p" > (< / span > < span class = "s" > " test.conf" < / span > < span class = "p" > ,< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s" > " test" < / span > < span class = "p" > :< / span > < span class = "mf" > 5< / span > < span class = "p" > })< / span >
< span class = "gp" > > > > < / span > < span class = "k" > def< / span > < span class = "nf" > cb< / span > < span class = "p" > (< / span > < span class = "n" > key< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ):< / span >
< span class = "gp" > ... < / span > < span class = "k" > print< / span > < span class = "n" > key< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span >
< span class = "gp" > ...< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > .< / span > < span class = "n" > register_change_callback< / span > < span class = "p" > (< / span > < span class = "n" > cb< / span > < span class = "p" > )< / span >
< / pre > < / div >
< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
< dt id = "deluge.config.Config.register_set_function" >
<!-- [deluge.config.Config.register_set_function] --> < tt class = "descname" > register_set_function< / tt > < big > (< / big > < em > key< / em > , < em > function< / em > , < em > apply_now=True< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.register_set_function" title = "Permalink to this definition" > ¶< / a > < / dt >
2008-11-06 07:55:38 +00:00
< dd > < p > Register a function to be called when a config value changes< / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first last simple" >
< li > < em > key< / em > – the item to monitor for change< / li >
< li > < em > function< / em > – the function to call when the value changes, f(key, value)< / li >
< li > < em > apply_now< / em > – if True, the function will be called after it’ s registered< / li >
< / ul >
< / td >
< / tr >
< / tbody >
< / table >
< p > < strong > Usage< / strong > < / p >
< div class = "highlight" > < pre > < span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > =< / span > < span class = "n" > Config< / span > < span class = "p" > (< / span > < span class = "s" > " test.conf" < / span > < span class = "p" > ,< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s" > " test" < / span > < span class = "p" > :< / span > < span class = "mf" > 5< / span > < span class = "p" > })< / span >
< span class = "gp" > > > > < / span > < span class = "k" > def< / span > < span class = "nf" > cb< / span > < span class = "p" > (< / span > < span class = "n" > key< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ):< / span >
< span class = "gp" > ... < / span > < span class = "k" > print< / span > < span class = "n" > key< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span >
< span class = "gp" > ...< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > .< / span > < span class = "n" > register_set_function< / span > < span class = "p" > (< / span > < span class = "s" > " test" < / span > < span class = "p" > ,< / span > < span class = "n" > cb< / span > < span class = "p" > ,< / span > < span class = "n" > apply_now< / span > < span class = "o" > =< / span > < span class = "bp" > True< / span > < span class = "p" > )< / span >
< span class = "go" > test 5< / span >
< / pre > < / div >
< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
< dt id = "deluge.config.Config.save" >
<!-- [deluge.config.Config.save] --> < tt class = "descname" > save< / tt > < big > (< / big > < em > filename=None< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.save" title = "Permalink to this definition" > ¶< / a > < / dt >
2008-11-06 07:55:38 +00:00
< dd > < p > Save configuration to disk< / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first last simple" >
< li > < em > filename< / em > – if None, uses filename set in object initiliazation< / li >
< / ul >
< / td >
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< dl class = "method" >
2008-11-06 07:55:38 +00:00
< dt id = "deluge.config.Config.set_item" >
<!-- [deluge.config.Config.set_item] --> < tt class = "descname" > set_item< / tt > < big > (< / big > < em > key< / em > , < em > value< / em > < big > )< / big > < a class = "headerlink" href = "#deluge.config.Config.set_item" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Sets item ‘ key’ to ‘ value’ in the config dictionary, but does not allow
changing the item’ s type unless it is None< / p >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first simple" >
< li > < em > key< / em > – string, item to change to change< / li >
< li > < em > value< / em > – the value to change item to, must be same type as what is currently in the config< / li >
< / ul >
< / td >
< / tr >
< tr class = "field" > < th class = "field-name" colspan = "2" > Raises ValueError:< / th > < / tr >
< tr > < td > < / td > < td class = "field-body" > < p class = "first last" > raised when the type of value is not the same as what is currently in the config< / p >
< / td >
< / tr >
< / tbody >
< / table >
< p > < strong > Usage< / strong > < / p >
< div class = "highlight" > < pre > < span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "o" > =< / span > < span class = "n" > Config< / span > < span class = "p" > (< / span > < span class = "s" > " test.conf" < / span > < span class = "p" > )< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s" > " test" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "mf" > 5< / span >
< span class = "gp" > > > > < / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s" > " test" < / span > < span class = "p" > ]< / span >
< span class = "go" > 5< / span >
< / pre > < / div >
< / dd > < / dl >
2008-11-05 03:14:45 +00:00
< / dd > < / dl >
< / div >
< / div >
< / div >
< / div >
< div class = "sphinxsidebar" >
< div class = "sphinxsidebarwrapper" >
< h4 > Previous topic< / h4 >
2008-11-06 07:55:38 +00:00
< p class = "topless" > < a href = "common.html" title = "previous chapter" > < tt class = "docutils literal docutils literal docutils literal" > < span class = "pre" > deluge.common< / span > < / tt > < / a > < / p >
2008-11-05 03:14:45 +00:00
< h3 > This Page< / h3 >
< ul class = "this-page-menu" >
< li > < a href = "../_sources/modules/config.txt" > Show Source< / a > < / li >
< / ul >
< h3 > Quick search< / h3 >
< form class = "search" action = "../search.html" method = "get" >
< input type = "text" name = "q" size = "18" / > < input type = "submit" value = "Go" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
< / div >
< div class = "clearer" > < / div >
< / div >
< div class = "related" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../genindex.html" title = "General Index"
accesskey="I">index< / a > < / li >
< li class = "right" >
< a href = "../modindex.html" title = "Global Module Index"
accesskey="M">modules< / a > |< / li >
< li class = "right" >
2008-11-06 07:55:38 +00:00
< a href = "common.html" title = "deluge.common"
2008-11-05 03:14:45 +00:00
accesskey="P">previous< / a > |< / li >
< li > < a href = "../index.html" > deluge v1.1.0 documentation< / a > » < / li >
< / ul >
< / div >
< div class = "footer" >
© Copyright 2008, Andrew Resch.
2008-11-08 06:13:40 +00:00
Last updated on Nov 06, 2008.
2008-11-05 03:14:45 +00:00
Created using < a href = "http://sphinx.pocoo.org/" > Sphinx< / a > .
< / div >
< / body >
< / html >