Here's my question of the moment: is it possible for robofont extensions to be aware of each other? Essentially I'm wondering if an extension could provide an API for other extensions to consume. I'm not necessarily looking for code examples, just wondering if any of the following are possible…
Is it possible to generate a list of the installed extensions in a python script? I know that from within an installed extension I could probably traverse up the current path until I got the the extensions folder, and then search around for the installed extensions, but I assume that there's a native way of doing this.
Is it possible to add an extension to the python path in order to allow other extensions to import its libraries?
Is it possible to have an extension write to a global variable that is then accessible to other extensions? (I'm assuming no, but trying to cover my bases)
Is it possible to register custom events? that could then be triggered from within another extension?
The web developer in me thinks that it might be possible to run a web server out of an extension, and have that available send requests to, but I really think that's probably the worst solution I could come up with.
I suppose everything is possible :)
- use the the
ExtensionBundleobject to manage your extensions
from mojo.extensions import ExtensionBundle print ExtensionBundle.allExtensions()
see: extension API
- to share variables/packages the best thing todo is to add the a root path with your packages to the python
install.pyin an extension
import sys import os sys.path.append(os.path.dirname(__file__))
this allows to import modules from an extension
Registering custom events will be possible in the next version!
never thought about it to allow third party app use the same notification center, but this could be indeed very handy...
- use the the
Haha, not the answer I was expecting. Next time I'll come up with more outlandish things to do.
Sorry about missing the mogo.extensions thing. I guess I need to sit down with the docs and read everything over again to make sure I don't ask any more dumb questions.
Getting the list of extensions should work well for what I'm working on now, but one of those other methods will be handy down the line. Really looking forward to custom events. :D