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.

checkIfAlive()[source]

Returns True if the GUI thread is running.

figureAlive(tag)[source]

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

figureDraw(tag)[source]

Forces redrawing of the given Figure.

join()[source]

Waits for the GUI thread to finish.

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

lockGUI()[source]

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.

postMessage(message)[source]

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.

startGUI()[source]

Starts the GUI thread.

stopGUI()[source]

Stops the GUI thread by sending it the exit command.

unlockGUI()[source]

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