Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d55bc5cf34
Fetching contributors…

Cannot retrieve contributors at this time

296 lines (287 sloc) 17.729 kb
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.9.1: http://docutils.sourceforge.net/" />
<title></title>
<style type="text/css">
/*<![CDATA[*/
body {
background-color: rgb(32, 32, 32);
color: rgb(192, 192, 192);
text-align: justify;
font-size: 10pt;
margin: 10px 10px 10px 10px;
}
A:link {
color: rgb(160, 96, 64);
text-decoration: none;
}
A:visited {
text-decoration: none;
color: rgb(160, 96, 64);
}
A:active {
text-decoration: none;
color: rgb(160, 96, 64);
}
A:hover {
text-decoration: underline;
color: rgb(160, 96, 64);
}
table {
border-color: rgb(96, 96, 96);
border-collapse: collapse;
border-style: solid;
border-width: 2px;
}
pre {
background-color: rgb(64, 64, 64);
border: 2px solid rgb(160, 96, 64);
border-left: none;
border-right: none;
color: rgb(224, 224, 224);
font-size: 12pt;
padding: 5px;
white-space: pre-wrap;
}
tt {
background-color: rgb(64, 64, 64);
color: rgb(224, 224, 224);
padding: 5px;
white-space: pre-wrap;
white-space: -moz-pre-wrap !important;
}
/*]]>*/
</style>
</head>
<body>
<div class="document">
<div class="section" id="foundations-manual-help-file">
<h1>
Foundations - Manual - Help File
</h1><br />
</div>
<div class="section" id="table-of-content">
<h1>
Table Of Content
</h1><!-- .tocTree -->
<ul class="simple">
<li>
<a class="reference internal" href="#introduction">Introduction</a>
</li>
<li>
<a class="reference internal" href="#installation">Installation</a>
</li>
<li>
<a class="reference internal" href="#usage">Usage</a>
</li>
<li>
<a class="reference internal" href="#api">Api</a>
</li>
<li>
<a class="reference internal" href="#changes">Changes</a>
</li>
<li>
<a class="reference internal" href="#about">About</a>
</li>
</ul><br />
<!-- .introduction -->
</div>
<div class="section" id="id1">
<h1>
<span class="target" id="introduction">Introduction</span>
</h1>
<p>
<strong>Foundations</strong> is the core package of <a class="reference external" href="http://github.com/KelSolaar/Umbra">Umbra</a>, <a class="reference external" href="http://github.com/KelSolaar/sIBL_GUI">sIBL_GUI</a>, <a class="reference external" href="http://github.com/KelSolaar/sIBL_Reporter">sIBL_Reporter</a>. It provides modules defining various utilities classes and definitions used in those packages.
</p><br />
<!-- .installation -->
</div>
<div class="section" id="id2">
<h1>
<span class="target" id="installation">Installation</span>
</h1>
<p>
The following dependencies are needed:
</p>
<ul class="simple">
<li>
<strong>Python 2.6.7</strong> or <strong>Python 2.7.3</strong>: <a class="reference external" href="http://www.python.org/">http://www.python.org/</a>
</li>
<li>
<strong>PyQt</strong>: <a class="reference external" href="http://www.riverbankcomputing.co.uk/">http://www.riverbankcomputing.co.uk/</a>
</li>
</ul>
<p>
To install <strong>Foundations</strong> from the <a class="reference external" href="http://pypi.python.org/pypi/Foundations">Python Package Index</a> you can issue this command in a shell:
</p>
<pre class="literal-block">
pip install Foundations
</pre>
<p>
or this alternative command:
</p>
<pre class="literal-block">
easy_install Foundations
</pre>
<p>
Alternatively, if you want to directly install from <a class="reference external" href="http://github.com/KelSolaar/Foundations">Github</a> source repository:
</p>
<pre class="literal-block">
git clone git://github.com/KelSolaar/Foundations.git
python setup.py install
</pre>
<p>
If you want to build the documentation you will also need:
</p>
<ul class="simple">
<li>
<strong>Tidy</strong> <a class="reference external" href="http://tidy.sourceforge.net/">http://tidy.sourceforge.net/</a>
</li>
</ul><br />
<!-- .usage -->
</div>
<div class="section" id="id3">
<h1>
<span class="target" id="usage">Usage</span>
</h1>
<p>
Given the large spectrum of the objects defined in <strong>Foundations</strong> package, please refer to <a class="reference external" href="http://thomasmansencal.com/Sharing/Foundations/Support/Documentation/Api/index.html">Foundations - Api</a> for precise usage examples about each modules. Here are listed a few non exhaustive usage examples.
</p>
<ul class="simple">
<li>
<strong>foundations.dataStructures.Structure</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span> <span class="o">=</span> <span class="n">Structure</span><span class="p">(</span><span class="n">firstName</span><span class="o">=</span><span class="s">&quot;Doe&quot;</span><span class="p">,</span> <span class="n">lastName</span><span class="o">=</span><span class="s">&quot;John&quot;</span><span class="p">,</span> <span class="n">gender</span><span class="o">=</span><span class="s">&quot;male&quot;</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span><span class="o">.</span><span class="n">firstName</span>
<span class="s">'Doe'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
<span class="p">[</span><span class="s">'gender'</span><span class="p">,</span> <span class="s">'firstName'</span><span class="p">,</span> <span class="s">'lastName'</span><span class="p">]</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span><span class="p">[</span><span class="s">&quot;gender&quot;</span><span class="p">]</span>
<span class="s">'male'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">del</span><span class="p">(</span><span class="n">person</span><span class="p">[</span><span class="s">&quot;gender&quot;</span><span class="p">])</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span><span class="p">[</span><span class="s">&quot;gender&quot;</span><span class="p">]</span>
<span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">):</span>
<span class="n">File</span> <span class="s">&quot;&lt;console&gt;&quot;</span><span class="p">,</span> <span class="n">line</span> <span class="mi">1</span><span class="p">,</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="ne">KeyError</span><span class="p">:</span> <span class="s">'gender'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span><span class="o">.</span><span class="n">gender</span>
<span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">):</span>
<span class="n">File</span> <span class="s">&quot;&lt;console&gt;&quot;</span><span class="p">,</span> <span class="n">line</span> <span class="mi">1</span><span class="p">,</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="ne">AttributeError</span><span class="p">:</span> <span class="s">'Structure'</span> <span class="nb">object</span> <span class="n">has</span> <span class="n">no</span> <span class="n">attribute</span> <span class="s">'gender'</span>
</pre>
<ul class="simple">
<li>
<strong>foundations.dataStructures.Lookup</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span> <span class="o">=</span> <span class="n">Lookup</span><span class="p">(</span><span class="n">firstName</span><span class="o">=</span><span class="s">&quot;Doe&quot;</span><span class="p">,</span> <span class="n">lastName</span><span class="o">=</span><span class="s">&quot;John&quot;</span><span class="p">,</span> <span class="n">gender</span><span class="o">=</span><span class="s">&quot;male&quot;</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">person</span><span class="o">.</span><span class="n">getFirstKeyFromValue</span><span class="p">(</span><span class="s">&quot;Doe&quot;</span><span class="p">)</span>
<span class="s">'firstName'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">persons</span> <span class="o">=</span> <span class="n">foundations</span><span class="o">.</span><span class="n">foundations</span><span class="o">.</span><span class="n">dataStructures</span><span class="o">.</span><span class="n">Lookup</span><span class="p">(</span><span class="n">John</span><span class="o">=</span><span class="s">&quot;Doe&quot;</span><span class="p">,</span> <span class="n">Jane</span><span class="o">=</span><span class="s">&quot;Doe&quot;</span><span class="p">,</span> <span class="n">Luke</span><span class="o">=</span><span class="s">&quot;Skywalker&quot;</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">persons</span><span class="o">.</span><span class="n">getKeysFromValue</span><span class="p">(</span><span class="s">&quot;Doe&quot;</span><span class="p">)</span>
<span class="p">[</span><span class="s">'Jane'</span><span class="p">,</span> <span class="s">'John'</span><span class="p">]</span>
</pre>
<ul class="simple">
<li>
<strong>foundations.environment.Environment</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="n">environment</span> <span class="o">=</span> <span class="n">Environment</span><span class="p">(</span><span class="n">JOHN</span><span class="o">=</span><span class="s">&quot;DOE&quot;</span><span class="p">,</span> <span class="n">DOE</span><span class="o">=</span><span class="s">&quot;JOHN&quot;</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">environment</span><span class="o">.</span><span class="n">setValues</span><span class="p">()</span>
<span class="bp">True</span>
<span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">os</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s">&quot;JOHN&quot;</span><span class="p">]</span>
<span class="s">'DOE'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s">&quot;DOE&quot;</span><span class="p">]</span>
<span class="s">'JOHN'</span>
</pre>
<ul class="simple">
<li>
<strong>foundations.strings.getNiceName</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="n">getNiceName</span><span class="p">(</span><span class="s">&quot;getMeANiceName&quot;</span><span class="p">)</span>
<span class="s">'Get Me A Nice Name'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">getNiceName</span><span class="p">(</span><span class="s">&quot;__getMeANiceName&quot;</span><span class="p">)</span>
<span class="s">'__Get Me A Nice Name'</span>
</pre>
<ul class="simple">
<li>
<strong>foundations.strings.getSplitextBasename</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="n">getSplitextBasename</span><span class="p">(</span><span class="s">&quot;/Users/JohnDoe/Documents/Test.txt&quot;</span><span class="p">)</span>
<span class="s">'Test'</span>
</pre>
<ul class="simple">
<li>
<strong>foundations.strings.getCommonPathsAncestor</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="n">getCommonPathsAncestor</span><span class="p">(</span><span class="s">&quot;/Users/JohnDoe/Documents&quot;</span><span class="p">,</span> <span class="s">&quot;/Users/JohnDoe/Documents/Test.txt&quot;</span><span class="p">)</span>
<span class="s">'/Users/JohnDoe/Documents'</span>
</pre>
<ul class="simple">
<li>
<strong>foundations.walkers.filesWalker</strong>:
</li>
</ul>
<pre class="code python literal-block">
<span class="o">&gt;&gt;&gt;</span> <span class="k">for</span> <span class="nb">file</span> <span class="ow">in</span> <span class="n">filesWalker</span><span class="p">(</span><span class="s">&quot;./foundations/tests/testsFoundations/resources/standard/level_0&quot;</span><span class="p">):</span>
<span class="o">...</span> <span class="k">print</span><span class="p">(</span><span class="nb">file</span><span class="p">)</span>
<span class="o">...</span>
<span class="o">./</span><span class="n">foundations</span><span class="o">/</span><span class="n">tests</span><span class="o">/</span><span class="n">testsFoundations</span><span class="o">/</span><span class="n">resources</span><span class="o">/</span><span class="n">standard</span><span class="o">/</span><span class="n">level_0</span><span class="o">/</span><span class="n">level_1</span><span class="o">/</span><span class="n">level_2</span><span class="o">/</span><span class="n">standard</span><span class="o">.</span><span class="n">sIBLT</span>
<span class="o">./</span><span class="n">foundations</span><span class="o">/</span><span class="n">tests</span><span class="o">/</span><span class="n">testsFoundations</span><span class="o">/</span><span class="n">resources</span><span class="o">/</span><span class="n">standard</span><span class="o">/</span><span class="n">level_0</span><span class="o">/</span><span class="n">level_1</span><span class="o">/</span><span class="n">loremIpsum</span><span class="o">.</span><span class="n">txt</span>
<span class="o">./</span><span class="n">foundations</span><span class="o">/</span><span class="n">tests</span><span class="o">/</span><span class="n">testsFoundations</span><span class="o">/</span><span class="n">resources</span><span class="o">/</span><span class="n">standard</span><span class="o">/</span><span class="n">level_0</span><span class="o">/</span><span class="n">level_1</span><span class="o">/</span><span class="n">standard</span><span class="o">.</span><span class="n">rc</span>
<span class="o">./</span><span class="n">foundations</span><span class="o">/</span><span class="n">tests</span><span class="o">/</span><span class="n">testsFoundations</span><span class="o">/</span><span class="n">resources</span><span class="o">/</span><span class="n">standard</span><span class="o">/</span><span class="n">level_0</span><span class="o">/</span><span class="n">standard</span><span class="o">.</span><span class="n">ibl</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">for</span> <span class="nb">file</span> <span class="ow">in</span> <span class="n">filesWalker</span><span class="p">(</span><span class="s">&quot;./foundations/tests/testsFoundations/resources/standard/level_0&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s">&quot;\.sIBLT&quot;</span><span class="p">,)):</span>
<span class="o">...</span> <span class="k">print</span><span class="p">(</span><span class="nb">file</span><span class="p">)</span>
<span class="o">...</span>
<span class="o">./</span><span class="n">foundations</span><span class="o">/</span><span class="n">tests</span><span class="o">/</span><span class="n">testsFoundations</span><span class="o">/</span><span class="n">resources</span><span class="o">/</span><span class="n">standard</span><span class="o">/</span><span class="n">level_0</span><span class="o">/</span><span class="n">level_1</span><span class="o">/</span><span class="n">level_2</span><span class="o">/</span><span class="n">standard</span><span class="o">.</span><span class="n">sIBLT</span>
</pre><br />
<!-- .api -->
</div>
<div class="section" id="id4">
<h1>
<span class="target" id="api">Api</span>
</h1>
<p>
<strong>Foundations</strong> Api documentation is available here: <a class="reference external" href="http://thomasmansencal.com/Sharing/Foundations/Support/Documentation/Api/index.html">Foundations - Api</a>
</p><br />
<!-- .changes -->
</div>
<div class="section" id="id6">
<h1>
<span class="target" id="changes">Changes</span>
</h1><br />
<!-- .about -->
</div>
<div class="section" id="id7">
<h1>
<span class="target" id="about">About</span>
</h1>
<div class="line-block">
<div class="line">
<strong>Foundations</strong> by Thomas Mansencal - 2008 - 2012
</div>
<div class="line">
Copyright© 2008 - 2012 - Thomas Mansencal - <a class="reference external" href="mailto:thomas.mansencal&#64;gmail.com">thomas.mansencal&#64;gmail.com</a>
</div>
<div class="line">
This software is released under terms of GNU GPL V3 license: <a class="reference external" href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>
</div>
<div class="line">
<a class="reference external" href="http://www.thomasmansencal.com/">http://www.thomasmansencal.com/</a>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.