<!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" /> <title>Preferences with Envisage — EnvisageCore v3.1.1 documentation</title> <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: '3.1.1', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="EnvisageCore v3.1.1 documentation" href="index.html" /> <link rel="next" title="Glossary" href="glossary.html" /> <link rel="prev" title="Workbench" href="workbench.html" /> </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="glossary.html" title="Glossary" accesskey="N">next</a> |</li> <li class="right" > <a href="workbench.html" title="Workbench" accesskey="P">previous</a> |</li> <li><a href="index.html">EnvisageCore v3.1.1 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="preferences-with-envisage"> <h1>Preferences with Envisage<a class="headerlink" href="#preferences-with-envisage" title="Permalink to this headline">¶</a></h1> <p>Envisage presents preferences with two different extension points:</p> <blockquote> <ul class="simple"> <li>PREFERENCES = ‘enthought.envisage.preferences’</li> <li>PREFERENCES_PAGES = ‘enthought.envisage.ui.workbench.preferences_pages’</li> </ul> </blockquote> <p>The first one is only model-related and is for programmatic access to preferences, whereas the second one is for displaying UIs to the user in the workbench plugin.</p> <div class="section" id="preferences"> <h2>Preferences<a class="headerlink" href="#preferences" title="Permalink to this headline">¶</a></h2> <p>The contribution point is simply a list of URLs to the preference file, e.g.:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">preferences_pages</span> <span class="o">=</span> <span class="n">List</span><span class="p">(</span> <span class="p">[</span><span class="s">'pkgfile://acme.acmelab/preferences.ini'</span><span class="p">],</span> <span class="n">contributes_to</span><span class="o">=</span><span class="n">PREFERENCES_PAGES</span><span class="p">)</span> </pre></div> </div> <p>where acme.acmelab is the python-module-like path to the package in which the default preferences.ini is stored.</p> <p>A plugin usually needs only one preferences file, regardless of how many preference pages or settings it has.</p> </div> <div class="section" id="preferences-pages"> <h2>Preferences pages<a class="headerlink" href="#preferences-pages" title="Permalink to this headline">¶</a></h2> <p>The preference pages are a Traits UI view to wrap the preferences and allow the user to modify them. A preference page is defined as in the preference_manager example in the AppTools examples. It can than be contributed to the workbench, as in:</p> <div class="highlight-python"><pre>preferences_pages = List(contributes_to=PREFERENCES_PAGES) def _preferences_pages_default(self): """ Trait initializer. """ from acme.preference_pages \ import ACMEPreferencePages return [ACMEPreferencePages, ]</pre> </div> <p>A plugin needs to contribute a preferences pages class for each category of preferences it contributes.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference external" href="">Preferences with Envisage</a><ul> <li><a class="reference external" href="#preferences">Preferences</a></li> <li><a class="reference external" href="#preferences-pages">Preferences pages</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="workbench.html" title="previous chapter">Workbench</a></p> <h4>Next topic</h4> <p class="topless"><a href="glossary.html" title="next chapter">Glossary</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/preferences.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <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> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </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" >index</a></li> <li class="right" > <a href="glossary.html" title="Glossary" >next</a> |</li> <li class="right" > <a href="workbench.html" title="Workbench" >previous</a> |</li> <li><a href="index.html">EnvisageCore v3.1.1 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2008, Martin Chivers. Last updated on Aug 21, 2009. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2. </div> </body> </html>