Skip to content

Commit

Permalink
[TASK] Update documentation, add donation page, update privacy, add s…
Browse files Browse the repository at this point in the history
…ome introductions to classes.
  • Loading branch information
tomvlk committed Jun 18, 2017
1 parent 963506a commit 537fb98
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 25 deletions.
25 changes: 25 additions & 0 deletions docs/source/privacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ You can add this line to your `base.py` file to change the behaviour.

**We really like to improve the stability of PyPlanet**, therefor we kindly ask you to keep the setting on, or at least
at level ``2``.


Analytics & Telemetry
---------------------

For future improvements and look into the usage of PyPlanet and it's apps we collect the following information:

- PyPlanet version
- Python version
- Server version
- Operating system
- Server login
- Server titlepack
- Active apps
- Total number of players

We do this by sending so called ping-updates every hour with up-to-date status about the server. By collecting this
we gain information on how to improve with targeting specific titles or apps for updates. And to improve the operating system
support if required.

You can turn this off by adding this line to your ``settings/base.py``:

.. code-block:: python
ANALYTICS = False
20 changes: 16 additions & 4 deletions docs/source/support.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Support, Bug report & Contact
=============================
Support & Contact
=================

If you have any problems with starting PyPlanet, please report it on GitHub: https://github.com/PyPlanet/PyPlanet

Expand All @@ -19,17 +19,29 @@ There are several demo servers available. You need to search for servers on the
Who is behind PyPlanet
----------------------

**Organisation**:

* Toffe: Project and organisation lead.

**Core**:

* Toffe: Lead developer of the PyPlanet project.

**Apps**:

* Toffe: Bundled Application developer.
* TheM: Bundled Application developer.

Want to help us? Contact Toffe on Discord or Forum:
:code:`Toffe#8999` or `Forum Profile <https://forum.maniaplanet.com/memberlist.php?mode=viewprofile&u=20394>`_.

.. tip::

The pages on this site will be updated
Donate
======

You can support PyPlanet and other projects of Toffe (such as ManiaCDN and the Toolkit application) with the following donation options:

.. image:: https://img.shields.io/badge/patreon-donate-yellow.svg
:target: https://patreon.com/pyplanet
.. image:: https://img.shields.io/badge/paypal-donate-yellow.svg
:target: https://paypal.me/tomvlk
2 changes: 1 addition & 1 deletion pyplanet/apps/contrib/info/templates/mapinfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<quad pos="0 -6.5" z-index="0" size="35 6" bgcolor="00000060"/>
<quad pos="0 -6.5" z-index="0" size="6.5 6" bgcolor="00000060"/>
<quad pos="0.9 -7.35" z-index="1" size="4.80 4.25" image="file://Media/Flags/samerica.dds" id="author_flag" /> <!-- TODO: Use flag of author -->
<quad pos="0.9 -7.35" z-index="1" size="4.80 4.25" image="file://Media/Flags/samerica.dds" id="author_flag" />
<label pos="20.5 -9.5" z-index="1" size="28.5 6"
data-login="{{ map_author }}" text="-" textsize="1.6"
valign="center2" halign="center" textfont="RajdhaniMono" textemboss="1"
Expand Down
2 changes: 1 addition & 1 deletion pyplanet/apps/contrib/mapinfo/templates/mapinfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<quad pos="0 -6.5" z-index="0" size="35 6" bgcolor="00000060"/>
<quad pos="0 -6.5" z-index="0" size="6.5 6" bgcolor="00000060"/>
<quad pos="0.5 -6.75" z-index="1" size="5.5 5" image="file://Media/Flags/samerica.dds"/> <!-- TODO: Use flag of author -->
<quad pos="0.5 -6.75" z-index="1" size="5.5 5" image="file://Media/Flags/samerica.dds"/>
<label pos="21.5 -9.5" z-index="1" size="28 6" text="{{ map_author }}" textsize="1.6" valign="center2" halign="center" textfont="RajdhaniMono" textemboss="1"/>

<quad pos="0 -13" z-index="0" size="40 6" bgcolor="00000060"/>
Expand Down
30 changes: 19 additions & 11 deletions pyplanet/contrib/command/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,31 @@ class Command:
"""
The command instance describes the command itself, the target to fire and all other related information, like
admin command or aliases.
.. todo::
Write introduction + examples
Some examples of some commands:
.. code-block:: python
# Admin command with permission on it.
Command(command='reboot', target=self.reboot_pool, perms='admin:reboot', admin=True)
# Normal user command with optional argument.
Command(command='list', target=self.show_map_list)\
.add_param(name='search', required=False)
"""

