Ejemplo n.º 1
0
Archivo: cylon.py Proyecto: q3w3e3/rgbd
    def __init__(self, length, func, config):
        self.length = length
        self.setpixel = func
        self.color = common.from_hex(config.get("color", "#ff00ff"))
        self.fade = config.get("fade", True)
        self.dark_color = common.from_hex("#000000")
        self.atonce = config.get("at_once", 1)

        if self.fade:
            self.gen_colors(config.get("color", "#ff00ff"))
Ejemplo n.º 2
0
 def __init__(self, length, func, config):
     self.length = length
     self.conf = config
     self.setpixel = func
     self.color = common.from_hex(self.conf.get("color", "#ff00ff"))
     self.text = self.conf.get("text")
     self.iters = 0
     self.blink_pattern = self._to_morse_blinks()
Ejemplo n.º 3
0
	def __init__(self, length, func, config):
		self.setpixel = func
		self.length = length

		states = config.get('states', None)
		if states:
			# Allows overwriting without having to worry about a missing UNKNOWN, etc
			self.states.update(self.states.update({k: from_hex(v) for k, v in states.items()}))

		self.update_color(self.states['UNKNOWN'])
Ejemplo n.º 4
0
	def __init__(self, length, func, config):
		self.length = length
		self.setpixel = func
		self.config = config
		self.color = common.from_hex(self.config.get("color"))
Ejemplo n.º 5
0
import json

from animations.common import from_hex

_DEFAULT_STATES = {
    'UNKNOWN': from_hex('#778899'),
    'GOOD': from_hex('#00ff00'),
    'WARNING': from_hex('#ffff00'),
    'DANGER': from_hex('#ff0000'),
}


class Anim:
	"""A 'warning' animation. It uses the deliver command to update the state.

	An example data payload would be {"state": "WARNING", "flash": true, "flash_count": 5}
	This would set it to a yellow color and flash on and off at the step_delay time 5 times.

	All data should be valid JSON.

	Default values for state are UNKNOWN, GOOD, WARNING, and DANGER.
	Flash may be true or false.
	Flash count can be any number or not set to flash forever."""
	states = _DEFAULT_STATES

	flash = False
	flash_count = None
	last_was_off = False

	color = states['UNKNOWN']