hyperspyui.mdi_mpl_backend module

Created on Fri Oct 31 14:22:53 2014

@author: Vidar Tonaas Fauske

hyperspyui.mdi_mpl_backend.FigureManager

alias of FigureManagerMdi

class hyperspyui.mdi_mpl_backend.FigureManagerMdi(canvas, num)

Bases: FigureManagerBase

Public attributes

canvas : The FigureCanvas instance num : The Figure number toolbar : The qt.QToolBar window : The FigureWindow

Our MPL figure manager class. Much of the code is copied from MPL Qt4 backend, but adapted for our needs.

_show_message(s)
_widgetclosed()
destroy(*args)
full_screen_toggle()
get_window_title()

Return the title text of the window containing the figure, or None if there is no window (e.g., a PS backend).

resize(width, height)

set the canvas size in pixels

set_window_title(title)

Set the title text of the window containing the figure.

This has no effect for non-GUI (e.g., PS) backends.

Examples

>>> fig = plt.figure()
>>> fig.canvas.manager.set_window_title('My figure')
show()

For GUI backends, show the figure window and redraw. For non-GUI backends, raise an exception, unless running headless (i.e. on Linux with an unset DISPLAY); this exception is converted to a warning in .Figure.show.

class hyperspyui.mdi_mpl_backend.FigureWindow(*args, **kwargs)

Bases: QMdiSubWindow

A basic MDI sub-window, but with a closing signal, and an activate QAction, which allows for switching between all FigureWindows (e.g. by a Windows-menu). An exclusive, static action group makes sure only one window can be active at the time. If you want to split the windows into different groups that can be treated separately, you will need to create your own QtWidgets.QActionGroups.

_activate_triggered(checked=True)
_windowStateChanged(oldState, newState)
activateAction()

Returns a QAction that will activate the window with setActiveSubWindow as long as it has an mdiArea set. If not, it will use activateWindow to try to make it the active window.

activeFigureActionGroup = <PyQt5.QtWidgets.QActionGroup object>
closeEvent(self, closeEvent: QCloseEvent | None)
closing

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

setWindowTitle(self, a0: str | None)
hyperspyui.mdi_mpl_backend._on_destroy(figure)

Destroying MPL figure event, calls subscribers. ‘figure’ parameter is of the type FigureWindow defined below

hyperspyui.mdi_mpl_backend._on_new_figure(figure)

New MPL figure event, calls subscribers. ‘figure’ parameter is of the type FigureWindow defined below

hyperspyui.mdi_mpl_backend.connect_on_destroy(callback, userdata=None)

Call to subscribe to destroying MPL figure events. ‘callback’ is called on the event, with the figure as it’s first parameter, and ‘userdata’ as it’s second parameter if it is not None. If it’s None, only one parameter is passed.

hyperspyui.mdi_mpl_backend.connect_on_new_figure(callback, userdata=None)

Call to subscribe to new MPL figure events. ‘callback’ is called on the event, with the figure as it’s first parameter, and ‘userdata’ as it’s second parameter if it is not None. If it’s None, only one parameter is passed.

hyperspyui.mdi_mpl_backend.disconnect_on_destroy(callback)

Disconnect callback from subscription.

hyperspyui.mdi_mpl_backend.disconnect_on_new_figure(callback)

Disconnect callback from subscription.

hyperspyui.mdi_mpl_backend.new_figure_manager(num, *args, **kwargs)

Create a new figure manager instance. MPL backend function.

hyperspyui.mdi_mpl_backend.new_figure_manager_given_figure(num, figure)

Create a new figure manager instance for the given figure. MPL backend function.