Commit 384fa456 authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

In between commit

Can now create a figure on the server side

Now requires the figure client
parent c3c2e65d
......@@ -96,10 +96,12 @@ if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'):
if D_HIERARCHY in ('CLIENT', 'client'):
# MyAxes: Overlay on matplotlib.Axes class
from .myAxes import MyAxes_client as MyAxes
from .myAxes_client import MyAxes_client as MyAxes
# MyFig: Overlay on matplotlib.Figure class
from .myFig import MyFig_client as MyFig
from .myFig_client import MyFig_client as MyFig
from .serverInterface import ServerInterface
elif(D_HIERARCHY in ('SERVER', 'server')):
......
......@@ -50,7 +50,7 @@ from . import rcParams
# Class MyAxes Overwriting Matplotlib.figure.Axes
class MyAxes(Axes):
class MyAxes_client(Axes):
# CONSTRUCTOR --------------------------------------------------------
def __init__(self, fig, ratio, frameRect, *args, **kwargs):
......
......@@ -32,7 +32,15 @@ class ServerInterface(object):
def newSyncFigure(self, figClass, symbolicRawdata, **kwargs):
syncFigure = figClass(symbolicRawdata, **kwargs)
# syncFigure = figClass(symbolicRawdata, **kwargs)
content = "['"+str(figClass.__name__)+"', \""+str(symbolicRawdata)+"\", '"+str(kwargs)+"']"
signal = "("+"'newSyncFigure'"+", "+str(content)+")"
sock = self.sendSignal(signal)
answer = self.waitForAnswer(sock)
header, content, errmsg = eval(answer)
# create a socket
# connect to ip:port
......@@ -41,12 +49,21 @@ class ServerInterface(object):
# response is [ID, errormsg]
# ID = -1 no figure were created
# maybe error msg?
ID = 1
ID = content
# if ok then create syncFigure.
if ID is not None:
syncFigure = figClass(symbolicRawdata, **kwargs)
syncFigure.syncID = ID
else:
print(WARN + 'The server could not create the figure')
print(errmsg)
syncFigure = None
# add the identifier of the server-side figure
syncFigure.syncID = ID
#syncFigure.syncID = ID
# return the syncFigure
# return(True)
return(syncFigure)
def sendSignal(self, signal):
......
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