1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Update site to include help

- Add sphinx documentation generated from build to help
- Add link to help (in english) in header
- Add link to github in header
This commit is contained in:
2018-04-08 11:25:34 -05:00
parent 10f06999ed
commit bacba3f0a5
431 changed files with 117335 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.build &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.conflict" href="conflict.html" />
<link rel="prev" title="hscommon" href="index.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.build</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="index.html">hscommon</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="conflict.html">hscommon.conflict</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.build">
<span id="hscommon-build"></span><h1>hscommon.build<a class="headerlink" href="#module-hscommon.build" title="Permalink to this headline"></a></h1>
<p>This module is a collection of function to help in HS apps build process.</p>
<dl class="function">
<dt id="hscommon.build.add_to_pythonpath">
<code class="descclassname">hscommon.build.</code><code class="descname">add_to_pythonpath</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.add_to_pythonpath" title="Permalink to this definition"></a></dt>
<dd><p>Adds <code class="docutils literal notranslate"><span class="pre">path</span></code> to both <code class="docutils literal notranslate"><span class="pre">PYTHONPATH</span></code> env and <code class="docutils literal notranslate"><span class="pre">sys.path</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.build.build_debian_changelog">
<code class="descclassname">hscommon.build.</code><code class="descname">build_debian_changelog</code><span class="sig-paren">(</span><em>changelogpath</em>, <em>destfile</em>, <em>pkgname</em>, <em>from_version=None</em>, <em>distribution='precise'</em>, <em>fix_version=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.build_debian_changelog" title="Permalink to this definition"></a></dt>
<dd><p>Builds a debian changelog out of a YAML changelog.</p>
<p>Use fix_version to patch the top changelog to that version (if, for example, there was a
packaging error and you need to quickly fix it)</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.build.build_dmg">
<code class="descclassname">hscommon.build.</code><code class="descname">build_dmg</code><span class="sig-paren">(</span><em>app_path</em>, <em>destfolder</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.build_dmg" title="Permalink to this definition"></a></dt>
<dd><p>Builds a DMG volume with application at <code class="docutils literal notranslate"><span class="pre">app_path</span></code> and puts it in <code class="docutils literal notranslate"><span class="pre">dest_path</span></code>.</p>
<p>The name of the resulting DMG volume is determined by the apps name and version.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.build.copy_packages">
<code class="descclassname">hscommon.build.</code><code class="descname">copy_packages</code><span class="sig-paren">(</span><em>packages_names</em>, <em>dest</em>, <em>create_links=False</em>, <em>extra_ignores=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.copy_packages" title="Permalink to this definition"></a></dt>
<dd><p>Copy python packages <code class="docutils literal notranslate"><span class="pre">packages_names</span></code> to <code class="docutils literal notranslate"><span class="pre">dest</span></code>, spurious data.</p>
<p>Copy will happen without tests, testdata, mercurial data or C extension module source with it.
<code class="docutils literal notranslate"><span class="pre">py2app</span></code> include and exclude rules are <strong>quite</strong> funky, and doing this is the only reliable
way to make sure we dont end up with useless stuff in our app.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.build.ensure_empty_folder">
<code class="descclassname">hscommon.build.</code><code class="descname">ensure_empty_folder</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.ensure_empty_folder" title="Permalink to this definition"></a></dt>
<dd><p>Make sure that the path exists and that its an empty folder.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.build.filereplace">
<code class="descclassname">hscommon.build.</code><code class="descname">filereplace</code><span class="sig-paren">(</span><em>filename</em>, <em>outfilename=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.filereplace" title="Permalink to this definition"></a></dt>
<dd><p>Reads <cite>filename</cite>, replaces all {variables} in kwargs, and writes the result to <cite>outfilename</cite>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.build.print_and_do">
<code class="descclassname">hscommon.build.</code><code class="descname">print_and_do</code><span class="sig-paren">(</span><em>cmd</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.build.print_and_do" title="Permalink to this definition"></a></dt>
<dd><p>Prints <code class="docutils literal notranslate"><span class="pre">cmd</span></code> and executes it in the shell.</p>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="index.html">hscommon</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="conflict.html">hscommon.conflict</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.conflict &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.desktop" href="desktop.html" />
<link rel="prev" title="hscommon.build" href="build.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.conflict</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="build.html">hscommon.build</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="desktop.html">hscommon.desktop</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.conflict">
<span id="hscommon-conflict"></span><h1>hscommon.conflict<a class="headerlink" href="#module-hscommon.conflict" title="Permalink to this headline"></a></h1>
<p>When you have to deal with names that have to be unique and can conflict together, you can use
this module that deals with conflicts by prepending unique numbers in <code class="docutils literal notranslate"><span class="pre">[]</span></code> brackets to the name.</p>
<dl class="function">
<dt id="hscommon.conflict.get_conflicted_name">
<code class="descclassname">hscommon.conflict.</code><code class="descname">get_conflicted_name</code><span class="sig-paren">(</span><em>other_names</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.conflict.get_conflicted_name" title="Permalink to this definition"></a></dt>
<dd><p>Returns name with a <code class="docutils literal notranslate"><span class="pre">[000]</span></code> number in front of it.</p>
<p>The number between brackets depends on how many conlicted filenames
there already are in other_names.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.conflict.get_unconflicted_name">
<code class="descclassname">hscommon.conflict.</code><code class="descname">get_unconflicted_name</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.conflict.get_unconflicted_name" title="Permalink to this definition"></a></dt>
<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">name</span></code> without <code class="docutils literal notranslate"><span class="pre">[]</span></code> brackets.</p>
<p>Brackets which, of course, might have been added by func:<cite>get_conflicted_name</cite>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.conflict.is_conflicted">
<code class="descclassname">hscommon.conflict.</code><code class="descname">is_conflicted</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.conflict.is_conflicted" title="Permalink to this definition"></a></dt>
<dd><p>Returns whether <code class="docutils literal notranslate"><span class="pre">name</span></code> is prepended with a bracketed number.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.conflict.smart_copy">
<code class="descclassname">hscommon.conflict.</code><code class="descname">smart_copy</code><span class="sig-paren">(</span><em>source_path</em>, <em>dest_path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.conflict.smart_copy" title="Permalink to this definition"></a></dt>
<dd><p>Copies <code class="docutils literal notranslate"><span class="pre">source_path</span></code> to <code class="docutils literal notranslate"><span class="pre">dest_path</span></code>, recursively and with conflict resolution.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.conflict.smart_move">
<code class="descclassname">hscommon.conflict.</code><code class="descname">smart_move</code><span class="sig-paren">(</span><em>source_path</em>, <em>dest_path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.conflict.smart_move" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#hscommon.conflict.smart_copy" title="hscommon.conflict.smart_copy"><code class="xref py py-func docutils literal notranslate"><span class="pre">smart_copy()</span></code></a>, but it moves files instead.</p>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="build.html">hscommon.build</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="desktop.html">hscommon.desktop</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,90 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.desktop &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.notify" href="notify.html" />
<link rel="prev" title="hscommon.conflict" href="conflict.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.desktop</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="conflict.html">hscommon.conflict</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="notify.html">hscommon.notify</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.desktop">
<span id="hscommon-desktop"></span><h1>hscommon.desktop<a class="headerlink" href="#module-hscommon.desktop" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="hscommon.desktop.open_path">
<code class="descclassname">hscommon.desktop.</code><code class="descname">open_path</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.desktop.open_path" title="Permalink to this definition"></a></dt>
<dd><p>Open <code class="docutils literal notranslate"><span class="pre">path</span></code> with its associated application.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.desktop.open_url">
<code class="descclassname">hscommon.desktop.</code><code class="descname">open_url</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.desktop.open_url" title="Permalink to this definition"></a></dt>
<dd><p>Open <code class="docutils literal notranslate"><span class="pre">url</span></code> with the default browser.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.desktop.reveal_path">
<code class="descclassname">hscommon.desktop.</code><code class="descname">reveal_path</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.desktop.reveal_path" title="Permalink to this definition"></a></dt>
<dd><p>Open the folder containing <code class="docutils literal notranslate"><span class="pre">path</span></code> with the default file browser.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.desktop.special_folder_path">
<code class="descclassname">hscommon.desktop.</code><code class="descname">special_folder_path</code><span class="sig-paren">(</span><em>special_folder</em>, <em>appname=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.desktop.special_folder_path" title="Permalink to this definition"></a></dt>
<dd><p>Returns the path of <code class="docutils literal notranslate"><span class="pre">special_folder</span></code>.</p>
<p><code class="docutils literal notranslate"><span class="pre">special_folder</span></code> is a SpecialFolder.* const. The result is the special folder for the current
application. The running process application info is used to determine relevant information.</p>
<p>You can override the application name with <code class="docutils literal notranslate"><span class="pre">appname</span></code>. This argument is ingored under Qt.</p>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="conflict.html">hscommon.conflict</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="notify.html">hscommon.notify</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,116 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.base &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.column" href="column.html" />
<link rel="prev" title="hscommon.jobprogress.qt" href="../jobprogress/qt.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.base</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="../jobprogress/qt.html">hscommon.jobprogress.qt</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="column.html">hscommon.gui.column</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.base">
<span id="hscommon-gui-base"></span><h1>hscommon.gui.base<a class="headerlink" href="#module-hscommon.gui.base" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GUIObject</span></code></a>([multibind])</td>
<td>Cross-toolkit “model” representation of a GUI layer object.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.base.GUIObject">
<em class="property">class </em><code class="descclassname">hscommon.gui.base.</code><code class="descname">GUIObject</code><span class="sig-paren">(</span><em>multibind=False</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.base.GUIObject" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit “model” representation of a GUI layer object.</p>
<p>A <code class="docutils literal notranslate"><span class="pre">GUIObject</span></code> is a cross-toolkit “model” representation of a GUI layer object, for example, a
table. It acts as a cross-toolkit interface to what we call here a <a class="reference internal" href="#hscommon.gui.base.GUIObject.view" title="hscommon.gui.base.GUIObject.view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code></a>. That
view is a toolkit-specific controller to the actual view (an <code class="docutils literal notranslate"><span class="pre">NSTableView</span></code>, a <code class="docutils literal notranslate"><span class="pre">QTableView</span></code>,
etc.). In our GUIObject, we need a reference to that toolkit-specific controller because some
actions have effects on it (for example, prompting it to refresh its data). The <code class="docutils literal notranslate"><span class="pre">GUIObject</span></code>
is typically instantiated before its <a class="reference internal" href="#hscommon.gui.base.GUIObject.view" title="hscommon.gui.base.GUIObject.view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code></a>, that is why we set it to <code class="docutils literal notranslate"><span class="pre">None</span></code> on init.
However, the GUI layer is supposed to set the view as soon as its toolkit-specific controller is
instantiated.</p>
<p>When you subclass <code class="docutils literal notranslate"><span class="pre">GUIObject</span></code>, you will likely want to update its view on instantiation. That
is why we call <code class="docutils literal notranslate"><span class="pre">self.view.refresh()</span></code> in <a class="reference internal" href="#hscommon.gui.base.GUIObject._view_updated" title="hscommon.gui.base.GUIObject._view_updated"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_view_updated()</span></code></a>. If you need another type of
action on view instantiation, just override the method.</p>
<p>Most of the time, you will only one to bind a view once in the lifetime of your GUI object.
That is why there are safeguards, when setting <code class="docutils literal notranslate"><span class="pre">view</span></code> to ensure that we dont double-assign.
However, sometimes you want to be able to re-bind another view. In this case, set the
<code class="docutils literal notranslate"><span class="pre">multibind</span></code> flag to <code class="docutils literal notranslate"><span class="pre">True</span></code> and the safeguard will be disabled.</p>
<dl class="method">
<dt id="hscommon.gui.base.GUIObject._view_updated">
<code class="descname">_view_updated</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.base.GUIObject._view_updated" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Called after <a class="reference internal" href="#hscommon.gui.base.GUIObject.view" title="hscommon.gui.base.GUIObject.view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code></a> has been set.</p>
<p>Doing nothing by default, this method is called after <a class="reference internal" href="#hscommon.gui.base.GUIObject.view" title="hscommon.gui.base.GUIObject.view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code></a> has been set (it isnt
called when its unset, however). Use this for initialization code that requires a view
(which is often the whole of the initialization code).</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.base.GUIObject.view">
<code class="descname">view</code><a class="headerlink" href="#hscommon.gui.base.GUIObject.view" title="Permalink to this definition"></a></dt>
<dd><p>A reference to our toolkit-specific view controller.</p>
<p><em>view answering to GUIObject sublasss view protocol</em>. <em>get/set</em></p>
<p>This view starts as <code class="docutils literal notranslate"><span class="pre">None</span></code> and has to be set “manually”. Theres two times at which we set
the view property: On initialization, where we set the view that well use for our lifetime,
and just before the view is deallocated. We need to unset our view at that time to avoid
calls to a deallocated instance (which means a crash).</p>
<p>To unset our view, we simple assign it to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="../jobprogress/qt.html">hscommon.jobprogress.qt</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="column.html">hscommon.gui.column</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,367 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.column &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.progress_window" href="progress_window.html" />
<link rel="prev" title="hscommon.gui.base" href="base.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.column</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="base.html">hscommon.gui.base</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="progress_window.html">hscommon.gui.progress_window</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.column">
<span id="hscommon-gui-column"></span><h1>hscommon.gui.column<a class="headerlink" href="#module-hscommon.gui.column" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.column.Columns" title="hscommon.gui.column.Columns"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Columns</span></code></a>(table[,&nbsp;prefaccess,&nbsp;savename])</td>
<td>Cross-toolkit GUI-enabled column set for tables or outlines.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.column.Column" title="hscommon.gui.column.Column"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Column</span></code></a>(name[,&nbsp;display,&nbsp;visible,&nbsp;optional])</td>
<td>Holds column attributes such as its name, width, visibility, etc.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.column.ColumnsView" title="hscommon.gui.column.ColumnsView"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColumnsView</span></code></a></td>
<td>Expected interface for <a class="reference internal" href="#hscommon.gui.column.Columns" title="hscommon.gui.column.Columns"><code class="xref py py-class docutils literal notranslate"><span class="pre">Columns</span></code></a>s view.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.column.PrefAccessInterface" title="hscommon.gui.column.PrefAccessInterface"><code class="xref py py-obj docutils literal notranslate"><span class="pre">PrefAccessInterface</span></code></a></td>
<td>Expected interface for <a class="reference internal" href="#hscommon.gui.column.Columns" title="hscommon.gui.column.Columns"><code class="xref py py-class docutils literal notranslate"><span class="pre">Columns</span></code></a>s prefaccess.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.column.Columns">
<em class="property">class </em><code class="descclassname">hscommon.gui.column.</code><code class="descname">Columns</code><span class="sig-paren">(</span><em>table</em>, <em>prefaccess=None</em>, <em>savename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit GUI-enabled column set for tables or outlines.</p>
<p>Manages a column sets order, visibility and width. We also manage the persistence of these
attributes so that we can restore them on the next run.</p>
<p>Subclasses <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUIObject</span></code></a>. Expected view: <a class="reference internal" href="#hscommon.gui.column.ColumnsView" title="hscommon.gui.column.ColumnsView"><code class="xref py py-class docutils literal notranslate"><span class="pre">ColumnsView</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>table</strong> The table the columns belong to. Its from there that we retrieve our column
configuration and it must have a <code class="docutils literal notranslate"><span class="pre">COLUMNS</span></code> attribute which is a list of
<a class="reference internal" href="#hscommon.gui.column.Column" title="hscommon.gui.column.Column"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a>. We also call <a class="reference internal" href="table.html#hscommon.gui.table.GUITable.save_edits" title="hscommon.gui.table.GUITable.save_edits"><code class="xref py py-meth docutils literal notranslate"><span class="pre">save_edits()</span></code></a> on it from time to
time. Technically, this argument can also be a tree, but theres probably some
sorting in the code to do to support this option cleanly.</li>
<li><strong>prefaccess</strong> An object giving access to user preferences for the currently running app.
We use this to make column attributes persistent. Must follow
<a class="reference internal" href="#hscommon.gui.column.PrefAccessInterface" title="hscommon.gui.column.PrefAccessInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrefAccessInterface</span></code></a>.</li>
<li><strong>savename</strong> (<em>str</em>) The name under which column preferences will be saved. This name is in fact
a prefix. Preferences are saved under more than one name, but they will all
have that same prefix.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="hscommon.gui.column.Columns._view_updated">
<code class="descname">_view_updated</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns._view_updated" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Called after <code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code> has been set.</p>
<p>Doing nothing by default, this method is called after <code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code> has been set (it isnt
called when its unset, however). Use this for initialization code that requires a view
(which is often the whole of the initialization code).</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.column_by_index">
<code class="descname">column_by_index</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.column_by_index" title="Permalink to this definition"></a></dt>
<dd><p>Return the <a class="reference internal" href="#hscommon.gui.column.Column" title="hscommon.gui.column.Column"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a> having the <a class="reference internal" href="#hscommon.gui.column.Column.logical_index" title="hscommon.gui.column.Column.logical_index"><code class="xref py py-attr docutils literal notranslate"><span class="pre">logical_index</span></code></a> <code class="docutils literal notranslate"><span class="pre">index</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.column_by_name">
<code class="descname">column_by_name</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.column_by_name" title="Permalink to this definition"></a></dt>
<dd><p>Return the <a class="reference internal" href="#hscommon.gui.column.Column" title="hscommon.gui.column.Column"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a> having the <a class="reference internal" href="#hscommon.gui.column.Column.name" title="hscommon.gui.column.Column.name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">name</span></code></a> <code class="docutils literal notranslate"><span class="pre">name</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.column_display">
<code class="descname">column_display</code><span class="sig-paren">(</span><em>colname</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.column_display" title="Permalink to this definition"></a></dt>
<dd><p>Returns display name for column named <code class="docutils literal notranslate"><span class="pre">colname</span></code>, or <code class="docutils literal notranslate"><span class="pre">''</span></code> if theres none.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.column_is_visible">
<code class="descname">column_is_visible</code><span class="sig-paren">(</span><em>colname</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.column_is_visible" title="Permalink to this definition"></a></dt>
<dd><p>Returns visibility for column named <code class="docutils literal notranslate"><span class="pre">colname</span></code>, or <code class="docutils literal notranslate"><span class="pre">True</span></code> if theres none.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.column_width">
<code class="descname">column_width</code><span class="sig-paren">(</span><em>colname</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.column_width" title="Permalink to this definition"></a></dt>
<dd><p>Returns width for column named <code class="docutils literal notranslate"><span class="pre">colname</span></code>, or <code class="docutils literal notranslate"><span class="pre">0</span></code> if theres none.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.columns_count">
<code class="descname">columns_count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.columns_count" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of columns in our set.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.columns_to_right">
<code class="descname">columns_to_right</code><span class="sig-paren">(</span><em>colname</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.columns_to_right" title="Permalink to this definition"></a></dt>
<dd><p>Returns the list of all columns to the right of <code class="docutils literal notranslate"><span class="pre">colname</span></code>.</p>
<p>“right” meaning “having a higher <a class="reference internal" href="#hscommon.gui.column.Column.ordered_index" title="hscommon.gui.column.Column.ordered_index"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Column.ordered_index</span></code></a>” in our left-to-right
civilization.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.menu_items">
<code class="descname">menu_items</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.menu_items" title="Permalink to this definition"></a></dt>
<dd><p>Returns a list of items convenient for quick visibility menu generation.</p>
<p>Returns a list of <code class="docutils literal notranslate"><span class="pre">(display_name,</span> <span class="pre">is_marked)</span></code> items for each optional column in the
current view (<code class="docutils literal notranslate"><span class="pre">is_marked</span></code> means that its visible).</p>
<p>You can use this to generate a menu to let the user toggle the visibility of an optional
column. That is why we only show optional column, because the visibility of mandatory
columns cant be toggled.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.move_column">
<code class="descname">move_column</code><span class="sig-paren">(</span><em>colname</em>, <em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.move_column" title="Permalink to this definition"></a></dt>
<dd><p>Moves column <code class="docutils literal notranslate"><span class="pre">colname</span></code> to <code class="docutils literal notranslate"><span class="pre">index</span></code>.</p>
<p>The column will be placed just in front of the column currently having that index, or to the
end of the list if theres none.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.reset_to_defaults">
<code class="descname">reset_to_defaults</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.reset_to_defaults" title="Permalink to this definition"></a></dt>
<dd><p>Reset all columns width and visibility to their default values.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.resize_column">
<code class="descname">resize_column</code><span class="sig-paren">(</span><em>colname</em>, <em>newwidth</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.resize_column" title="Permalink to this definition"></a></dt>
<dd><p>Set column <code class="docutils literal notranslate"><span class="pre">colname</span></code>s width to <code class="docutils literal notranslate"><span class="pre">newwidth</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.restore_columns">
<code class="descname">restore_columns</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.restore_columns" title="Permalink to this definition"></a></dt>
<dd><p>Restores column persistent attributes from the last <a class="reference internal" href="#hscommon.gui.column.Columns.save_columns" title="hscommon.gui.column.Columns.save_columns"><code class="xref py py-meth docutils literal notranslate"><span class="pre">save_columns()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.save_columns">
<code class="descname">save_columns</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.save_columns" title="Permalink to this definition"></a></dt>
<dd><p>Save column attributes in persistent storage for restoration in <a class="reference internal" href="#hscommon.gui.column.Columns.restore_columns" title="hscommon.gui.column.Columns.restore_columns"><code class="xref py py-meth docutils literal notranslate"><span class="pre">restore_columns()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.set_column_order">
<code class="descname">set_column_order</code><span class="sig-paren">(</span><em>colnames</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.set_column_order" title="Permalink to this definition"></a></dt>
<dd><p>Change the columns order so it matches the order in <code class="docutils literal notranslate"><span class="pre">colnames</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>colnames</strong> A list of column names in the desired order.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.set_column_visible">
<code class="descname">set_column_visible</code><span class="sig-paren">(</span><em>colname</em>, <em>visible</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.set_column_visible" title="Permalink to this definition"></a></dt>
<dd><p>Set the visibility of column <code class="docutils literal notranslate"><span class="pre">colname</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.set_default_width">
<code class="descname">set_default_width</code><span class="sig-paren">(</span><em>colname</em>, <em>width</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.set_default_width" title="Permalink to this definition"></a></dt>
<dd><p>Set the default width or column <code class="docutils literal notranslate"><span class="pre">colname</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.Columns.toggle_menu_item">
<code class="descname">toggle_menu_item</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Columns.toggle_menu_item" title="Permalink to this definition"></a></dt>
<dd><p>Toggles the visibility of an optional column.</p>
<p>You know, that optional column menu youve generated in <a class="reference internal" href="#hscommon.gui.column.Columns.menu_items" title="hscommon.gui.column.Columns.menu_items"><code class="xref py py-meth docutils literal notranslate"><span class="pre">menu_items()</span></code></a>? Well, <code class="docutils literal notranslate"><span class="pre">index</span></code>
is the index of them menu item in <em>that</em> menu that the user has clicked on to toggle it.</p>
<p>Returns whether the column in question ends up being visible or not.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Columns.colnames">
<code class="descname">colnames</code><a class="headerlink" href="#hscommon.gui.column.Columns.colnames" title="Permalink to this definition"></a></dt>
<dd><p>List of column names in visible order.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Columns.ordered_columns">
<code class="descname">ordered_columns</code><a class="headerlink" href="#hscommon.gui.column.Columns.ordered_columns" title="Permalink to this definition"></a></dt>
<dd><p>List of <a class="reference internal" href="#hscommon.gui.column.Column" title="hscommon.gui.column.Column"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a> in visible order.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.column.Column">
<em class="property">class </em><code class="descclassname">hscommon.gui.column.</code><code class="descname">Column</code><span class="sig-paren">(</span><em>name</em>, <em>display=''</em>, <em>visible=True</em>, <em>optional=False</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.Column" title="Permalink to this definition"></a></dt>
<dd><p>Holds column attributes such as its name, width, visibility, etc.</p>
<p>These attributes are then used to correctly configure the column on the “view” side.</p>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.default_visible">
<code class="descname">default_visible</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.default_visible" title="Permalink to this definition"></a></dt>
<dd><p>Whether the column is visible by default. It will be used if column restoration doesnt
contain any “remembered” widths.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.default_width">
<code class="descname">default_width</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.default_width" title="Permalink to this definition"></a></dt>
<dd><p>Default width of the column. This value usually depends on the platform and is set on
columns initialisation. It will be used if column restoration doesnt contain any
“remembered” widths.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.display">
<code class="descname">display</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.display" title="Permalink to this definition"></a></dt>
<dd><p>Display name (title) of the column.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.logical_index">
<code class="descname">logical_index</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.logical_index" title="Permalink to this definition"></a></dt>
<dd><p>Immutable index of the column. Doesnt change even when columns are re-ordered. Used in
<a class="reference internal" href="#hscommon.gui.column.Columns.column_by_index" title="hscommon.gui.column.Columns.column_by_index"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Columns.column_by_index()</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.name">
<code class="descname">name</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.name" title="Permalink to this definition"></a></dt>
<dd><p>“programmatical” (not for display) name. Used as a reference in a couple of place, such
as <a class="reference internal" href="#hscommon.gui.column.Columns.column_by_name" title="hscommon.gui.column.Columns.column_by_name"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Columns.column_by_name()</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.optional">
<code class="descname">optional</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.optional" title="Permalink to this definition"></a></dt>
<dd><p>Whether the column can have <a class="reference internal" href="#hscommon.gui.column.Column.visible" title="hscommon.gui.column.Column.visible"><code class="xref py py-attr docutils literal notranslate"><span class="pre">visible</span></code></a> set to false.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.ordered_index">
<code class="descname">ordered_index</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.ordered_index" title="Permalink to this definition"></a></dt>
<dd><p>Index of the column in the ordered set of columns.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.visible">
<code class="descname">visible</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.visible" title="Permalink to this definition"></a></dt>
<dd><p>Whether the column is visible.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.column.Column.width">
<code class="descname">width</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.column.Column.width" title="Permalink to this definition"></a></dt>
<dd><p>Width of the column.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.column.ColumnsView">
<em class="property">class </em><code class="descclassname">hscommon.gui.column.</code><code class="descname">ColumnsView</code><a class="headerlink" href="#hscommon.gui.column.ColumnsView" title="Permalink to this definition"></a></dt>
<dd><p>Expected interface for <a class="reference internal" href="#hscommon.gui.column.Columns" title="hscommon.gui.column.Columns"><code class="xref py py-class docutils literal notranslate"><span class="pre">Columns</span></code></a>s view.</p>
<p><em>Not actually used in the code. For documentation purposes only.</em></p>
<p>Our view, the columns controller of a table or outline, is expected to properly respond to
callbacks.</p>
<dl class="method">
<dt id="hscommon.gui.column.ColumnsView.restore_columns">
<code class="descname">restore_columns</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.ColumnsView.restore_columns" title="Permalink to this definition"></a></dt>
<dd><p>Update all columns according to the model.</p>
<p>When this is called, our view has to update the columns title, order and visibility of all
columns.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.ColumnsView.set_column_visible">
<code class="descname">set_column_visible</code><span class="sig-paren">(</span><em>colname</em>, <em>visible</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.ColumnsView.set_column_visible" title="Permalink to this definition"></a></dt>
<dd><p>Update visibility of column <code class="docutils literal notranslate"><span class="pre">colname</span></code>.</p>
<p>Called when the user toggles the visibility of a column, we must update the column
<code class="docutils literal notranslate"><span class="pre">colname</span></code>s visibility status to <code class="docutils literal notranslate"><span class="pre">visible</span></code>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.column.PrefAccessInterface">
<em class="property">class </em><code class="descclassname">hscommon.gui.column.</code><code class="descname">PrefAccessInterface</code><a class="headerlink" href="#hscommon.gui.column.PrefAccessInterface" title="Permalink to this definition"></a></dt>
<dd><p>Expected interface for <a class="reference internal" href="#hscommon.gui.column.Columns" title="hscommon.gui.column.Columns"><code class="xref py py-class docutils literal notranslate"><span class="pre">Columns</span></code></a>s prefaccess.</p>
<p><em>Not actually used in the code. For documentation purposes only.</em></p>
<dl class="method">
<dt id="hscommon.gui.column.PrefAccessInterface.get_default">
<code class="descname">get_default</code><span class="sig-paren">(</span><em>key</em>, <em>fallback_value</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.PrefAccessInterface.get_default" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve the value for <code class="docutils literal notranslate"><span class="pre">key</span></code> in the currently running apps preference store.</p>
<p>If the key doesnt exist, return <code class="docutils literal notranslate"><span class="pre">fallback_value</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.column.PrefAccessInterface.set_default">
<code class="descname">set_default</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.column.PrefAccessInterface.set_default" title="Permalink to this definition"></a></dt>
<dd><p>Set the value <code class="docutils literal notranslate"><span class="pre">value</span></code> for <code class="docutils literal notranslate"><span class="pre">key</span></code> in the currently running apps preference store.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="base.html">hscommon.gui.base</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="progress_window.html">hscommon.gui.progress_window</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,199 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.progress_window &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.selectable_list" href="selectable_list.html" />
<link rel="prev" title="hscommon.gui.column" href="column.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.progress_window</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="column.html">hscommon.gui.column</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="selectable_list.html">hscommon.gui.selectable_list</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.progress_window">
<span id="hscommon-gui-progress-window"></span><h1>hscommon.gui.progress_window<a class="headerlink" href="#module-hscommon.gui.progress_window" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow" title="hscommon.gui.progress_window.ProgressWindow"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ProgressWindow</span></code></a>(finish_func[,&nbsp;error_func])</td>
<td>Cross-toolkit GUI-enabled progress window.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindowView" title="hscommon.gui.progress_window.ProgressWindowView"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ProgressWindowView</span></code></a></td>
<td>Expected interface for <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow" title="hscommon.gui.progress_window.ProgressWindow"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProgressWindow</span></code></a>s view.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.progress_window.ProgressWindow">
<em class="property">class </em><code class="descclassname">hscommon.gui.progress_window.</code><code class="descname">ProgressWindow</code><span class="sig-paren">(</span><em>finish_func</em>, <em>error_func=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindow" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit GUI-enabled progress window.</p>
<p>This class allows you to run a long running, job enabled function in a separate thread and
allow the user to follow its progress with a progress dialog.</p>
<p>To use it, you start your long-running job with <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow.run" title="hscommon.gui.progress_window.ProgressWindow.run"><code class="xref py py-meth docutils literal notranslate"><span class="pre">run()</span></code></a> and then have your UI layer
regularly call <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow.pulse" title="hscommon.gui.progress_window.ProgressWindow.pulse"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pulse()</span></code></a> to refresh the job status in the UI. It is advised that you call
<a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow.pulse" title="hscommon.gui.progress_window.ProgressWindow.pulse"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pulse()</span></code></a> in the main thread because GUI toolkit usually only support calling UI-related
functions from the main thread.</p>
<p>We subclass <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUIObject</span></code></a> and <a class="reference internal" href="../jobprogress/performer.html#hscommon.jobprogress.performer.ThreadedJobPerformer" title="hscommon.jobprogress.performer.ThreadedJobPerformer"><code class="xref py py-class docutils literal notranslate"><span class="pre">ThreadedJobPerformer</span></code></a>.
Expected view: <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindowView" title="hscommon.gui.progress_window.ProgressWindowView"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProgressWindowView</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>finish_func</strong> A function <code class="docutils literal notranslate"><span class="pre">f(jobid)</span></code> that is called when a job is completed. <code class="docutils literal notranslate"><span class="pre">jobid</span></code> is
an arbitrary id passed to <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow.run" title="hscommon.gui.progress_window.ProgressWindow.run"><code class="xref py py-meth docutils literal notranslate"><span class="pre">run()</span></code></a>.</li>
<li><strong>error_func</strong> A function <code class="docutils literal notranslate"><span class="pre">f(jobid,</span> <span class="pre">err)</span></code> that is called when an exception is raised and
unhandled during the job. If not specified, the error will be raised in the
main thread. If its specified, its your responsibility to raise the error
if you want to. If the function returns <code class="docutils literal notranslate"><span class="pre">True</span></code>, <code class="docutils literal notranslate"><span class="pre">finish_func()</span></code> will be
called as if the job terminated normally.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="hscommon.gui.progress_window.ProgressWindow.cancel">
<code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindow.cancel" title="Permalink to this definition"></a></dt>
<dd><p>Call for a user-initiated job cancellation.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.progress_window.ProgressWindow.pulse">
<code class="descname">pulse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindow.pulse" title="Permalink to this definition"></a></dt>
<dd><p>Update progress reports in the GUI.</p>
<p>Call this regularly from the GUI main run loop. The values might change before
<a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindowView.set_progress" title="hscommon.gui.progress_window.ProgressWindowView.set_progress"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ProgressWindowView.set_progress()</span></code></a> happens.</p>
<p>If the job is finished, <code class="docutils literal notranslate"><span class="pre">pulse()</span></code> will take care of closing the window and re-raising any
exception that might have been raised during the job (in the main thread this time). If
there was no exception, <code class="docutils literal notranslate"><span class="pre">finish_func(jobid)</span></code> is called to let you take appropriate action.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.progress_window.ProgressWindow.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>jobid</em>, <em>title</em>, <em>target</em>, <em>args=()</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindow.run" title="Permalink to this definition"></a></dt>
<dd><p>Starts a threaded job.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">target</span></code> function will be sent, as its first argument, a <a class="reference internal" href="../jobprogress/job.html#hscommon.jobprogress.job.Job" title="hscommon.jobprogress.job.Job"><code class="xref py py-class docutils literal notranslate"><span class="pre">Job</span></code></a> instance which
it can use to report on its progress.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>jobid</strong> Arbitrary identifier which will be passed to <code class="docutils literal notranslate"><span class="pre">finish_func()</span></code> at the end.</li>
<li><strong>title</strong> A title for the task youre starting.</li>
<li><strong>target</strong> The function that does your famous long running job.</li>
<li><strong>args</strong> additional arguments that you want to send to <code class="docutils literal notranslate"><span class="pre">target</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.progress_window.ProgressWindow.jobdesc_textfield">
<code class="descname">jobdesc_textfield</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindow.jobdesc_textfield" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference internal" href="text_field.html#hscommon.gui.text_field.TextField" title="hscommon.gui.text_field.TextField"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextField</span></code></a>. It contains that title you gave the job on <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow.run" title="hscommon.gui.progress_window.ProgressWindow.run"><code class="xref py py-meth docutils literal notranslate"><span class="pre">run()</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.progress_window.ProgressWindow.progressdesc_textfield">
<code class="descname">progressdesc_textfield</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindow.progressdesc_textfield" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference internal" href="text_field.html#hscommon.gui.text_field.TextField" title="hscommon.gui.text_field.TextField"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextField</span></code></a>. It contains the job textual update that the function might yield
during its course.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.progress_window.ProgressWindowView">
<em class="property">class </em><code class="descclassname">hscommon.gui.progress_window.</code><code class="descname">ProgressWindowView</code><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindowView" title="Permalink to this definition"></a></dt>
<dd><p>Expected interface for <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow" title="hscommon.gui.progress_window.ProgressWindow"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProgressWindow</span></code></a>s view.</p>
<p><em>Not actually used in the code. For documentation purposes only.</em></p>
<p>Our view, some kind window with a progress bar, two labels and a cancel button, is expected
to properly respond to its callbacks.</p>
<p>Its also expected to call <a class="reference internal" href="#hscommon.gui.progress_window.ProgressWindow.cancel" title="hscommon.gui.progress_window.ProgressWindow.cancel"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ProgressWindow.cancel()</span></code></a> when the cancel button is clicked.</p>
<dl class="method">
<dt id="hscommon.gui.progress_window.ProgressWindowView.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindowView.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the dialog.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.progress_window.ProgressWindowView.set_progress">
<code class="descname">set_progress</code><span class="sig-paren">(</span><em>progress</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindowView.set_progress" title="Permalink to this definition"></a></dt>
<dd><p>Set the progress of the progress bar to <code class="docutils literal notranslate"><span class="pre">progress</span></code>.</p>
<p>Not all jobs are equally responsive on their job progress report and it is recommended that
you put your progressbar in “indeterminate” mode as long as you havent received the first
<code class="docutils literal notranslate"><span class="pre">set_progress()</span></code> call to avoid letting the user think that the app is frozen.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>progress</strong> (<em>int</em>) a value between <code class="docutils literal notranslate"><span class="pre">0</span></code> and <code class="docutils literal notranslate"><span class="pre">100</span></code>.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.progress_window.ProgressWindowView.show">
<code class="descname">show</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.progress_window.ProgressWindowView.show" title="Permalink to this definition"></a></dt>
<dd><p>Show the dialog.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="column.html">hscommon.gui.column</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="selectable_list.html">hscommon.gui.selectable_list</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,232 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.selectable_list &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.table" href="table.html" />
<link rel="prev" title="hscommon.gui.progress_window" href="progress_window.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.selectable_list</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="progress_window.html">hscommon.gui.progress_window</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="table.html">hscommon.gui.table</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.selectable_list">
<span id="hscommon-gui-selectable-list"></span><h1>hscommon.gui.selectable_list<a class="headerlink" href="#module-hscommon.gui.selectable_list" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.selectable_list.Selectable" title="hscommon.gui.selectable_list.Selectable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Selectable</span></code></a>()</td>
<td>Mix-in for a <code class="docutils literal notranslate"><span class="pre">Sequence</span></code> that manages its selection status.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.selectable_list.SelectableList" title="hscommon.gui.selectable_list.SelectableList"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SelectableList</span></code></a>([items])</td>
<td>A list that can manage selection of its items.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableList" title="hscommon.gui.selectable_list.GUISelectableList"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GUISelectableList</span></code></a>([items])</td>
<td>Cross-toolkit GUI-enabled list view.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableListView" title="hscommon.gui.selectable_list.GUISelectableListView"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GUISelectableListView</span></code></a></td>
<td>Expected interface for <a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableList" title="hscommon.gui.selectable_list.GUISelectableList"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUISelectableList</span></code></a>s view.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.selectable_list.Selectable">
<em class="property">class </em><code class="descclassname">hscommon.gui.selectable_list.</code><code class="descname">Selectable</code><a class="headerlink" href="#hscommon.gui.selectable_list.Selectable" title="Permalink to this definition"></a></dt>
<dd><p>Mix-in for a <code class="docutils literal notranslate"><span class="pre">Sequence</span></code> that manages its selection status.</p>
<p>When mixed in with a <code class="docutils literal notranslate"><span class="pre">Sequence</span></code>, we enable it to manage its selection status. The selection
is held as a list of <code class="docutils literal notranslate"><span class="pre">int</span></code> indexes. Multiple selection is supported.</p>
<dl class="method">
<dt id="hscommon.gui.selectable_list.Selectable._update_selection">
<code class="descname">_update_selection</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.Selectable._update_selection" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Updates the models selection appropriately.</p>
<p>Called after selection has been updated. Takes the tables selection and does appropriates
updates on the view and/or model. Common sense would dictate that when the selection doesnt
change, we dont update anything (and thus dont call <code class="docutils literal notranslate"><span class="pre">_update_selection()</span></code> at all), but
there are cases where its false. For example, if our list updates its items but doesnt
change its selection, we probably want to update the models selection.</p>
<p>By default, does nothing.</p>
<p>Important note: This is only called on <a class="reference internal" href="#hscommon.gui.selectable_list.Selectable.select" title="hscommon.gui.selectable_list.Selectable.select"><code class="xref py py-meth docutils literal notranslate"><span class="pre">select()</span></code></a>, not on changes to
<a class="reference internal" href="#hscommon.gui.selectable_list.Selectable.selected_indexes" title="hscommon.gui.selectable_list.Selectable.selected_indexes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_indexes</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.Selectable.select">
<code class="descname">select</code><span class="sig-paren">(</span><em>indexes</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.Selectable.select" title="Permalink to this definition"></a></dt>
<dd><p>Update selection to <code class="docutils literal notranslate"><span class="pre">indexes</span></code>.</p>
<p><a class="reference internal" href="#hscommon.gui.selectable_list.Selectable._update_selection" title="hscommon.gui.selectable_list.Selectable._update_selection"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_update_selection()</span></code></a> is called afterwards.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>indexes</strong> (<em>list</em>) List of <code class="docutils literal notranslate"><span class="pre">int</span></code> that is to become the new selection.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.selectable_list.Selectable.selected_index">
<code class="descname">selected_index</code><a class="headerlink" href="#hscommon.gui.selectable_list.Selectable.selected_index" title="Permalink to this definition"></a></dt>
<dd><p>Points to the first selected index.</p>
<p><em>int</em>. <em>get/set</em>.</p>
<p>Thin wrapper around <a class="reference internal" href="#hscommon.gui.selectable_list.Selectable.selected_indexes" title="hscommon.gui.selectable_list.Selectable.selected_indexes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_indexes</span></code></a>. <code class="docutils literal notranslate"><span class="pre">None</span></code> if selection is empty. Using this
property only makes sense if your selectable sequence supports single selection only.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.selectable_list.Selectable.selected_indexes">
<code class="descname">selected_indexes</code><a class="headerlink" href="#hscommon.gui.selectable_list.Selectable.selected_indexes" title="Permalink to this definition"></a></dt>
<dd><p>List of selected indexes.</p>
<p><em>list of int</em>. <em>get/set</em>.</p>
<p>When setting the value, automatically removes out-of-bounds indexes. The list is kept
sorted.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.selectable_list.SelectableList">
<em class="property">class </em><code class="descclassname">hscommon.gui.selectable_list.</code><code class="descname">SelectableList</code><span class="sig-paren">(</span><em>items=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.SelectableList" title="Permalink to this definition"></a></dt>
<dd><p>A list that can manage selection of its items.</p>
<p>Subclasses <a class="reference internal" href="#hscommon.gui.selectable_list.Selectable" title="hscommon.gui.selectable_list.Selectable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Selectable</span></code></a>. Behaves like a <code class="docutils literal notranslate"><span class="pre">list</span></code>.</p>
<dl class="method">
<dt id="hscommon.gui.selectable_list.SelectableList._on_change">
<code class="descname">_on_change</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.SelectableList._on_change" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Called whenever the contents of the list changes.</p>
<p>By default, does nothing.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.SelectableList.append">
<code class="descname">append</code><span class="sig-paren">(</span><em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.SelectableList.append" title="Permalink to this definition"></a></dt>
<dd><p>S.append(value) append value to the end of the sequence</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.SelectableList.insert">
<code class="descname">insert</code><span class="sig-paren">(</span><em>index</em>, <em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.SelectableList.insert" title="Permalink to this definition"></a></dt>
<dd><p>S.insert(index, value) insert value before index</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.SelectableList.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em>row</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.SelectableList.remove" title="Permalink to this definition"></a></dt>
<dd><p>S.remove(value) remove first occurrence of value.
Raise ValueError if the value is not present.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.selectable_list.GUISelectableList">
<em class="property">class </em><code class="descclassname">hscommon.gui.selectable_list.</code><code class="descname">GUISelectableList</code><span class="sig-paren">(</span><em>items=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableList" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit GUI-enabled list view.</p>
<p>Represents a UI element presenting the user with a selectable list of items.</p>
<p>Subclasses <a class="reference internal" href="#hscommon.gui.selectable_list.SelectableList" title="hscommon.gui.selectable_list.SelectableList"><code class="xref py py-class docutils literal notranslate"><span class="pre">SelectableList</span></code></a> and <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUIObject</span></code></a>. Expected view:
<a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableListView" title="hscommon.gui.selectable_list.GUISelectableListView"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUISelectableListView</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>items</strong> (<em>iterable</em>) If specified, items to fill the list with initially.</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="hscommon.gui.selectable_list.GUISelectableList._on_change">
<code class="descname">_on_change</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableList._on_change" title="Permalink to this definition"></a></dt>
<dd><p>Refreshes the view contents with <a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableListView.refresh" title="hscommon.gui.selectable_list.GUISelectableListView.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GUISelectableListView.refresh()</span></code></a>.</p>
<p>Overrides <a class="reference internal" href="#hscommon.gui.selectable_list.SelectableList._on_change" title="hscommon.gui.selectable_list.SelectableList._on_change"><code class="xref py py-meth docutils literal notranslate"><span class="pre">SelectableList._on_change()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.GUISelectableList._update_selection">
<code class="descname">_update_selection</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableList._update_selection" title="Permalink to this definition"></a></dt>
<dd><p>Refreshes the view selection with <a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableListView.update_selection" title="hscommon.gui.selectable_list.GUISelectableListView.update_selection"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GUISelectableListView.update_selection()</span></code></a>.</p>
<p>Overrides <a class="reference internal" href="#hscommon.gui.selectable_list.Selectable._update_selection" title="hscommon.gui.selectable_list.Selectable._update_selection"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Selectable._update_selection()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.GUISelectableList._view_updated">
<code class="descname">_view_updated</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableList._view_updated" title="Permalink to this definition"></a></dt>
<dd><p>Refreshes the view contents with <a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableListView.refresh" title="hscommon.gui.selectable_list.GUISelectableListView.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GUISelectableListView.refresh()</span></code></a>.</p>
<p>Overrides <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject._view_updated" title="hscommon.gui.base.GUIObject._view_updated"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_view_updated()</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.selectable_list.GUISelectableListView">
<em class="property">class </em><code class="descclassname">hscommon.gui.selectable_list.</code><code class="descname">GUISelectableListView</code><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableListView" title="Permalink to this definition"></a></dt>
<dd><p>Expected interface for <a class="reference internal" href="#hscommon.gui.selectable_list.GUISelectableList" title="hscommon.gui.selectable_list.GUISelectableList"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUISelectableList</span></code></a>s view.</p>
<p><em>Not actually used in the code. For documentation purposes only.</em></p>
<p>Our view, some kind of list view or combobox, is expected to sync with the lists contents by
appropriately behave to all callbacks in this interface.</p>
<dl class="method">
<dt id="hscommon.gui.selectable_list.GUISelectableListView.refresh">
<code class="descname">refresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableListView.refresh" title="Permalink to this definition"></a></dt>
<dd><p>Refreshes the contents of the list widget.</p>
<p>Ensures that the contents of the list widget is synced with the model.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.selectable_list.GUISelectableListView.update_selection">
<code class="descname">update_selection</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.selectable_list.GUISelectableListView.update_selection" title="Permalink to this definition"></a></dt>
<dd><p>Update selection status.</p>
<p>Ensures that the list widgets selection is in sync with the model.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="progress_window.html">hscommon.gui.progress_window</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="table.html">hscommon.gui.table</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,441 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.table &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.text_field" href="text_field.html" />
<link rel="prev" title="hscommon.gui.selectable_list" href="selectable_list.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.table</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="selectable_list.html">hscommon.gui.selectable_list</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="text_field.html">hscommon.gui.text_field</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.table">
<span id="hscommon-gui-table"></span><h1>hscommon.gui.table<a class="headerlink" href="#module-hscommon.gui.table" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.table.Table" title="hscommon.gui.table.Table"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Table</span></code></a>()</td>
<td>Sortable and selectable sequence of <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Row</span></code></a>(table)</td>
<td>Represents a row in a <a class="reference internal" href="#hscommon.gui.table.Table" title="hscommon.gui.table.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.table.GUITable" title="hscommon.gui.table.GUITable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GUITable</span></code></a>()</td>
<td>Cross-toolkit GUI-enabled table view.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.table.GUITableView" title="hscommon.gui.table.GUITableView"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GUITableView</span></code></a></td>
<td>Expected interface for <a class="reference internal" href="#hscommon.gui.table.GUITable" title="hscommon.gui.table.GUITable"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUITable</span></code></a>s view.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.table.Table">
<em class="property">class </em><code class="descclassname">hscommon.gui.table.</code><code class="descname">Table</code><a class="headerlink" href="#hscommon.gui.table.Table" title="Permalink to this definition"></a></dt>
<dd><p>Sortable and selectable sequence of <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>.</p>
<p>In fact, the Table is very similar to <a class="reference internal" href="selectable_list.html#hscommon.gui.selectable_list.SelectableList" title="hscommon.gui.selectable_list.SelectableList"><code class="xref py py-class docutils literal notranslate"><span class="pre">SelectableList</span></code></a> in
practice and differs mostly in principle. Their difference lies in the nature of their items
they manage. With the Table, rows usually have many properties, presented in columns, and they
have to subclass <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>.</p>
<p>Usually used with <a class="reference internal" href="column.html#hscommon.gui.column.Column" title="hscommon.gui.column.Column"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a>.</p>
<p>Subclasses <a class="reference internal" href="selectable_list.html#hscommon.gui.selectable_list.Selectable" title="hscommon.gui.selectable_list.Selectable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Selectable</span></code></a>.</p>
<dl class="method">
<dt id="hscommon.gui.table.Table.append">
<code class="descname">append</code><span class="sig-paren">(</span><em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Table.append" title="Permalink to this definition"></a></dt>
<dd><p>Appends <code class="docutils literal notranslate"><span class="pre">item</span></code> at the end of the table.</p>
<p>If theres a footer, the item is inserted before it.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Table.insert">
<code class="descname">insert</code><span class="sig-paren">(</span><em>index</em>, <em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Table.insert" title="Permalink to this definition"></a></dt>
<dd><p>Inserts <code class="docutils literal notranslate"><span class="pre">item</span></code> at <code class="docutils literal notranslate"><span class="pre">index</span></code> in the table.</p>
<p>If theres a header, will make sure we dont insert before it, and if theres a footer, will
make sure that we dont insert after it.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Table.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em>row</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Table.remove" title="Permalink to this definition"></a></dt>
<dd><p>Removes <code class="docutils literal notranslate"><span class="pre">row</span></code> from table.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">row</span></code> is a header or footer, that header or footer will be set to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Table.sort_by">
<code class="descname">sort_by</code><span class="sig-paren">(</span><em>column_name</em>, <em>desc=False</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Table.sort_by" title="Permalink to this definition"></a></dt>
<dd><p>Sort table by <code class="docutils literal notranslate"><span class="pre">column_name</span></code>.</p>
<p>Sort key for each row is computed from <a class="reference internal" href="#hscommon.gui.table.Row.sort_key_for_column" title="hscommon.gui.table.Row.sort_key_for_column"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Row.sort_key_for_column()</span></code></a>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">desc</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, sort order is reversed.</p>
<p>If present, header and footer will always be first and last, respectively.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.Table.footer">
<code class="descname">footer</code><a class="headerlink" href="#hscommon.gui.table.Table.footer" title="Permalink to this definition"></a></dt>
<dd><p>If set, a row that always stay at the bottom of the table.</p>
<p><a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>. <em>get/set</em>.</p>
<p>When set to something else than <code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="docutils literal notranslate"><span class="pre">header</span></code> and <code class="docutils literal notranslate"><span class="pre">footer</span></code> represent rows that will
always be kept in first and/or last position, regardless of sorting. <code class="docutils literal notranslate"><span class="pre">len()</span></code> and indexing
will include them, which means that if theres a header, <code class="docutils literal notranslate"><span class="pre">table[0]</span></code> returns it and if
theres a footer, <code class="docutils literal notranslate"><span class="pre">table[-1]</span></code> returns it. To make things short, all list-like functions
work with header and footer “on”. But things get fuzzy for <code class="docutils literal notranslate"><span class="pre">append()</span></code> and <code class="docutils literal notranslate"><span class="pre">insert()</span></code>
because these will ensure that no “normal” row gets inserted before the header or after the
footer.</p>
<p>Adding and removing footer here and there might seem (and is) hackish, but its much simpler
than the alternative (when, of course, you need such a feature), which is to override magic
methods and adjust the results. When we do that, there the slice stuff that we have to
implement and it gets quite complex. Moreover, the most frequent operation on a table is
<code class="docutils literal notranslate"><span class="pre">__getitem__</span></code>, and making checks to know whether the key is a header or footer at each
call would make that operation, which is the most used, slower.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.Table.header">
<code class="descname">header</code><a class="headerlink" href="#hscommon.gui.table.Table.header" title="Permalink to this definition"></a></dt>
<dd><p>If set, a row that always stay at the bottom of the table.</p>
<p>See <a class="reference internal" href="#hscommon.gui.table.Table.footer" title="hscommon.gui.table.Table.footer"><code class="xref py py-attr docutils literal notranslate"><span class="pre">footer</span></code></a> for details.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.Table.row_count">
<code class="descname">row_count</code><a class="headerlink" href="#hscommon.gui.table.Table.row_count" title="Permalink to this definition"></a></dt>
<dd><p>Number or rows in the table (without counting header and footer).</p>
<p><em>int</em>. <em>read-only</em>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.Table.rows">
<code class="descname">rows</code><a class="headerlink" href="#hscommon.gui.table.Table.rows" title="Permalink to this definition"></a></dt>
<dd><p>List of rows in the table, excluding header and footer.</p>
<p>List of <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>. <em>read-only</em>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.Table.selected_row">
<code class="descname">selected_row</code><a class="headerlink" href="#hscommon.gui.table.Table.selected_row" title="Permalink to this definition"></a></dt>
<dd><p>Selected row according to <code class="xref py py-attr docutils literal notranslate"><span class="pre">Selectable.selected_index</span></code>.</p>
<p><a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>. <em>get/set</em>.</p>
<p>When setting this attribute, we look up the index of the row and set the selected index from
there. If the row isnt in the list, selection isnt changed.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.Table.selected_rows">
<code class="descname">selected_rows</code><a class="headerlink" href="#hscommon.gui.table.Table.selected_rows" title="Permalink to this definition"></a></dt>
<dd><p>List of selected rows based on <a class="reference internal" href="selectable_list.html#hscommon.gui.selectable_list.Selectable.selected_indexes" title="hscommon.gui.selectable_list.Selectable.selected_indexes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_indexes</span></code></a>.</p>
<p>List of <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>. <em>read-only</em>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.table.Row">
<em class="property">class </em><code class="descclassname">hscommon.gui.table.</code><code class="descname">Row</code><span class="sig-paren">(</span><em>table</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row" title="Permalink to this definition"></a></dt>
<dd><p>Represents a row in a <a class="reference internal" href="#hscommon.gui.table.Table" title="hscommon.gui.table.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a>.</p>
<p>It holds multiple values to be represented through columns. Its its role to prepare data
fetched from model instances into ready-to-present-in-a-table fashion. You will do this in
<a class="reference internal" href="#hscommon.gui.table.Row.load" title="hscommon.gui.table.Row.load"><code class="xref py py-meth docutils literal notranslate"><span class="pre">load()</span></code></a>.</p>
<p>When you do this, youll put the result into arbitrary attributes, which will later be fetched
by your table for presentation to the user.</p>
<p>You can organize your attributes in whatever way you want, but theres a convention you can
follow if you want to minimize subclassing and use default behavior:</p>
<ol class="arabic simple">
<li>Attribute name = column name. If your attribute is <code class="docutils literal notranslate"><span class="pre">foobar</span></code>, whenever we refer to
<code class="docutils literal notranslate"><span class="pre">column_name</span></code>, you refer to that attribute with the column name <code class="docutils literal notranslate"><span class="pre">foobar</span></code>.</li>
<li>Public attributes are for <em>formatted</em> value, that is, user readable strings.</li>
<li>Underscore prefix is the unformatted (computable) value. For example, you could have
<code class="docutils literal notranslate"><span class="pre">_foobar</span></code> at <code class="docutils literal notranslate"><span class="pre">42</span></code> and <code class="docutils literal notranslate"><span class="pre">foobar</span></code> at <code class="docutils literal notranslate"><span class="pre">&quot;42</span> <span class="pre">seconds&quot;</span></code> (what you present to the user).</li>
<li>Unformatted values are used for sorting.</li>
<li>If your column name is a python keyword, add an underscore suffix (<code class="docutils literal notranslate"><span class="pre">from_</span></code>).</li>
</ol>
<p>Of course, this is only default behavior. This can be overriden.</p>
<dl class="method">
<dt id="hscommon.gui.table.Row.can_edit">
<code class="descname">can_edit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.can_edit" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Whether the whole row can be edited.</p>
<p>By default, always returns <code class="docutils literal notranslate"><span class="pre">True</span></code>. This is for the <em>whole</em> row. For individual cells, its
<a class="reference internal" href="#hscommon.gui.table.Row.can_edit_cell" title="hscommon.gui.table.Row.can_edit_cell"><code class="xref py py-meth docutils literal notranslate"><span class="pre">can_edit_cell()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Row.can_edit_cell">
<code class="descname">can_edit_cell</code><span class="sig-paren">(</span><em>column_name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.can_edit_cell" title="Permalink to this definition"></a></dt>
<dd><p>Returns whether cell for column <code class="docutils literal notranslate"><span class="pre">column_name</span></code> can be edited.</p>
<p>By the default, the check is done in many steps:</p>
<ol class="arabic simple">
<li>We check whether the whole row can be edited with <a class="reference internal" href="#hscommon.gui.table.Row.can_edit" title="hscommon.gui.table.Row.can_edit"><code class="xref py py-meth docutils literal notranslate"><span class="pre">can_edit()</span></code></a>. If it cant, the cell
cant either.</li>
<li>If the column doesnt exist as an attribute, we cant edit.</li>
<li>If we have an attribute <code class="docutils literal notranslate"><span class="pre">can_edit_&lt;column_name&gt;</span></code>, return that.</li>
<li>Check if our attribute is a property. If its not, its not editable.</li>
<li>If our attribute is in fact a property, check whether the property is “settable” (has a
<code class="docutils literal notranslate"><span class="pre">fset</span></code> method). The cell is editable only if the property is “settable”.</li>
</ol>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Row.get_cell_value">
<code class="descname">get_cell_value</code><span class="sig-paren">(</span><em>attrname</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.get_cell_value" title="Permalink to this definition"></a></dt>
<dd><p>Get cell value for <code class="docutils literal notranslate"><span class="pre">attrname</span></code>.</p>
<p>By default, does a simple <code class="docutils literal notranslate"><span class="pre">getattr()</span></code>, but it is used to allow subclasses to have
alternative value storage mechanisms.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Row.load">
<code class="descname">load</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.load" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual/Required) Loads up values from the model to be presented in the table.</p>
<p>Usually, our model instances contain values that are not quite ready for display. If you
have number formatting, display calculations and other whatnots to perform, you do it here
and then you put the result in an arbitrary attribute of the row.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Row.save">
<code class="descname">save</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.save" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual/Required) Saves user edits into your model.</p>
<p>If your table is editable, this is called when the user commits his changes. Usually, these
are typed up stuff, or selected indexes. You have to do proper parsing and reference
linking, and save that stuff into your model.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Row.set_cell_value">
<code class="descname">set_cell_value</code><span class="sig-paren">(</span><em>attrname</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.set_cell_value" title="Permalink to this definition"></a></dt>
<dd><p>Set cell value to <code class="docutils literal notranslate"><span class="pre">value</span></code> for <code class="docutils literal notranslate"><span class="pre">attrname</span></code>.</p>
<p>By default, does a simple <code class="docutils literal notranslate"><span class="pre">setattr()</span></code>, but it is used to allow subclasses to have
alternative value storage mechanisms.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.Row.sort_key_for_column">
<code class="descname">sort_key_for_column</code><span class="sig-paren">(</span><em>column_name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.Row.sort_key_for_column" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Return the value that is to be used to sort by column <code class="docutils literal notranslate"><span class="pre">column_name</span></code>.</p>
<p>By default, looks for an attribute with the same name as <code class="docutils literal notranslate"><span class="pre">column_name</span></code>, but with an
underscore prefix (“unformatted value”). If theres none, tries without the underscore. If
theres none, raises <code class="docutils literal notranslate"><span class="pre">AttributeError</span></code>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.table.GUITable">
<em class="property">class </em><code class="descclassname">hscommon.gui.table.</code><code class="descname">GUITable</code><a class="headerlink" href="#hscommon.gui.table.GUITable" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit GUI-enabled table view.</p>
<p>Represents a UI element presenting the user with a sortable, selectable, possibly editable,
table view.</p>
<p>Behaves like the <a class="reference internal" href="#hscommon.gui.table.Table" title="hscommon.gui.table.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a> which it subclasses, but is more focused on being the presenter
of some model data to its <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject.view" title="hscommon.gui.base.GUIObject.view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">GUIObject.view</span></code></a>. Theres a <a class="reference internal" href="#hscommon.gui.table.GUITable.refresh" title="hscommon.gui.table.GUITable.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>
mechanism which ensures fresh data while preserving sorting order and selection. Theres also an
editing mechanism which tracks whether (and which) row is being edited (or added) and
save/cancel edits when appropriate.</p>
<p>Subclasses <a class="reference internal" href="#hscommon.gui.table.Table" title="hscommon.gui.table.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a> and <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUIObject</span></code></a>. Expected view:
<a class="reference internal" href="#hscommon.gui.table.GUITableView" title="hscommon.gui.table.GUITableView"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUITableView</span></code></a>.</p>
<dl class="method">
<dt id="hscommon.gui.table.GUITable._do_add">
<code class="descname">_do_add</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable._do_add" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Creates a new row, adds it in the table.</p>
<p>Returns <code class="docutils literal notranslate"><span class="pre">(row,</span> <span class="pre">insert_index)</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable._do_delete">
<code class="descname">_do_delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable._do_delete" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Delete the selected rows.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable._fill">
<code class="descname">_fill</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable._fill" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual/Required) Fills the table with all the rows that this table is supposed to have.</p>
<p>Called by <a class="reference internal" href="#hscommon.gui.table.GUITable.refresh" title="hscommon.gui.table.GUITable.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>. Does nothing by default.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable._is_edited_new">
<code class="descname">_is_edited_new</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable._is_edited_new" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Returns whether the currently edited row should be considered “new”.</p>
<p>This is used in <a class="reference internal" href="#hscommon.gui.table.GUITable.cancel_edits" title="hscommon.gui.table.GUITable.cancel_edits"><code class="xref py py-meth docutils literal notranslate"><span class="pre">cancel_edits()</span></code></a> to know whether the cancellation of the edit means a
revert of the rows value or the removal of the row.</p>
<p>By default, always false.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable._restore_selection">
<code class="descname">_restore_selection</code><span class="sig-paren">(</span><em>previous_selection</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable._restore_selection" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Restores row selection after a contents-changing operation.</p>
<p>Before each contents changing operation, we store our previously selected indexes because in
many cases, such as in <a class="reference internal" href="#hscommon.gui.table.GUITable.refresh" title="hscommon.gui.table.GUITable.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>, our selection will be lost. After the operation is
over, we call this method with our previously selected indexes (in <code class="docutils literal notranslate"><span class="pre">previous_selection</span></code>).</p>
<p>The default behavior is (if we indeed have an empty <a class="reference internal" href="selectable_list.html#hscommon.gui.selectable_list.Selectable.selected_indexes" title="hscommon.gui.selectable_list.Selectable.selected_indexes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_indexes</span></code></a>) to re-select
<code class="docutils literal notranslate"><span class="pre">previous_selection</span></code>. If it was empty, we select the last row of the table.</p>
<p>This behavior can, of course, be overriden.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.add">
<code class="descname">add</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.add" title="Permalink to this definition"></a></dt>
<dd><p>Add a new row in edit mode.</p>
<p>Requires <code class="xref py py-meth docutils literal notranslate"><span class="pre">do_add()</span></code> to be implemented. The newly added row will be selected and in edit
mode.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.can_edit_cell">
<code class="descname">can_edit_cell</code><span class="sig-paren">(</span><em>column_name</em>, <em>row_index</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.can_edit_cell" title="Permalink to this definition"></a></dt>
<dd><p>Returns whether the cell at <code class="docutils literal notranslate"><span class="pre">row_index</span></code> and <code class="docutils literal notranslate"><span class="pre">column_name</span></code> can be edited.</p>
<p>A row is, by default, editable as soon as it has an attr with the same name as <cite>column</cite>.
If <a class="reference internal" href="#hscommon.gui.table.Row.can_edit" title="hscommon.gui.table.Row.can_edit"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Row.can_edit()</span></code></a> returns False, the row is not editable at all. You can set
editability of rows at the attribute level with can_edit_* properties.</p>
<p>Mostly just a shortcut to <a class="reference internal" href="#hscommon.gui.table.Row.can_edit_cell" title="hscommon.gui.table.Row.can_edit_cell"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Row.can_edit_cell()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.cancel_edits">
<code class="descname">cancel_edits</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.cancel_edits" title="Permalink to this definition"></a></dt>
<dd><p>Cancels the current edit operation.</p>
<p>If theres an <a class="reference internal" href="#hscommon.gui.table.GUITable.edited" title="hscommon.gui.table.GUITable.edited"><code class="xref py py-attr docutils literal notranslate"><span class="pre">edited</span></code></a> row, it will be re-initialized (with <a class="reference internal" href="#hscommon.gui.table.Row.load" title="hscommon.gui.table.Row.load"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Row.load()</span></code></a>).</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.delete">
<code class="descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete the currently selected rows.</p>
<p>Requires <a class="reference internal" href="#hscommon.gui.table.GUITable._do_delete" title="hscommon.gui.table.GUITable._do_delete"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_do_delete()</span></code></a> for this to have any effect on the model. Cancels editing if
relevant.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.refresh">
<code class="descname">refresh</code><span class="sig-paren">(</span><em>refresh_view=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.refresh" title="Permalink to this definition"></a></dt>
<dd><p>Empty the table and re-create its rows.</p>
<p><a class="reference internal" href="#hscommon.gui.table.GUITable._fill" title="hscommon.gui.table.GUITable._fill"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_fill()</span></code></a> is called after we emptied the table to create our rows. Previous sort order
will be preserved, regardless of the order in which the rows were filled. If there was any
edit operation taking place, its cancelled.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>refresh_view</strong> (<em>bool</em>) Whether we tell our view to refresh after our refill operation.
Most of the time, its what we want, but theres some cases where
we dont.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.save_edits">
<code class="descname">save_edits</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.save_edits" title="Permalink to this definition"></a></dt>
<dd><p>Commit user edits to the model.</p>
<p>This is done by calling <a class="reference internal" href="#hscommon.gui.table.Row.save" title="hscommon.gui.table.Row.save"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Row.save()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITable.sort_by">
<code class="descname">sort_by</code><span class="sig-paren">(</span><em>column_name</em>, <em>desc=False</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITable.sort_by" title="Permalink to this definition"></a></dt>
<dd><p>Sort table by <code class="docutils literal notranslate"><span class="pre">column_name</span></code>.</p>
<p>Overrides <a class="reference internal" href="#hscommon.gui.table.Table.sort_by" title="hscommon.gui.table.Table.sort_by"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Table.sort_by()</span></code></a>. After having performed sorting, calls
<a class="reference internal" href="selectable_list.html#hscommon.gui.selectable_list.Selectable._update_selection" title="hscommon.gui.selectable_list.Selectable._update_selection"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_update_selection()</span></code></a> to give you the chance,
if appropriate, to update your selected indexes according to, maybe, the selection that you
have in your model.</p>
<p>Then, we refresh our view.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.table.GUITable.edited">
<code class="descname">edited</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.table.GUITable.edited" title="Permalink to this definition"></a></dt>
<dd><p>The row being currently edited by the user. <code class="docutils literal notranslate"><span class="pre">None</span></code> if no edit is taking place.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.table.GUITableView">
<em class="property">class </em><code class="descclassname">hscommon.gui.table.</code><code class="descname">GUITableView</code><a class="headerlink" href="#hscommon.gui.table.GUITableView" title="Permalink to this definition"></a></dt>
<dd><p>Expected interface for <a class="reference internal" href="#hscommon.gui.table.GUITable" title="hscommon.gui.table.GUITable"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUITable</span></code></a>s view.</p>
<p><em>Not actually used in the code. For documentation purposes only.</em></p>
<p>Our view, some kind of table view, is expected to sync with the tables contents by
appropriately behave to all callbacks in this interface.</p>
<p>When in edit mode, the content types by the user is expected to be sent as soon as possible
to the <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a>.</p>
<p>Whenever the user changes the selection, we expect the view to call <code class="xref py py-meth docutils literal notranslate"><span class="pre">Table.select()</span></code>.</p>
<dl class="method">
<dt id="hscommon.gui.table.GUITableView.refresh">
<code class="descname">refresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITableView.refresh" title="Permalink to this definition"></a></dt>
<dd><p>Refreshes the contents of the table widget.</p>
<p>Ensures that the contents of the table widget is synced with the model. This includes
selection.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITableView.start_editing">
<code class="descname">start_editing</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITableView.start_editing" title="Permalink to this definition"></a></dt>
<dd><p>Start editing the currently selected row.</p>
<p>Begin whatever inline editing support that the view supports.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.table.GUITableView.stop_editing">
<code class="descname">stop_editing</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.table.GUITableView.stop_editing" title="Permalink to this definition"></a></dt>
<dd><p>Stop editing if theres an inline editing in effect.</p>
<p>Theres no “aborting” implied in this call, so its appropriate to send whatever the user
has typed and might not have been sent down to the <a class="reference internal" href="#hscommon.gui.table.Row" title="hscommon.gui.table.Row"><code class="xref py py-class docutils literal notranslate"><span class="pre">Row</span></code></a> yet. After youve done that,
stop the editing mechanism.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="selectable_list.html">hscommon.gui.selectable_list</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="text_field.html">hscommon.gui.text_field</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,160 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.text_field &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.tree" href="tree.html" />
<link rel="prev" title="hscommon.gui.table" href="table.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.text_field</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="table.html">hscommon.gui.table</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="tree.html">hscommon.gui.tree</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.text_field">
<span id="hscommon-gui-text-field"></span><h1>hscommon.gui.text_field<a class="headerlink" href="#module-hscommon.gui.text_field" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.text_field.TextField" title="hscommon.gui.text_field.TextField"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TextField</span></code></a>()</td>
<td>Cross-toolkit text field.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.text_field.TextFieldView" title="hscommon.gui.text_field.TextFieldView"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TextFieldView</span></code></a></td>
<td>Expected interface for <a class="reference internal" href="#hscommon.gui.text_field.TextField" title="hscommon.gui.text_field.TextField"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextField</span></code></a>s view.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.text_field.TextField">
<em class="property">class </em><code class="descclassname">hscommon.gui.text_field.</code><code class="descname">TextField</code><a class="headerlink" href="#hscommon.gui.text_field.TextField" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit text field.</p>
<p>Represents a UI element allowing the user to input a text value. Its main attribute is
<a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">text</span></code></a> which acts as the store of the said value.</p>
<p>When our model value isnt a string, we have a built-in parsing/formatting mechanism allowing
us to directly retrieve/set our non-string value through <a class="reference internal" href="#hscommon.gui.text_field.TextField.value" title="hscommon.gui.text_field.TextField.value"><code class="xref py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>.</p>
<p>Subclasses <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUIObject</span></code></a>. Expected view: <a class="reference internal" href="#hscommon.gui.text_field.TextFieldView" title="hscommon.gui.text_field.TextFieldView"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextFieldView</span></code></a>.</p>
<dl class="method">
<dt id="hscommon.gui.text_field.TextField._format">
<code class="descname">_format</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.text_field.TextField._format" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Formats <code class="docutils literal notranslate"><span class="pre">value</span></code> to put into <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">text</span></code></a>.</p>
<p>Returns the formatted version of <code class="docutils literal notranslate"><span class="pre">value</span></code>. Called whenever <a class="reference internal" href="#hscommon.gui.text_field.TextField.value" title="hscommon.gui.text_field.TextField.value"><code class="xref py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> changes.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.text_field.TextField._parse">
<code class="descname">_parse</code><span class="sig-paren">(</span><em>text</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.text_field.TextField._parse" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Parses <code class="docutils literal notranslate"><span class="pre">text</span></code> to put into <a class="reference internal" href="#hscommon.gui.text_field.TextField.value" title="hscommon.gui.text_field.TextField.value"><code class="xref py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>.</p>
<p>Returns the parsed version of <code class="docutils literal notranslate"><span class="pre">text</span></code>. Called whenever <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">text</span></code></a> changes.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.text_field.TextField._update">
<code class="descname">_update</code><span class="sig-paren">(</span><em>newvalue</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.text_field.TextField._update" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Called whenever we have a new value.</p>
<p>Whenever our text/value store changes to a new value (different from the old one), this
method is called. By default, it does nothing but you can override it if you want.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.text_field.TextField._view_updated">
<code class="descname">_view_updated</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.text_field.TextField._view_updated" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Called after <code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code> has been set.</p>
<p>Doing nothing by default, this method is called after <code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code> has been set (it isnt
called when its unset, however). Use this for initialization code that requires a view
(which is often the whole of the initialization code).</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.text_field.TextField.refresh">
<code class="descname">refresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.text_field.TextField.refresh" title="Permalink to this definition"></a></dt>
<dd><p>Triggers a view <a class="reference internal" href="#hscommon.gui.text_field.TextFieldView.refresh" title="hscommon.gui.text_field.TextFieldView.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.text_field.TextField.text">
<code class="descname">text</code><a class="headerlink" href="#hscommon.gui.text_field.TextField.text" title="Permalink to this definition"></a></dt>
<dd><p>The text that is currently displayed in the widget.</p>
<p><em>str</em>. <em>get/set</em>.</p>
<p>This property can be set. When it is, <a class="reference internal" href="#hscommon.gui.text_field.TextField.refresh" title="hscommon.gui.text_field.TextField.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> is called and the view is synced with
our value. Always in sync with <a class="reference internal" href="#hscommon.gui.text_field.TextField.value" title="hscommon.gui.text_field.TextField.value"><code class="xref py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.text_field.TextField.value">
<code class="descname">value</code><a class="headerlink" href="#hscommon.gui.text_field.TextField.value" title="Permalink to this definition"></a></dt>
<dd><p>The “parsed” representation of <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">text</span></code></a>.</p>
<p><em>arbitrary type</em>. <em>get/set</em>.</p>
<p>By default, its a mirror of <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">text</span></code></a>, but a subclass can override <a class="reference internal" href="#hscommon.gui.text_field.TextField._parse" title="hscommon.gui.text_field.TextField._parse"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_parse()</span></code></a> and
<a class="reference internal" href="#hscommon.gui.text_field.TextField._format" title="hscommon.gui.text_field.TextField._format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_format()</span></code></a> to have anything else. Always in sync with <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">text</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.text_field.TextFieldView">
<em class="property">class </em><code class="descclassname">hscommon.gui.text_field.</code><code class="descname">TextFieldView</code><a class="headerlink" href="#hscommon.gui.text_field.TextFieldView" title="Permalink to this definition"></a></dt>
<dd><p>Expected interface for <a class="reference internal" href="#hscommon.gui.text_field.TextField" title="hscommon.gui.text_field.TextField"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextField</span></code></a>s view.</p>
<p><em>Not actually used in the code. For documentation purposes only.</em></p>
<p>Our view is expected to sync with <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">TextField.text</span></code></a> “both ways”, that is, update the
models text when the user types something, but also update the text field when <a class="reference internal" href="#hscommon.gui.text_field.TextFieldView.refresh" title="hscommon.gui.text_field.TextFieldView.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>
is called.</p>
<dl class="method">
<dt id="hscommon.gui.text_field.TextFieldView.refresh">
<code class="descname">refresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.text_field.TextFieldView.refresh" title="Permalink to this definition"></a></dt>
<dd><p>Refreshes the contents of the input widget.</p>
<p>Ensures that the contents of the input widget is actually <a class="reference internal" href="#hscommon.gui.text_field.TextField.text" title="hscommon.gui.text_field.TextField.text"><code class="xref py py-attr docutils literal notranslate"><span class="pre">TextField.text</span></code></a>.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="table.html">hscommon.gui.table</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="tree.html">hscommon.gui.tree</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,260 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.gui.tree &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="Changelog" href="../../../changelog.html" />
<link rel="prev" title="hscommon.gui.text_field" href="text_field.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.gui.tree</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="text_field.html">hscommon.gui.text_field</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="../../../changelog.html">Changelog</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.gui.tree">
<span id="hscommon-gui-tree"></span><h1>hscommon.gui.tree<a class="headerlink" href="#module-hscommon.gui.tree" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.gui.tree.Tree" title="hscommon.gui.tree.Tree"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Tree</span></code></a>()</td>
<td>Cross-toolkit GUI-enabled tree view.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.gui.tree.Node" title="hscommon.gui.tree.Node"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Node</span></code></a>(name)</td>
<td>Pretty bland node implementation to be used in a <a class="reference internal" href="#hscommon.gui.tree.Tree" title="hscommon.gui.tree.Tree"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tree</span></code></a>.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.gui.tree.Tree">
<em class="property">class </em><code class="descclassname">hscommon.gui.tree.</code><code class="descname">Tree</code><a class="headerlink" href="#hscommon.gui.tree.Tree" title="Permalink to this definition"></a></dt>
<dd><p>Cross-toolkit GUI-enabled tree view.</p>
<p>This class is a bit too thin to be used as a tree view controller out of the box and HS apps
that subclasses it each add quite a bit of logic to it to make it workable. Making this more
usable out of the box is a work in progress.</p>
<p>This class is here (in addition to being a <a class="reference internal" href="#hscommon.gui.tree.Node" title="hscommon.gui.tree.Node"><code class="xref py py-class docutils literal notranslate"><span class="pre">Node</span></code></a>) mostly to handle selection.</p>
<p>Subclasses <a class="reference internal" href="#hscommon.gui.tree.Node" title="hscommon.gui.tree.Node"><code class="xref py py-class docutils literal notranslate"><span class="pre">Node</span></code></a> (it is the root node of all its children) and <a class="reference internal" href="base.html#hscommon.gui.base.GUIObject" title="hscommon.gui.base.GUIObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">GUIObject</span></code></a>.</p>
<dl class="method">
<dt id="hscommon.gui.tree.Tree._select_nodes">
<code class="descname">_select_nodes</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Tree._select_nodes" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Customize node selection behavior.</p>
<p>By default, simply set <a class="reference internal" href="#hscommon.gui.tree.Tree._selected_nodes" title="hscommon.gui.tree.Tree._selected_nodes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_selected_nodes</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Tree._view_updated">
<code class="descname">_view_updated</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Tree._view_updated" title="Permalink to this definition"></a></dt>
<dd><p>(Virtual) Called after <code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code> has been set.</p>
<p>Doing nothing by default, this method is called after <code class="xref py py-attr docutils literal notranslate"><span class="pre">view</span></code> has been set (it isnt
called when its unset, however). Use this for initialization code that requires a view
(which is often the whole of the initialization code).</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Tree.clear">
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Tree.clear" title="Permalink to this definition"></a></dt>
<dd><p>Clears the node of all its children.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Tree._selected_nodes">
<code class="descname">_selected_nodes</code><em class="property"> = None</em><a class="headerlink" href="#hscommon.gui.tree.Tree._selected_nodes" title="Permalink to this definition"></a></dt>
<dd><p>Where we store selected nodes (as a list of <a class="reference internal" href="#hscommon.gui.tree.Node" title="hscommon.gui.tree.Node"><code class="xref py py-class docutils literal notranslate"><span class="pre">Node</span></code></a>)</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Tree.selected_node">
<code class="descname">selected_node</code><a class="headerlink" href="#hscommon.gui.tree.Tree.selected_node" title="Permalink to this definition"></a></dt>
<dd><p>Currently selected node.</p>
<p><em>:class:`Node`</em>. <em>get/set</em>.</p>
<p>First of <a class="reference internal" href="#hscommon.gui.tree.Tree.selected_nodes" title="hscommon.gui.tree.Tree.selected_nodes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_nodes</span></code></a>. <code class="docutils literal notranslate"><span class="pre">None</span></code> if empty.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Tree.selected_nodes">
<code class="descname">selected_nodes</code><a class="headerlink" href="#hscommon.gui.tree.Tree.selected_nodes" title="Permalink to this definition"></a></dt>
<dd><p>List of selected nodes in the tree.</p>
<p><em>List of :class:`Node`</em>. <em>get/set</em>.</p>
<p>We use nodes instead of indexes to store selection because its simpler when its time to
manage selection of multiple node levels.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Tree.selected_path">
<code class="descname">selected_path</code><a class="headerlink" href="#hscommon.gui.tree.Tree.selected_path" title="Permalink to this definition"></a></dt>
<dd><p>Currently selected path.</p>
<p><em>:attr:`Node.path`</em>. <em>get/set</em>.</p>
<p>First of <a class="reference internal" href="#hscommon.gui.tree.Tree.selected_paths" title="hscommon.gui.tree.Tree.selected_paths"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_paths</span></code></a>. <code class="docutils literal notranslate"><span class="pre">None</span></code> if empty.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Tree.selected_paths">
<code class="descname">selected_paths</code><a class="headerlink" href="#hscommon.gui.tree.Tree.selected_paths" title="Permalink to this definition"></a></dt>
<dd><p>List of selected paths in the tree.</p>
<p><em>List of :attr:`Node.path`</em>. <em>get/set</em></p>
<p>Computed from <a class="reference internal" href="#hscommon.gui.tree.Tree.selected_nodes" title="hscommon.gui.tree.Tree.selected_nodes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">selected_nodes</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.gui.tree.Node">
<em class="property">class </em><code class="descclassname">hscommon.gui.tree.</code><code class="descname">Node</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node" title="Permalink to this definition"></a></dt>
<dd><p>Pretty bland node implementation to be used in a <a class="reference internal" href="#hscommon.gui.tree.Tree" title="hscommon.gui.tree.Tree"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tree</span></code></a>.</p>
<p>It has a <a class="reference internal" href="#hscommon.gui.tree.Node.parent" title="hscommon.gui.tree.Node.parent"><code class="xref py py-attr docutils literal notranslate"><span class="pre">parent</span></code></a>, behaves like a list, its content being its children. Link integrity
is somewhat enforced (adding a child to a node will set the childs <a class="reference internal" href="#hscommon.gui.tree.Node.parent" title="hscommon.gui.tree.Node.parent"><code class="xref py py-attr docutils literal notranslate"><span class="pre">parent</span></code></a>, but thats
pretty much as far as we go, integrity-wise. Nodes dont tend to move around much in a GUI
tree). We dont even check for infinite node loops. Dont play around these grounds too much.</p>
<p>Nodes are designed to be subclassed and given meaningful attributes (those youll want to
display in your tree view), but they all have a <a class="reference internal" href="#hscommon.gui.tree.Node.name" title="hscommon.gui.tree.Node.name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">name</span></code></a>, which is given on initialization.</p>
<dl class="method">
<dt id="hscommon.gui.tree.Node.append">
<code class="descname">append</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.append" title="Permalink to this definition"></a></dt>
<dd><p>S.append(value) append value to the end of the sequence</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Node.clear">
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.clear" title="Permalink to this definition"></a></dt>
<dd><p>Clears the node of all its children.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Node.find">
<code class="descname">find</code><span class="sig-paren">(</span><em>predicate</em>, <em>include_self=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.find" title="Permalink to this definition"></a></dt>
<dd><p>Return the first child to match <code class="docutils literal notranslate"><span class="pre">predicate</span></code>.</p>
<p>See <a class="reference internal" href="#hscommon.gui.tree.Node.findall" title="hscommon.gui.tree.Node.findall"><code class="xref py py-meth docutils literal notranslate"><span class="pre">findall()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Node.findall">
<code class="descname">findall</code><span class="sig-paren">(</span><em>predicate</em>, <em>include_self=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.findall" title="Permalink to this definition"></a></dt>
<dd><p>Yield all children matching <code class="docutils literal notranslate"><span class="pre">predicate</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>predicate</strong> <code class="docutils literal notranslate"><span class="pre">f(node)</span> <span class="pre">--&gt;</span> <span class="pre">bool</span></code></li>
<li><strong>include_self</strong> Whether we can return <code class="docutils literal notranslate"><span class="pre">self</span></code> or we return only children.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Node.get_node">
<code class="descname">get_node</code><span class="sig-paren">(</span><em>index_path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.get_node" title="Permalink to this definition"></a></dt>
<dd><p>Returns the node at <code class="docutils literal notranslate"><span class="pre">index_path</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index_path</strong> a list of int indexes leading to our node. See <a class="reference internal" href="#hscommon.gui.tree.Node.path" title="hscommon.gui.tree.Node.path"><code class="xref py py-attr docutils literal notranslate"><span class="pre">path</span></code></a>.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Node.get_path">
<code class="descname">get_path</code><span class="sig-paren">(</span><em>target_node</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.get_path" title="Permalink to this definition"></a></dt>
<dd><p>Returns the <a class="reference internal" href="#hscommon.gui.tree.Node.path" title="hscommon.gui.tree.Node.path"><code class="xref py py-attr docutils literal notranslate"><span class="pre">path</span></code></a> of <code class="docutils literal notranslate"><span class="pre">target_node</span></code>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">target_node</span></code> is <code class="docutils literal notranslate"><span class="pre">None</span></code>, returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.gui.tree.Node.insert">
<code class="descname">insert</code><span class="sig-paren">(</span><em>index</em>, <em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.gui.tree.Node.insert" title="Permalink to this definition"></a></dt>
<dd><p>S.insert(index, value) insert value before index</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Node.children_count">
<code class="descname">children_count</code><a class="headerlink" href="#hscommon.gui.tree.Node.children_count" title="Permalink to this definition"></a></dt>
<dd><p>Same as <code class="docutils literal notranslate"><span class="pre">len(self)</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Node.name">
<code class="descname">name</code><a class="headerlink" href="#hscommon.gui.tree.Node.name" title="Permalink to this definition"></a></dt>
<dd><p>Name for the node, supplied on init.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Node.parent">
<code class="descname">parent</code><a class="headerlink" href="#hscommon.gui.tree.Node.parent" title="Permalink to this definition"></a></dt>
<dd><p>Parent of the node.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">None</span></code>, we have a root node.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Node.path">
<code class="descname">path</code><a class="headerlink" href="#hscommon.gui.tree.Node.path" title="Permalink to this definition"></a></dt>
<dd><p>A list of node indexes leading from the root node to <code class="docutils literal notranslate"><span class="pre">self</span></code>.</p>
<p>The path of a node is always related to its <a class="reference internal" href="#hscommon.gui.tree.Node.root" title="hscommon.gui.tree.Node.root"><code class="xref py py-attr docutils literal notranslate"><span class="pre">root</span></code></a>. Its the sequences of index that
we have to take to get to our node, starting from the root. For example, if
<code class="docutils literal notranslate"><span class="pre">node.path</span> <span class="pre">==</span> <span class="pre">[1,</span> <span class="pre">2,</span> <span class="pre">3,</span> <span class="pre">4]</span></code>, it means that <code class="docutils literal notranslate"><span class="pre">node.root[1][2][3][4]</span> <span class="pre">is</span> <span class="pre">node</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.gui.tree.Node.root">
<code class="descname">root</code><a class="headerlink" href="#hscommon.gui.tree.Node.root" title="Permalink to this definition"></a></dt>
<dd><p>Root node of current node.</p>
<p>To get it, we recursively follow our <a class="reference internal" href="#hscommon.gui.tree.Node.parent" title="hscommon.gui.tree.Node.parent"><code class="xref py py-attr docutils literal notranslate"><span class="pre">parent</span></code></a> chain until we have <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="text_field.html">hscommon.gui.text_field</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="../../../changelog.html">Changelog</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,83 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.build" href="build.html" />
<link rel="prev" title="core.gui.deletion_options" href="../core/gui/deletion_options.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="../core/gui/deletion_options.html">core.gui.deletion_options</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="build.html">hscommon.build</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="hscommon">
<h1>hscommon<a class="headerlink" href="#hscommon" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="build.html">hscommon.build</a></li>
<li class="toctree-l1"><a class="reference internal" href="conflict.html">hscommon.conflict</a></li>
<li class="toctree-l1"><a class="reference internal" href="desktop.html">hscommon.desktop</a></li>
<li class="toctree-l1"><a class="reference internal" href="notify.html">hscommon.notify</a></li>
<li class="toctree-l1"><a class="reference internal" href="path.html">hscommon.path</a></li>
<li class="toctree-l1"><a class="reference internal" href="util.html">hscommon.util</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobprogress/job.html">hscommon.jobprogress.job</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobprogress/performer.html">hscommon.jobprogress.performer</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobprogress/qt.html">hscommon.jobprogress.qt</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/base.html">hscommon.gui.base</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/column.html">hscommon.gui.column</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/progress_window.html">hscommon.gui.progress_window</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/selectable_list.html">hscommon.gui.selectable_list</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/table.html">hscommon.gui.table</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/text_field.html">hscommon.gui.text_field</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui/tree.html">hscommon.gui.tree</a></li>
</ul>
</div>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="../core/gui/deletion_options.html">core.gui.deletion_options</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="build.html">hscommon.build</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,147 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.jobprogress.job &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.jobprogress.performer" href="performer.html" />
<link rel="prev" title="hscommon.util" href="../util.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.jobprogress.job</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="../util.html">hscommon.util</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="performer.html">hscommon.jobprogress.performer</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.jobprogress.job">
<span id="hscommon-jobprogress-job"></span><h1>hscommon.jobprogress.job<a class="headerlink" href="#module-hscommon.jobprogress.job" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.jobprogress.job.Job" title="hscommon.jobprogress.job.Job"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Job</span></code></a>(job_proportions,&nbsp;callback)</td>
<td>Manages a jobs progression and return its progression through a callback.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#hscommon.jobprogress.job.NullJob" title="hscommon.jobprogress.job.NullJob"><code class="xref py py-obj docutils literal notranslate"><span class="pre">NullJob</span></code></a>(*args,&nbsp;**kwargs)</td>
<td></td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.jobprogress.job.Job">
<em class="property">class </em><code class="descclassname">hscommon.jobprogress.job.</code><code class="descname">Job</code><span class="sig-paren">(</span><em>job_proportions</em>, <em>callback</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job" title="Permalink to this definition"></a></dt>
<dd><p>Manages a jobs progression and return its progression through a callback.</p>
<p>Note that this class is not foolproof. For example, you could call
start_subjob, and then call add_progress from the parent job, and nothing
would stop you from doing it. However, it would mess your progression
because it is the sub job that is supposed to drive the progression.
Another example would be to start a subjob, then start another, and call
add_progress from the old subjob. Once again, it would mess your progression.
There are no stops because it would remove the lightweight aspect of the
class (A Job would need to have a Parent instead of just a callback,
and the parent could be None. A lot of checks for nothing.).
Another one is that nothing stops you from calling add_progress right after
SkipJob.</p>
<dl class="method">
<dt id="hscommon.jobprogress.job.Job._do_update">
<code class="descname">_do_update</code><span class="sig-paren">(</span><em>desc</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job._do_update" title="Permalink to this definition"></a></dt>
<dd><p>Calls the callback function with a % progress as a parameter.</p>
<p>The parameter is a int in the 0-100 range.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.jobprogress.job.Job._subjob_callback">
<code class="descname">_subjob_callback</code><span class="sig-paren">(</span><em>progress</em>, <em>desc=''</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job._subjob_callback" title="Permalink to this definition"></a></dt>
<dd><p>This is the callback passed to children jobs.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.jobprogress.job.Job.iter_with_progress">
<code class="descname">iter_with_progress</code><span class="sig-paren">(</span><em>iterable</em>, <em>desc_format=None</em>, <em>every=1</em>, <em>count=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job.iter_with_progress" title="Permalink to this definition"></a></dt>
<dd><p>Iterate through <code class="docutils literal notranslate"><span class="pre">iterable</span></code> while automatically adding progress.</p>
<p>WARNING: We need our iterables length. If <code class="docutils literal notranslate"><span class="pre">iterable</span></code> is not a sequence (that is,
something we can call <code class="docutils literal notranslate"><span class="pre">len()</span></code> on), you <em>have</em> to specify a count through the <code class="docutils literal notranslate"><span class="pre">count</span></code>
argument. If <code class="docutils literal notranslate"><span class="pre">count</span></code> is <code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="docutils literal notranslate"><span class="pre">len(iterable)</span></code> is used.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.jobprogress.job.Job.set_progress">
<code class="descname">set_progress</code><span class="sig-paren">(</span><em>progress</em>, <em>desc=''</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job.set_progress" title="Permalink to this definition"></a></dt>
<dd><p>Sets the progress of the current job to progress, and call the
callback</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.jobprogress.job.Job.start_job">
<code class="descname">start_job</code><span class="sig-paren">(</span><em>max_progress=100</em>, <em>desc=''</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job.start_job" title="Permalink to this definition"></a></dt>
<dd><p>Begin work on the next job. You must not call start_job more than
jobcount (in __init__) times.
max is the job units you are to perform.
desc is the description of the job.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.jobprogress.job.Job.start_subjob">
<code class="descname">start_subjob</code><span class="sig-paren">(</span><em>job_proportions</em>, <em>desc=''</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.Job.start_subjob" title="Permalink to this definition"></a></dt>
<dd><p>Starts a sub job. Use this when you want to split a job into
multiple smaller jobs. Pretty handy when starting a process where you
know how many subjobs you will have, but dont know the work unit count
for every of them.
returns the Job object</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.jobprogress.job.NullJob">
<em class="property">class </em><code class="descclassname">hscommon.jobprogress.job.</code><code class="descname">NullJob</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.job.NullJob" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="../util.html">hscommon.util</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="performer.html">hscommon.jobprogress.performer</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,92 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.jobprogress.performer &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.jobprogress.qt" href="qt.html" />
<link rel="prev" title="hscommon.jobprogress.job" href="job.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.jobprogress.performer</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="job.html">hscommon.jobprogress.job</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="qt.html">hscommon.jobprogress.qt</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.jobprogress.performer">
<span id="hscommon-jobprogress-performer"></span><h1>hscommon.jobprogress.performer<a class="headerlink" href="#module-hscommon.jobprogress.performer" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.jobprogress.performer.ThreadedJobPerformer" title="hscommon.jobprogress.performer.ThreadedJobPerformer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ThreadedJobPerformer</span></code></a></td>
<td>Run threaded jobs and track progress.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.jobprogress.performer.ThreadedJobPerformer">
<em class="property">class </em><code class="descclassname">hscommon.jobprogress.performer.</code><code class="descname">ThreadedJobPerformer</code><a class="headerlink" href="#hscommon.jobprogress.performer.ThreadedJobPerformer" title="Permalink to this definition"></a></dt>
<dd><p>Run threaded jobs and track progress.</p>
<p>To run a threaded job, first create a job with _create_job(), then call _run_threaded(), with
your work function as a parameter.</p>
<p>Example:</p>
<p>j = self._create_job()
self._run_threaded(self.some_work_func, (arg1, arg2, j))</p>
<dl class="method">
<dt id="hscommon.jobprogress.performer.ThreadedJobPerformer.reraise_if_error">
<code class="descname">reraise_if_error</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.performer.ThreadedJobPerformer.reraise_if_error" title="Permalink to this definition"></a></dt>
<dd><p>Reraises the error that happened in the thread if any.</p>
<p>Call this after the caller of run_threaded detected that self._job_running returned to False</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="job.html">hscommon.jobprogress.job</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="qt.html">hscommon.jobprogress.qt</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,79 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.jobprogress.qt &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hscommon.gui.base" href="../gui/base.html" />
<link rel="prev" title="hscommon.jobprogress.performer" href="performer.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.jobprogress.qt</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="performer.html">hscommon.jobprogress.performer</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="../gui/base.html">hscommon.gui.base</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.jobprogress.qt">
<span id="hscommon-jobprogress-qt"></span><h1>hscommon.jobprogress.qt<a class="headerlink" href="#module-hscommon.jobprogress.qt" title="Permalink to this headline"></a></h1>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#hscommon.jobprogress.qt.Progress" title="hscommon.jobprogress.qt.Progress"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Progress</span></code></a>(parent)</td>
<td></td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="hscommon.jobprogress.qt.Progress">
<em class="property">class </em><code class="descclassname">hscommon.jobprogress.qt.</code><code class="descname">Progress</code><span class="sig-paren">(</span><em>parent</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.jobprogress.qt.Progress" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="performer.html">hscommon.jobprogress.performer</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="../gui/base.html">hscommon.gui.base</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,113 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.notify &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.path" href="path.html" />
<link rel="prev" title="hscommon.desktop" href="desktop.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.notify</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="desktop.html">hscommon.desktop</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="path.html">hscommon.path</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.notify">
<span id="hscommon-notify"></span><h1>hscommon.notify<a class="headerlink" href="#module-hscommon.notify" title="Permalink to this headline"></a></h1>
<p>Very simple inter-object notification system.</p>
<p>This module is a brain-dead simple notification system involving a <a class="reference internal" href="#hscommon.notify.Broadcaster" title="hscommon.notify.Broadcaster"><code class="xref py py-class docutils literal notranslate"><span class="pre">Broadcaster</span></code></a> and a
<a class="reference internal" href="#hscommon.notify.Listener" title="hscommon.notify.Listener"><code class="xref py py-class docutils literal notranslate"><span class="pre">Listener</span></code></a>. A listener can only listen to one broadcaster. A broadcaster can have multiple
listeners. If the listener is connected, whenever the broadcaster calls <a class="reference internal" href="#hscommon.notify.Broadcaster.notify" title="hscommon.notify.Broadcaster.notify"><code class="xref py py-meth docutils literal notranslate"><span class="pre">notify()</span></code></a>,
the method with the same name as the broadcasted message is called on the listener.</p>
<dl class="class">
<dt id="hscommon.notify.Broadcaster">
<em class="property">class </em><code class="descclassname">hscommon.notify.</code><code class="descname">Broadcaster</code><a class="headerlink" href="#hscommon.notify.Broadcaster" title="Permalink to this definition"></a></dt>
<dd><p>Broadcasts messages that are received by all listeners.</p>
<dl class="method">
<dt id="hscommon.notify.Broadcaster.notify">
<code class="descname">notify</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.notify.Broadcaster.notify" title="Permalink to this definition"></a></dt>
<dd><p>Notify all connected listeners of <code class="docutils literal notranslate"><span class="pre">msg</span></code>.</p>
<p>That means that each listeners will have their method with the same name as <code class="docutils literal notranslate"><span class="pre">msg</span></code> called.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.notify.Listener">
<em class="property">class </em><code class="descclassname">hscommon.notify.</code><code class="descname">Listener</code><span class="sig-paren">(</span><em>broadcaster</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.notify.Listener" title="Permalink to this definition"></a></dt>
<dd><p>A listener is initialized with the broadcaster its going to listen to. Initially, it is not connected.</p>
<dl class="method">
<dt id="hscommon.notify.Listener.bind_messages">
<code class="descname">bind_messages</code><span class="sig-paren">(</span><em>messages</em>, <em>func</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.notify.Listener.bind_messages" title="Permalink to this definition"></a></dt>
<dd><p>Binds multiple message to the same function.</p>
<p>Often, we perform the same thing on multiple messages. Instead of having the same function
repeated again and agin in our class, we can use this method to bind multiple messages to
the same function.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.notify.Listener.connect">
<code class="descname">connect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.notify.Listener.connect" title="Permalink to this definition"></a></dt>
<dd><p>Connects the listener to its broadcaster.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.notify.Listener.disconnect">
<code class="descname">disconnect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.notify.Listener.disconnect" title="Permalink to this definition"></a></dt>
<dd><p>Disconnects the listener from its broadcaster.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="hscommon.notify.Repeater">
<em class="property">class </em><code class="descclassname">hscommon.notify.</code><code class="descname">Repeater</code><span class="sig-paren">(</span><em>broadcaster</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.notify.Repeater" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="desktop.html">hscommon.desktop</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="path.html">hscommon.path</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.path &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.util" href="util.html" />
<link rel="prev" title="hscommon.notify" href="notify.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.path</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="notify.html">hscommon.notify</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="util.html">hscommon.util</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.path">
<span id="hscommon-path"></span><h1>hscommon.path<a class="headerlink" href="#module-hscommon.path" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="hscommon.path.Path">
<em class="property">class </em><code class="descclassname">hscommon.path.</code><code class="descname">Path</code><a class="headerlink" href="#hscommon.path.Path" title="Permalink to this definition"></a></dt>
<dd><p>A handy class to work with paths.</p>
<p>We subclass <code class="docutils literal notranslate"><span class="pre">tuple</span></code>, each element of the tuple represents an element of the path.</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">Path('/foo/bar/baz')[1]</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">'bar'</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">Path('/foo/bar/baz')[1:2]</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">Path('bar/baz')</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">Path('/foo/bar')['baz']</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">Path('/foo/bar/baz')</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">str(Path('/foo/bar/baz'))</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">'/foo/bar/baz'</span></code></li>
</ul>
<dl class="method">
<dt id="hscommon.path.Path.is_parent_of">
<code class="descname">is_parent_of</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.path.Path.is_parent_of" title="Permalink to this definition"></a></dt>
<dd><p>Whether <code class="docutils literal notranslate"><span class="pre">other</span></code> is a subpath of <code class="docutils literal notranslate"><span class="pre">self</span></code>.</p>
<p>Almost the same as <code class="docutils literal notranslate"><span class="pre">other</span> <span class="pre">in</span> <span class="pre">self</span></code>, but its a bit more self-explicative and when
<code class="docutils literal notranslate"><span class="pre">other</span> <span class="pre">==</span> <span class="pre">self</span></code>, returns False.</p>
</dd></dl>
<dl class="method">
<dt id="hscommon.path.Path.parent">
<code class="descname">parent</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.path.Path.parent" title="Permalink to this definition"></a></dt>
<dd><p>Returns the parent path.</p>
<p><code class="docutils literal notranslate"><span class="pre">Path('/foo/bar/baz').parent()</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">Path('/foo/bar')</span></code></p>
</dd></dl>
<dl class="attribute">
<dt id="hscommon.path.Path.name">
<code class="descname">name</code><a class="headerlink" href="#hscommon.path.Path.name" title="Permalink to this definition"></a></dt>
<dd><p>Last element of the path (filename), with extension.</p>
<p><code class="docutils literal notranslate"><span class="pre">Path('/foo/bar/baz').name</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">'baz'</span></code></p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="hscommon.path.log_io_error">
<code class="descclassname">hscommon.path.</code><code class="descname">log_io_error</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.path.log_io_error" title="Permalink to this definition"></a></dt>
<dd><p>Catches OSError, IOError and WindowsError and log them</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.path.pathify">
<code class="descclassname">hscommon.path.</code><code class="descname">pathify</code><span class="sig-paren">(</span><em>f</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.path.pathify" title="Permalink to this definition"></a></dt>
<dd><p>Ensure that every annotated <a class="reference internal" href="#hscommon.path.Path" title="hscommon.path.Path"><code class="xref py py-class docutils literal notranslate"><span class="pre">Path</span></code></a> arguments are actually paths.</p>
<p>When a function is decorated with <code class="docutils literal notranslate"><span class="pre">&#64;pathify</span></code>, every argument with annotated as Path will be
converted to a Path if it wasnt already. Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nd">@pathify</span>
<span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="n">path</span><span class="p">:</span> <span class="n">Path</span><span class="p">,</span> <span class="n">otherarg</span><span class="p">):</span>
<span class="k">return</span> <span class="n">path</span><span class="o">.</span><span class="n">listdir</span><span class="p">()</span>
</pre></div>
</div>
<p>Calling <code class="docutils literal notranslate"><span class="pre">foo('/bar',</span> <span class="pre">0)</span></code> will convert <code class="docutils literal notranslate"><span class="pre">'/bar'</span></code> to <code class="docutils literal notranslate"><span class="pre">Path('/bar')</span></code>.</p>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="notify.html">hscommon.notify</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="util.html">hscommon.util</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>

View File

@@ -0,0 +1,289 @@
<!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" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hscommon.util &#8212; dupeGuru 4.0.3 documentation</title>
<link rel="stylesheet" href="../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/translations.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hscommon.jobprogress.job" href="jobprogress/job.html" />
<link rel="prev" title="hscommon.path" href="path.html" />
</head><body>
<div class="header" role="banner"><h1 class="heading"><a href="../../index.html">
<span>dupeGuru 4.0.3 documentation</span></a></h1>
<h2 class="heading"><span>hscommon.util</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«&#160;&#160;<a href="path.html">hscommon.path</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="jobprogress/job.html">hscommon.jobprogress.job</a>&#160;&#160;»
</p>
</div>
<div class="content">
<div class="section" id="module-hscommon.util">
<span id="hscommon-util"></span><h1>hscommon.util<a class="headerlink" href="#module-hscommon.util" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="hscommon.util.FileOrPath">
<em class="property">class </em><code class="descclassname">hscommon.util.</code><code class="descname">FileOrPath</code><span class="sig-paren">(</span><em>file_or_path</em>, <em>mode='rb'</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.FileOrPath" title="Permalink to this definition"></a></dt>
<dd><p>Does the same as <a class="reference internal" href="#hscommon.util.open_if_filename" title="hscommon.util.open_if_filename"><code class="xref py py-func docutils literal notranslate"><span class="pre">open_if_filename()</span></code></a>, but it can be used with a <code class="docutils literal notranslate"><span class="pre">with</span></code> statement.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">FileOrPath</span><span class="p">(</span><span class="n">infile</span><span class="p">):</span>
<span class="n">dostuff</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.RE_INVALID_XML_SUB">
<code class="descclassname">hscommon.util.</code><code class="descname">RE_INVALID_XML_SUB</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.RE_INVALID_XML_SUB" title="Permalink to this definition"></a></dt>
<dd><p>Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.allsame">
<code class="descclassname">hscommon.util.</code><code class="descname">allsame</code><span class="sig-paren">(</span><em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.allsame" title="Permalink to this definition"></a></dt>
<dd><p>Returns whether all elements of iterable are the same.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.dedupe">
<code class="descclassname">hscommon.util.</code><code class="descname">dedupe</code><span class="sig-paren">(</span><em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.dedupe" title="Permalink to this definition"></a></dt>
<dd><p>Returns a list of elements in <code class="docutils literal notranslate"><span class="pre">iterable</span></code> with all dupes removed.</p>
<p>The order of the elements is preserved.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.delete_files_with_pattern">
<code class="descclassname">hscommon.util.</code><code class="descname">delete_files_with_pattern</code><span class="sig-paren">(</span><em>folder_path</em>, <em>pattern</em>, <em>recursive=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.delete_files_with_pattern" title="Permalink to this definition"></a></dt>
<dd><p>Delete all files (or folders) in <cite>folder_path</cite> that match the glob <cite>pattern</cite>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.delete_if_empty">
<code class="descclassname">hscommon.util.</code><code class="descname">delete_if_empty</code><span class="sig-paren">(</span><em>path: hscommon.path.Path</em>, <em>files_to_delete=[]</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.delete_if_empty" title="Permalink to this definition"></a></dt>
<dd><p>Deletes the directory at path if it is empty or if it only contains files_to_delete.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.ensure_file">
<code class="descclassname">hscommon.util.</code><code class="descname">ensure_file</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.ensure_file" title="Permalink to this definition"></a></dt>
<dd><p>Create <cite>path</cite> as an empty file if it doesnt exist.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.ensure_folder">
<code class="descclassname">hscommon.util.</code><code class="descname">ensure_folder</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.ensure_folder" title="Permalink to this definition"></a></dt>
<dd><p>Create <cite>path</cite> as a folder if it doesnt exist.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.escape">
<code class="descclassname">hscommon.util.</code><code class="descname">escape</code><span class="sig-paren">(</span><em>s</em>, <em>to_escape</em>, <em>escape_with='\\'</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.escape" title="Permalink to this definition"></a></dt>
<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">s</span></code> with characters in <code class="docutils literal notranslate"><span class="pre">to_escape</span></code> all prepended with <code class="docutils literal notranslate"><span class="pre">escape_with</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.extract">
<code class="descclassname">hscommon.util.</code><code class="descname">extract</code><span class="sig-paren">(</span><em>predicate</em>, <em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.extract" title="Permalink to this definition"></a></dt>
<dd><p>Separates the wheat from the shaft (<cite>predicate</cite> defines whats the wheat), and returns both.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.find_in_path">
<code class="descclassname">hscommon.util.</code><code class="descname">find_in_path</code><span class="sig-paren">(</span><em>name</em>, <em>paths=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.find_in_path" title="Permalink to this definition"></a></dt>
<dd><p>Search for <cite>name</cite> in all directories of <cite>paths</cite> and return the absolute path of the first
occurrence. If <cite>paths</cite> is None, $PATH is used.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.first">
<code class="descclassname">hscommon.util.</code><code class="descname">first</code><span class="sig-paren">(</span><em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.first" title="Permalink to this definition"></a></dt>
<dd><p>Returns the first item of <code class="docutils literal notranslate"><span class="pre">iterable</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.flatten">
<code class="descclassname">hscommon.util.</code><code class="descname">flatten</code><span class="sig-paren">(</span><em>iterables</em>, <em>start_with=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.flatten" title="Permalink to this definition"></a></dt>
<dd><p>Takes a list of lists <code class="docutils literal notranslate"><span class="pre">iterables</span></code> and returns a list containing elements of every list.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">start_with</span></code> is not <code class="docutils literal notranslate"><span class="pre">None</span></code>, the result will start with <code class="docutils literal notranslate"><span class="pre">start_with</span></code> items, exactly as
if <code class="docutils literal notranslate"><span class="pre">start_with</span></code> would be the first item of lists.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.format_size">
<code class="descclassname">hscommon.util.</code><code class="descname">format_size</code><span class="sig-paren">(</span><em>size</em>, <em>decimal=0</em>, <em>forcepower=-1</em>, <em>showdesc=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.format_size" title="Permalink to this definition"></a></dt>
<dd><p>Transform a byte count in a formatted string (KB, MB etc..).</p>
<p><code class="docutils literal notranslate"><span class="pre">size</span></code> is the number of bytes to format.
<code class="docutils literal notranslate"><span class="pre">decimal</span></code> is the number digits after the dot.
<code class="docutils literal notranslate"><span class="pre">forcepower</span></code> is the desired suffix. 0 is B, 1 is KB, 2 is MB etc.. if kept at -1, the suffix
will be automatically chosen (so the resulting number is always below 1024).
if <code class="docutils literal notranslate"><span class="pre">showdesc</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the suffix will be shown after the number.
Usage example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">format_size</span><span class="p">(</span><span class="mi">1234</span><span class="p">,</span> <span class="n">decimal</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">showdesc</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="go">&#39;1.21 KB&#39;</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.format_time">
<code class="descclassname">hscommon.util.</code><code class="descname">format_time</code><span class="sig-paren">(</span><em>seconds</em>, <em>with_hours=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.format_time" title="Permalink to this definition"></a></dt>
<dd><p>Transforms seconds in a hh:mm:ss string.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">with_hours</span></code> if false, the format is mm:ss.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.format_time_decimal">
<code class="descclassname">hscommon.util.</code><code class="descname">format_time_decimal</code><span class="sig-paren">(</span><em>seconds</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.format_time_decimal" title="Permalink to this definition"></a></dt>
<dd><p>Transforms seconds in a strings like 3.4 minutes.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.get_file_ext">
<code class="descclassname">hscommon.util.</code><code class="descname">get_file_ext</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.get_file_ext" title="Permalink to this definition"></a></dt>
<dd><p>Returns the lowercase extension part of filename, without the dot.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.iterconsume">
<code class="descclassname">hscommon.util.</code><code class="descname">iterconsume</code><span class="sig-paren">(</span><em>seq</em>, <em>reverse=True</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.iterconsume" title="Permalink to this definition"></a></dt>
<dd><p>Iterate over <code class="docutils literal notranslate"><span class="pre">seq</span></code> and pops yielded objects.</p>
<p>Because we use the <code class="docutils literal notranslate"><span class="pre">pop()</span></code> method, we reverse <code class="docutils literal notranslate"><span class="pre">seq</span></code> before proceeding. If you dont need
to do that, set <code class="docutils literal notranslate"><span class="pre">reverse</span></code> to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
<p>This is useful in tight memory situation where you are looping over a sequence of objects that
are going to be discarded afterwards. If youre creating other objects during that iteration
you might want to use this to avoid <code class="docutils literal notranslate"><span class="pre">MemoryError</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.iterdaterange">
<code class="descclassname">hscommon.util.</code><code class="descname">iterdaterange</code><span class="sig-paren">(</span><em>start</em>, <em>end</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.iterdaterange" title="Permalink to this definition"></a></dt>
<dd><p>Yields every day between <code class="docutils literal notranslate"><span class="pre">start</span></code> and <code class="docutils literal notranslate"><span class="pre">end</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.minmax">
<code class="descclassname">hscommon.util.</code><code class="descname">minmax</code><span class="sig-paren">(</span><em>value</em>, <em>min_value</em>, <em>max_value</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.minmax" title="Permalink to this definition"></a></dt>
<dd><p>Returns <cite>value</cite> or one of the min/max bounds if <cite>value</cite> is not between them.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.modified_after">
<code class="descclassname">hscommon.util.</code><code class="descname">modified_after</code><span class="sig-paren">(</span><em>first_path: hscommon.path.Path</em>, <em>second_path: hscommon.path.Path</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.modified_after" title="Permalink to this definition"></a></dt>
<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">True</span></code> if first_paths mtime is higher than second_paths mtime.</p>
<p>If one of the files doesnt exist or is <code class="docutils literal notranslate"><span class="pre">None</span></code>, it is considered “never modified”.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.multi_replace">
<code class="descclassname">hscommon.util.</code><code class="descname">multi_replace</code><span class="sig-paren">(</span><em>s</em>, <em>replace_from</em>, <em>replace_to=''</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.multi_replace" title="Permalink to this definition"></a></dt>
<dd><p>A function like str.replace() with multiple replacements.</p>
<p><code class="docutils literal notranslate"><span class="pre">replace_from</span></code> is a list of things you want to replace. Ex: [a,bc,d]
<code class="docutils literal notranslate"><span class="pre">replace_to</span></code> is a list of what you want to replace to.
If <code class="docutils literal notranslate"><span class="pre">replace_to</span></code> is a list and has the same length as <code class="docutils literal notranslate"><span class="pre">replace_from</span></code>, <code class="docutils literal notranslate"><span class="pre">replace_from</span></code>
items will be translated to corresponding <code class="docutils literal notranslate"><span class="pre">replace_to</span></code>. A <code class="docutils literal notranslate"><span class="pre">replace_to</span></code> list must
have the same length as <code class="docutils literal notranslate"><span class="pre">replace_from</span></code>
If <code class="docutils literal notranslate"><span class="pre">replace_to</span></code> is a string, all <code class="docutils literal notranslate"><span class="pre">replace_from</span></code> occurence will be replaced
by that string.
<code class="docutils literal notranslate"><span class="pre">replace_from</span></code> can also be a str. If it is, every char in it will be translated
as if <code class="docutils literal notranslate"><span class="pre">replace_from</span></code> would be a list of chars. If <code class="docutils literal notranslate"><span class="pre">replace_to</span></code> is a str and has
the same length as <code class="docutils literal notranslate"><span class="pre">replace_from</span></code>, it will be transformed into a list.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.nonone">
<code class="descclassname">hscommon.util.</code><code class="descname">nonone</code><span class="sig-paren">(</span><em>value</em>, <em>replace_value</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.nonone" title="Permalink to this definition"></a></dt>
<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">value</span></code> if <code class="docutils literal notranslate"><span class="pre">value</span></code> is not <code class="docutils literal notranslate"><span class="pre">None</span></code>. Returns <code class="docutils literal notranslate"><span class="pre">replace_value</span></code> otherwise.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.open_if_filename">
<code class="descclassname">hscommon.util.</code><code class="descname">open_if_filename</code><span class="sig-paren">(</span><em>infile</em>, <em>mode='rb'</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.open_if_filename" title="Permalink to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">infile</span></code> is a string, it opens and returns it. If its already a file object, it simply returns it.</p>
<p>This function returns <code class="docutils literal notranslate"><span class="pre">(file,</span> <span class="pre">should_close_flag)</span></code>. The should_close_flag is True is a file has
effectively been opened (if we already pass a file object, we assume that the responsibility for
closing the file has already been taken). Example usage:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">fp</span><span class="p">,</span> <span class="n">shouldclose</span> <span class="o">=</span> <span class="n">open_if_filename</span><span class="p">(</span><span class="n">infile</span><span class="p">)</span>
<span class="n">dostuff</span><span class="p">()</span>
<span class="k">if</span> <span class="n">shouldclose</span><span class="p">:</span>
<span class="n">fp</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.pluralize">
<code class="descclassname">hscommon.util.</code><code class="descname">pluralize</code><span class="sig-paren">(</span><em>number</em>, <em>word</em>, <em>decimals=0</em>, <em>plural_word=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.pluralize" title="Permalink to this definition"></a></dt>
<dd><p>Returns a pluralized string with <code class="docutils literal notranslate"><span class="pre">number</span></code> in front of <code class="docutils literal notranslate"><span class="pre">word</span></code>.</p>
<p>Adds a s to s if <code class="docutils literal notranslate"><span class="pre">number</span></code> &gt; 1.
<code class="docutils literal notranslate"><span class="pre">number</span></code>: The number to go in front of s
<code class="docutils literal notranslate"><span class="pre">word</span></code>: The word to go after number
<code class="docutils literal notranslate"><span class="pre">decimals</span></code>: The number of digits after the dot
<code class="docutils literal notranslate"><span class="pre">plural_word</span></code>: If the plural rule for word is more complex than adding a s, specify a plural</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.rem_file_ext">
<code class="descclassname">hscommon.util.</code><code class="descname">rem_file_ext</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.rem_file_ext" title="Permalink to this definition"></a></dt>
<dd><p>Returns the filename without extension.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.stripfalse">
<code class="descclassname">hscommon.util.</code><code class="descname">stripfalse</code><span class="sig-paren">(</span><em>seq</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.stripfalse" title="Permalink to this definition"></a></dt>
<dd><p>Returns a sequence with all false elements stripped out of seq.</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.trailiter">
<code class="descclassname">hscommon.util.</code><code class="descname">trailiter</code><span class="sig-paren">(</span><em>iterable</em>, <em>skipfirst=False</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.trailiter" title="Permalink to this definition"></a></dt>
<dd><p>Yields (prev_element, element), starting with (None, first_element).</p>
<p>If skipfirst is True, there will be no (None, item1) element and well start
directly with (item1, item2).</p>
</dd></dl>
<dl class="function">
<dt id="hscommon.util.tryint">
<code class="descclassname">hscommon.util.</code><code class="descname">tryint</code><span class="sig-paren">(</span><em>value</em>, <em>default=0</em><span class="sig-paren">)</span><a class="headerlink" href="#hscommon.util.tryint" title="Permalink to this definition"></a></dt>
<dd><p>Tries to convert <code class="docutils literal notranslate"><span class="pre">value</span></code> to in <code class="docutils literal notranslate"><span class="pre">int</span></code> and returns <code class="docutils literal notranslate"><span class="pre">default</span></code> if it fails.</p>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«&#160;&#160;<a href="path.html">hscommon.path</a>
&#160;&#160;::&#160;&#160;
<a class="uplink" href="../../index.html">Contents</a>
&#160;&#160;::&#160;&#160;
<a href="jobprogress/job.html">hscommon.jobprogress.job</a>&#160;&#160;»
</p>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2016, Hardcoded Software.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1.
</div>
</body>
</html>