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,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>