Difference: DpHipePluginsDeveloperManual (15 vs. 16)

Revision 162011-03-23 - PaulBalm

Line: 1 to 1
 
META TOPICPARENT name="DpHipePlugins"

Plug-in Developer Manual

Line: 122 to 122
 

Slightly more advanced topics

Added:
>
>

Organizing your plugin.py into several shorter scripts

If your plugin.py growse large, it becomes difficult to maintain. You can organize the plugin.py into several files and call these from the plugin.py script as follows. First, you have to find the directory in which your plug-in is installed. The next few lines assign this directory to the variable basedir:

from herschel.ia.gui.apps.plugin import PluginRegistry
reg = PluginRegistry.getInstance()

name = 'myPluginName' # fill in the name of the plug-in here
plugin = reg.get(name)
basedir = plugin.pluginDir.absolutePath

Using this base directory, you can execute scripts in your plug-in using the execfile command:

execfile(basedir + '/a.py')
execfile(basedir + '/b.py')
execfile(basedir + '/c.py')

Note that you can store these scripts in subdirectories within your plug-in as well.

 

Compatibility information

It is highly recommended to include a file called plugin.xml at the top-level (root directory) of your plug-in and use it to specify the compatible HIPE versions. You do this by specifying a minimum version which with HIPE is compatible, and a maximum version. You should always specify a maximum version, because you don't know if your plug-in will be compatible with the next version of HIPE. If you distribute a plug-in when HIPE v1.0 is current, you should specify that is compatible with versions up to 1.0.*. This means that your plug-in is compatible with all builds from the 1.0 track, which means all 1.x releases. This is correct, because if 1.1 has been released now, and your plug-in is compatible, you know that it will be compatible with release 1.2 as well. No compatible changes are allowed in existing release tracks.

 
This site is powered by the TWiki collaboration platform Powered by Perl