Plugin Menu API

From SPEDAS Wiki
Revision as of 22:11, 7 March 2014 by Floresaa (talk | contribs) (moving to page with capitalized title)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

The Plugin Menu API allows third party software to operate of variables stored in the SPEDAS GUI. The plugin menu operates by instructing the GUI to call a third party plugin window. The plugin window can then call separate helper routines that can operate on data stored within the GUI. Plugins have access to all data and associated metadata stored within the GUI. Each plugin window can store its own set of options which will be recalled each time to plugin window is opened.

Configuration File

Plugins are added by editing the configuration file /spedas/gui/resources/spd_ui_plugin_config.txt. The format is as follows:

 <menu item name>, <folder> | <subfolder>, <name of procedure to call>

The menu item name and procedure are required while the folder/subfolder field may be left blank. The following example will add a "New Plugin" menu option under Plugins > Mission > Analysis. When selected this will run the file mission_ui_plugin.pro:

 New Plugin, Mission | Analysis, mission_ui_plugin

Plugin Window

The procedure specified in the configuration file will usually be a widget program which allows the user to actively interact with the data. An example program can be found in the software at /spedas/gui/api_examples/plugin_menu/yyy_ui_plugin.pro. The plugin window routine must meet the following requirements:

  • The routine must take the following arguments (in order).
    • GUI top widget ID
    • GUI loaded data object
    • GUI call sequence object
    • GUI history window object
    • GUI status bar object
  • The routine must use the _extra keyword.
  • The routine may access the following via keyword (not required).
    • GUI loaded data tree
    • GUI time range object
    • Plugin data structure (uniquely defined and accessed by the plugin window)

Helper Routines

Helper routines are called by the plugin window to perform operations on GUI data. Examples of helper routines for yyy_ui_plugin.pro can also be found in the /spedas/gui/api_examples/plugin_menu/ folder. Helper routines must meet the following requirements:

  • The routine must take the following arguments (in order).
    • GUI loaded data object
    • GUI history window object
    • GUI status bar object
  • The routine must use the _extra keyword.
  • All other input/output must use named keywords.

GUI Document Support

In order for operations performed by plugins to be replayed when opened a GUI document a reference must be added to the GUI's call sequence object upon successful execution of a helper function (examples of this are shown in yyy_ui_plugin.pro).