Commit f4bdcba0 authored by Yori Fournier's avatar Yori Fournier
Browse files

server-side of the tested version. Now figure is created on

both side. newSyncFigure works
parent c3c2e65d
......@@ -103,13 +103,14 @@ if D_HIERARCHY in ('CLIENT', 'client'):
elif(D_HIERARCHY in ('SERVER', 'server')):
# MyAxes: Overlay on matplotlib.Axes class
from .myAxes_server import MyAxes_server as MyAxes
# MyFig: Overlay on matplotlib.Figure class
from .myFig_server import MyFig_server as MyFig
# from .test import FigTestServer
from .test import FigTest
elif D_HIERARCHY in ('LOCAL', 'local'):
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# ================= FILE HEADER ========================================
......
......@@ -4,9 +4,10 @@ from . import D_PORT
from . import INFO, DBUG, WARN, SEVR, SPCE
from . import readStupidData
from . import FigTest
G_RAWDATA = {}
G_FIGURES = {}
class Server():
......@@ -53,6 +54,7 @@ class Server():
except:
print(WARN+"I could not execute the command")
print(SPCE+'Received: '+str(signal))
print(SPCE+'Received: '+eval(str(signal)))
print(SPCE+"I expect '(header, content)'")
answer = ('readData', None, 'answer not correct format')
return(answer)
......@@ -90,6 +92,34 @@ class Server():
answer = ('readData', None, 'function could not be executed')
return(answer)
elif header in ('newSyncFigure'):
try:
(figClass, rawdata, kwargs) = eval(str(content))
except:
print(WARN+"The content of readData could not be extracted")
print(SPCE+'Received: '+str(content))
print(SPCE+"I expect '(figClass, rawdata, kwargs)'")
answer = ('newSyncFigure', None, 'could not extract content')
return(answer)
if(True):
# try:
# print(figClass.__name__, rawdata, kwargs)
FigID = 'Test'
datas = "("
for raw in eval(rawdata):
datas = datas + "G_RAWDATA['"+raw+"'],"
datas = datas + ")"
print(datas)
print(figClass+'('+str(datas)+', '+kwargs+')')
G_FIGURES[FigID] = eval(figClass+'('+str(datas)+', '+kwargs+')')
answer = ('newSyncFigure', FigID, '')
# except:
# print(WARN+"The required fig could not be created")
# answer = ('newSyncFigure', None, 'could not create the Figure')
# return(answer)
else:
print(WARN+"I don't know ths signal, sorry")
answer = ('readData', None, 'signal unknown')
......
......@@ -12,9 +12,8 @@ if D_HIERARCHY in ('CLIENT', 'client'):
# ]
elif D_HIERARCHY in ('SERVER', 'server'):
pass
# from .axTestServer import AxTestServer
# from .figTestServer import FigTestServer
from .axTestServer import AxTestServer
from .figTestServer import FigTestServer as FigTest
# from .tests_server import myTest
# from .tests_server import test100
......
......@@ -51,8 +51,11 @@ else:
print(SEVR+"This is atest for the server, the imports are not correct.")
raise ImportError
print(INFO+"Just before Imported my Axes")
from .. import MyAxes
print(INFO+"Imported my Axes")
D_XRANGE = None
D_YRANGE = None
D_LOGY = False
......
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