Adding stack plugins

Overview

A Stack plugin is a module that will be automatically added to the PyMca stack windows in order to perform user defined operations on the data stack. It has to inherit the StackPluginBase class and implement the following methods:

and modify the static module variable MENU_TEXT and the static module function getStackPluginInstance() according to the defined plugin.

The plugin class has access to following inherited methods:

These plugins will be compatible with any stack window that provides the following methods:

#data related

  • getStackDataObject()
  • getStackData()
  • getStackInfo()
  • setStack()
  • getStackROIImagesAndNames()
  • isStackFinite()
  • getStackOriginalCurve()
  • getStackOriginalImage()

#mask related

  • setStackSelectionMask()
  • getStackSelectionMask()

#displayed curves

  • getActiveCurve()
  • getGraphXLimits()
  • getGraphYLimits()
  • getGraphXLabel()
  • getGraphYLabel()

#images

  • addImage()
  • removeImage()
  • replaceImage()

#information method

  • stackUpdated()
  • selectionMaskUpdated()
  • stackClosed()

Stack plugin API

class PyMca5.PyMcaCore.StackPluginBase.StackPluginBase(stackWindow, **kw)[source]
applyMethod(name)[source]

The plugin is asked to apply the method associated to name.

getActiveCurve()[source]

Function to access the currently active curve. It returns None in case of not having an active curve.

Output has the form:

xvalues, yvalues, legend, dict

where dict is a dictionnary containing curve info.

For the time being, only the plot labels associated to the curve are warranted to be present under the keys xlabel, ylabel.

getGraphXLabel()[source]

Get the graph X label

getGraphXLimits()[source]

Get the graph X limits.

getGraphYLabel()[source]

Get the graph Y label

getGraphYLimits()[source]

Get the graph Y limits.

getMethodPixmap(name)[source]

Returns the pixmap associated to the particular method name or None.

getMethodToolTip(name)[source]

Returns the help associated to the particular method name or None.

getMethods()[source]

A list with the NAMES associated to the callable methods that are applicable to the specified stack.

stackClosed()[source]

This method is called when the stack widget is closed. You can implement this to shut down the plugin (close widgets...).

By default, widgets referenced as self.widget and self._widget are closed.

PyMca5.PyMcaCore.StackPluginBase.getStackPluginInstance(stackWindow, **kw)[source]

This function will be called by the stack window instantiating and calling the plugins. It passes itself as first argument, but the default implementation of the base class only keeps a weak reference to prevent circular references.