Added docs for cpl.console

This commit is contained in:
Sven Heidemann 2021-05-16 17:42:09 +02:00
parent cda1fabd4f
commit 7b90b5af57
19 changed files with 479 additions and 283 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -187,8 +187,12 @@
<code class="sig-name descname"><span class="pre">add_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_configuration" title="Permalink to this definition"></a></dt>
<dd><p>Add configuration object</p>
<blockquote>
<div><p>key_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code>]
value: <a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a></p>
<div><dl class="simple">
<dt>key_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code>]</dt><dd><p>Type of the value</p>
</dd>
<dt>value: <a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a></dt><dd><p>Object of the value</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -197,7 +201,10 @@ value: <a class="reference internal" href="#cpl.configuration.configuration_mode
<code class="sig-name descname"><span class="pre">add_console_argument</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.console_argument.ConsoleArgument" title="cpl.configuration.console_argument.ConsoleArgument"><span class="pre">cpl.configuration.console_argument.ConsoleArgument</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_console_argument" title="Permalink to this definition"></a></dt>
<dd><p>Adds console argument to known console arguments</p>
<blockquote>
<div><p>argument: <code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.console_argument.ConsoleArgument</span></code></p>
<div><dl class="simple">
<dt>argument: <a class="reference internal" href="#cpl.configuration.console_argument.ConsoleArgument" title="cpl.configuration.console_argument.ConsoleArgument"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.console_argument.ConsoleArgument</span></code></a></dt><dd><p>Specifies the console argument</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -218,7 +225,10 @@ value: <a class="reference internal" href="#cpl.configuration.configuration_mode
<code class="sig-name descname"><span class="pre">add_environment_variables</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_environment_variables" title="Permalink to this definition"></a></dt>
<dd><p>Reads the environment variables</p>
<blockquote>
<div><p>prefix: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<div><dl class="simple">
<dt>prefix: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Prefix of the variables</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -227,10 +237,16 @@ value: <a class="reference internal" href="#cpl.configuration.configuration_mode
<code class="sig-name descname"><span class="pre">add_json_file</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optional</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_json_file" title="Permalink to this definition"></a></dt>
<dd><p>Reads and saves settings from given json file</p>
<blockquote>
<div><p>name (str): Name of the file
optional: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>
output: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>
path: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<div><dl class="simple">
<dt>name: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Name of the file</p>
</dd>
<dt>optional: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Specifies whether an error should occur if the file was not found</p>
</dd>
<dt>output: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></dt><dd><p>Specifies whether an output should take place</p>
</dd>
<dt>path: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Path in which the file should be stored</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -254,7 +270,10 @@ path: <code class="xref py py-class docutils literal notranslate"><span class="p
<code class="sig-name descname"><span class="pre">get_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">search_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.get_configuration" title="Permalink to this definition"></a></dt>
<dd><p>Returns value from configuration by given type</p>
<blockquote>
<div><p>search_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Type[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
<div><dl class="simple">
<dt>search_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Type[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</dt><dd><p>Type to search for</p>
</dd>
</dl>
</div></blockquote>
<blockquote>
<div><p>Object of Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Callable[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
@ -275,8 +294,12 @@ path: <code class="xref py py-class docutils literal notranslate"><span class="p
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_configuration" title="Permalink to this definition"></a></dt>
<dd><p>Add configuration object</p>
<blockquote>
<div><p>key_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code>]
value: <a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a></p>
<div><dl class="simple">
<dt>key_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code>]</dt><dd><p>Type of the value</p>
</dd>
<dt>value: <a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a></dt><dd><p>Object of the value</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -285,7 +308,10 @@ value: <a class="reference internal" href="#cpl.configuration.configuration_mode
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_console_argument</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.console_argument.ConsoleArgument" title="cpl.configuration.console_argument.ConsoleArgument"><span class="pre">cpl.configuration.console_argument.ConsoleArgument</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_console_argument" title="Permalink to this definition"></a></dt>
<dd><p>Adds console argument to known console arguments</p>
<blockquote>
<div><p>argument: <code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.console_argument.ConsoleArgument</span></code></p>
<div><dl class="simple">
<dt>argument: <a class="reference internal" href="#cpl.configuration.console_argument.ConsoleArgument" title="cpl.configuration.console_argument.ConsoleArgument"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.console_argument.ConsoleArgument</span></code></a></dt><dd><p>Specifies the console argument</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -306,7 +332,10 @@ value: <a class="reference internal" href="#cpl.configuration.configuration_mode
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_environment_variables</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_environment_variables" title="Permalink to this definition"></a></dt>
<dd><p>Reads the environment variables</p>
<blockquote>
<div><p>prefix: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<div><dl class="simple">
<dt>prefix: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Prefix of the variables</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -315,10 +344,16 @@ value: <a class="reference internal" href="#cpl.configuration.configuration_mode
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_json_file</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optional</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_json_file" title="Permalink to this definition"></a></dt>
<dd><p>Reads and saves settings from given json file</p>
<blockquote>
<div><p>name (str): Name of the file
optional: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>
output: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>
path: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<div><dl class="simple">
<dt>name: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Name of the file</p>
</dd>
<dt>optional: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Specifies whether an error should occur if the file was not found</p>
</dd>
<dt>output: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></dt><dd><p>Specifies whether an output should take place</p>
</dd>
<dt>path: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Path in which the file should be stored</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
@ -342,7 +377,10 @@ path: <code class="xref py py-class docutils literal notranslate"><span class="p
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">get_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">search_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.get_configuration" title="Permalink to this definition"></a></dt>
<dd><p>Returns value from configuration by given type</p>
<blockquote>
<div><p>search_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Type[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
<div><dl class="simple">
<dt>search_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Type[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</dt><dd><p>Type to search for</p>
</dd>
</dl>
</div></blockquote>
<blockquote>
<div><p>Object of Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Callable[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
@ -361,9 +399,10 @@ path: <code class="xref py py-class docutils literal notranslate"><span class="p
<dl class="py method">
<dt id="cpl.configuration.configuration_model_abc.ConfigurationModelABC.from_dict">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">from_dict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Converts attributes to dict
:param settings:
:return:</p>
<dd><p>Converts attributes to dict</p>
<blockquote>
<div><p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</div></blockquote>
</dd></dl>
</dd></dl>

View File

@ -246,53 +246,57 @@
<dl class="py method">
<dt id="cpl.console.console.Console.banner">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">banner</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.banner" title="Permalink to this definition"></a></dt>
<dd><p>Prints the string as a banner
:param string:
:return:</p>
<dd><p>Prints the string as a banner</p>
<blockquote>
<div><dl class="simple">
<dt>string: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Message to print as banner</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.clear">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">clear</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.clear" title="Permalink to this definition"></a></dt>
<dd><p>Clears the console
:return:</p>
<dd><p>Clears the console</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.close">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">close</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the application
:return:</p>
<dd><p>Closes the application</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.color_reset">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">color_reset</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.color_reset" title="Permalink to this definition"></a></dt>
<dd><p>Resets color
:return:</p>
<dd><p>Resets the color settings</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.disable">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">disable</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.disable" title="Permalink to this definition"></a></dt>
<dd><p>Disable console interaction
:return:</p>
<dd><p>Disables console interaction</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.enable">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">enable</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.enable" title="Permalink to this definition"></a></dt>
<dd><p>Enable console interaction
:return:</p>
<dd><p>Enables console interaction</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.error">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">error</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tb</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.error" title="Permalink to this definition"></a></dt>
<dd><p>Prints an error with traceback
:param string:
:param tb:
:return:</p>
<dd><p>Prints an error with traceback</p>
<blockquote>
<div><dl class="simple">
<dt>string: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Error message</p>
</dd>
<dt>tb: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Error traceback</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py attribute">
@ -303,65 +307,106 @@
<dl class="py method">
<dt id="cpl.console.console.Console.read">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">read</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">str</span><a class="headerlink" href="#cpl.console.console.Console.read" title="Permalink to this definition"></a></dt>
<dd><p>Read in line
:param output:
:return:</p>
<dd><p>Reads in line</p>
<blockquote>
<div><dl class="simple">
<dt>output: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>String to print before input</p>
</dd>
</dl>
</div></blockquote>
<blockquote>
<div><p>input()</p>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.read_line">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">read_line</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">str</span><a class="headerlink" href="#cpl.console.console.Console.read_line" title="Permalink to this definition"></a></dt>
<dd><p>Reads in next line
:param output:
:return:</p>
<dd><p>Reads in next line</p>
<blockquote>
<div><dl class="simple">
<dt>output: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>String to print before input</p>
</dd>
</dl>
</div></blockquote>
<blockquote>
<div><p>input()</p>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.reset_cursor_position">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">reset_cursor_position</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.reset_cursor_position" title="Permalink to this definition"></a></dt>
<dd><p>Resets cursor position
:return:</p>
<dd><p>Resets cursor position</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.select">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">select</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">char:</span> <span class="pre">str</span></em>, <em class="sig-param"><span class="pre">message:</span> <span class="pre">str</span></em>, <em class="sig-param"><span class="pre">options:</span> <span class="pre">list</span></em>, <em class="sig-param"><span class="pre">header_foreground_color:</span> <span class="pre">Union[str</span></em>, <em class="sig-param"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum]</span> <span class="pre">=</span> <span class="pre">&lt;ForegroundColorEnum.default:</span> <span class="pre">'default'&gt;</span></em>, <em class="sig-param"><span class="pre">header_background_color:</span> <span class="pre">Union[str</span></em>, <em class="sig-param"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum]</span> <span class="pre">=</span> <span class="pre">&lt;BackgroundColorEnum.default:</span> <span class="pre">'on_default'&gt;</span></em>, <em class="sig-param"><span class="pre">option_foreground_color:</span> <span class="pre">Union[str</span></em>, <em class="sig-param"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum]</span> <span class="pre">=</span> <span class="pre">&lt;ForegroundColorEnum.default:</span> <span class="pre">'default'&gt;</span></em>, <em class="sig-param"><span class="pre">option_background_color:</span> <span class="pre">Union[str</span></em>, <em class="sig-param"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum]</span> <span class="pre">=</span> <span class="pre">&lt;BackgroundColorEnum.default:</span> <span class="pre">'on_default'&gt;</span></em>, <em class="sig-param"><span class="pre">cursor_foreground_color:</span> <span class="pre">Union[str</span></em>, <em class="sig-param"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum]</span> <span class="pre">=</span> <span class="pre">&lt;ForegroundColorEnum.default:</span> <span class="pre">'default'&gt;</span></em>, <em class="sig-param"><span class="pre">cursor_background_color:</span> <span class="pre">Union[str</span></em>, <em class="sig-param"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum]</span> <span class="pre">=</span> <span class="pre">&lt;BackgroundColorEnum.default:</span> <span class="pre">'on_default'&gt;</span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">str</span><a class="headerlink" href="#cpl.console.console.Console.select" title="Permalink to this definition"></a></dt>
<dd><p>Prints select menu
:param char:
:param message:
:param options:
:param header_foreground_color:
:param header_background_color:
:param option_foreground_color:
:param option_background_color:
:param cursor_foreground_color:
:param cursor_background_color:
:return: Selected option as str</p>
<dd><p>Prints select menu</p>
<blockquote>
<div><dl class="simple">
<dt>char: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Character to show which element is selected</p>
</dd>
<dt>message: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Message or header of the selection</p>
</dd>
<dt>options: List[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</dt><dd><p>Selectable options</p>
</dd>
<dt>header_foreground_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></code></a>]</dt><dd><p>Foreground color of the header</p>
</dd>
<dt>header_background_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>]</dt><dd><p>Background color of the header</p>
</dd>
<dt>option_foreground_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></code></a>]</dt><dd><p>Foreground color of the options</p>
</dd>
<dt>option_background_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>]</dt><dd><p>Background color of the options</p>
</dd>
<dt>cursor_foreground_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></code></a>]</dt><dd><p>Foreground color of the cursor</p>
</dd>
<dt>cursor_background_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>]</dt><dd><p>Background color of the cursor</p>
</dd>
</dl>
</div></blockquote>
<blockquote>
<div><p>Selected option as <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.set_background_color">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">set_background_color</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></a><span class="p"><span class="pre">,</span> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.set_background_color" title="Permalink to this definition"></a></dt>
<dd><p>Sets the background color
:param color:
:return:</p>
<dd><p>Sets the background color</p>
<blockquote>
<div><dl class="simple">
<dt>color: Union[<a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</dt><dd><p>Background color of the console</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.set_cursor_position">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">set_cursor_position</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.set_cursor_position" title="Permalink to this definition"></a></dt>
<dd><p>Sets cursor position
:param x:
:param y:
:return:</p>
<dd><p>Sets cursor position</p>
<blockquote>
<div><dl class="simple">
<dt>x: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>X coordinate</p>
</dd>
<dt>y: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>Y coordinate</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.set_foreground_color">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">set_foreground_color</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></a><span class="p"><span class="pre">,</span> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.set_foreground_color" title="Permalink to this definition"></a></dt>
<dd><p>Sets the foreground color
:param color:
:return:</p>
<dd><p>Sets the foreground color</p>
<blockquote>
<div><dl class="simple">
<dt>color: Union[<a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</dt><dd><p>Foreground color of the console</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
@ -372,63 +417,102 @@
<dl class="py method">
<dt id="cpl.console.console.Console.spinner">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">spinner</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">call</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">collections.abc.Callable</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text_foreground_color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">spinner_foreground_color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text_background_color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">spinner_background_color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">any</span><a class="headerlink" href="#cpl.console.console.Console.spinner" title="Permalink to this definition"></a></dt>
<dd><p>Shows spinner and calls given function
When function has ended the spinner stops
:param message:
:param call:
:param args:
:param text_foreground_color:
:param spinner_foreground_color:
:param text_background_color:
:param spinner_background_color:
:param kwargs:
:return: Return value of call</p>
<dd><p>Shows spinner and calls given function, when function has ended the spinner stops</p>
<blockquote>
<div><dl class="simple">
<dt>message: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Message of the spinner</p>
</dd>
<dt>call: <code class="xref py py-class docutils literal notranslate"><span class="pre">Callable</span></code></dt><dd><p>Function to call</p>
</dd>
<dt>args: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></dt><dd><p>Arguments of the function</p>
</dd>
<dt>text_foreground_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></code></a>]</dt><dd><p>Foreground color of the text</p>
</dd>
<dt>spinner_foreground_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></code></a>]</dt><dd><p>Foreground color of the spinner</p>
</dd>
<dt>text_background_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>]</dt><dd><p>Background color of the text</p>
</dd>
<dt>spinner_background_color: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></code></a>]</dt><dd><p>Background color of the spinner</p>
</dd>
<dt>kwargs: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></dt><dd><p>Keyword arguments of the call</p>
</dd>
</dl>
</div></blockquote>
<blockquote>
<div><p>Return value of call</p>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.table">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">table</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">header</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.table" title="Permalink to this definition"></a></dt>
<dd><p>Prints a table with header and values
:param header:
:param values:
:return:</p>
<dd><p>Prints a table with header and values</p>
<blockquote>
<div><dl class="simple">
<dt>header: List[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</dt><dd><p>Header of the table</p>
</dd>
<dt>values: List[List[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]]</dt><dd><p>Values of the table</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.write">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">write</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">end</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.write" title="Permalink to this definition"></a></dt>
<dd><p>Prints in active line
:param args:
:param end:
:return:</p>
<dd><p>Prints in active line</p>
<blockquote>
<div><dl class="simple">
<dt>args: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></dt><dd><p>Elements to print</p>
</dd>
<dt>end: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Last character to print</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.write_at">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">write_at</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.write_at" title="Permalink to this definition"></a></dt>
<dd><p>Prints at given position
:param x:
:param y:
:param args:
:return:</p>
<dd><p>Prints at given position</p>
<blockquote>
<div><dl class="simple">
<dt>x: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>X coordinate</p>
</dd>
<dt>y: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>Y coordinate</p>
</dd>
<dt>args: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></dt><dd><p>Elements to print</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.write_line">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">write_line</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.write_line" title="Permalink to this definition"></a></dt>
<dd><p>Prints to new line
:param args:
:return:</p>
<dd><p>Prints to new line</p>
<blockquote>
<div><dl class="simple">
<dt>args: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></dt><dd><p>Elements to print</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.console.Console.write_line_at">
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">write_line_at</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console.Console.write_line_at" title="Permalink to this definition"></a></dt>
<dd><p>Prints new line at given position
:param x:
:param y:
:param args:
:return:</p>
<dd><p>Prints new line at given position</p>
<blockquote>
<div><dl class="simple">
<dt>x: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>X coordinate</p>
</dd>
<dt>y: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>Y coordinate</p>
</dd>
<dt>args: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></dt><dd><p>Elements to print</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
</dd></dl>
@ -440,6 +524,15 @@ When function has ended the spinner stops
<dt id="cpl.console.console_call.ConsoleCall">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.console.console_call.</span></code><code class="sig-name descname"><span class="pre">ConsoleCall</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">collections.abc.Callable</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.console_call.ConsoleCall" 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>Represents a console call, for hold back when spinner is active</p>
<blockquote>
<div><dl class="simple">
<dt>function: <code class="xref py py-class docutils literal notranslate"><span class="pre">Callable</span></code></dt><dd><p>Function to call</p>
</dd>
<dt>args: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></dt><dd><p>List of arguments</p>
</dd>
</dl>
</div></blockquote>
<dl class="py method">
<dt id="cpl.console.console_call.ConsoleCall.args">
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">args</span></code><a class="headerlink" href="#cpl.console.console_call.ConsoleCall.args" title="Permalink to this definition"></a></dt>
@ -514,25 +607,33 @@ When function has ended the spinner stops
<dt id="cpl.console.spinner_thread.SpinnerThread">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.console.spinner_thread.</span></code><code class="sig-name descname"><span class="pre">SpinnerThread</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg_len</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">foreground_color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.console.foreground_color_enum.ForegroundColorEnum" title="cpl.console.foreground_color_enum.ForegroundColorEnum"><span class="pre">cpl.console.foreground_color_enum.ForegroundColorEnum</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">background_color</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.console.background_color_enum.BackgroundColorEnum" title="cpl.console.background_color_enum.BackgroundColorEnum"><span class="pre">cpl.console.background_color_enum.BackgroundColorEnum</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.spinner_thread.SpinnerThread" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">threading.Thread</span></code></p>
<p>Thread to show spinner in terminal</p>
<blockquote>
<div><dl class="simple">
<dt>msg_len: <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></dt><dd><p>Length of the message</p>
</dd>
<dt>foreground_color: <code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.foreground_color.ForegroundColorEnum</span></code></dt><dd><p>Foreground color of the spinner</p>
</dd>
<dt>background_color: <code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.background_color.BackgroundColorEnum</span></code></dt><dd><p>Background color of the spinner</p>
</dd>
</dl>
</div></blockquote>
<dl class="py method">
<dt id="cpl.console.spinner_thread.SpinnerThread.exit">
<code class="sig-name descname"><span class="pre">exit</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.spinner_thread.SpinnerThread.exit" title="Permalink to this definition"></a></dt>
<dd><p>Stops the spinner
:return:</p>
<dd><p>Stops the spinner</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.spinner_thread.SpinnerThread.run">
<code class="sig-name descname"><span class="pre">run</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; <span class="pre">None</span><a class="headerlink" href="#cpl.console.spinner_thread.SpinnerThread.run" title="Permalink to this definition"></a></dt>
<dd><p>Entry point of thread, shows the spinner
:return:</p>
<dd><p>Entry point of thread, shows the spinner</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.console.spinner_thread.SpinnerThread.stop_spinning">
<code class="sig-name descname"><span class="pre">stop_spinning</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.console.spinner_thread.SpinnerThread.stop_spinning" title="Permalink to this definition"></a></dt>
<dd><p>Stops the spinner
:return:</p>
<dd><p>Stops the spinner</p>
</dd></dl>
</dd></dl>

View File

@ -236,9 +236,10 @@
<dl class="py method">
<dt id="cpl.database.database_settings.DatabaseSettings.from_dict">
<code class="sig-name descname"><span class="pre">from_dict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.database.database_settings.DatabaseSettings.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Converts attributes to dict
:param settings:
:return:</p>
<dd><p>Converts attributes to dict</p>
<blockquote>
<div><p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</div></blockquote>
</dd></dl>
</dd></dl>

View File

@ -393,9 +393,10 @@
<dl class="py method">
<dt id="cpl.logging.logging_settings.LoggingSettings.from_dict">
<code class="sig-name descname"><span class="pre">from_dict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.logging.logging_settings.LoggingSettings.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Converts attributes to dict
:param settings:
:return:</p>
<dd><p>Converts attributes to dict</p>
<blockquote>
<div><p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</div></blockquote>
</dd></dl>
<dl class="py method">

View File

@ -328,9 +328,10 @@
<dl class="py method">
<dt id="cpl.mailing.email_client_settings.EMailClientSettings.from_dict">
<code class="sig-name descname"><span class="pre">from_dict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.mailing.email_client_settings.EMailClientSettings.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Converts attributes to dict
:param settings:
:return:</p>
<dd><p>Converts attributes to dict</p>
<blockquote>
<div><p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</div></blockquote>
</dd></dl>
<dl class="py method">

View File

@ -197,9 +197,10 @@
<dl class="py method">
<dt id="cpl.time.time_format_settings.TimeFormatSettings.from_dict">
<code class="sig-name descname"><span class="pre">from_dict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.time.time_format_settings.TimeFormatSettings.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Converts attributes to dict
:param settings:
:return:</p>
<dd><p>Converts attributes to dict</p>
<blockquote>
<div><p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</div></blockquote>
</dd></dl>
<dl class="py method">

File diff suppressed because one or more lines are too long

View File

@ -54,7 +54,9 @@ class Configuration(ConfigurationABC):
Parameter
---------
name: :class:`str`
Info name
message: :class:`str`
Info message
"""
Console.set_foreground_color(ForegroundColorEnum.green)
Console.write_line(f'[{name}] {message}')
@ -67,7 +69,9 @@ class Configuration(ConfigurationABC):
Parameter
---------
name: :class:`str`
Warning name
message: :class:`str`
Warning message
"""
Console.set_foreground_color(ForegroundColorEnum.yellow)
Console.write_line(f'[{name}] {message}')
@ -80,7 +84,9 @@ class Configuration(ConfigurationABC):
Parameter
---------
name: :class:`str`
Error name
message: :class:`str`
Error message
"""
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[{name}] {message}')
@ -92,7 +98,9 @@ class Configuration(ConfigurationABC):
Parameter
---------
name: :class:`str`
Name of the variable
value: :class:`any`
Value of the variable
"""
if name == ConfigurationVariableNameEnum.environment.value:
self._application_environment.environment_name = EnvironmentNameEnum(value)
@ -113,8 +121,11 @@ class Configuration(ConfigurationABC):
Parameter
---------
argument: :class:`str`
Command as string
argument_type: :class:`cpl.configuration.console_argument.ConsoleArgument`
Command type as ConsoleArgument
next_arguments: list[:class:`str`]
Following arguments of argument
Returns
-------

View File

@ -37,6 +37,7 @@ class ConfigurationABC(ABC):
Parameter
---------
prefix: :class:`str`
Prefix of the variables
"""
pass
@ -47,6 +48,7 @@ class ConfigurationABC(ABC):
Parameter
---------
argument: :class:`cpl.configuration.console_argument.ConsoleArgument`
Specifies the console argument
"""
pass
@ -85,7 +87,9 @@ class ConfigurationABC(ABC):
Parameter
---------
key_type: Union[:class:`str`, :class:`type`]
Type of the value
value: :class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`
Object of the value
"""
pass
@ -96,6 +100,7 @@ class ConfigurationABC(ABC):
Parameter
---------
search_type: Union[:class:`str`, Type[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
Type to search for
Returns
-------

View File

@ -18,9 +18,7 @@ from cpl.console.spinner_thread import SpinnerThread
class Console:
"""
Useful functions for handling with input and output
"""
r"""Useful functions for handling with input and output"""
colorama.init()
_is_first_write = True
@ -42,9 +40,7 @@ class Console:
_selected_menu_cursor_foreground_color: ForegroundColorEnum = ForegroundColorEnum.default
_selected_menu_cursor_background_color: BackgroundColorEnum = BackgroundColorEnum.default
"""
Properties
"""
"""Properties"""
@classmethod
@property
@ -56,9 +52,7 @@ class Console:
def foreground_color(cls) -> str:
return str(cls._foreground_color.value)
"""
Settings
"""
"""Settings"""
@classmethod
def set_hold_back(cls, value: bool):
@ -66,10 +60,12 @@ class Console:
@classmethod
def set_background_color(cls, color: Union[BackgroundColorEnum, str]):
"""
Sets the background color
:param color:
:return:
r"""Sets the background color
Parameter
---------
color: Union[:class:`cpl.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
Background color of the console
"""
if type(color) is str:
cls._background_color = BackgroundColorEnum[color]
@ -78,10 +74,12 @@ class Console:
@classmethod
def set_foreground_color(cls, color: Union[ForegroundColorEnum, str]):
"""
Sets the foreground color
:param color:
:return:
r"""Sets the foreground color
Parameter
---------
color: Union[:class:`cpl.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
Foreground color of the console
"""
if type(color) is str:
cls._foreground_color = ForegroundColorEnum[color]
@ -90,37 +88,40 @@ class Console:
@classmethod
def reset_cursor_position(cls):
"""
Resets cursor position
:return:
"""
r"""Resets cursor position"""
cls._x = None
cls._y = None
@classmethod
def set_cursor_position(cls, x: int, y: int):
"""
Sets cursor position
:param x:
:param y:
:return:
r"""Sets cursor position
Parameter
---------
x: :class:`int`
X coordinate
y: :class:`int`
Y coordinate
"""
cls._x = x
cls._y = y
"""
Useful protected methods
"""
"""Useful protected functions"""
@classmethod
def _output(cls, string: str, x: int = None, y: int = None, end: str = None):
"""
Prints given output with given format
:param string:
:param x:
:param y:
:param end:
:return:
r"""Prints given output with given format
Parameter
---------
string: :class:`str`
Message to print
x: :class:`int`
X coordinate
y: :class:`int`
Y coordinate
end: :class:`str`
End character of the message (could be \n)
"""
if cls._is_first_write:
cls._is_first_write = False
@ -149,10 +150,7 @@ class Console:
@classmethod
def _show_select_menu(cls):
"""
Shows the select menu
:return:
"""
r"""Shows the select menu"""
if not cls._is_first_select_menu_output:
for _ in range(0, len(cls._select_menu_items) + 1):
sys.stdout.write('\x1b[1A\x1b[2K')
@ -176,10 +174,12 @@ class Console:
@classmethod
def _select_menu_key_press(cls, key: Key):
"""
Event function when key press is detected
:param key:
:return:
r"""Event function when key press is detected
Parameter
---------
key: :class:`pynput.keyboard.Key`
Pressed key
"""
if key == Key.down:
if cls._selected_menu_item_index == len(cls._select_menu_items) - 1:
@ -196,16 +196,16 @@ class Console:
elif key == Key.enter:
return False
"""
Useful public methods
"""
""" Useful public functions"""
@classmethod
def banner(cls, string: str):
"""
Prints the string as a banner
:param string:
:return:
r"""Prints the string as a banner
Parameter
---------
string: :class:`str`
Message to print as banner
"""
if cls._disabled:
return
@ -219,19 +219,13 @@ class Console:
@classmethod
def color_reset(cls):
"""
Resets color
:return:
"""
r"""Resets the color settings"""
cls._background_color = BackgroundColorEnum.default
cls._foreground_color = ForegroundColorEnum.default
@classmethod
def clear(cls):
"""
Clears the console
:return:
"""
r"""Clears the console"""
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.clear))
return
@ -240,10 +234,7 @@ class Console:
@classmethod
def close(cls):
"""
Close the application
:return:
"""
r"""Closes the application"""
if cls._disabled:
return
@ -258,19 +249,19 @@ class Console:
@classmethod
def disable(cls):
"""
Disable console interaction
:return:
"""
r"""Disables console interaction"""
cls._disabled = True
@classmethod
def error(cls, string: str, tb: str = None):
"""
Prints an error with traceback
:param string:
:param tb:
:return:
r"""Prints an error with traceback
Parameter
---------
string: :class:`str`
Error message
tb: :class:`str`
Error traceback
"""
if cls._disabled:
return
@ -288,18 +279,21 @@ class Console:
@classmethod
def enable(cls):
"""
Enable console interaction
:return:
"""
r"""Enables console interaction"""
cls._disabled = False
@classmethod
def read(cls, output: str = None) -> str:
"""
Read in line
:param output:
:return:
r"""Reads in line
Parameter
---------
output: :class:`str`
String to print before input
Returns
-------
input()
"""
if output is not None and not cls._hold_back:
cls.write_line(output)
@ -308,10 +302,16 @@ class Console:
@classmethod
def read_line(cls, output: str = None) -> str:
"""
Reads in next line
:param output:
:return:
r"""Reads in next line
Parameter
---------
output: :class:`str`
String to print before input
Returns
-------
input()
"""
if cls._disabled and not cls._hold_back:
return ''
@ -325,11 +325,14 @@ class Console:
@classmethod
def table(cls, header: list[str], values: list[list[str]]):
"""
Prints a table with header and values
:param header:
:param values:
:return:
r"""Prints a table with header and values
Parameter
---------
header: List[:class:`str`]
Header of the table
values: List[List[:class:`str`]]
Values of the table
"""
if cls._disabled:
return
@ -352,18 +355,32 @@ class Console:
cursor_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
cursor_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default
) -> str:
"""
Prints select menu
:param char:
:param message:
:param options:
:param header_foreground_color:
:param header_background_color:
:param option_foreground_color:
:param option_background_color:
:param cursor_foreground_color:
:param cursor_background_color:
:return: Selected option as str
r"""Prints select menu
Parameter
---------
char: :class:`str`
Character to show which element is selected
message: :class:`str`
Message or header of the selection
options: List[:class:`str`]
Selectable options
header_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
Foreground color of the header
header_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
Background color of the header
option_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
Foreground color of the options
option_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
Background color of the options
cursor_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
Foreground color of the cursor
cursor_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
Background color of the cursor
Returns
-------
Selected option as :class:`str`
"""
cls._selected_menu_item_char = char
cls.options = options
@ -396,18 +413,30 @@ class Console:
spinner_foreground_color: Union[str, ForegroundColorEnum] = None,
text_background_color: Union[str, BackgroundColorEnum] = None,
spinner_background_color: Union[str, BackgroundColorEnum] = None, **kwargs) -> any:
"""
Shows spinner and calls given function
When function has ended the spinner stops
:param message:
:param call:
:param args:
:param text_foreground_color:
:param spinner_foreground_color:
:param text_background_color:
:param spinner_background_color:
:param kwargs:
:return: Return value of call
r"""Shows spinner and calls given function, when function has ended the spinner stops
Parameter
---------
message: :class:`str`
Message of the spinner
call: :class:`Callable`
Function to call
args: :class:`list`
Arguments of the function
text_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
Foreground color of the text
spinner_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
Foreground color of the spinner
text_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
Background color of the text
spinner_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
Background color of the spinner
kwargs: :class:`dict`
Keyword arguments of the call
Returns
-------
Return value of call
"""
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.spinner, message, call, *args))
@ -454,11 +483,14 @@ class Console:
@classmethod
def write(cls, *args, end=''):
"""
Prints in active line
:param args:
:param end:
:return:
r"""Prints in active line
Parameter
---------
args: :class:`list`
Elements to print
end: :class:`str`
Last character to print
"""
if cls._disabled:
return
@ -472,12 +504,16 @@ class Console:
@classmethod
def write_at(cls, x: int, y: int, *args):
"""
Prints at given position
:param x:
:param y:
:param args:
:return:
r"""Prints at given position
Parameter
---------
x: :class:`int`
X coordinate
y: :class:`int`
Y coordinate
args: :class:`list`
Elements to print
"""
if cls._disabled:
return
@ -491,10 +527,12 @@ class Console:
@classmethod
def write_line(cls, *args):
"""
Prints to new line
:param args:
:return:
r"""Prints to new line
Parameter
---------
args: :class:`list`
Elements to print
"""
if cls._disabled:
return
@ -510,12 +548,16 @@ class Console:
@classmethod
def write_line_at(cls, x: int, y: int, *args):
"""
Prints new line at given position
:param x:
:param y:
:param args:
:return:
r"""Prints new line at given position
Parameter
---------
x: :class:`int`
X coordinate
y: :class:`int`
Y coordinate
args: :class:`list`
Elements to print
"""
if cls._disabled:
return

