mirror of
https://github.com/evennia/evennia.git
synced 2026-03-18 13:56:30 +01:00
700 lines
No EOL
54 KiB
HTML
700 lines
No EOL
54 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.utils.evtable — Evennia 1.0 documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="evennia.utils.funcparser" href="evennia.utils.funcparser.html" />
|
||
<link rel="prev" title="evennia.utils.evmore" href="evennia.utils.evmore.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.funcparser.html" title="evennia.utils.funcparser"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.evmore.html" title="evennia.utils.evmore"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 1.0</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.utils.html" accesskey="U">evennia.utils</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.utils.evtable</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
|
||
<div class="documentwrapper">
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="evennia.utils.evmore.html"
|
||
title="previous chapter">evennia.utils.evmore</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="evennia.utils.funcparser.html"
|
||
title="next chapter">evennia.utils.funcparser</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.utils.evtable.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com">Home page</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Evennia Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li>
|
||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<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 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="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>
|
||
</pre></div>
|
||
</div>
|
||
<p>Result:</p>
|
||
<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">Heading2</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">+~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~+~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~+</span>
|
||
<span class="o">|</span> <span class="mi">1</span> <span class="o">|</span> <span class="mi">4</span> <span class="o">|</span> <span class="mi">7</span> <span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">long</span> <span class="n">data</span> <span class="o">|</span>
|
||
<span class="o">+----------------------+----------+---+--------------------------+</span>
|
||
<span class="o">|</span> <span class="mi">2</span> <span class="o">|</span> <span class="mi">5</span> <span class="o">|</span> <span class="mi">8</span> <span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">even</span> <span class="n">longer</span> <span class="n">data</span> <span class="o">|</span>
|
||
<span class="o">+----------------------+----------+---+--------------------------+</span>
|
||
<span class="o">|</span> <span class="mi">3</span> <span class="o">|</span> <span class="mi">6</span> <span class="o">|</span> <span class="mi">9</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">+----------------------+----------+---+--------------------------+</span>
|
||
<span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">a</span> <span class="n">single</span> <span class="n">row</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">+----------------------+----------+---+--------------------------+</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>As seen, the table will automatically expand with empty cells to make
|
||
the table symmetric. Tables can be restricted to a given width:</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</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">align</span><span class="o">=</span><span class="s2">"l"</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>(We could just have added these keywords to the table creation call)</p>
|
||
<p>This yields the following result:</p>
|
||
<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">Heading2</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">+~~~~~~~~~~~+~~~~~~~~~~~~+~~~~~~~~~~~+~~~~~~~~~~~+</span>
|
||
<span class="o">|</span> <span class="mi">1</span> <span class="o">|</span> <span class="mi">4</span> <span class="o">|</span> <span class="mi">7</span> <span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="o">|</span>
|
||
<span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="n">long</span> <span class="n">data</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">This</span> <span class="ow">is</span> <span class="o">|</span>
|
||
<span class="o">|</span> <span class="mi">2</span> <span class="o">|</span> <span class="mi">5</span> <span class="o">|</span> <span class="mi">8</span> <span class="o">|</span> <span class="n">even</span> <span class="o">|</span>
|
||
<span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="n">longer</span> <span class="o">|</span>
|
||
<span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="n">data</span> <span class="o">|</span>
|
||
<span class="o">+-----------+------------+-----------+-----------+</span>
|
||
<span class="o">|</span> <span class="mi">3</span> <span class="o">|</span> <span class="mi">6</span> <span class="o">|</span> <span class="mi">9</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">+-----------+------------+-----------+-----------+</span>
|
||
<span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">a</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">|</span> <span class="n">single</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">|</span> <span class="n">row</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span> <span class="o">|</span>
|
||
<span class="o">+-----------+------------+-----------+-----------+</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Table-columns can be individually formatted. Note that if an
|
||
individual column is set with a specific width, table auto-balancing
|
||
will not affect this column (this may lead to the full table being too
|
||
wide, so be careful mixing fixed-width columns with auto- balancing).
|
||
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>
|
||
</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>
|
||
<span class="o">|</span> <span class="mi">1</span> <span class="o">|</span> <span class="mi">4</span> <span class="o">|</span> <span class="mi">7</span> <span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">long</span> <span class="n">data</span> <span class="o">|</span> <span class="n">Test1</span> <span class="o">|</span>
|
||
<span class="o">+-----------+-------+-----+-----------------------------+---------+</span>
|
||
<span class="o">|</span> <span class="mi">2</span> <span class="o">|</span> <span class="mi">5</span> <span class="o">|</span> <span class="mi">8</span> <span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">even</span> <span class="n">longer</span> <span class="n">data</span> <span class="o">|</span> <span class="n">Test3</span> <span class="o">|</span>
|
||
<span class="o">+-----------+-------+-----+-----------------------------+---------+</span>
|
||
<span class="o">|</span> <span class="mi">3</span> <span class="o">|</span> <span class="mi">6</span> <span class="o">|</span> <span class="mi">9</span> <span class="o">|</span> <span class="o">|</span> <span class="n">Test4</span> <span class="o">|</span>
|
||
<span class="o">+-----------+-------+-----+-----------------------------+---------+</span>
|
||
<span class="o">|</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">a</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">single</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">row</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>
|
||
</pre></div>
|
||
</div>
|
||
<p>When adding new rows/columns their data can have its own alignments
|
||
(left/center/right, top/center/bottom).</p>
|
||
<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 <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">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">ANSITextWrapper</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">width</span><span class="o">=</span><span class="default_value">70</span></em>, <em class="sig-param"><span class="n">initial_indent</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">subsequent_indent</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">expand_tabs</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">replace_whitespace</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">fix_sentence_endings</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">break_long_words</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">drop_whitespace</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">break_on_hyphens</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">tabsize</span><span class="o">=</span><span class="default_value">8</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">max_lines</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">placeholder</span><span class="o">=</span><span class="default_value">' [...]'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#ANSITextWrapper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.ANSITextWrapper" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">textwrap.TextWrapper</span></code></p>
|
||
<p>This is a wrapper work class for handling strings with ANSI tags
|
||
in it. It overloads the standard library <strong>TextWrapper</strong> class and
|
||
is used internally in <strong>EvTable</strong> and has no public methods.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.evtable.wrap">
|
||
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">wrap</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">text</span></em>, <em class="sig-param"><span class="n">width</span><span class="o">=</span><span class="default_value">78</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#wrap"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.wrap" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Wrap a single paragraph of text, returning a list of wrapped lines.</p>
|
||
<p>Reformat the single paragraph in ‘text’ so it fits in lines of no
|
||
more than ‘width’ columns, and return a list of wrapped lines. By
|
||
default, tabs in ‘text’ are expanded with string.expandtabs(), and
|
||
all other whitespace characters (including newline) are converted to</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>text</strong> (<em>str</em>) – Text to wrap.</p></li>
|
||
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) – Width to wrap <strong>text</strong> to.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>TextWrapper class for available keyword args to customize</strong> (<em>See</em>) – </p></li>
|
||
<li><p><strong>behaviour.</strong> (<em>wrapping</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.evtable.fill">
|
||
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">fill</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">text</span></em>, <em class="sig-param"><span class="n">width</span><span class="o">=</span><span class="default_value">78</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#fill"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.fill" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Fill a single paragraph of text, returning a new string.</p>
|
||
<p>Reformat the single paragraph in ‘text’ to fit in lines of no more
|
||
than ‘width’ columns, and return a new string containing the entire
|
||
wrapped paragraph. As with wrap(), tabs are expanded and other
|
||
whitespace characters converted to space.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>text</strong> (<em>str</em>) – Text to fill.</p></li>
|
||
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) – Width of fill area.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>TextWrapper class for available keyword args to customize</strong> (<em>See</em>) – </p></li>
|
||
<li><p><strong>behaviour.</strong> (<em>filling</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.evtable.EvCell">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">EvCell</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>Holds a single data cell for the table. A cell has a certain width
|
||
and height and contains one or more lines of data. It can shrink
|
||
and resize as needed.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) – The un-padded data of the entry.</p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>width</strong> (<em>int</em>) – Desired width of cell. It will pad
|
||
to this size.</p></li>
|
||
<li><p><strong>height</strong> (<em>int</em>) – Desired height of cell. it will pad
|
||
to this size.</p></li>
|
||
<li><p><strong>pad_width</strong> (<em>int</em>) – General padding width. This can be overruled
|
||
by individual settings below.</p></li>
|
||
<li><p><strong>pad_left</strong> (<em>int</em>) – Number of extra pad characters on the left.</p></li>
|
||
<li><p><strong>pad_right</strong> (<em>int</em>) – Number of extra pad characters on the right.</p></li>
|
||
<li><p><strong>pad_top</strong> (<em>int</em>) – Number of extra pad lines top (will pad with <strong>vpad_char</strong>).</p></li>
|
||
<li><p><strong>pad_bottom</strong> (<em>int</em>) – Number of extra pad lines bottom (will pad with <strong>vpad_char</strong>).</p></li>
|
||
<li><p><strong>pad_char</strong> (<em>str</em>) – by individual settings below (default <strong>” “</strong>).</p></li>
|
||
<li><p><strong>hpad_char</strong> (<em>str</em>) – Pad character to use both for extra horizontal
|
||
padding (default <strong>” “</strong>).</p></li>
|
||
<li><p><strong>vpad_char</strong> (<em>str</em>) – Pad character to use for extra vertical padding
|
||
and for vertical fill (default <strong>” “</strong>).</p></li>
|
||
<li><p><strong>fill_char</strong> (<em>str</em>) – Character used to filling (expanding cells to
|
||
desired size). This can be overruled by individual settings below.</p></li>
|
||
<li><p><strong>hfill_char</strong> (<em>str</em>) – Character used for horizontal fill (default <strong>” “</strong>).</p></li>
|
||
<li><p><strong>vfill_char</strong> (<em>str</em>) – Character used for vertical fill (default <strong>” “</strong>).</p></li>
|
||
<li><p><strong>align</strong> (<em>str</em>) – Should be one of “l”, “r”, “c”, “f” or “a” for left-, right-, center-,
|
||
full-justified (with space between words) or absolute (keep as much original
|
||
whitespace as possible). Default is left-aligned.</p></li>
|
||
<li><p><strong>valign</strong> (<em>str</em>) – Should be one of “t”, “b” or “c” for top-, bottom and center
|
||
vertical alignment respectively. Default is centered.</p></li>
|
||
<li><p><strong>border_width</strong> (<em>int</em>) – General border width. This is overruled
|
||
by individual settings below.</p></li>
|
||
<li><p><strong>border_left</strong> (<em>int</em>) – Left border width.</p></li>
|
||
<li><p><strong>border_right</strong> (<em>int</em>) – Right border width.</p></li>
|
||
<li><p><strong>border_top</strong> (<em>int</em>) – Top border width.</p></li>
|
||
<li><p><strong>border_bottom</strong> (<em>int</em>) – Bottom border width.</p></li>
|
||
<li><p><strong>border_char</strong> (<em>str</em>) – This will use a single border char for all borders.
|
||
overruled by individual settings below.</p></li>
|
||
<li><p><strong>border_left_char</strong> (<em>str</em>) – Char used for left border.</p></li>
|
||
<li><p><strong>border_right_char</strong> (<em>str</em>) – Char used for right border.</p></li>
|
||
<li><p><strong>border_top_char</strong> (<em>str</em>) – Char used for top border.</p></li>
|
||
<li><p><strong>border_bottom_char</strong> (<em>str</em>) – Char user for bottom border.</p></li>
|
||
<li><p><strong>corner_char</strong> (<em>str</em>) – Character used when two borders cross. (default is “”).
|
||
This is overruled by individual settings below.</p></li>
|
||
<li><p><strong>corner_top_left_char</strong> (<em>str</em>) – Char used for “nw” corner.</p></li>
|
||
<li><p><strong>corner_top_right_char</strong> (<em>str</em>) – Char used for “ne” corner.</p></li>
|
||
<li><p><strong>corner_bottom_left_char</strong> (<em>str</em>) – Char used for “sw” corner.</p></li>
|
||
<li><p><strong>corner_bottom_right_char</strong> (<em>str</em>) – Char used for “se” corner.</p></li>
|
||
<li><p><strong>crop_string</strong> (<em>str</em>) – String to use when cropping sideways, default is <strong>‘[…]’</strong>.</p></li>
|
||
<li><p><strong>crop</strong> (<em>bool</em>) – Crop contentof cell rather than expand vertically, default=**False**.</p></li>
|
||
<li><p><strong>enforce_size</strong> (<em>bool</em>) – If true, the width/height of the cell is
|
||
strictly enforced and extra text will be cropped rather than the
|
||
cell growing vertically.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><strong>Exception</strong> – for impossible cell size requirements where the
|
||
border width or height cannot fit, or the content is too
|
||
small.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.get_min_height">
|
||
<code class="sig-name descname">get_min_height</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_min_height"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_min_height" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get the minimum possible height of cell, including at least
|
||
one line for data.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><em>min_height (int)</em> – The mininum height of cell.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.get_min_width">
|
||
<code class="sig-name descname">get_min_width</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_min_width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_min_width" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get the minimum possible width of cell, including at least one
|
||
character-width for data.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><em>min_width (int)</em> – The minimum width of cell.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.get_height">
|
||
<code class="sig-name descname">get_height</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_height"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_height" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get natural height of cell, including padding.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><em>natural_height (int)</em> – Height of cell.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.get_width">
|
||
<code class="sig-name descname">get_width</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_width" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get natural width of cell, including padding.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><em>natural_width (int)</em> – Width of cell.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.replace_data">
|
||
<code class="sig-name descname">replace_data</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.replace_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.replace_data" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Replace cell data. This causes a full reformat of the cell.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) – Cell data.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>The available keyword arguments are the same as for
|
||
<strong>EvCell.__init__</strong>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.reformat">
|
||
<code class="sig-name descname">reformat</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.reformat" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Reformat the EvCell with new options</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Keyword Arguments</dt>
|
||
<dd class="field-odd"><p><strong>available keyword arguments are the same as for EvCell.__init__.</strong> (<em>The</em>) – </p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><strong>Exception</strong> – If the cells cannot shrink enough to accomodate
|
||
the options or the data given.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvCell.get">
|
||
<code class="sig-name descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get data, padded and aligned in the form of a list of lines.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.evtable.EvColumn">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">EvColumn</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>This class holds a list of Cells to represent a column of a table.
|
||
It holds operations and settings that affect <em>all</em> cells in the
|
||
column.</p>
|
||
<p>Columns are not intended to be used stand-alone; they should be
|
||
incorporated into an EvTable (like EvCells)</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvColumn.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>for each row in the column</strong> (<a class="reference internal" href="evennia.utils.optionclasses.html#evennia.utils.optionclasses.Text" title="evennia.utils.optionclasses.Text"><em>Text</em></a>) – </p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>EvCell.__init_ keywords are available</strong><strong>, </strong><strong>these</strong> (<em>All</em>) – </p></li>
|
||
<li><p><strong>will be persistently applied to every Cell in the</strong> (<a class="reference internal" href="evennia.utils.logger.html#evennia.utils.logger.EvenniaLogFile.settings" title="evennia.utils.logger.EvenniaLogFile.settings"><em>settings</em></a>) – </p></li>
|
||
<li><p><strong>column.</strong> – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvColumn.add_rows">
|
||
<code class="sig-name descname">add_rows</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.add_rows"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.add_rows" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add new cells to column. They will be inserted as
|
||
a series of rows. It will inherit the options
|
||
of the rest of the column’s cells (use update to change
|
||
options).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>for the new cells</strong> (<em>Texts</em>) – </p></li>
|
||
<li><p><strong>ypos</strong> (<em>int</em><em>, </em><em>optional</em>) – Index position in table before which to insert the
|
||
new column. Uses Python indexing, so to insert at the top,
|
||
use <strong>ypos=0</strong>. If not given, data will be inserted at the end
|
||
of the column.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><p><strong>keywods as per EvCell.__init__.</strong> (<em>Available</em>) – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvColumn.reformat">
|
||
<code class="sig-name descname">reformat</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.reformat" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Change the options for the column.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Keyword Arguments</dt>
|
||
<dd class="field-odd"><p><strong>as per EvCell.__init__.</strong> (<em>Keywords</em>) – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvColumn.reformat_cell">
|
||
<code class="sig-name descname">reformat_cell</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">index</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.reformat_cell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.reformat_cell" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>reformat cell at given index, keeping column options if
|
||
necessary.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>index</strong> (<em>int</em>) – Index location of the cell in the column,
|
||
starting from 0 for the first row to Nrows-1.</p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><p><strong>as per EvCell.__init__.</strong> (<em>Keywords</em>) – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.evtable.EvTable">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">EvTable</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>The table class holds a list of EvColumns, each consisting of EvCells so
|
||
that the result is a 2D matrix.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>texts for the table.</strong> (<em>Header</em>) – </p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>table</strong> (list of lists or list of <strong>EvColumns</strong>, optional) – This is used to build the table in a quick way. If not
|
||
given, the table will start out empty and <strong>add_</strong> methods
|
||
need to be used to add rows/columns.</p></li>
|
||
<li><p><strong>header</strong> (<em>bool</em><em>, </em><em>optional</em>) – <strong>True</strong>/<strong>False</strong> - turn off the
|
||
header texts (<strong>*args</strong>) being treated as a header (such as
|
||
not adding extra underlining)</p></li>
|
||
<li><p><strong>pad_width</strong> (<em>int</em><em>, </em><em>optional</em>) – How much empty space to pad your cells with
|
||
(default is 1)</p></li>
|
||
<li><p><strong>border</strong> (<em>str</em><em>, </em><em>optional</em><em>)</em>) – The border style to use. This is one of
|
||
- <strong>None</strong> - No border drawing at all.
|
||
- “table” - only a border around the whole table.
|
||
- “tablecols” - table and column borders. (default)
|
||
- “header” - only border under header.
|
||
- “cols” - only vertical borders.
|
||
- “incols” - vertical borders, no outer edges.
|
||
- “rows” - only borders between rows.
|
||
- “cells” - border around all cells.</p></li>
|
||
<li><p><strong>border_width</strong> (<em>int</em><em>, </em><em>optional</em>) – Width of table borders, if border is active.
|
||
Note that widths wider than 1 may give artifacts in the corners. Default is 1.</p></li>
|
||
<li><p><strong>corner_char</strong> (<em>str</em><em>, </em><em>optional</em>) – Character to use in corners when border is active.
|
||
Default is <strong>+</strong>.</p></li>
|
||
<li><p><strong>corner_top_left_char</strong> (<em>str</em><em>, </em><em>optional</em>) – Character used for “nw” corner of table.
|
||
Defaults to <strong>corner_char</strong>.</p></li>
|
||
<li><p><strong>corner_top_right_char</strong> (<em>str</em><em>, </em><em>optional</em>) – Character used for “ne” corner of table.
|
||
Defaults to <strong>corner_char</strong>.</p></li>
|
||
<li><p><strong>corner_bottom_left_char</strong> (<em>str</em><em>, </em><em>optional</em>) – Character used for “sw” corner of table.
|
||
Defaults to <strong>corner_char</strong>.</p></li>
|
||
<li><p><strong>corner_bottom_right_char</strong> (<em>str</em><em>, </em><em>optional</em>) – Character used for “se” corner of table.
|
||
Defaults to <strong>corner_char</strong>.</p></li>
|
||
<li><p><strong>pretty_corners</strong> (<em>bool</em><em>, </em><em>optional</em>) – Use custom characters to
|
||
make the table corners look “rounded”. Uses UTF-8
|
||
characters. Defaults to <strong>False</strong> for maximum compatibility with various displays
|
||
that may occationally have issues with UTF-8 characters.</p></li>
|
||
<li><p><strong>header_line_char</strong> (<em>str</em><em>, </em><em>optional</em>) – Character to use for underlining
|
||
the header row (default is ‘~’). Requires <strong>border</strong> to not be <strong>None</strong>.</p></li>
|
||
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) – Fixed width of table. If not set,
|
||
width is set by the total width of each column. This will
|
||
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>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).
|
||
This keyword has no meaning if <strong>width</strong> is set.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><strong>Exception</strong> – If given erroneous input or width settings for the data.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>Beyond those table-specific keywords, the non-overlapping keywords
|
||
of <strong>EvCell.__init__</strong> are also available. These will be passed down
|
||
to every cell in the table.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.add_header">
|
||
<code class="sig-name descname">add_header</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.add_header"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.add_header" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add header to table. This is a number of texts to be put at
|
||
the top of the table. They will replace an existing header.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>args</strong> (<em>str</em>) – These strings will be used as the header texts.</p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>keywords as per EvTable.__init__. Will be applied</strong> (<em>Same</em>) – </p></li>
|
||
<li><p><strong>the new header's cells.</strong> (<em>to</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.add_column">
|
||
<code class="sig-name descname">add_column</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.add_column"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.add_column" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add a column to table. If there are more rows in new column
|
||
than there are rows in the current table, the table will
|
||
expand with empty rows in the other columns. If too few, the
|
||
new column with get new empty rows. All filling rows are added
|
||
to the end.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>args</strong> (<strong>EvColumn</strong> or multiple strings) – Either a single EvColumn instance or
|
||
a number of data string arguments to be used to create a new column.</p></li>
|
||
<li><p><strong>header</strong> (<em>str</em><em>, </em><em>optional</em>) – The header text for the column</p></li>
|
||
<li><p><strong>xpos</strong> (<em>int</em><em>, </em><em>optional</em>) – Index position in table <em>before</em> which
|
||
to input new column. If not given, column will be added to the end
|
||
of the table. Uses Python indexing (so first column is <strong>xpos=0</strong>)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><p><strong>keywords as per Cell.__init__.</strong> (<em>Other</em>) – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.add_row">
|
||
<code class="sig-name descname">add_row</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.add_row"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.add_row" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add a row to table (not a header). If there are more cells in
|
||
the given row than there are cells in the current table the
|
||
table will be expanded with empty columns to match. These will
|
||
be added to the end of the table. In the same way, adding a
|
||
line with too few cells will lead to the last ones getting
|
||
padded.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>args</strong> (<em>str</em>) – Any number of string argumnets to use as the
|
||
data in the row (one cell per argument).</p></li>
|
||
<li><p><strong>ypos</strong> (<em>int</em><em>, </em><em>optional</em>) – Index position in table before which to
|
||
input new row. If not given, will be added to the end of the table.
|
||
Uses Python indexing (so first row is <strong>ypos=0</strong>)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><p><strong>keywords are as per EvCell.__init__.</strong> (<em>Other</em>) – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.reformat">
|
||
<code class="sig-name descname">reformat</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.reformat" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Force a re-shape of the entire table.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Keyword Arguments</dt>
|
||
<dd class="field-odd"><p><strong>options as per EvTable.__init__.</strong> (<em>Table</em>) – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.reformat_column">
|
||
<code class="sig-name descname">reformat_column</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">index</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.reformat_column"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.reformat_column" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Sends custom options to a specific column in the table.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>index</strong> (<em>int</em>) – Which column to reformat. The column index is
|
||
given from 0 to Ncolumns-1.</p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><p><strong>options as per EvCell.__init__.</strong> (<em>Column</em>) – </p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><strong>Exception</strong> – if an invalid index is found.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.evtable.EvTable.get">
|
||
<code class="sig-name descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.get" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return lines of table as a list.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><em>table_lines (list)</em> – The lines of the table, in order.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.funcparser.html" title="evennia.utils.funcparser"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.evmore.html" title="evennia.utils.evmore"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 1.0</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.utils.html" >evennia.utils</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.utils.evtable</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2022, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |