def main():
    app = QtCore.QCoreApplication(sys.argv)
    t1 = time.time()
    nchans = 10

    chans = []
    for x in range(nchans):
        channel = ccda.sdchan(None, "", "cx::127.0.0.1:60.NAME.%d" % x)
        chans.append(channel)
        # channel.valueMeasured.connect(partial(printval, app, t1))
        channel.valueMeasured.connect(partial(processing, app))

    sys.exit(app.exec_())
import signal

t1 = time.time()

nchans = 10
i = 0

def printval(chan):
    global i
    i += 1
    if i == 50:
        print(chan.val)
        t2 = time.time()
        print("time = %f " % (t2-t1))
        app.quit()

signal.signal(signal.SIGINT, signal.SIG_DFL)

app = QtCore.QCoreApplication(sys.argv)


chans = []
for x in range(nchans):
    chans.append(ccda.sdchan(None, "", "cx::127.0.0.1:60.NAME.%d" % x))


for x in chans:
    x.valueMeasured.connect(printval)


sys.exit(app.exec_())
#!/usr/bin/env python
import signal

import sys
from monitors.cx4.cython_wrapper import ccda
from PyQt4 import QtCore
import time


def new_data(chan1):
    "running slot"
    t1 = time.time()
    for x in range(1000000):
        chan1.setValue(0.0)
    t2 = time.time()

    print("settime = %f" % (t2-t1))
    #app.quit()


signal.signal(signal.SIGINT, signal.SIG_DFL)

app = QtCore.QCoreApplication(sys.argv)

#cont = ccda.cda_context()
# None passed to chan - default context will be used
chan = ccda.sdchan(None, "", "linmagx.mc-c208.n45_set")
chan.valueMeasured.connect(new_data)

sys.exit(app.exec_())