Exemplo n.º 1
0
    win_plot = ui_plot.QtGui.QMainWindow()
    uiplot = ui_plot.Ui_win_plot()
    uiplot.setupUi(win_plot)
    uiplot.btnA.clicked.connect(plotSomething)
    #uiplot.btnB.clicked.connect(lambda: uiplot.timer.setInterval(100.0))
    #uiplot.btnC.clicked.connect(lambda: uiplot.timer.setInterval(10.0))
    #uiplot.btnD.clicked.connect(lambda: uiplot.timer.setInterval(1.0))
    c=Qwt.QwtPlotCurve()  
    c.attach(uiplot.qwtPlot)
    
    uiplot.qwtPlot.setAxisScale(uiplot.qwtPlot.yLeft, 0,20000)
    
    uiplot.timer = QtCore.QTimer()
    uiplot.timer.start(1.0)
    
    win_plot.connect(uiplot.timer, QtCore.SIGNAL('timeout()'), plotSomething) 
    
    platform = LEDWindow()  
    parser = ModeParser(sys.argv, platform.modes)
    platform.updateMode(parser.modes.items()[0])

    SR=SwhRecorder()
    SR.setup()
    SR.continuousStart()

    ### DISPLAY WINDOWS
    win_plot.show()
    code=app.exec_()
    SR.close()
    sys.exit(code)
    platform.updateLEDs(fIntervals)
    SR.newAudio = False


if __name__ == "__main__":

    # Setup Led graphical window or actual Led platform matrix
    platform = LEDWindow()
    # platform = LEDPlatform(7,14)
    AA = AudioAnalyzer(platform)

    # parses mode input to set mode
    parser = ModeParser(sys.argv, platform.modes)
    mode = parser.modes.items()[0]
    platform.updateMode(mode)
    # Start up display
    platform.updateMode(("textdisplay", "text='3 2 1'"))
    password = ""
    with open("ServerPassword.txt") as f:
        for line in f:
            line = line.strip()
            password += line

    # Sets up socket connection to node.js server
    server = ServerSocketConnection("/tmp/Led_Dance_Platform_Socket")
    # Spawn a thread to connect to the node.js server so it does not block
    threadPiConnect = threading.Thread(target=server.connectToSocket, args=())
    threadPiConnect.start()
    print "started connection attempt"
    # spawn a subprocess for node.js server