pyplanet.apps

class pyplanet.apps.Apps(instance)[source]

The apps class contains the context applications, loaded or not loaded in order of declaration or requirements if given by app configuration.

The apps should contain a configuration class that could be loaded for reading out metadata, options and other useful information such as description, author, version and more.

check()[source]

Check and remove unsupported apps based on the current game and script mode. Also loads unloaded apps and try if the mode and game does support it again.

discover()[source]

The discover function will discover all models, signals and more from apps in the right order.

init()[source]

This method will initiate all apps in order and in series.

populate(apps, in_order=False)[source]

Loads application into the apps registry. Once you populate, the order isn’t yet been decided. After all imports are done you should shuffle the apps list so it’s in the right order of execution!

Parameters:
  • apps (list) – Apps list.
  • in_order – Is the list already in order?
start()[source]

This method will start all apps that are previously initiated.

stop()[source]

This method is executed when the instance is shutting down (will stop all the apps).

class pyplanet.apps.AppConfig(app_name, app_module, instance)[source]

This class is the base class for the Applications metadata class. The class holds information and hooks that will be executed after initiation for example.

class MyApp(AppConfig):

        async def on_start(self):
                print('we are staring!!')
app_dependencies = None

You can provide a list of dependencies to other apps (each entry needs to be a string of the app label!)

game_dependencies = None

You can provide a list of game dependencies that needs to meet when the app is started. For example you can provide:

game_dependencies = ['trackmania']

You can override this behaviour by defining the following method in your config class

def is_game_supported(self, game):
        return game != 'questmania'
human_name = None
static import_app(entry, instance)[source]
is_game_supported(game)[source]
is_mode_supported(mode)[source]
label = None
mode_dependencies = None

You can provide a list of gamemodes that are required to activate the app. Gamemodes needs to be declared as script names. You can override this behaviour by defining the following method in your config class

def is_mode_supported(self, mode):
        return mode.lower().startswith('TimeAttack')
name = None
on_destroy()[source]

On destroy is being called when unloading the app from the memory.

on_init()[source]

The on_init will be called before all apps are started (just before the on_ready). This will allow the app to register things like commands, permissions and other things that are important and don’t require other apps to be ready.

on_start()[source]

The on_start call is being called after all apps has been started successfully. You should register any stuff that is related to any other apps and signals like your self context for signals if they are classmethods.

on_stop()[source]

The on_stop will be called before stopping the app.

path = None
class pyplanet.apps.config._AppContext(app)[source]

The app context holds instances of core/contrib components that must be managed on a per app base. Such as the UI registration and distribution.

setting = None

Setting Contrib Component. See Setting Classes.

signals = None

Signal manager. See Signal Manager.

ui = None

UI Component. See UI Classes.