7.2. pyopus.plotter.manager — Manager for Matplotlib plot windows

Inheritance diagram of pyopus.plotter.manager

Manager for Matplotlib plot windows

The graphical part (PyQt + MatPlotLib) is running in a thread and the part that issues the plotting commands (defined in the interface module) runs in the main thread (or process).

The main thread uses a QPController object for sending and receiving messages from the graphical thread. The messages are sent to the GUI by emitting a messagePoster signal from a QPController. A queue.Queue object is used for sending the response back to the main thread. On the graphical thread’s side a QPControlWindow widget is handling the received commands.

The processMessage slot in QPControlWindow calls the QPControlWindow.interpretCommand() method that dispatches the received message to the corresponding command handler.

class pyopus.plotter.manager.QPController(args=[])

This is the controller responsible for sending commands to the GUI and collection responses.

args are passed to the GUIentry() function which forwards them as command line arguments to the QApplication object.


Returns True if the GUI thread is running.


Checks if the window of the given Figure is still open.


Forces redrawing of the given Figure.


Waits for the GUI thread to finish.

KeyboardInterrupt and SystemExit are caught and the GUI is stopped upon which the exception is re-raised.


Marks the beginning of a section of code where Matplotlib API calls are made. Locking prevents these calls from interfering with the PyQt event loop and crashing the application.


This is the function that is invoked for every command that is sent to the GUI. It emits a messagePoster signal.


Starts the GUI thread.


Stops the GUI thread by sending it the exit command.


Marks the end of a section of code where Matplotlib API calls are made. It reenables the PyQt event loop.