adammhaile/RPi-LPD8806 — pull request #4 by Packetslave (2013-10-08 01:11:43+00:00)
Title: Refactoring

Hi Adam,

This pull request is a fairly large refactoring of the library:

- pulls the Color* classes and wheel_color() function into a separate color.py library (needed by the next step)
- separates the animations from the core LED control library
- makes each animation its own class with its own state, moves parameters that stay static into the constructor, and adds a generic step() function for each.
- adds a .run() method to each animation (through the BaseAnimation class) that loops it w/ optional sleep value

For the color.py and animation.py modules, I went with standard PEP8 python style (spaces instead of tabs, underscore_naming instead of camelCase naming, etc.). I didn't touch LPD8806.py more than absolutely necessary in this pull, so it's still formatted as originally written.

I've tested out each animation and the example demo on my 160-LED Adafruit strip, and all seemed to be well.

Let me know if you have comments. It's a pretty big change, but (IMHO) a net win for using the library if all you need is the LED control code, not the animations themselves.