mirror of
https://github.com/evennia/evennia.git
synced 2026-04-01 05:27:17 +02:00
Updated HTML docs
This commit is contained in:
parent
86fb09d6bf
commit
86c930be7a
1221 changed files with 76528 additions and 29095 deletions
|
|
@ -30,6 +30,7 @@
|
|||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">evennia.utils.evtable</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
|
|
@ -39,13 +40,15 @@
|
|||
|
||||
<section id="module-evennia.utils.evtable">
|
||||
<span id="evennia-utils-evtable"></span><h1>evennia.utils.evtable<a class="headerlink" href="#module-evennia.utils.evtable" title="Permalink to this headline">¶</a></h1>
|
||||
<p>This is an advanced ASCII table creator. It was inspired by
|
||||
[prettytable](<a class="reference external" href="https://code.google.com/p/prettytable/">https://code.google.com/p/prettytable/</a>) but shares no code.</p>
|
||||
<p>This is an advanced ASCII table creator. It was inspired by Prettytable
|
||||
(<a class="reference external" href="https://code.google.com/p/prettytable/">https://code.google.com/p/prettytable/</a>) but shares no code and is considerably
|
||||
more advanced, supporting auto-balancing of incomplete tables and ANSI colors among
|
||||
other things.</p>
|
||||
<p>Example usage:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">evtable</span>
|
||||
|
||||
<span class="n">table</span> <span class="o">=</span> <span class="n">evtable</span><span class="o">.</span><span class="n">EvTable</span><span class="p">(</span><span class="s2">"Heading1"</span><span class="p">,</span> <span class="s2">"Heading2"</span><span class="p">,</span>
|
||||
<span class="n">table</span><span class="o">=</span><span class="p">[[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">]],</span> <span class="n">border</span><span class="o">=</span><span class="s2">"cells"</span><span class="p">)</span>
|
||||
<span class="n">table</span><span class="o">=</span><span class="p">[[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">]],</span> <span class="n">border</span><span class="o">=</span><span class="s2">"cells"</span><span class="p">)</span>
|
||||
<span class="n">table</span><span class="o">.</span><span class="n">add_column</span><span class="p">(</span><span class="s2">"This is long data"</span><span class="p">,</span> <span class="s2">"This is even longer data"</span><span class="p">)</span>
|
||||
<span class="n">table</span><span class="o">.</span><span class="n">add_row</span><span class="p">(</span><span class="s2">"This is a single row"</span><span class="p">)</span>
|
||||
<span class="nb">print</span> <span class="n">table</span>
|
||||
|
|
@ -99,8 +102,9 @@ Here we change the width and alignment of the column at index 3
|
|||
(Python starts from 0):</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">table</span><span class="o">.</span><span class="n">reformat_column</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> <span class="n">align</span><span class="o">=</span><span class="s2">"r"</span><span class="p">)</span>
|
||||
<span class="nb">print</span> <span class="n">table</span>
|
||||
|
||||
<span class="o">+-----------+-------+-----+-----------------------------+---------+</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">+-----------+-------+-----+-----------------------------+---------+</span>
|
||||
<span class="o">|</span> <span class="n">Heading1</span> <span class="o">|</span> <span class="n">Headi</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||||
<span class="o">|</span> <span class="o">|</span> <span class="n">ng2</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||||
<span class="o">+~~~~~~~~~~~+~~~~~~~+~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~+</span>
|
||||
|
|
@ -121,14 +125,13 @@ Here we change the width and alignment of the column at index 3
|
|||
<p>If the height is restricted, cells will be restricted from expanding
|
||||
vertically. This will lead to text contents being cropped. Each cell
|
||||
can only shrink to a minimum width and height of 1.</p>
|
||||
<p><strong>EvTable</strong> is intended to be used with [ANSIString](evennia.utils.ansi#ansistring)
|
||||
for supporting ANSI-coloured string types.</p>
|
||||
<p>When a cell is auto-wrapped across multiple lines, ANSI-reset
|
||||
sequences will be put at the end of each wrapped line. This means that
|
||||
the colour of a wrapped cell will not “bleed”, but it also means that
|
||||
eventual colour outside the table will not transfer “across” a table,
|
||||
you need to re-set the color to have it appear on both sides of the
|
||||
table string.</p>
|
||||
<p><strong>EvTable</strong> is intended to be used with <strong>ANSIString</strong> for supporting ANSI-coloured
|
||||
string types.</p>
|
||||
<p>When a cell is auto-wrapped across multiple lines, ANSI-reset sequences will be
|
||||
put at the end of each wrapped line. This means that the colour of a wrapped
|
||||
cell will not “bleed”, but it also means that eventual colour outside the table
|
||||
will not transfer “across” a table, you need to re-set the color to have it
|
||||
appear on both sides of the table string.</p>
|
||||
<hr class="docutils" />
|
||||
<dl class="py class">
|
||||
<dt id="evennia.utils.evtable.ANSITextWrapper">
|
||||
|
|
@ -476,8 +479,9 @@ resize individual columns in the vertical direction to fit.</p></li>
|
|||
<li><p><strong>height</strong> (<em>int</em><em>, </em><em>optional</em>) – Fixed height of table. Defaults to being unset. Width is
|
||||
still given precedence. If given, table cells will crop text rather
|
||||
than expand vertically.</p></li>
|
||||
<li><p><strong>evenwidth</strong> (<em>bool</em><em>, </em><em>optional</em>) – Used with the <strong>width</strong> keyword. Adjusts columns to have as even width as
|
||||
possible. This often looks best also for mixed-length tables. Default is <strong>False</strong>.</p></li>
|
||||
<li><p><strong>evenwidth</strong> (<em>bool</em><em>, </em><em>optional</em>) – Used with the <strong>width</strong> keyword. Adjusts columns to have as
|
||||
even width as possible. This often looks best also for mixed-length tables. Default
|
||||
is <strong>False</strong>.</p></li>
|
||||
<li><p><strong>maxwidth</strong> (<em>int</em><em>, </em><em>optional</em>) – This will set a maximum width
|
||||
of the table while allowing it to be smaller. Only if it grows wider than this
|
||||
size will it be resized by expanding horizontally (or crop <strong>height</strong> is given).
|
||||
|
|
@ -649,7 +653,6 @@ given from 0 to Ncolumns-1.</p>
|
|||
<li><a href="../../0.9.5/api/evennia.utils.evtable.html">0.9.5 (v0.9.5 branch)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
|
|
@ -666,6 +669,7 @@ given from 0 to Ncolumns-1.</p>
|
|||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">evennia.utils.evtable</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright 2020, The Evennia developer community.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue