returnStatus(False,"I could not create the requested Figure. I tried: "+str(FigClass.__name__)+'('+str(datas)+', '+str(kwargs)+')'+" Exception details where:"+str(e.message)+str(e.args))
ifFigIDinG_FIGURES:
returnStatus(True,"SERVER: I created the requested Figure with following instructions"+str(FigClass.__name__)+str(datas)+'('+str(args)+', '+str(kwargs)+')')
# add the figure to the global index
G_FIGURES[fig.getFigID()]=fig
deftreatUpdateSyncFigure(self,content):
pass
iffig.getFigID()inG_FIGURES:
returnAnswer(fig.getFigID())
deftreatSyncFigFormatRawData(self,figID):
defgetFigByID(self,figID):
""" Identify the figure by ID and return it. On error it will return a Status Signal"""
# Identify the figure
fig=G_FIGURES.get(figID,None)
...
...
@@ -99,6 +99,33 @@ class MplHandler(SocketServer.StreamRequestHandler):
elifisinstance(fig,MyFig):
ifDEBUG:
print('Figure ',figID,' found in database')
returnfig
deftreatUpdateSyncFigure(self,content):
""" If client request an update of the keywords of a figure. This function forwards the request to the corresponding figure"""
figID,kwargs=content
fig=self.getFigByID(figID)
# if an error occured forward the signal
ifisinstance(fig,Signal):
returnfig
status=fig.update(**kwargs)
ifstatus:
returnStatus(True,'Kewords of figure ID: '+figID+' successfully updated')
else:
returnStatus(False,'Kewords of figure ID: '+figID+' could not be updated')
deftreatSyncFigFormatRawData(self,figID):
# Identify the figure
fig=self.getFigByID(figID)
# if an error occured forward the signal
ifisinstance(fig,Signal):
returnfig
# Format the rawdata
try:
...
...
@@ -238,8 +265,18 @@ class MplServer2(SocketServer.TCPServer):