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 calling the processMessage() method of a QPController object via a meta object. 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.

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

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 invokes the processMessage() method of the control window via a meta object and picks up the return value from the response queue.


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.