View File

@ -2,13 +2,17 @@ from collections import Callable
class ConsoleCall:
r"""Represents a console call, for hold back when spinner is active
Parameter
---------
function: :class:`Callable`
Function to call
args: :class:`list`
List of arguments
"""
def __init__(self, function: Callable, *args):
"""
Represents a console call, for hold back when spinner is active
:param function:
:param args:
"""
self._func = function
self._args = args

View File

@ -10,14 +10,19 @@ from cpl.console.foreground_color_enum import ForegroundColorEnum
class SpinnerThread(threading.Thread):
r"""Thread to show spinner in terminal
Parameter
---------
msg_len: :class:`int`
Length of the message
foreground_color: :class:`cpl.console.foreground_color.ForegroundColorEnum`
Foreground color of the spinner
background_color: :class:`cpl.console.background_color.BackgroundColorEnum`
Background color of the spinner
"""
def __init__(self, msg_len: int, foreground_color: ForegroundColorEnum, background_color: BackgroundColorEnum):
"""
Thread to show spinner in terminal
:param msg_len:
:param foreground_color:
:param background_color:
"""
threading.Thread.__init__(self)
self._msg_len = msg_len
@ -29,19 +34,13 @@ class SpinnerThread(threading.Thread):
@staticmethod
def _spinner():
"""
Selects active spinner char
:return:
"""
r"""Selects active spinner char"""
while True:
for cursor in '|/-\\':
yield cursor
def _get_color_args(self) -> list[str]:
"""
Creates color arguments
:return:
"""
r"""Creates color arguments"""
color_args = []
if self._foreground_color is not None:
color_args.append(str(self._foreground_color.value))
@ -52,10 +51,7 @@ class SpinnerThread(threading.Thread):
return color_args
def run(self) -> None:
"""
Entry point of thread, shows the spinner
:return:
"""
r"""Entry point of thread, shows the spinner"""
columns = 0
if sys.platform == 'win32':
columns = os.get_terminal_size().columns
@ -90,18 +86,12 @@ class SpinnerThread(threading.Thread):
print(colored(end_msg, *self._get_color_args()), end='')
def stop_spinning(self):
"""
Stops the spinner
:return:
"""
r"""Stops the spinner"""
self._is_spinning = False
time.sleep(0.1)
def exit(self):
"""
Stops the spinner
:return:
"""
r"""Stops the spinner"""
self._is_spinning = False
self._exit = True
time.sleep(0.1)