Public API
Reference the stable symbols and plugin-bound values available from elyx.
Public elyx API
Plugin code has one supported import surface:
or:
Do not import engine, importer, installer, or plugin model classes from their physical runtime modules. They are host implementation details.
Plugin-bound environment
These names are resolved for the plugin which called them:
| Name | Type | Availability |
|---|---|---|
settings | SettingsController | always |
metainfo | dict | when metadata loaded successfully |
refmap | dict | when a refmap loaded successfully |
assets | Assets | when an asset directory is declared or discovered |
strings | Strings | when at least one localization value was loaded |
These dynamic values are intentionally not included in elyx.__all__, because
not every plugin declares every environment component.
get_environment()
Returns the complete environment dictionary for the calling plugin. Raises
RuntimeError when called outside Elyx plugin code.
import_module(name, package=None)
Imports a matching module relative to the calling plugin. Falls back to normal Python import behavior when no local module exists.
Assets
Assets(dir_path)
Represents a resource directory. Supports get, item access, attribute
access, nested directories, containment checks, iteration, and len.
See Assets.
Asset(dir_path, filename, name)
Represents one resource file.
Class methods:
Content methods:
Android conversion methods:
Asset exceptions
Localization
Strings(all_strings)
Locale-aware, read-only lookup object.
See Localization.
Settings
SettingsController(plugin_id)
Persistent settings wrapper.
It also supports:
See Settings storage.
Java callback proxies
Elyx exports ready-to-instantiate proxy classes:
| Name | Java interface | Implemented method | Returns callback value |
|---|---|---|---|
OnClickListener | android.view.View.OnClickListener | onClick | no |
Runnable | java.lang.Runnable | run | no |
Callback | Utilities.Callback | run | no |
Callback2 | Utilities.Callback2 | run | no |
Callback3 | Utilities.Callback3 | run | no |
CallbackReturn | Utilities.CallbackReturn | run | yes |
Example:
Extra constructor arguments are appended to the Java callback arguments:
Exceptions are caught and written to the app log so they do not cross the Java callback boundary.
Proxy generators
gen(java_class, method_name, return_value=False, default_value=None)
Creates and caches a Python proxy class for a one-method Java interface:
For a callback which returns a value:
default_value is returned when the Python callback raises. It is valid only
when return_value=True.
gen2(java_class, return_value=False, **methods)
Creates a proxy for an interface with several methods:
If the interface methods must return their Python results, set
return_value=True.
MVEL
mvel_execute(script, data, to_type=None, java_instance=None)
Compiles and caches an MVEL expression, converts a Python dictionary to
java.util.HashMap, and executes it:
data must be a Python dict or Java HashMap.
Optional arguments:
to_typeasks MVEL to convert the result to a Java typejava_instanceprovides thethisvalue
LazyDict
A dictionary with attribute lookup:
Missing attributes behave like missing dictionary keys and raise KeyError.
Supported exports
The current elyx.__all__ is:
The plugin-bound assets, metainfo, refmap, settings, and strings
values are accessed explicitly and are not part of star imports.