Feedback — Feedback Base Class

This module contains the Feedback class, which is the baseclass of all feedbacks.

class FeedbackBase.Feedback.Feedback(port_num=None)

Base class for all feedbacks.

This class provides methods which are called by the FeedbackController on certain events. Override the methods as needed.

As a bare minimum you should override the on_play method in your derived class to do anything useful.

To get the data from control signals, you can use the “_data” variable in your feedback which will always hold the latest control signal.

To get the data from the interaction signals, you can use the variable names just as sent by the GUI.

This class provides the send_parallel method which you can use to send arbitrary data to the parallel port. You don’t have to override this method in your feedback.

inject(module)

Inject methods from module to Feedback Controller.

load_variables(filename)

Load variables from file and (over)write object attributes with their values.

filename – the file where the variables are stored.

This method expects the file to be in the same format as the save_variables method produces (currently JSON).

on_control_event(data)

This method is called after the FeedbackController received a control signal. The FeedbackController parses the signal, extracts the values stores the resulting tuple in the object-variable “data” and calls this method.

Override this method if you want to react on control events.

on_init()

This method is called right after the feedback object was loaded by the FeedbackController.

Override this method to initialize everything you need before the feedback starts.

on_interaction_event(data)

This method is called after the FeedbackController received a interaction signal. The FeedbackController parses the signal, extracts the variable-value pairs, stores them as object-variables in your feedback and calls this method.

If the FeedbackController detects a “play”, “pause” or “quit” signal, it calls the appropriate on_-method after this method has returned.

If the FeedbackController detects an “init” signal, it calls “on_init” before “on_interaction_event”!

Override this method if you want to react on interaction events.

on_pause()

This method is called by the FeedbackController when it received a “Pause” event via interaction signal.

Override this method to pause your feedback.

on_play()

This method is called by the FeedbackController when it received a “Play” event via interaction signal.

Override this method to actually start your feedback.

on_quit()

This Method is called just before the FeedbackController will destroy the feedback object. The FeedbackController will not destroy the feedback object until this method has returned.

Override this method to cleanup everything as needed or save information before the object gets destroyed.

on_stop()

This method is called by the FeedbackController when it received a “Stop” event.

Override this method to stop your feedback. It should be possible to start again when receiving the on_start event.

save_variables(filename)

Save all variables which are pickleable in JSON format.

filename – the file where to store the variables.

send_parallel(data, reset=True)

Sends the data to the parallel port.

send_udp(data)

Sends the data to UDP

Module author: Bastian Venthur <venthur@cs.tu-berlin.de>

Previous topic

Feedback Base Classes

Next topic

MainloopFeedback — Base Class for Feedbacks with a Mainloop

This Page