screpl.plugin module ¶
Plugin manager for SC-REPL
SC-REPL plugins support SC-REPL with various apps. They may define special functions to explain themselves to SC-REPL:
-
screpl.plugin.
plugin_get_dependency
( ) ¶ -
Returns list of plugins with string
-
screpl.plugin.
plugin_setup
( ) ¶ -
Some triggers may called on this function. It is exactly called once.
Example plugin. Its directory structure:
my_plugin
├── __init__.py
└── app.py # defines MyApp
The contents on __init__.py may be:
from screpl.apps.repl import REPL
from screpl.core.appcommand import AppCommand
from screpl.main import get_app_manager
from screpl.plugins.cunit.detail import CUnitDetailApp
from .app import MyApp
@AppCommand
def cmd1(self):
get_app_manager().start_application(MyApp)
@AppCommand
def cmd2(self):
CUnitDetailApp.set_focus_epd(EPD(0x59CCA8))
get_app_manager().start_application(CUnitDetailApp)
def plugin_get_dependency():
return ["screpl.plugins.cunit"]
def plugin_setup():
DoActions(DisplayText("My plugin is going to be setup!"))
REPL.add_command("cmd1", cmd1)
REPL.add_command("cmd2", cmd2)