c = Controller() games = [ PressBlinkersGame(c), SyncBlinkersGame(c) ] slots = [ LCDSlot(c), ] import sys if __name__ == '__main__' and len(sys.argv) == 1: fc = FutureClient('ws://localhost:8888/socket','VidEditConsole') fc.available_games = games fc.message_slots = slots fc.start() while True: try: time.sleep(0.05) except: fc.quit() break else: # test mode for i in range(led_count): c.set_led(i,1) time.sleep(0.5) c.set_led(i,0)
def __init__(self, id=None, length=40, x=0, y=0): self.x = x self.y = y super(PressMessageSlot, self).__init__(id,length) def on_message(self,text): global stdscr stdscr.move(self.y,self.x) stdscr.clrtoeol() if (text): stdscr.addstr(self.y,self.x,text,curses.A_BLINK|curses.A_BOLD) slots = [ PressMessageSlot(1,50,10,2) ] if __name__ == '__main__': fc = FutureClient('ws://localhost:8888/socket','basic test client') fc.available_games = games fc.message_slots = slots fc.start() while True: c = stdscr.getch() if c > 0: c = chr(c) stdscr.addstr(5,0,"last keypress: "+c) if c == 'q' or c == 'Q': break else: for game in games: game.on_keypress(c) time.sleep(0.05) fc.quit()