bioweb  0.09.92
C++/Python(django)/JavaScript(angularJS) framework
views.py
Go to the documentation of this file.
1 ## @file calcpy/views.py
2 # @brief calculation library interface to client
3 
4 """
5 calc library interface to client
6 
7 export calculation results to client
8 """
9 import calc
10 
11 def getNumber(params):
12  """the calculation from C++ library"""
13  return {
14  "number" : calc.getNumber()
15  }
16 
17 def getCommands(params):
18  """return the commands descriptors"""
19  cmdmgr = calc.CommandManager()
20  ids = cmdmgr.getIds()
21  out = dict()
22  for i in ids:
23  out[int(i)] = { "state" : str(cmdmgr.getState(i)), "progress": float(cmdmgr.getProgress(i)) }
24  return out
25 
26 def startCommand(params):
27  """start new tick command"""
28  cmdmgr = calc.CommandManager()
29  cmd_id = cmdmgr.start()
30  return cmd_id
31