Skip to content

Commit

Permalink
Deployed 4d5e117 with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Oct 24, 2024
1 parent 5108953 commit 7c8e4b7
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Facet/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ <h2 id="mininterface.facet.Facet.set_title" class="doc doc-heading">


<h2 id="mininterface.facet.Facet.submit" class="doc doc-heading">
<code class="highlight language-python"><span class="n">submit</span><span class="p">()</span></code>
<code class="highlight language-python"><span class="n">submit</span><span class="p">(</span><span class="n">_post_submit</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span></code>

</h2>

Expand Down
48 changes: 40 additions & 8 deletions Mininterface/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,17 @@ <h2 id="mininterface.Mininterface.choice" class="doc doc-heading">
<a id="__codelineno-3-6" name="__codelineno-3-6" href="#__codelineno-3-6"></a><span class="n">m</span><span class="o">.</span><span class="n">choice</span><span class="p">(</span><span class="n">Color</span><span class="p">)</span>
</code></pre></div>
<p><img alt="Choices from enum" src="../asset/choice_enum_type.avif" /></p>
<p>TODO Enum instance</p>
<p>Alternatively, you may use an Enum instance.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="k">class</span> <span class="nc">Color</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span>
<a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a> <span class="n">RED</span> <span class="o">=</span> <span class="s2">&quot;red&quot;</span>
<a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a> <span class="n">GREEN</span> <span class="o">=</span> <span class="s2">&quot;green&quot;</span>
<a id="__codelineno-4-4" name="__codelineno-4-4" href="#__codelineno-4-4"></a> <span class="n">BLUE</span> <span class="o">=</span> <span class="s2">&quot;blue&quot;</span>
<a id="__codelineno-4-5" name="__codelineno-4-5" href="#__codelineno-4-5"></a>
<a id="__codelineno-4-6" name="__codelineno-4-6" href="#__codelineno-4-6"></a><span class="n">m</span><span class="o">.</span><span class="n">choice</span><span class="p">(</span><span class="n">Color</span><span class="o">.</span><span class="n">BLUE</span><span class="p">)</span>
</code></pre></div>
<p><img alt="Choices from enum" src="../asset/choice_enum_instance.avif" /></p>
<p>Alternatively, you may use an Enum instances list.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="n">m</span><span class="o">.</span><span class="n">choice</span><span class="p">([</span><span class="n">Color</span><span class="o">.</span><span class="n">GREEN</span><span class="p">,</span> <span class="n">Color</span><span class="o">.</span><span class="n">BLUE</span><span class="p">])</span>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="n">m</span><span class="o">.</span><span class="n">choice</span><span class="p">([</span><span class="n">Color</span><span class="o">.</span><span class="n">GREEN</span><span class="p">,</span> <span class="n">Color</span><span class="o">.</span><span class="n">BLUE</span><span class="p">])</span>
</code></pre></div>
<p><img alt="Choices from enum list" src="../asset/choice_enum_list.avif" /></p>
</div>
Expand Down Expand Up @@ -1090,6 +1098,10 @@ <h2 id="mininterface.Mininterface.choice" class="doc doc-heading">
</tr>
</tbody>
</table>
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>To tackle a more detailed form, see <a class="autorefs autorefs-internal" href="../Tag/#mininterface.Tag.choices"><code>Tag.choices</code></a>.</p>
</div>

</div>

Expand All @@ -1099,7 +1111,7 @@ <h2 id="mininterface.Mininterface.choice" class="doc doc-heading">


<h2 id="mininterface.Mininterface.form" class="doc doc-heading">
<code class="highlight language-python"><span class="n">form</span><span class="p">(</span><span class="n">form</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">)</span></code>
<code class="highlight language-python"><span class="n">form</span><span class="p">(</span><span class="n">form</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">submit</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></code>

</h2>

Expand Down Expand Up @@ -1148,12 +1160,18 @@ <h2 id="mininterface.Mininterface.form" class="doc doc-heading">
</td>
<td>
<div class="doc-md-description">
<p>Dict of <code>{labels: value}</code>. The form widget infers from the default value type.
<p>We accept a dataclass type, a dataclass instance, a dict or None.</p>
<ul>
<li>If dict, we expect a dict of <code>{labels: value}</code>.
The form widget infers from the default value type.
The dict can be nested, it can contain a subgroup.
The value might be a <a class="autorefs autorefs-internal" href="../Tag/#mininterface.Tag"><code>Tag</code></a> that allows you to add descriptions.
If None, the <code>self.env</code> is being used as a form, allowing the user to edit whole configuration.
(Previously fetched from CLI and config file.)
A checkbox example: <code>{"my label": Tag(True, "my description")}</code></p>
The value might be a <a class="autorefs autorefs-internal" href="../Tag/#mininterface.Tag"><code>Tag</code></a> that allows you to add descriptions.</li>
</ul>
<p>A checkbox example: <code>{"my label": Tag(True, "my description")}</code></p>
<ul>
<li>If None, the <code>self.env</code> is being used as a form, allowing the user to edit whole configuration.
(Previously fetched from CLI and config file.)</li>
</ul>
</div>
</td>
<td>
Expand All @@ -1174,6 +1192,20 @@ <h2 id="mininterface.Mininterface.form" class="doc doc-heading">
<code>&#39;&#39;</code>
</td>
</tr>
<tr class="doc-section-item">
<td><code>submit</code></td>
<td>
<code>str | bool</code>
</td>
<td>
<div class="doc-md-description">
<p>Set the submit button text (by default 'Ok') or hide it with False.</p>
</div>
</td>
<td>
<code>True</code>
</td>
</tr>
</tbody>
</table>

Expand Down
29 changes: 20 additions & 9 deletions Tag/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ <h2 id="mininterface.Tag.val" class="doc doc-heading">

<div class="doc doc-contents ">

<p>The value wrapped by Tag.</p>
<p>The value wrapped by Tag. It can be any value.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="kn">from</span> <span class="nn">mininterface</span> <span class="kn">import</span> <span class="n">run</span><span class="p">,</span> <span class="n">Tag</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="n">tag</span> <span class="o">=</span> <span class="n">Tag</span><span class="p">(</span><span class="kc">True</span><span class="p">,</span> <span class="s2">&quot;This is my boolean&quot;</span><span class="p">,</span> <span class="nb">bool</span><span class="p">)</span>
Expand All @@ -889,6 +889,13 @@ <h2 id="mininterface.Tag.val" class="doc doc-heading">
<p><img alt="Image title" src="../asset/tag_val.avif" /></p>
<p>The encapsulated value is <code>True</code>, <code>tag.description</code> is 'This is my boolean',
<code>tag.annotation</code> is <code>bool</code> and 'My boolean' is used as <code>tag.name</code>.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>If the Tag is nested, the info is fetched to the outer Tag.
When updated, the inner Tag value updates accordingly.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="n">tag</span> <span class="o">=</span> <span class="n">Tag</span><span class="p">(</span><span class="n">Tag</span><span class="p">(</span><span class="kc">True</span><span class="p">))</span>
</code></pre></div>
</div>
</div>

</div>
Expand Down Expand Up @@ -997,20 +1004,24 @@ <h2 id="mininterface.Tag.choices" class="doc doc-heading">

<div class="doc doc-contents ">

<p>Print the radio buttons. Constraint the value.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span>
<p>Print the radio buttons / select box. Constraint the value.</p>
<p><div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Annotated</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="kn">from</span> <span class="nn">mininterface</span> <span class="kn">import</span> <span class="n">run</span><span class="p">,</span> <span class="n">Choices</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="nd">@dataclass</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="k">class</span> <span class="nc">Env</span><span class="p">:</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">foo</span><span class="p">:</span> <span class="n">Annotated</span><span class="p">[</span><span class="s2">&quot;str&quot;</span><span class="p">,</span> <span class="n">Choices</span><span class="p">(</span><span class="s2">&quot;one&quot;</span><span class="p">,</span> <span class="s2">&quot;two&quot;</span><span class="p">)]</span> <span class="o">=</span> <span class="s2">&quot;one&quot;</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="c1"># `Choices` is an alias for `Tag(choices=)`</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="n">m</span> <span class="o">=</span> <span class="n">run</span><span class="p">(</span><span class="n">Env</span><span class="p">)</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="n">m</span><span class="o">.</span><span class="n">form</span><span class="p">()</span> <span class="c1"># prompts a dialog</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="c1"># `Choices` is an alias for `Tag(choices=)`</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="n">m</span> <span class="o">=</span> <span class="n">run</span><span class="p">(</span><span class="n">Env</span><span class="p">)</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="n">m</span><span class="o">.</span><span class="n">form</span><span class="p">()</span> <span class="c1"># prompts a dialog</span>
</code></pre></div>
<img alt="Form choice" src="../asset/tag_choices.avif" /></p>
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>When dealing with a simple use case, use the <a class="autorefs autorefs-internal" href="../Mininterface/#mininterface.Mininterface.choice">mininterface.choice</a> dialog.</p>
</div>
</div>

</div>
Expand Down Expand Up @@ -1284,7 +1295,7 @@ <h2 id="mininterface.tag.ChoicesType" class="doc doc-heading">
<p>You can denote the choices in many ways.
Either put options in an iterable or to a dict <code>{labels: value}</code>.
Values might be Tags as well.</p>
<p>See <a class="autorefs autorefs-internal" href="../Mininterface/#mininterface.Mininterface.choice">mininterface.choice</a> for examples.</p>
<p>See <a class="autorefs autorefs-internal" href="../Mininterface/#mininterface.Mininterface.choice">mininterface.choice</a> or <a class="autorefs autorefs-internal" href="#mininterface.Tag.choices"><code>Tag.choices</code></a> for examples.</p>
</div>

</div>
Expand Down
4 changes: 4 additions & 0 deletions Types/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,10 @@ <h2 id="mininterface.types.CallbackTag" class="doc doc-heading">


<p>Callback function is guaranteed to receives the <a class="autorefs autorefs-internal" href="../Tag/#mininterface.Tag">Tag</a> as a parameter.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Experimental. May change.</p>
</div>
<p>For the following examples, we will use these custom callback functions:
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="kn">from</span> <span class="nn">mininterface</span> <span class="kn">import</span> <span class="n">run</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>
Expand Down
Binary file added asset/choice_enum_instance.avif
Binary file not shown.
Binary file added asset/complex_example.avif
Binary file not shown.
Binary file added asset/complex_example_missing_field.avif
Binary file not shown.
Binary file modified asset/list_of_paths.avif
Binary file not shown.
Binary file added asset/tag_choices.avif
Binary file not shown.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ <h2 id="a-complex-dataclass">A complex dataclass.</h2>
<a id="__codelineno-5-13" name="__codelineno-5-13" href="#__codelineno-5-13"></a> <span class="n">nested_config</span><span class="p">:</span> <span class="n">NestedEnv</span>
<a id="__codelineno-5-14" name="__codelineno-5-14" href="#__codelineno-5-14"></a>
<a id="__codelineno-5-15" name="__codelineno-5-15" href="#__codelineno-5-15"></a> <span class="n">mandatory_str</span><span class="p">:</span> <span class="nb">str</span>
<a id="__codelineno-5-16" name="__codelineno-5-16" href="#__codelineno-5-16"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot; As there is not default value, you will be prompted automatically to fill up the field &quot;&quot;&quot;</span>
<a id="__codelineno-5-16" name="__codelineno-5-16" href="#__codelineno-5-16"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot; As there is no default value, you will be prompted automatically to fill up the field &quot;&quot;&quot;</span>
<a id="__codelineno-5-17" name="__codelineno-5-17" href="#__codelineno-5-17"></a>
<a id="__codelineno-5-18" name="__codelineno-5-18" href="#__codelineno-5-18"></a> <span class="n">my_number</span><span class="p">:</span> <span class="nb">int</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<a id="__codelineno-5-19" name="__codelineno-5-19" href="#__codelineno-5-19"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot; This is not just a dummy number, if left empty, it is None. &quot;&quot;&quot;</span>
Expand All @@ -590,6 +590,10 @@ <h2 id="a-complex-dataclass">A complex dataclass.</h2>
<a id="__codelineno-5-36" name="__codelineno-5-36" href="#__codelineno-5-36"></a><span class="c1"># Edit values in a dialog</span>
<a id="__codelineno-5-37" name="__codelineno-5-37" href="#__codelineno-5-37"></a><span class="n">m</span><span class="o">.</span><span class="n">form</span><span class="p">()</span>
</code></pre></div>
<p>As there is no default value at <code>mandatory_str</code>, you will be prompted automatically to fill up the field:</p>
<p><img alt="Complex example missing field" src="asset/complex_example_missing_field.avif" /></p>
<p>Then, full form appears:</p>
<p><img alt="Complex example" src="asset/complex_example.avif" /></p>
<h2 id="form-with-paths">Form with paths</h2>
<p>We have a dict with some paths. Here is how it looks.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="kn">from</span> <span class="nn">pathlib</span> <span class="kn">import</span> <span class="n">Path</span>
Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit 7c8e4b7

Please sign in to comment.