test_com_nogl.py 956 Bytes
Newer Older
Yori Fournier's avatar
Yori Fournier committed
1
2
3
4
5
6
7
8
9
10
11
12
import threading

from serverside.myIOs import readStupidData
from serverside.figTest import FigTest as FigTests
from clientside.figTest import FigTest as FigTestc

SERVER_IOFUNCTIONS = {'readStupidData': readStupidData}
SERVER_FIGURES = {'FigTest': FigTests}

import serverside.myplotlib as mpl_server
import clientside.myplotlib as mpl_client

13
server = mpl_server.MplServer2(port=12345, knownFunctions=SERVER_IOFUNCTIONS, knownFigures=SERVER_FIGURES)
Yori Fournier's avatar
Yori Fournier committed
14
15
client = mpl_client.MplClient2()

Yori Fournier's avatar
Yori Fournier committed
16
server.run(as_daemon=True)
17
18
19
print "Server loop running in thread:", server.server_thread.name
client.connect(('', 12345))
print("Client is now connected")
Yori Fournier's avatar
Yori Fournier committed
20

21
# create a figure
Yori Fournier's avatar
Yori Fournier committed
22
client.readData('readStupidData', 'data1')
23
24
25
26
27
28
29
30
31
32
fig1 = client.newSyncFigure(FigTestc, ('data1',))

# update test
fig1.update(xRange=[-2, 2],yRange=[-2, 2])

# multiple figures
fig2 = client.newSyncFigure(FigTestc, ('data1',), xRange=[-1.5, 1.5], yRange=[-1.5, 1.5])

fig1.deSyncFig()
fig2.deSyncFig()