mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Fix docstring formatting
This commit is contained in:
parent
363de634c5
commit
4fa9f12d65
4 changed files with 39 additions and 28 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# API Summary
|
||||
# API Summary
|
||||
|
||||
[evennia](api:evennia) - library root
|
||||
- [evennia.accounts](api:evennia.accounts) - the out-of-character entities representing players
|
||||
|
|
@ -75,6 +75,7 @@ The flat API is defined in `__init__.py` [viewable here](github:evennia/__init__
|
|||
- [evennia.EvMenu](api:evennia.utils.evmenu#evennia.utils.evmenu.EvMenu) - menu system ([docs](Components/EvMenu))
|
||||
- [evennia.EvTable](api:evennia.utils.evtable#evennia.utils.evtable.EvTable) - text table creater
|
||||
- [evennia.EvForm](api:evennia.utils.evform#evennia.utils.evform.EvForm) - text form creator
|
||||
- Evennia.EvMore - text paginator
|
||||
- [evennia.EvEditor](api:evennia.utils.eveditor#evennia.utils.eveditor.EvEditor) - in game text line editor ([docs](Components/EvEditor))
|
||||
|
||||
### Global singleton handlers
|
||||
|
|
|
|||
|
|
@ -578,8 +578,8 @@ class IAttributeBackend:
|
|||
|
||||
def do_batch_finish(self, attr_objs):
|
||||
"""
|
||||
Called only by batch_add. Used for handling database operations and/or
|
||||
caching complications.
|
||||
Called after batch_add completed. Used for handling database operations
|
||||
and/or caching complications.
|
||||
|
||||
Args:
|
||||
attr_objs (list of IAttribute): The Attributes created/updated thus far.
|
||||
|
|
@ -1098,10 +1098,11 @@ class AttributeHandler:
|
|||
*args (tuple): Each argument should be a tuples (can be of varying
|
||||
length) representing the Attribute to add to this object.
|
||||
Supported tuples are
|
||||
- `(key, value)`
|
||||
- `(key, value, category)`
|
||||
- `(key, value, category, lockstring)`
|
||||
- `(key, value, category, lockstring, default_access)`
|
||||
|
||||
- (key, value)
|
||||
- (key, value, category)
|
||||
- (key, value, category, lockstring)
|
||||
- (key, value, category, lockstring, default_access)
|
||||
|
||||
Keyword Args:
|
||||
strattr (bool): If `True`, value must be a string. This
|
||||
|
|
|
|||
|
|
@ -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