Skip to content

Commit

Permalink
Deployed 89f4e02 with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Nov 27, 2024
1 parent ccdfb20 commit 53a4240
Show file tree
Hide file tree
Showing 13 changed files with 405 additions and 67 deletions.
35 changes: 30 additions & 5 deletions Changelog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,18 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>

<li class="md-nav__item">
<a href="#070" class="md-nav__link">
<a href="#071-2024-11-27" class="md-nav__link">
<span class="md-ellipsis">
0.7.0
0.7.1 (2024-11-27)
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#070-2024-11-08" class="md-nav__link">
<span class="md-ellipsis">
0.7.0 (2024-11-08)
</span>
</a>

Expand Down Expand Up @@ -684,9 +693,18 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>

<li class="md-nav__item">
<a href="#070" class="md-nav__link">
<a href="#071-2024-11-27" class="md-nav__link">
<span class="md-ellipsis">
0.7.1 (2024-11-27)
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#070-2024-11-08" class="md-nav__link">
<span class="md-ellipsis">
0.7.0
0.7.0 (2024-11-08)
</span>
</a>

Expand All @@ -711,7 +729,14 @@


<h1 id="changelog">Changelog</h1>
<h2 id="070">0.7.0</h2>
<h2 id="071-2024-11-27">0.7.1 (2024-11-27)</h2>
<ul>
<li>GUI scrollbars if window is bigger than the screen</li>
<li><a class="autorefs autorefs-internal" href="../Mininterface/#mininterface.Mininterface.__enter__">non-interactive</a> session support</li>
<li><a href="Types/#mininterface.types.DatetimeTag">datetime</a> support</li>
<li>nested generics support (a tuple in a list)</li>
</ul>
<h2 id="070-2024-11-08">0.7.0 (2024-11-08)</h2>
<ul>
<li>hidden <a href="../Overview/#bash-completion"><code>--integrate-to-system</code></a> argument</li>
<li>interfaces migrated to <a href="../Interfaces/"><code>mininterface.interfaces</code></a> to save around 50 ms starting time due to lazy loading</li>
Expand Down
1 change: 1 addition & 0 deletions Interfaces/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ <h2 id="textualinterface"><code>TextualInterface</code></h2>
<p>If <a href="https://github.com/Textualize/textual">textual</a> installed, rich and mouse clickable interface is used.</p>
<h2 id="textinterface"><code>TextInterface</code></h2>
<p>Plain text only interface with no dependency as a fallback.</p>
<p>When used in a with statement, the non-interactive session becomes interactive if possible, see the Mininterface <a class="autorefs autorefs-internal" href="../Mininterface/#mininterface.Mininterface.__enter__">enter</a> method.</p>
<h1 id="replinterface"><code>ReplInterface</code></h1>
<p>A debug terminal. Invokes a breakpoint after every dialog.</p>

Expand Down
111 changes: 109 additions & 2 deletions Mininterface/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,39 @@
</span>
</a>

<nav class="md-nav" aria-label="__enter__">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#mininterface.Mininterface.__enter__--continual-window" class="md-nav__link">
<span class="md-ellipsis">
Continual window
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#mininterface.Mininterface.__enter__--stdout-redirection" class="md-nav__link">
<span class="md-ellipsis">
Stdout redirection
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#mininterface.Mininterface.__enter__--make-the-session-interactive" class="md-nav__link">
<span class="md-ellipsis">
Make the session interactive
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -809,6 +842,39 @@
</span>
</a>

<nav class="md-nav" aria-label="__enter__">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#mininterface.Mininterface.__enter__--continual-window" class="md-nav__link">
<span class="md-ellipsis">
Continual window
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#mininterface.Mininterface.__enter__--stdout-redirection" class="md-nav__link">
<span class="md-ellipsis">
Stdout redirection
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#mininterface.Mininterface.__enter__--make-the-session-interactive" class="md-nav__link">
<span class="md-ellipsis">
Make the session interactive
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -996,8 +1062,49 @@ <h2 id="mininterface.Mininterface.__enter__" class="doc doc-heading">

<div class="doc doc-contents ">

<p>When used in the with statement, the GUI window does not vanish between dialogs
and it redirects the stdout to a text area.</p>
<p>Usage within the with statement makes the program to attempt for the following benefits:</p>
<h3 id="mininterface.Mininterface.__enter__--continual-window">Continual window</h3>
<p>Do not vanish between dialogs (the GUI window stays the same)</p>
<h3 id="mininterface.Mininterface.__enter__--stdout-redirection">Stdout redirection</h3>
<p>Redirects the stdout to a text area instead of a terminal.</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>
<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="k">with</span> <span class="n">run</span><span class="p">()</span> <span class="k">as</span> <span class="n">m</span><span class="p">:</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;This is a printed text&quot;</span><span class="p">)</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">m</span><span class="o">.</span><span class="n">alert</span><span class="p">(</span><span class="s2">&quot;Alert text&quot;</span><span class="p">)</span>
</code></pre></div>
<p><img alt="With statement print redirect" src="../asset/with-print-redirect.avif" /></p>
<h3 id="mininterface.Mininterface.__enter__--make-the-session-interactive">Make the session interactive</h3>
<p>If run from an interactive terminal or if a GUI is used, nothing special happens.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="c1"># $ ./program.py</span>
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="k">with</span> <span class="n">run</span><span class="p">()</span> <span class="k">as</span> <span class="n">m</span><span class="p">:</span>
<a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a> <span class="n">m</span><span class="o">.</span><span class="n">ask_number</span><span class="p">(</span><span class="s2">&quot;What number&quot;</span><span class="p">)</span>
</code></pre></div>
<p><img alt="Asking number" src="../asset/ask-number.avif" /></p>
<p>However, when run in a non-interactive session with TUI (ex. no display), <a href="../Interfaces/#TextInterface">TextInterface</a>
is used which is able to turn it into an interactive one.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="n">piped_in</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a>
<a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="k">with</span> <span class="n">run</span><span class="p">(</span><span class="n">interface</span><span class="o">=</span><span class="s2">&quot;tui&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">m</span><span class="p">:</span>
<a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a> <span class="n">result</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">ask_number</span><span class="p">(</span><span class="s2">&quot;What number&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">piped_in</span>
<a id="__codelineno-2-5" name="__codelineno-2-5" href="#__codelineno-2-5"></a><span class="nb">print</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>$<span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="m">2</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>./program.py
<a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a>What<span class="w"> </span>number:<span class="w"> </span><span class="m">3</span>
<a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="m">5</span>
</code></pre></div>
<p>If the <code>with</code> statement is not used, the result is the same as if an interactive session is not available, like in a cron job.
In that case, plain Mininterface is used.</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">piped_in</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a>
<a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="n">m</span> <span class="o">=</span> <span class="n">run</span><span class="p">(</span><span class="n">interface</span><span class="o">=</span><span class="s2">&quot;tui&quot;</span><span class="p">)</span>
<a id="__codelineno-4-4" name="__codelineno-4-4" href="#__codelineno-4-4"></a><span class="n">result</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">ask_number</span><span class="p">(</span><span class="s2">&quot;What number&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">piped_in</span>
<a id="__codelineno-4-5" name="__codelineno-4-5" href="#__codelineno-4-5"></a><span class="nb">print</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="nb">echo</span><span class="w"> </span><span class="m">2</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>./program.py
<a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a>Asking:<span class="w"> </span>What<span class="w"> </span>number
<a id="__codelineno-5-3" name="__codelineno-5-3" href="#__codelineno-5-3"></a><span class="m">3</span>
</code></pre></div>

</div>

Expand Down
Loading

0 comments on commit 53a4240

Please sign in to comment.