Skip to main content
`Ctrl`+`K`

# `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:

- `CopyAction`

- `PrintAction`

- `SaveAction`

selectOutputGroup(h5filename)

  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)

  QAction for saving Plot content.

  It opens a Save as… dialog.

  Parameters:

    - plot – `PlotWidget` instance on which to operate.

    - parent – See `QAction`.

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

    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)

    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:

      dict

class PrintAction(plot, parent=None)

  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:

    - plot – `PlotWidget` instance on which to operate.

    - parent – See `QAction`.

  getPrinter()

    The QPrinter instance used by the PrintAction.

    Return type:

      QPrinter

  printPlotAsWidget()

    Open the print dialog and print the plot.

    Use `QWidget.render()` to print the plot

    Returns:

      True if successful

  printPlot()

    Open the print dialog and print the plot.

    Use `Plot.saveGraph()` to print the plot.

    Returns:

      True if successful

class CopyAction(plot, parent=None)

  QAction to copy `PlotWidget` content to clipboard.

  Parameters:

    - plot – `PlotWidget` instance on which to operate

    - parent – See `QAction`

  copyPlot()

    Copy plot content to the clipboard as a bitmap.