Commit ba552696 authored by Philipp Gast's avatar Philipp Gast
Browse files

basic tests are working now. New functions introduced. listRemoteData getData

parent 78764ab7
Pipeline #432 failed with stage
in 3 minutes and 7 seconds
......@@ -136,14 +136,8 @@ class MplHandler(SocketServer.StreamRequestHandler):
print(SPCE+"SERVER: Exception details where:",e.message, e.args )
return Status(False,"I couldn't format the rawdata. Exception details where:",e.message, e.args)
# compose the answer
datas = ()
for ax in fig.get_axes():
# ax.data is any user defined object
# ax.packFormattedData returns it's string representation
# to be unpacked by ax.unpackFormattedData
# datas.append(ax.packFormattedData(ax.data))
datas = datas + (ax.data,)
# compose the formated data
datas = tuple(ax.data for ax in fig.get_axes())
return Answer(datas)
......
......@@ -154,19 +154,18 @@ class MyFig_client(Figure):
return state
def reSyncFig(self):
def reSyncFig(self,datanames):
if self.client is not None :
# collect the current state of the figure
state = self.getState()
# call the client to recreate the figure on the server side and analyse the status.
if self.client.reSyncFig(self.syncID,state) :
print('The figure was successfully recreated on the server side')
self.syncID = -1
else :
print('The figure could not be recreated on the server side')
# call the client to create a new figure on the server side
newFig = self.client.newSyncFigure(self.__class__, datanames, **state)
# since the state matches the current instance. only the new syncID is kept.
self.syncID = newFig.syncID
else:
print('The client is not connected to a server yet. Please use the client to set up a sync conection.')
......@@ -279,12 +278,12 @@ class MyFig_client(Figure):
print(SEVR + "The axes name ", name, " was not found")
return None
def getAxesName(self,unknownax) :
""" compares all axes against the function parameter and returns the name of that axes if found in figure"""
for ax in self.get_axes() :
if unknownax == ax :
return ax.name
#~ def getAxesName(self,unknownax) :
#~ """ compares all axes against the function parameter and returns the name of that axes if found in figure"""
#~
#~ for ax in self.get_axes() :
#~ if unknownax == ax :
#~ return ax.name
# FORMAT RAW DATA --------------------------------------------------
def formatRawData(self):
......
......@@ -25,8 +25,8 @@ class FigTest2(MyFig): # Fig wi
frame1 = [0.1, 0.1, 0.4, 0.8] # part of the fig that is available
frame2 = [0.6, 0.1, 0.4, 0.8] # part of the fig that is available
print(self.add_axes(AxTest(self, ratio, frame1),"p1"))
print(self.add_axes(AxTest(self, ratio, frame2),"p2"))
self.add_axes(AxTest(self, ratio, frame1),"p1")
self.add_axes(AxTest(self, ratio, frame2),"p2")
def declareAliases(self):
......
......@@ -25,8 +25,8 @@ class FigTest2(MyFig): # Fig wi
frame1 = [0.1, 0.1, 0.4, 0.8] # part of the fig that is available
frame2 = [0.6, 0.1, 0.4, 0.8] # part of the fig that is available
print(self.add_axes(AxTest(self, ratio, frame1),"p1"))
print(self.add_axes(AxTest(self, ratio, frame2),"p2"))
self.add_axes(AxTest(self, ratio, frame1),"p1")
self.add_axes(AxTest(self, ratio, frame2),"p2")
def declareAliases(self):
......
......@@ -11,7 +11,7 @@ from serverside.figTest import FigTest2 as FigTests2
from clientside.figTest import FigTest2 as FigTestc2
SERVER_IOFUNCTIONS = {'readStupidData': readStupidData,'readStupidData2': readStupidData2}
SERVER_FIGURES = {'FigTest': FigTests,'FigTest2': FigTests}
SERVER_FIGURES = {'FigTest': FigTests,'FigTest2': FigTests2}
import serverside.myplotlib as mpl_server
import clientside.myplotlib as mpl_client
......@@ -32,24 +32,24 @@ client.connect(('localhost', 12345))
client.readData('readStupidData', 'data1')
fig1 = client.newSyncFigure(FigTestc, ('data1',))
#~ win=mpl_client.MyWin(fig1)
#~ sleep(2)
win=mpl_client.MyWin(fig1)
sleep(2)
# update test
fig1.update(xRange=[-2, 2],yRange=[-2, 2])
#~ win.refresh()
#~ sleep(2)
win.refresh()
sleep(2)
# multiple figures with multiple data
client.readData('readStupidData2', 'data2')
print("known datasets: ",client.listRemoteData())
fig2 = client.newSyncFigure(FigTestc2, ('data1','data2'), xRange=[-1.5, 1.5], yRange=[-1.5, 1.5])
#~ fig2 = client.newSyncFigure(FigTestc2, ('data1',), xRange=[-1.5, 1.5], yRange=[-1.5, 1.5])
print('current state:::',fig2.getState())
#~ win=mpl_client.MyWin(fig2)
#~
#~
#~ fig1.deSyncFig()
#~ fig2.deSyncFig()
fig2 = client.newSyncFigure(FigTestc2, ('data1','data2'), xRange_p1=[-2.0, 2.0], xRange_p2=[-3, 3], yRange=[-2.0, 2.0])
print('current state:::',fig2.getState())
win=mpl_client.MyWin(fig2)
sleep(2)
# desync resync test
fig1.deSyncFig()
fig1.reSyncFig(('data1',))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment