pyplanet.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¶
- 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¶
- async 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.
- async 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.
- path = None¶
- 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.
- async check(on_start=False)[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.
- async discover()[source]¶
The discover function will discover all models, signals and more from apps in the right order.
- 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?
- 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¶
Setting Contrib Component. See Setting Classes.
- signals¶
Signal manager. See Signal Manager.
- ui¶
UI Component. See UI Classes.