示例#1
0
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)
c = Controller()

games = [
    PatchVerbGame(c),
    ToggleSwitchGame(c),
    AllOffGame(c)
]

slots = [
    #StdoutSlot(c),
]

import sys

if __name__ == '__main__' and len(sys.argv) == 1:
    fc = FutureClient('ws://192.168.1.99:2600/socket','PatchConsole')
    #fc = FutureClient('ws://localhost:2600/socket', name='PatchConsole')
    fc.available_games = games
    fc.message_slots = slots
    fc.start()
    try:
	while True:
	    c.get_patches()
	    #time.sleep(0.05)
    except:
	fc.quit()
else:
    # test mode
    # do nothing
    print "test"
示例#3
0
songs = [  #("ROW YOUR BOAT",   [0, 0, 0, 2, 4]),       # Row Row Row Your Boat - C C C D E
		 ("E-I-E-I-O",       [4, 4, 2, 2, 0]),       # E-I-E-I-O - E E D D C
		 ("FRERE JACQUES",   [7, 9, 11, 7]),         # Frere Jacques - G A B G
		 ("TWINKLE TWINKLE", [7, 7, 2, 2]),          # Twinkle Twinkle Little Star - G G D D 
		 ("ALOUETTE",        [0, 2, 4, 4]),          # Alouette - C D E E 
		 ("BEETHOVEN",       [9, 9, 9, 5]),          # Beethoven's 5th - A A A F
		 #("HAPPY BIRTHDAY",  [2, 2, 4, 2, 7, 5]),    # Happy Birthday - D D E D G F
		]

chords = [  [0, 'MAJOR'],
            [4, 'MAJOR'],
            [9, 'MAJOR'],
            [2, 'MINOR'],
          #  [7, 'MINOR'],
            [5, 'MINOR'] ] 

fc = FutureClient(name="ToyPianoClient", urlstring="ws://192.168.1.99:2600/socket")
fc.available_games = [PlayOneNote(controller, i) for i in controller.allKeys] 
fc.message_slots = [LCDMessageSlot('PrintSlot', controller.lcd)]

fc.start()
try:
	while 1:
		controller.lcd.update()
		time.sleep(0.05)
except:
	fc.quit()


示例#4
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()
示例#5
0
          ("the FBI", [3, 2, 4]),
          ("the KGB", [5, 4, 2]),
          ("the A-Team", [6, 7, 8]),
          ("your lawyer", [5, 4, 3, 7]),
          ("Bill and Ted", [9, 4, 6, 2]),
          ("not found", [4, 0, 4]),
          ("James Bond", [0, 0, 7]),
          ("your mother", [6, 6, 6]),
          ("Moviefone", [4, 1, 1]),
          ("Razor and Blade", [1, 3, 3, 7]),
          ("Emmanuel Goldstein", [2, 6, 0, 0]),
          ("the Devil", [6, 6, 6]),
          ("Jenny", [8, 6, 7, 5, 3, 0, 9]),
          ("Murder", [6]),
          ("Pi", [3, 1, 4]),
          ("the Ghostbusters", [6, 0, 2])]

fc = FutureClient(name="RotaryConsole", urlstring="ws://192.168.1.99:2600/socket")
fc.available_games = [OneDigitGame(controller, i) for i in range(1, 11)] +  [PhonebookGame(controller, i[0], i[1]) for i in people] 
fc.message_slots = [LCDMessageSlot('PrintSlot', controller.lcd)]

fc.start()
try:
    while 1:
        controller.lcd.update()
        time.sleep(0.05)
except:
    fc.quit()