Icy-imaging/Icy-Kernel — pull request #525 by oeway (2013-11-01 09:44:45+00:00)
Title: Add native script-plugin support to Icy to build plugins with Javascript, Python, R, and etc.

Hi everyone,

Recently, I am thinking about add script plugin support to Icy. The motivations are:
1. Icy supports Javascript, Python and more in the future, but no script engine interface established.
2. Supporting plugins in script will change the way of developing, it will ease our developing experience and boost the speed. We now have ScriptEditor with autocomplete and highlighting, why should we use eclipse.
3. ScriptEditor can write script easily and why should we run it in the editor? When the develop is done, we only want to click a button and run it just like other plugins in Icy. Native script plugin support will be more elegant for user to run.
4. Script can be used to do some automation like macro, and also can be used to build actionable plugin, like this one [https://github.com/Icy-imaging/Icy-Kernel/issues/472] by Timothée Lecomte.

So I made this demonstration, and send this pull request to remind you, and you don't have to merge my code but I hope you can have a try.
The idea is that, script plugin is almost the same with normal plugin in Icy, it can be compressed in to a zip package. And unzip it in the "plugins" directory when installed, so every script is a directory with some specific name, and in the directory there should at least a xml file like normal plugin and a startup script with specific name like "__init__.py" or "__init__.js", To run the plugin, we should define a script engine interface, so script engine plugins be used, every script plugin store its script engine plugin class name in xml file. When icy started, it checks all the directory to find directory with "__init__.*" file and the corresponding xml file and try to load it as pluginDescriptor, and store it if valid. In the pluginDescriptor, the plugin class is set to the script engine's plugin class. Then if we click on the plugin icon, the script engine will be created and excute the startup script.

So, the differences between a normal plugin and a script plugin is that it contains a "__init__*" file rather than a jar file, a script plugin also contain an additional node in xml to define which script engine should be used to run the script.

Here we got a example script plugin, you can search online plugin repository for "PyPluginTest", and download it, ignore the error message. After download, you will get a file "plugins/oeway/pyplugintest.jar", delete the xml file in the same directory, and rename the jar file to "pyplugintest.zip" and unzip it to the same directory, and we will get a script plugin with GUI.
It startup file is in Javascript, when it starts, it build a Python Interpreter to run a simple python plugin with EzPlug by Timothée Lecomte.It runs like this:

![scriptplugindemonstration](https://f.cloud.github.com/assets/478667/1452621/b01600b6-42d8-11e3-97a3-94e726671934.png)

If we want to integrate this in the future version, the plugin installer, updater and other also the website should make some change.
Feel free to check out and try it.