import numpy as np
from pyqtgraph.Qt import QtCore, QtGui
import helper

use_ip_endpoint = None
fixed_selection = None

if len(sys.argv) != 3:
    print 'switching to default view mode'
    use_ip_endpoint = 'tcp://127.0.0.1:2001'
else:
    print 'using fixed view mode'
    use_ip_endpoint = sys.argv[1]
    fixed_selection = int(sys.argv[2])

nett.initialize(use_ip_endpoint)


class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setDockOptions(QtGui.QMainWindow.AnimatedDocks)
        self.setWindowTitle('Firing rate Chart')

        if fixed_selection != None:
            self.setWindowTitle('Firing rate: ' + str(fixed_selection))

        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
Beispiel #2
0
import nett_python as nett
from float_vector_message_pb2 import *
from float_message_pb2 import *
from color_table_message_pb2 import *

import pyqtgraph as pg
import numpy as np
from pyqtgraph.Qt import QtCore, QtGui
import helper_simple

nett.initialize('tcp://127.0.0.1:2002')


class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setDockOptions(QtGui.QMainWindow.AnimatedDocks)
        self.setWindowTitle('Connections')

        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')

        win = pg.PlotWidget()
        self.setCentralWidget(win)

        self.plot = win.getPlotItem()

        self.connection_data_i = {}
        self.connection_data_e = {}
        layout_inner.addWidget(valueLabel)
        self.value_label[number] = valueLabel
        layout.addLayout(layout_inner)

    def change_value(self, slider_number, value):
        self.eta_dict[slider_number] = -(value / 1.)
        self.send_rates()
        self.value_label[slider_number].setText(
            str(self.eta_dict[slider_number]))

    def send_rates(self):
        print self.eta_dict
        msg = float_vector_message()
        for key in self.eta_dict:
            msg.value.append(self.eta_dict[key])
        self.slot_out.send(msg.SerializeToString())


def main():

    app = QtGui.QApplication(sys.argv)
    ex = ETAManipulator()
    sys.exit(app.exec_())


if __name__ == '__main__':
    helper.write_ip_address_viz()
    ip = helper.obtain_ip_address_viz()
    nett.initialize('tcp://' + str(ip) + ':2007')
    main()