<spanid="evennia-contrib-base-systems-building-menu-building-menu"></span><h1>evennia.contrib.base_systems.building_menu.building_menu<aclass="headerlink"href="#module-evennia.contrib.base_systems.building_menu.building_menu"title="Permalink to this headline">¶</a></h1>
<p>Module containing the building menu system.</p>
<p>Evennia contributor: vincent-lg 2018</p>
<p>Building menus are in-game menus, not unlike <strong>EvMenu</strong> though using a
different approach. Building menus have been specifically designed to edit
information as a builder. Creating a building menu in a command allows
builders quick-editing of a given object, like a room. If you follow the
steps below to add the contrib, you will have access to an <strong>@edit</strong> command
that will edit any default object offering to change its key and description.</p>
<olclass="arabic">
<li><p>Import the <strong>GenericBuildingCmd</strong> class from this contrib in your
<li><p>Below, add the command in the <strong>CharacterCmdSet</strong>:</p>
<blockquote>
<div><divclass="highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># ... These lines should exist in the file</span>
<p>The <strong>@edit</strong> command will allow you to edit any object. You will need to
specify the object name or ID as an argument. For instance: <strong>@edit here</strong>
will edit the current room. However, building menus can perform much more
than this very simple example, read on for more details.</p>
<p>Building menus can be set to edit about anything. Here is an example of
output you could obtain when editing the room:</p>
<blockquote>
<div><p>Editing the room: Limbo(#2)</p>
<p>[T]itle: the limbo room
[D]escription</p>
<blockquote>
<div><p>This is the limbo room. You can easily change this default description,
either by using the <ahref="#id1"><spanclass="problematic"id="id2">|</span></a><aclass="reference external"href="mailto:y%40desc/edit|n">y<span>@</span>desc/edit|n</a> command, or simply by entering this
menu (enter <ahref="#id3"><spanclass="problematic"id="id4">|</span></a>yd|n).</p>
</div></blockquote>
<dlclass="simple">
<dt>[E]xits:</dt><dd><p>north to A parking(#4)</p>
</dd>
</dl>
<p>[Q]uit this menu</p>
</div></blockquote>
<p>From there, you can open the title choice by pressing t. You can then
change the room title by simply entering text, and go back to the
main menu entering @ (all this is customizable). Press q to quit this menu.</p>
<p>The first thing to do is to create a new module and place a class
inheriting from <strong>BuildingMenu</strong> in it.</p>
<p>This is a very short introduction. For more details, see the online tutorial
(<aclass="reference external"href="https://github.com/evennia/evennia/wiki/Building-menus">https://github.com/evennia/evennia/wiki/Building-menus</a>) or read the
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">menu_setattr</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">menu</span></em>, <emclass="sig-param"><spanclass="n">choice</span></em>, <emclass="sig-param"><spanclass="n">obj</span></em>, <emclass="sig-param"><spanclass="n">string</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#menu_setattr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.menu_setattr"title="Permalink to this definition">¶</a></dt>
<dd><p>Set the value at the specified attribute.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>menu</strong> (<aclass="reference internal"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu"title="evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu"><em>BuildingMenu</em></a>) – the menu object.</p></li>
<li><p><strong>choice</strong> (<em>Chocie</em>) – the specific choice.</p></li>
<li><p><strong>obj</strong> (<em>Object</em>) – the object to modify.</p></li>
<li><p><strong>string</strong> (<em>str</em>) – the string with the new value.</p></li>
</ul>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This function is supposed to be used as a default to
<strong>BuildingMenu.add_choice</strong>, when an attribute name is specified
(in the <strong>attr</strong> argument) but no function <strong>on_nomatch</strong> is defined.</p>
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">menu_quit</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">caller</span></em>, <emclass="sig-param"><spanclass="n">menu</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#menu_quit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.menu_quit"title="Permalink to this definition">¶</a></dt>
<dd><p>Quit the menu, closing the CmdSet.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>caller</strong> (<em>Account</em><em> or </em><em>Object</em>) – the caller.</p></li>
<li><p><strong>menu</strong> (<aclass="reference internal"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu"title="evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu"><em>BuildingMenu</em></a>) – the building menu to close.</p></li>
</ul>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This callback is used by default when using the
<strong>BuildingMenu.add_choice_quit</strong> method. This method is called
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">menu_edit</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">caller</span></em>, <emclass="sig-param"><spanclass="n">choice</span></em>, <emclass="sig-param"><spanclass="n">obj</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#menu_edit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.menu_edit"title="Permalink to this definition">¶</a></dt>
<dd><p>Open the EvEditor to edit a specified attribute.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>caller</strong> (<em>Account</em><em> or </em><em>Object</em>) – the caller.</p></li>
<li><p><strong>choice</strong> (<aclass="reference internal"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice"title="evennia.contrib.base_systems.building_menu.building_menu.Choice"><em>Choice</em></a>) – the choice object.</p></li>
<li><p><strong>obj</strong> (<em>Object</em>) – the object to edit.</p></li>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">CmdNoInput</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/contrib/base_systems/building_menu/building_menu.html#CmdNoInput"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__noinput_command'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">locks</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput.locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</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/contrib/base_systems/building_menu/building_menu.html#CmdNoInput.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>The lockhandler works the same as for objects.
optional kwargs will be set as properties on the Command at runtime,
overloading evential same-named class properties.</p>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#CmdNoInput.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput.func"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoInput.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.contrib.base_systems.building_menu.building_menu.CmdNoInput.lock_storage"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">CmdNoMatch</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/contrib/base_systems/building_menu/building_menu.html#CmdNoMatch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__nomatch_command'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">locks</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch.locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</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/contrib/base_systems/building_menu/building_menu.html#CmdNoMatch.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>The lockhandler works the same as for objects.
optional kwargs will be set as properties on the Command at runtime,
overloading evential same-named class properties.</p>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#CmdNoMatch.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch.func"title="Permalink to this definition">¶</a></dt>
<dd><p>Call the proper menu or redirect to nomatch.</p>
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.CmdNoMatch.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.contrib.base_systems.building_menu.building_menu.CmdNoMatch.lock_storage"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">BuildingMenuCmdSet</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/contrib/base_systems/building_menu/building_menu.html#BuildingMenuCmdSet"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = 'building_menu'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">priority</code><emclass="property"> = 5</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet.priority"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">mergetype</code><emclass="property"> = 'Replace'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet.mergetype"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/contrib/base_systems/building_menu/building_menu.html#BuildingMenuCmdSet.at_cmdset_creation"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet.at_cmdset_creation"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">path</code><emclass="property"> = 'evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenuCmdSet.path"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">title</span></em>, <emclass="sig-param"><spanclass="n">key</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">aliases</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">attr</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">text</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">glance</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">on_enter</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">on_nomatch</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">on_leave</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">menu</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">caller</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">obj</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#Choice.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Constructor.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>title</strong> (<em>str</em>) – the choice’s title.</p></li>
<li><p><strong>key</strong> (<em>str</em><em>, </em><em>optional</em>) – the key of the letters to type to access
the choice. If not set, try to guess it based on the title.</p></li>
<li><p><strong>aliases</strong> (<em>list of str</em><em>, </em><em>optional</em>) – the allowed aliases for this choice.</p></li>
<li><p><strong>attr</strong> (<em>str</em><em>, </em><em>optional</em>) – the name of the attribute of ‘obj’ to set.</p></li>
<li><p><strong>text</strong> (<em>str</em><em> or </em><em>callable</em><em>, </em><em>optional</em>) – a text to be displayed for this
choice. It can be a callable.</p></li>
<li><p><strong>glance</strong> (<em>str</em><em> or </em><em>callable</em><em>, </em><em>optional</em>) – an at-a-glance summary of the
sub-menu shown in the main menu. It can be set to
display the current value of the attribute in the
main menu itself.</p></li>
<li><p><strong>menu</strong> (<aclass="reference internal"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu"title="evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu"><em>BuildingMenu</em></a><em>, </em><em>optional</em>) – the parent building menu.</p></li>
<li><p><strong>on_enter</strong> (<em>callable</em><em>, </em><em>optional</em>) – a callable to call when the
caller enters into the choice.</p></li>
<li><p><strong>on_nomatch</strong> (<em>callable</em><em>, </em><em>optional</em>) – a callable to call when no
match is entered in the choice.</p></li>
<li><p><strong>on_leave</strong> (<em>callable</em><em>, </em><em>optional</em>) – a callable to call when the caller
leaves the choice.</p></li>
<li><p><strong>caller</strong> (<em>Account</em><em> or </em><em>Object</em><em>, </em><em>optional</em>) – the caller.</p></li>
<li><p><strong>obj</strong> (<em>Object</em><em>, </em><em>optional</em>) – the object to edit.</p></li>
<emclass="property">property </em><codeclass="sig-name descname">keys</code><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice.keys"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a tuple of keys separated by <strong>sep_keys</strong>.</p>
<codeclass="sig-name descname">format_text</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#Choice.format_text"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice.format_text"title="Permalink to this definition">¶</a></dt>
<dd><p>Format the choice text and return it, or an empty string.</p>
<codeclass="sig-name descname">enter</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">string</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#Choice.enter"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice.enter"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the user opens the choice.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>string</strong> (<em>str</em>) – the entered string.</p>
<codeclass="sig-name descname">nomatch</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">string</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#Choice.nomatch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice.nomatch"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the user entered something in the choice.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>string</strong> (<em>str</em>) – the entered string.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>to_display (bool)</em>– The return value of <strong>nomatch</strong> if set or
<strong>True</strong>. The rule is that if <strong>no_match</strong> returns <strong>True</strong>,
<codeclass="sig-name descname">leave</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">string</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#Choice.leave"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice.leave"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the user closes the choice.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>string</strong> (<em>str</em>) – the entered string.</p>
<codeclass="sig-name descname">keys_go_back</code><emclass="property"> = ['@']</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.keys_go_back"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">sep_keys</code><emclass="property"> = '.'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.sep_keys"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">joker_key</code><emclass="property"> = '*'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.joker_key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">min_shortcut</code><emclass="property"> = 1</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.min_shortcut"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">current_choice</code><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.current_choice"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current choice or None.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>choice (Choice)</em>– the current choice or None.</p>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>We use the menu keys to identify the current position of
the caller in the menu. The menu <strong>keys</strong> hold a list of
<emclass="property">property </em><codeclass="sig-name descname">relevant_choices</code><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.relevant_choices"title="Permalink to this definition">¶</a></dt>
<dd><p>Only return the relevant choices according to the current meny key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>relevant (list of Choice object)</em>– the relevant choices.</p>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>We use the menu keys to identify the current position of
the caller in the menu. The menu <strong>keys</strong> hold a list of
<codeclass="sig-name descname">init</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">obj</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.init"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.init"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the sub-menu to edit the specified object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>obj</strong> (<em>Object</em>) – the object to edit.</p>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This method is probably to be overridden in your subclasses.
Use <strong>add_choice</strong> and its variants to create menu choices.</p>
<codeclass="sig-name descname">add_choice_quit</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">title</span><spanclass="o">=</span><spanclass="default_value">'quit the menu'</span></em>, <emclass="sig-param"><spanclass="n">key</span><spanclass="o">=</span><spanclass="default_value">'q'</span></em>, <emclass="sig-param"><spanclass="n">aliases</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">on_enter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.add_choice_quit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.add_choice_quit"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a simple choice just to quit the building menu.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>title</strong> (<em>str</em><em>, </em><em>optional</em>) – the choice’s title.</p></li>
<li><p><strong>key</strong> (<em>str</em><em>, </em><em>optional</em>) – the choice’s key.</p></li>
<li><p><strong>aliases</strong> (<em>list of str</em><em>, </em><em>optional</em>) – the choice’s aliases.</p></li>
<li><p><strong>on_enter</strong> (<em>callable</em><em>, </em><em>optional</em>) – a different callable
to quit the building menu.</p></li>
</ul>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This is just a shortcut method, calling <strong>add_choice</strong>.
If <strong>on_enter</strong> is not set, use <strong>menu_quit</strong> which simply
closes the menu and displays a message. It also
removes the CmdSet from the caller. If you supply
another callable instead, make sure to do the same.</p>
<codeclass="sig-name descname">open</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.open"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.open"title="Permalink to this definition">¶</a></dt>
<dd><p>Open the building menu for the caller.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This method should be called once when the building menu
has been instanciated. From there, the building menu will
be re-created automatically when the server
reloads/restarts, assuming <strong>persistent</strong> is set to <strong>True</strong>.</p>
<codeclass="sig-name descname">open_parent_menu</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.open_parent_menu"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.open_parent_menu"title="Permalink to this definition">¶</a></dt>
<dd><p>Open the parent menu, using <strong>self.parents</strong>.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>You probably don’t need to call this method directly,
since the caller can go back to the parent menu using the
<codeclass="sig-name descname">open_submenu</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">submenu_class</span></em>, <emclass="sig-param"><spanclass="n">submenu_obj</span></em>, <emclass="sig-param"><spanclass="n">parent_keys</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.open_submenu"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.open_submenu"title="Permalink to this definition">¶</a></dt>
<dd><p>Open a sub-menu, closing the current menu and opening the new one.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>submenu_class</strong> (<em>str</em>) – the submenu class as a Python path.</p></li>
<li><p><strong>submenu_obj</strong> (<em>Object</em>) – the object to give to the submenu.</p></li>
<li><p><strong>parent_keys</strong> (<em>list of str</em><em>, </em><em>optional</em>) – the parent keys when
the submenu is closed.</p></li>
</ul>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>When the user enters <strong>@</strong> in the submenu, she will go back to
the current menu, with the <strong>parent_keys</strong> set as its keys.
Therefore, you should set it on the keys of the choice that
should be opened when the user leaves the submenu.</p>
</div>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>new_menu (BuildingMenu)</em>– the new building menu or None.</p>
<codeclass="sig-name descname">move</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">key</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">back</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">quiet</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">string</span><spanclass="o">=</span><spanclass="default_value">''</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.move"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.move"title="Permalink to this definition">¶</a></dt>
<dd><p>Move inside the menu.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>key</strong> (<em>any</em>) – the portion of the key to add to the current
menu keys. If you wish to go back in the menu
tree, don’t provide a <strong>key</strong>, just set <strong>back</strong> to <strong>True</strong>.</p></li>
<li><p><strong>back</strong> (<em>bool</em><em>, </em><em>optional</em>) – go back in the menu (<strong>False</strong> by default).</p></li>
<li><p><strong>quiet</strong> (<em>bool</em><em>, </em><em>optional</em>) – should the menu or choice be
displayed afterward?</p></li>
<li><p><strong>string</strong> (<em>str</em><em>, </em><em>optional</em>) – the string sent by the caller to move.</p></li>
</ul>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This method will need to be called directly should you
use more than two levels in your menu. For instance,
in your room menu, if you want to have an “exits”
option, and then be able to enter “north” in this
choice to edit an exit. The specific exit choice
could be a different menu (with a different class), but
it could also be an additional level in your original menu.
If that’s the case, you will need to use this method.</p>
<codeclass="sig-name descname">close</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.close"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.close"title="Permalink to this definition">¶</a></dt>
<dd><p>Close the building menu, removing the CmdSet.</p>
<codeclass="sig-name descname">display_title</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.display_title"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.display_title"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">display_choice</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">choice</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.display_choice"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.display_choice"title="Permalink to this definition">¶</a></dt>
<dd><p>Display the specified choice.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>choice</strong> (<aclass="reference internal"href="#evennia.contrib.base_systems.building_menu.building_menu.Choice"title="evennia.contrib.base_systems.building_menu.building_menu.Choice"><em>Choice</em></a>) – the menu choice.</p>
<codeclass="sig-name descname">display</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.display"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.display"title="Permalink to this definition">¶</a></dt>
<dd><p>Display the entire menu or a single choice, depending on the keys.</p>
<emclass="property">static </em><codeclass="sig-name descname">restore</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">caller</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#BuildingMenu.restore"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.BuildingMenu.restore"title="Permalink to this definition">¶</a></dt>
<dd><p>Restore the building menu for the caller.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>caller</strong> (<em>Account</em><em> or </em><em>Object</em>) – the caller.</p>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This method should be automatically called if a menu is
saved in the caller, but the object itself cannot be found.</p>
<codeclass="sig-name descname">init</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">obj</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/building_menu/building_menu.html#GenericBuildingMenu.init"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingMenu.init"title="Permalink to this definition">¶</a></dt>
<dd><p>Build the meny, adding the ‘key’ and ‘description’ choices.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>obj</strong> (<em>Object</em>) – any object to be edited, like a character or room.</p>
</dd>
</dl>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>The ‘quit’ choice will be automatically added, though you can
call <strong>add_choice_quit</strong> to add this choice with different options.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.base_systems.building_menu.building_menu.</code><codeclass="sig-name descname">GenericBuildingCmd</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/contrib/base_systems/building_menu/building_menu.html#GenericBuildingCmd"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '@edit'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd.key"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/contrib/base_systems/building_menu/building_menu.html#GenericBuildingCmd.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd.func"title="Permalink to this definition">¶</a></dt>
<dd><p>This is the actual executing part of the command. It is
called directly after self.parse(). See the docstring of this
module for which object properties are available (beyond those
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd.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.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': '', 'category': 'general', 'key': '@edit', 'no_prefix': 'edit ', 'tags': '', 'text': "\n Generic building command.\n\n Syntax:\n @edit [object]\n\n Open a building menu to edit the specified object. This menu allows to\n change the object's key and description.\n\n Examples:\n @edit here\n @edit self\n @edit #142\n\n "}</em><aclass="headerlink"href="#evennia.contrib.base_systems.building_menu.building_menu.GenericBuildingCmd.search_index_entry"title="Permalink to this definition">¶</a></dt>