Fix docstring formatting
This commit is contained in:
parent
daa8be261c
commit
9238a9bb58
4 changed files with 39 additions and 28 deletions
|
|
@ -163,8 +163,6 @@ reaching a node without any options.
|
|||
For a menu demo, import `CmdTestMenu` from this module and add it to
|
||||
your default cmdset. Run it with this module, like `testmenu evennia.utils.evmenu`.
|
||||
|
||||
----
|
||||
|
||||
|
||||
## Menu generation from template string
|
||||
|
||||
|
|
@ -179,10 +177,13 @@ EvMenu:
|
|||
For maximum flexibility you can inject normally-created nodes in the menu tree
|
||||
before passing it to EvMenu. If that's not needed, you can also create a menu
|
||||
in one step with:
|
||||
::
|
||||
|
||||
```python
|
||||
|
||||
evmenu.template2menu(caller, menu_template, goto_callables)
|
||||
|
||||
```
|
||||
|
||||
The `goto_callables` is a mapping `{"funcname": callable, ...}`, where each
|
||||
callable must be a module-global function on the form
|
||||
`funcname(caller, raw_string, **kwargs)` (like any goto-callable). The
|
||||
|
|
@ -260,10 +261,11 @@ strings is only needed if wanting to pass strippable spaces, otherwise the
|
|||
key:values will be converted to strings/numbers with literal_eval before passed
|
||||
into the callable.
|
||||
|
||||
The `> ` option takes a glob or regex to perform different actions depending on user
|
||||
input. Make sure to sort these in increasing order of generality since they
|
||||
will be tested in sequence.
|
||||
The \\> option takes a glob or regex to perform different actions depending
|
||||
on user input. Make sure to sort these in increasing order of generality since
|
||||
they will be tested in sequence.
|
||||
|
||||
----
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -7,17 +7,20 @@ the text (the name comes from the traditional 'more' unix command).
|
|||
|
||||
To use, simply pass the text through the EvMore object:
|
||||
|
||||
```python
|
||||
from evennia.utils.evmore import EvMore
|
||||
|
||||
text = some_long_text_output()
|
||||
EvMore(caller, text, always_page=False, session=None, justify_kwargs=None, **kwargs)
|
||||
```python
|
||||
|
||||
from evennia.utils.evmore import EvMore
|
||||
|
||||
text = some_long_text_output()
|
||||
EvMore(caller, text, always_page=False, session=None, justify_kwargs=None, **kwargs)
|
||||
```
|
||||
|
||||
One can also use the convenience function `msg` from this module to avoid
|
||||
having to set up the `EvMenu` object manually:
|
||||
|
||||
```python
|
||||
|
||||
from evennia.utils import evmore
|
||||
|
||||
text = some_long_text_output()
|
||||
|
|
@ -153,20 +156,22 @@ class EvMore(object):
|
|||
):
|
||||
|
||||
"""
|
||||
Initialization of the EvMore pager
|
||||
Initialization of the EvMore pager.
|
||||
|
||||
Args:
|
||||
caller (Object or Account): Entity reading the text.
|
||||
inp (str, EvTable, Paginator or iterator): The text or data to put under paging.
|
||||
|
||||
- If a string, paginage normally. If this text contains
|
||||
one or more `\f` format symbol, automatic pagination and justification
|
||||
are force-disabled and page-breaks will only happen after each `\f`.
|
||||
one or more `\\\\f` format symbol, automatic pagination and justification
|
||||
are force-disabled and page-breaks will only happen after each `\\\\f`.
|
||||
- If `EvTable`, the EvTable will be paginated with the same
|
||||
setting on each page if it is too long. The table
|
||||
decorations will be considered in the size of the page.
|
||||
setting on each page if it is too long. The table
|
||||
decorations will be considered in the size of the page.
|
||||
- Otherwise `inp` is converted to an iterator, where each step is
|
||||
expected to be a line in the final display. Each line
|
||||
will be run through `iter_callable`.
|
||||
expected to be a line in the final display. Each line
|
||||
will be run through `iter_callable`.
|
||||
|
||||
always_page (bool, optional): If `False`, the
|
||||
pager will only kick in if `inp` is too big
|
||||
to fit the screen.
|
||||
|
|
@ -445,14 +450,15 @@ class EvMore(object):
|
|||
|
||||
Notes:
|
||||
If overridden, this method must perform the following actions:
|
||||
|
||||
- read and re-store `self._data` (the incoming data set) if needed for pagination to work.
|
||||
- set `self._npages` to the total number of pages. Default is 1.
|
||||
- set `self._paginator` to a callable that will take a page number 1...N and return
|
||||
the data to display on that page (not any decorations or next/prev buttons). If only
|
||||
wanting to change the paginator, override `self.paginator` instead.
|
||||
the data to display on that page (not any decorations or next/prev buttons). If only
|
||||
wanting to change the paginator, override `self.paginator` instead.
|
||||
- set `self._page_formatter` to a callable that will receive the page from `self._paginator`
|
||||
and format it with one element per line. Default is `str`. Or override `self.page_formatter`
|
||||
directly instead.
|
||||
and format it with one element per line. Default is `str`. Or override `self.page_formatter`
|
||||
directly instead.
|
||||
|
||||
By default, helper methods are called that perform these actions
|
||||
depending on supported inputs.
|
||||
|
|
@ -528,6 +534,7 @@ def msg(
|
|||
):
|
||||
"""
|
||||
EvMore-supported version of msg, mimicking the normal msg method.
|
||||
|
||||
"""
|
||||
EvMore(
|
||||
caller,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue