exercise3.py sample code

The exercise3.py script is a PyQt5 application for live performance of a set of stepper-motor driven sculptures. It uses simulated or physical MIDI input as events to drive an Arduino-based stepper system connected via a serial port. It includes a basic interface to a four-channel DMX controller. It includes hooks for MIDI and OSC output for extending the performance across the network.

The script and libraries are packaged as exercise3.zip.

The script is capable of driving up to 16 motors, four per driver, up to four drivers. The example user interfaces allows driving eight motors at a time from the MPD218 4x4 pad interface, with the second set available on Pad Bank B. Two pads each send forward/backward step commands.

A show control system with GUI.

class exercise3.AppWindow(main)[source]

A custom main window which provides all GUI controls. This generally follows a model-view-controller convention in which this window provides the views, passing events to the application controller via callbacks.

apply_user_configuration(config)[source]

Apply the persistent configuration values from a configparser section proxy object.

closeEvent(event)[source]

Qt callback received before windows closes.

connect_callbacks()[source]

Finish initializing the GUI by connecting all callbacks from GUI elements to application controller methods. This allows the log window to be set up early to capture any messages from the initialization of other object.

gather_configuration(config)[source]

Update the persistent configuration values in a configparser section proxy object.

set_status(string)[source]

Update the status bar at the bottom of the display to show the provided string.

update_opacity_indicator(opacity)[source]
update_tempo_indicator(tempo)[source]
class exercise3.MainApp[source]

Main application controller object holding any non-GUI related state.

app_has_started()[source]

Callback to be invoked right after the main event loop begins. This may be extended in child classes to implement startup behaviors which require a running event loop.

app_is_exiting()[source]

Callback invoked right before the program ends, either from a keyboard interrupt window close. This may be extended in child classes to clean up external resources, e.g., close any serial ports to remove associated lock files.

apply_configuration()[source]
dmx_slider_change(channel, value)[source]

Callback invoked when a DMX channel strip slider is moved.

frame_timer_tick()[source]
initialize_default_configuration()[source]

Method to add default configuration values. This is intended to be extended in child classes. It is called during object initialization.

save_configuration(path=None)[source]

Method to save the current configuration file. This is not called by default, it must be invoked explicitly by child classes.

class exercise3.WinchMIDILogic(main)[source]

Core performance logic for processing MIDI input into winch commands.

channel_pressure(channel, pressure)[source]

Process a MIDI Channel Pressure event.

control_change(channel, cc, value)[source]

Process a MIDI Control Change event.

increment_target(winch_index, steps)[source]

Map a given winch index to the particular winch set.

note_off(channel, key, velocity)[source]

Process a MIDI Note Off event.

note_on(channel, key, velocity)[source]

Process a MIDI Note On event.

set_freq_damping()[source]