Commit 8d7accf3 authored by Yori Fournier's avatar Yori Fournier
Browse files

Merge branch '63-cleaning-server-client-renovation' of...

Merge branch '63-cleaning-server-client-renovation' of gitlab.aip.de:yfournier/myplotlib into 63-cleaning-server-client-renovation
parents 7637a447 e3b890d7
Pipeline #400 failed with stage
in 1 minute and 25 seconds
......@@ -18,7 +18,7 @@ class MplClient(object):
self.ip = ip
self.port = port
# just a list of names
self.currentRemoteData = []
#~ self.currentRemoteData = []
# PACK SIGNAL ------------------------------------------------------
def packSignal(self, unpackedSignal):
......
......@@ -3,11 +3,11 @@ import pickle
#from .signal import Signal, Status, Answer
#from .signal import Query as Server_Query
from . import Query, Status, Answer, Signal
debug = True
from . import DBUG,WARN,SPCE,SEVR,INFO
from . import MplUnpickler
from . import MyData
debug = True
class MplClient2():
......@@ -118,9 +118,14 @@ class MplClient2():
if not status :
print('something went wrong with the sending of newSincFigure request...')
statusSig = self.waitForSignal()
# try to create a figure of the same class on the client side
if self.testStatusSig(query,statusSig) :
fig = figname(dataname,*args,**kwargs)
print('trying to create a figure of the same class on the client side')
fig = figname((MyData(),),*args,**kwargs)
# Link the temporary Sync Figure
fig.syncID = '26042017'
fig.client = self
return fig
#~ def updateSyncFigure()
......@@ -190,9 +195,6 @@ class MplClient2():
print('instead if answer a error was received')
datas = (None,)
else :
status = self.send(Signal(True,'Answer received'))
if status :
rt = self.waitForSignal()
# set the figure data to answerSig.value
datas = formatedData.content
return datas
......@@ -84,8 +84,6 @@ class MplHandler(SocketServer.StreamRequestHandler):
if FigID in G_FIGURES :
return Status(True,"SERVER: I created the requested Figure with following instructions"+str(FigClass.__name__)+str(datas)+'('+str(args)+', '+str(kwargs)+')')
return False #should never get here
def treatUpdateSyncFigure(self,content) :
pass
......@@ -120,19 +118,7 @@ class MplHandler(SocketServer.StreamRequestHandler):
# datas.append(ax.packFormattedData(ax.data))
datas = datas + (ax.data,)
answer = Answer(datas)
# Send the packed Formatted data
status = self.send(answer)
# If failed
if not status:
print('sending answer to request SYNCFIGFORMATRAWDATA failed')
# Wait for the client receipt
status = self.waitForReceipt(conn)
return Status(True,'round trip complet')
return Answer(datas)
def send(self,sig):
# pickel the signal
......
......@@ -30,7 +30,7 @@ class Query(Signal) :
pass
elif queryType == Query.SYNCFIGFORMATRAWDATA :
pass
self.content = content
......
......@@ -80,3 +80,19 @@ class AxTest(MyAxes):
print(DBUG + 'I formatted the raw data!')
return(True)
def plotting(self):
xRange = self.keywords.get('xRange')
yRange = self.keywords.get('yRange')
try:
self.plot(self.data['xdata'], self.data['ydata'])
except KeyError:
print(SEVR + 'The formatting of the data was apparently wrong. --> EXIT')
return(False)
if (xRange): self.set_xlim(xRange)
if (yRange): self.set_ylim(yRange)
return(True)
# IMPORT ---------------------------------------------------------------
from .. import D_HIERARCHY
from .. import SEVR, DBUG, INFO
from myplotlib import MyFig
from axTest import AxTest
if D_HIERARCHY in ('SERVER', 'server'):
print(INFO+"Testing the server.")
else:
print(SEVR+"This is atest for the server, the imports are not correct.")
raise ImportError
from .. import MyFig
from . import AxTestServer
class FigTestServer(MyFig):
class FigTest(MyFig):
FIGSIZE = (8., 6.)
......@@ -20,4 +11,4 @@ class FigTestServer(MyFig):
ratio = 6. / 8. # height/width of the axes (in inch)
frame1 = [0.1, 0.1, 0.8, 0.8] # part of the fig that is available
self.add_axes(AxTestServer(self, ratio, frame1), "p1")
self.add_axes(AxTest(self, ratio, frame1), "p1")
from myplotlib import INFO, DBUG, WARN, SEVR, SPCE
......@@ -42,6 +42,7 @@
#
#
# IMPORT ---------------------------------------------------------------
from . import INFO, DBUG, WARN, SEVR, SPCE
from myplotlib import MyAxes
D_XRANGE = None
......
import threading
from time import sleep
from serverside.myIOs import readStupidData
from serverside.figTest import FigTest
from serverside.figTest import FigTest as FigTests
from clientside.figTest import FigTest as FigTestc
SERVER_IOFUNCTIONS = {'readStupidData': readStupidData}
SERVER_FIGURES = {'FigTest': FigTest}
SERVER_FIGURES = {'FigTest': FigTests}
import serverside.myplotlib as mpl_server
import clientside.myplotlib as mpl_client
......@@ -22,7 +24,7 @@ print "Server loop running in thread:", server_thread.name
client.connect(('', 50803))
#query = mpl_client.Query(0, None)
#print(query.__class__)
client.readData('readStupidData', 'data1')
fig = client.newSyncFigure(FigTestc, ('data1',))
win=mpl_client.MyWin(fig)
sleep(10)
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