def __init__(
self, command, target, aliases=None, admin=False, namespace=None, parser=None, perms=None, description=None
):
"""
Initiate a command.
:param command: Command text (prefix without parameters).
:param target: Target method to fire.
:param aliases: Alias(ses) for the command.
:param admin: Register command in admin context.
:param namespace: Custom namespace, this can be used to create commands like '/prog start' and '/prog end'
:param namespace: Custom namespace, this can be used to create commands like '/prog start' and '/prog end'
where 'prog' is the namespace.
:param perms: Required parameters, default everyone is allowed.
:param parser: Custom parser.
Expand Down Expand Up @@ -53,7 +61,7 @@ def __init__(
def match(self, raw):
"""
Try to match the command with the given input in array style (splitted by spaces).
:param raw: Raw input, split by spaces.
:type raw: list
:return: Boolean if command matches.
Expand Down Expand Up @@ -92,7 +100,7 @@ def match(self, raw):
def get_params(self, input):
"""
Get params in array from input in array.
:param input: Array of raw input.
:type input: list
:return: Array of parameters, stripped of the command name and namespace, if defined.
Expand All @@ -119,7 +127,7 @@ def add_param(
):
"""
Add positional parameter.
:param name: Name of parameter, will be used to store result into!
:param nargs: Number of arguments, use integer or '*' for multiple or infinite.
:param type: Type of value, keep str to match all types. Use any other to try to parse to the type.
Expand All @@ -138,7 +146,7 @@ def add_param(
async def handle(self, instance, player, argv):
"""
Handle command parsing and execution.
:param player: Player object.
:param argv: Arguments in array
:type player: pyplanet.apps.core.maniaplanet.models.player.Player
Expand Down Expand Up @@ -176,7 +184,7 @@ async def handle(self, instance, player, argv):
@property
def usage_text(self):
"""
The usage text line for the command.
The usage text line for the command.
"""
text = 'Usage: /{}{}{}'.format(
'/' if self.admin else '',
Expand Down
19 changes: 16 additions & 3 deletions pyplanet/contrib/command/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,26 @@ class CommandManager(CoreContrib):
The Command Manager contributed extension is a manager that controls all chat-commands in the game.
Your app needs to use this manager to register any custom commands you want to provide.
.. todo::
You should access this class within your app like this:
Write introduction.
.. code-block:: python
self.instance.command_manager
You can register your commands like this:
.. code-block:: python
await self.instance.command_manager.register(
Command(command='reboot', target=self.reboot_pool, perms='admin:reboot', admin=True),
)
More information of the command and the options of it, see the :class:`pyplanet.contrib.command.Command` class.
.. warning::
Don't initiate this class yourself.
Don't initiate this class yourself. Access this class from the ``self.instance.command_manager`` instance.
"""

def __init__(self, instance):
Expand Down
9 changes: 7 additions & 2 deletions pyplanet/contrib/player/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ class PlayerManager(CoreContrib):
"""
Player Manager.
.. todo::
You can access this class in your app with:
Write introduction.
.. code-block:: python
self.instance.player_manager
With the manager you can get several useful information about the players on the server. See all the properties and methods
below for more information.
.. warning::
Expand Down
2 changes: 1 addition & 1 deletion pyplanet/core/gbx/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async def listen(self):
'Connection with the dedicated server has been closed, we will now close down the subprocess! {}'.format(str(e))
)
# When the connection has been reset, we will close the controller process so it can be restarted by the god
# process. Exit code 10 gives the information to the god process. TODO: Make nice table for exit codes.
# process. Exit code 10 gives the information to the god process.
exit(10)
except Exception as e:
handle_exception(exception=e, module_name=__name__, func_name='listen')
Expand Down
1 change: 0 additions & 1 deletion pyplanet/core/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ async def print_footer(self): # pragma: no cover
raw=True
)

# TODO: Write analytics util for this. Fire every admin connect (random admin connect). Fetch new version x hours.
try:
asyncio.ensure_future(releases.UpdateChecker.init_checker(self))
except:
Expand Down
2 changes: 1 addition & 1 deletion pyplanet/core/management/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def run_from_argv(self, argv):
sys.exit(1)
finally:
pass
# TODO: Clonse all db connections etc.
# TODO: Close all db connections etc.

def execute(self, *args, **options):
"""
Expand Down

0 comments on commit 537fb98

Please sign in to comment.