<spanid="evennia-utils-evmore"></span><h1>evennia.utils.evmore<aclass="headerlink"href="#module-evennia.utils.evmore"title="Permalink to this headline">¶</a></h1>
<p>EvMore - pager mechanism</p>
<p>This is a pager for displaying long texts and allows stepping up and down in
the text (the name comes from the traditional ‘more’ unix command).</p>
<p>To use, simply pass the text through the EvMore object:</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.utils.evmore.</code><codeclass="sig-name descname">CmdMore</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#CmdMore"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.CmdMore"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__noinput_command'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMore.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">auto_help</code><emclass="property"> = False</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMore.auto_help"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#CmdMore.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.CmdMore.func"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMore.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all();'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMore.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': 'top b a end quit e q t next n back abort', 'category': 'general', 'key': '__noinput_command', 'tags': '', 'text': '\n Manipulate the text paging\n '}</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMore.search_index_entry"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.utils.evmore.</code><codeclass="sig-name descname">CmdMoreLook</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#CmdMoreLook"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = 'look'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">aliases</code><emclass="property"> = ['l']</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">auto_help</code><emclass="property"> = False</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook.auto_help"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#CmdMoreLook.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook.func"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all();'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdMoreLook.lock_storage"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.utils.evmore.</code><codeclass="sig-name descname">CmdSetMore</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">cmdsetobj</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">key</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#CmdSetMore"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.CmdSetMore"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = 'more_commands'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdSetMore.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">priority</code><emclass="property"> = 110</em><aclass="headerlink"href="#evennia.utils.evmore.CmdSetMore.priority"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">at_cmdset_creation</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#CmdSetMore.at_cmdset_creation"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.CmdSetMore.at_cmdset_creation"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook method - this should be overloaded in the inheriting
class, and should take care of populating the cmdset by use of
<codeclass="sig-name descname">path</code><emclass="property"> = 'evennia.utils.evmore.CmdSetMore'</em><aclass="headerlink"href="#evennia.utils.evmore.CmdSetMore.path"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.evmore.</code><codeclass="sig-name descname">queryset_maxsize</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">qs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#queryset_maxsize"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.queryset_maxsize"title="Permalink to this definition">¶</a></dt>
<dt>If <strong>EvTable</strong>, the EvTable will be paginated with the same</dt><dd><p>setting on each page if it is too long. The table
decorations will be considered in the size of the page.</p>
</dd>
</dl>
</li>
<li><dlclass="simple">
<dt>Otherwise <strong>inp</strong> is converted to an iterator, where each step is</dt><dd><p>expected to be a line in the final display. Each line
will be run through <strong>iter_callable</strong>.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<dlclass="simple">
<dt>always_page (bool, optional): If <strong>False</strong>, the</dt><dd><p>pager will only kick in if <strong>inp</strong> is too big
to fit the screen.</p>
</dd>
<dt>session (Session, optional): If given, this session will be used</dt><dd><p>to determine the screen width and will receive all output.</p>
</dd>
<dt>justify (bool, optional): If set, auto-justify long lines. This must be turned</dt><dd><p>off for fixed-width or formatted output, like tables. It’s force-disabled
if <strong>inp</strong> is an EvTable.</p>
</dd>
<dt>justify_kwargs (dict, optional): Keywords for the justifiy function. Used only</dt><dd><p>if <strong>justify</strong> is True. If this is not set, default arguments will be used.</p>
</dd>
<dt>exit_on_lastpage (bool, optional): If reaching the last page without the</dt><dd><p>page being completely filled, exit pager immediately. If unset,
<dt>exit_cmd (str, optional): If given, this command-string will be executed on</dt><dd><p>the caller when the more page exits. Note that this will be using whatever
<spanclass="n">pages</span><spanclass="o">=</span><spanclass="n">Paginator</span><spanclass="p">(</span><spanclass="n">query</span><spanclass="p">,</span><spanclass="mi">10</span><spanclass="p">)</span><spanclass="c1"># 10 objs per page</span>
<codeclass="sig-name descname">display</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">show_footer</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.display"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.display"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">page_top</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.page_top"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.page_top"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">page_end</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.page_end"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.page_end"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">page_next</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.page_next"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.page_next"title="Permalink to this definition">¶</a></dt>
<dd><p>Scroll the text to the next page. Quit if already at the end
<codeclass="sig-name descname">page_back</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.page_back"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.page_back"title="Permalink to this definition">¶</a></dt>
<dd><p>Scroll the text back up, at the most to the top.</p>
<codeclass="sig-name descname">page_quit</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">quiet</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.page_quit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.page_quit"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">start</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.start"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.start"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">paginator_index</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">pageno</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.paginator_index"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.paginator_index"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">paginator_slice</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">pageno</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.paginator_slice"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.paginator_slice"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">paginator_django</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">pageno</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.paginator_django"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.paginator_django"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_evtable</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">table</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_evtable"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_evtable"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_queryset</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">qs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_queryset"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_queryset"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_django_paginator</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">pages</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_django_paginator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_django_paginator"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_iterable</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">inp</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_iterable"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_iterable"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_f_str</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">text</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_f_str"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_f_str"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_str</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">text</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_str"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_str"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">init_pages</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">inp</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.init_pages"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.init_pages"title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize the pagination. By default, will analyze input type to determine
how pagination automatically.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>inp</strong> (<em>any</em>) – Incoming data to be paginated. By default, handles pagination of
strings, querysets, django.Paginator, EvTables and any iterables with strings.</p>
</dd>
</dl>
<pclass="rubric">Notes</p>
<p>If overridden, this method must perform the following actions:
- read and re-store <strong>self._data</strong> (the incoming data set) if needed for pagination to work.
- set <strong>self._npages</strong> to the total number of pages. Default is 1.
- set <strong>self._paginator</strong> to a callable that will take a page number 1…N and return</p>
<blockquote>
<div><p>the data to display on that page (not any decorations or next/prev buttons). If only
wanting to change the paginator, override <strong>self.paginator</strong> instead.</p>
</div></blockquote>
<ulclass="simple">
<li><dlclass="simple">
<dt>set <strong>self._page_formatter</strong> to a callable that will receive the page from <strong>self._paginator</strong></dt><dd><p>and format it with one element per line. Default is <strong>str</strong>. Or override <strong>self.page_formatter</strong>
directly instead.</p>
</dd>
</dl>
</li>
</ul>
<p>By default, helper methods are called that perform these actions
<codeclass="sig-name descname">paginator</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">pageno</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.paginator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.paginator"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">page_formatter</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">page</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/evmore.html#EvMore.page_formatter"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.evmore.EvMore.page_formatter"title="Permalink to this definition">¶</a></dt>
<li><p><strong>inp</strong> (<em>str</em><em>, </em><aclass="reference internal"href="evennia.utils.evtable.html#evennia.utils.evtable.EvTable"title="evennia.utils.evtable.EvTable"><em>EvTable</em></a><em>, </em><em>Paginator</em><em> or </em><em>iterator</em>) –<p>The text or data to put under paging.
- If a string, paginage normally. If this text contains</p>
<dt>If <strong>EvTable</strong>, the EvTable will be paginated with the same</dt><dd><p>setting on each page if it is too long. The table
decorations will be considered in the size of the page.</p>
</dd>
</dl>
</li>
<li><dlclass="simple">
<dt>Otherwise <strong>inp</strong> is converted to an iterator, where each step is</dt><dd><p>expected to be a line in the final display. Each line
will be run through <strong>iter_callable</strong>.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<dlclass="simple">
<dt>always_page (bool, optional): If <strong>False</strong>, the</dt><dd><p>pager will only kick in if <strong>inp</strong> is too big
to fit the screen.</p>
</dd>
<dt>session (Session, optional): If given, this session will be used</dt><dd><p>to determine the screen width and will receive all output.</p>
</dd>
<dt>justify (bool, optional): If set, auto-justify long lines. This must be turned</dt><dd><p>off for fixed-width or formatted output, like tables. It’s force-disabled
if <strong>inp</strong> is an EvTable.</p>
</dd>
<dt>justify_kwargs (dict, optional): Keywords for the justifiy function. Used only</dt><dd><p>if <strong>justify</strong> is True. If this is not set, default arguments will be used.</p>
</dd>
<dt>exit_on_lastpage (bool, optional): If reaching the last page without the</dt><dd><p>page being completely filled, exit pager immediately. If unset,
<dt>exit_cmd (str, optional): If given, this command-string will be executed on</dt><dd><p>the caller when the more page exits. Note that this will be using whatever
<spanclass="n">pages</span><spanclass="o">=</span><spanclass="n">Paginator</span><spanclass="p">(</span><spanclass="n">query</span><spanclass="p">,</span><spanclass="mi">10</span><spanclass="p">)</span><spanclass="c1"># 10 objs per page</span>