silx.gui.plot.actions.io

silx.gui.plot.actions.io provides a set of QAction relative of inputs and outputs for a PlotWidget.

The following QAction are available:

selectOutputGroup(h5filename)[source]

Open a dialog to prompt the user to select a group in which to output data.

Parameters

h5filename (str) – name of an existing HDF5 file

Return type

str

Returns

Name of output group, or None if the dialog was cancelled

class SaveAction(plot, parent=None)[source]

QAction for saving Plot content.

It opens a Save as… dialog.

Parameters
  • plotPlotWidget instance on which to operate.

  • parent – See QAction.

setFileFilter(dataKind, nameFilter, func, index=None, appendToFile=False)[source]

Set a name filter to add/replace a file format support

Parameters
  • dataKind (str) – The kind of data for which the provided filter is valid. One of: ‘all’, ‘curve’, ‘curves’, ‘image’, ‘scatter’

  • nameFilter (str) – The name filter in the QFileDialog. See QFileDialog.setNameFilters().

  • func (callable) – The function to call to perform saving. Expected signature is: bool func(PlotWidget plot, str filename, str nameFilter)

  • appendToFile (bool) – True to append the data into the selected file.

  • index (integer) – Index of the filter in the final list (or None)

getFileFilters(dataKind)[source]

Returns the nameFilter and associated function for a kind of data.

Parameters

dataKind (str) – The kind of data for which the provided filter is valid. On of: ‘all’, ‘curve’, ‘curves’, ‘image’, ‘scatter’

Returns

{nameFilter: function} associations.

Return type

collections.OrderedDict

class PrintAction(plot, parent=None)[source]

QAction for printing the plot.

It opens a Print dialog.

Current implementation print a bitmap of the plot area and not vector graphics, so printing quality is not great.

Parameters
  • plotPlotWidget instance on which to operate.

  • parent – See QAction.

getPrinter()[source]

The QPrinter instance used by the PrintAction.

Return type

QPrinter

printPlotAsWidget()[source]

Open the print dialog and print the plot.

Use QWidget.render() to print the plot

Returns

True if successful

printPlot()[source]

Open the print dialog and print the plot.

Use Plot.saveGraph() to print the plot.

Returns

True if successful

class CopyAction(plot, parent=None)[source]

QAction to copy PlotWidget content to clipboard.

Parameters
  • plotPlotWidget instance on which to operate

  • parent – See QAction

copyPlot()[source]

Copy plot content to the clipboard as a bitmap.