# Path: bibliopixel/drivers/simpixel.py



import os, tempfile, threading, time
import common
from bibliopixel.builder import Builder
from bibliopixel.animation.tests import StripChannelTest
from bibliopixel.drivers.simpixel import SimPixel
def run():
    common.test_prompt('builder')

    with tempfile.TemporaryDirectory() as td:
        save_file = os.path.join(td, SAVE_FILE)
        pb = Builder()
        desc = pb.desc
        desc.shape = 32
        desc.animation = '.tests.PixelTester'
        pb.simpixel()

        def stop():
            time.sleep(2)
            pb.stop()

        def start_and_stop():
            threading.Thread(daemon=True, target=stop).start()
            pb.start()

        start_and_stop()

        pb.save(save_file)
        pb.clear()

        pb = Builder(save_file)
        start_and_stop()

        pb.danimation = StripChannelTest
        start_and_stop()


# Path: bibliopixel/drivers/simpixel.py



# Path: scripts/release_test/tests/builder.py
import os, tempfile, threading, time
import common
from bibliopixel.builder import Builder
from bibliopixel.animation.tests import StripChannelTest
from bibliopixel.drivers.simpixel import SimPixel

def run():
    common.test_prompt('builder')

    with tempfile.TemporaryDirectory() as td:
        save_file = os.path.join(td, SAVE_FILE)
        pb = Builder()
        desc = pb.desc
        desc.shape = 32
        desc.animation = '.tests.PixelTester'
        pb.simpixel()

        def stop():
            time.sleep(2)
            pb.stop()

        def start_and_stop():
            threading.Thread(daemon=True, target=stop).start()
            pb.start()

        start_and_stop()

        pb.save(save_file)
        pb.clear()

        pb = Builder(save_file)
        start_and_stop()

        pb.danimation = StripChannelTest
        start_and_stop()


        pb.animation = '$bpa.strip.Wave'