# Path: plugins/io_base.py
# class IOBase:
#     def __init__(self, bus):
#         self.bus = bus
#         self.bus.subscribe(self.process_event, thread=False)
#         self.write_queue = Queue(10)
#         self.reader = threading.Thread(target=self.reader_thread)
#         self.reader.daemon = True
#         self.reader.start()
#         self.writer = threading.Thread(target=self.writer_thread)
#         self.writer.daemon = True
#         self.writer.start()
# 
#     def reader_thread(self):
#         raise NotImplementedError()
# 
#     def writer_thread(self):
#         raise NotImplementedError()
# 
#     def convert_data(self, data):
#         return data
# 
#     def process_event(self, ev):
#         try:
#             if ev.name == "leds_enabled":
#                 data = self.convert_data(ev.data)
#                 self.write_queue.put_nowait(data)
#         except queue.Full:
#             #TODO alert somehow without flooding?
#             pass


import time
import pygame
from .io_base import IOBase


class Plugin(IOBase):
    key_map = {
        87: 'yellow_minus',  # KP_1
        79: 'yellow_plus',  # KP_7
        89: 'black_minus',  # KP_3
        81: 'black_plus',  # KP_9
        84: 'ok',  # KP_5

        24: 'yellow_plus',  # Q
        26: 'black_plus',  # E
        39: 'ok',  # S
        52: 'yellow_minus',  # Z
        54: 'black_minus',  # C
    }

    goal_map = {

# Path: plugins/io_base.py
# class IOBase:
#     def __init__(self, bus):
#         self.bus = bus
#         self.bus.subscribe(self.process_event, thread=False)
#         self.write_queue = Queue(10)
#         self.reader = threading.Thread(target=self.reader_thread)
#         self.reader.daemon = True
#         self.reader.start()
#         self.writer = threading.Thread(target=self.writer_thread)
#         self.writer.daemon = True
#         self.writer.start()
# 
#     def reader_thread(self):
#         raise NotImplementedError()
# 
#     def writer_thread(self):
#         raise NotImplementedError()
# 
#     def convert_data(self, data):
#         return data
# 
#     def process_event(self, ev):
#         try:
#             if ev.name == "leds_enabled":
#                 data = self.convert_data(ev.data)
#                 self.write_queue.put_nowait(data)
#         except queue.Full:
#             #TODO alert somehow without flooding?
#             pass


# Path: plugins/io_keyboard.py
import time
import pygame
from .io_base import IOBase



class Plugin(IOBase):
    key_map = {
        87: 'yellow_minus',  # KP_1
        79: 'yellow_plus',  # KP_7
        89: 'black_minus',  # KP_3
        81: 'black_plus',  # KP_9
        84: 'ok',  # KP_5

        24: 'yellow_plus',  # Q
        26: 'black_plus',  # E
        39: 'ok',  # S
        52: 'yellow_minus',  # Z
        54: 'black_minus',  # C
    }

    goal_map = {

        83: 'yellow',  # KP_4