diff --git a/mt/ptcal/dapi.py b/mt/ptcal/dapi.py index 4c621822..d859440a 100644 --- a/mt/ptcal/dapi.py +++ b/mt/ptcal/dapi.py @@ -101,6 +101,7 @@ def configure(self,graph,type,pl2gi,ex,pLabel=None,attr=None,journal=None) : for the caller to do with them what he wants... ''' def __raise(self,msg) : self._ex['$err'] = msg + print("Error: " + str(msg)) raise RuntimeError(msg) @@ -212,7 +213,9 @@ def _getAllNodes(self,fulltypes=None) : pLabels.append(pLabel) return pLabels - + def _getNodesFromLabels(self, pLabels): + nodes = [self._graph.vs[self._pl2gi[pLabel]] for pLabel in pLabels] + return nodes def _getNeighbors(self,dir,type,pLabel) : if not self._type.startswith('pattern') : diff --git a/mt/ptcal/dcal.py b/mt/ptcal/dcal.py index 93e6c7b3..7db5e2a5 100644 --- a/mt/ptcal/dcal.py +++ b/mt/ptcal/dcal.py @@ -128,6 +128,7 @@ def __init__(self,dAPI) : 'getAttrNames' : dAPI._getAttrNames, 'setAttr' : dAPI._setAttr, 'getAllNodes' : dAPI._getAllNodes, + 'getNodesFromLabels' : dAPI._getNodesFromLabels, 'getNeighbors' : dAPI._getNeighbors, 'isConnectionType' : dAPI._isConnectionType, 'httpReq' : dAPI._httpReq, diff --git a/users/(default)/Formalisms/Workflows/Templates/CreateDSL.model b/users/(default)/Formalisms/Workflows/Templates/CreateDSL.model index cee3742d..c11c6d94 100644 --- a/users/(default)/Formalisms/Workflows/Templates/CreateDSL.model +++ b/users/(default)/Formalisms/Workflows/Templates/CreateDSL.model @@ -4892,7 +4892,7 @@ "0": { "parameterList": { "type": "string", - "value": "" + "value": "{2:/Formalisms/__LanguageSyntax__/SimpleClassDiagram/SimpleClassDiagram.umlIcons.metamodel,4:.model,7:/Formalisms/__LanguageSyntax__/ConcreteSyntax/ConcreteSyntax.defaultIcons.metamodel,9:Icons.model,3:Create the metamodel,8:Create the Concret Syntax,10:Icons.model,11:.model,13:Icons.model}" }, "$type": "/Formalisms/Workflows/Workflows/Parameters" }, @@ -4906,7 +4906,7 @@ "2": { "Location@2": { "type": "string", - "value": "" + "value": "/Formalisms/__LanguageSyntax__/SimpleClassDiagram/SimpleClassDiagram.uml" }, "extension": { "type": "string", @@ -4978,7 +4978,7 @@ "7": { "Location@2": { "type": "string", - "value": "" + "value": "/Formalisms/__LanguageSyntax__/ConcreteSyntax/ConcreteSyntax.default" }, "extension": { "type": "string", diff --git a/users/(default)/Formalisms/Workflows/simulate/R_LoadRTParams.model b/users/(default)/Formalisms/Workflows/simulate/R_LoadRTParams.model index 609f3d38..0a677960 100644 --- a/users/(default)/Formalisms/Workflows/simulate/R_LoadRTParams.model +++ b/users/(default)/Formalisms/Workflows/simulate/R_LoadRTParams.model @@ -1462,7 +1462,7 @@ "108": { "Action": { "type": "code", - "value": "data = ''\nc = 0\nmsg = ''\ntxt = ''\nParameterId = 0\nwidgets = '{\"widgets\":['\nnodes = getAllNodes()\nnodes = sorted(nodes, key=lambda a:int(getAttr('$atompmId', a)))\n#print nodes\n\nfor n in nodes:\n\tif getAttr('$type', n) != u'/Formalisms/Workflows/Workflows/Parameters' :\n\t\text = ''\n\t\tlabel = ''\t\t\n\t\tfor a in sorted(getAttrNames(n),reverse=True):\n\t\t\tif a[0] != '$' and a not in ['parameterList','current','Duration','Executing','Message','Name','Mode','tarParam','srcParam','id','chosen','iterations','isTrue','condition'] and str(getAttr(a, n))!= '%' :\n\t\t\t\ts = str(getAttr('$ft__', n))\n\t\t\t\tb = s.split('/')\n\t\t\t\tif b[-1] not in ['InitialNode','FinalNode','ForkNode','JoinNode','DecisionNode','IterationNode','Link','Flow','Alternative','Dependency','ExecTransformation','GenerateAS','GenerateCS', 'EditModel','VerifyAS']:\n\t\t\t\t\tif data and a != 'extension': \n\t\t\t\t\t\tdata += ','\n\t\t\t\t\tif c > 0 and a != 'name': \n\t\t\t\t\t\twidgets += ','\n\t\t\t\t\tc +=1\n\t\t\t\t\tif a == 'extension' and str(getAttr(a, n)) != '':\n\t\t\t\t\t\text = str(getAttr(a, n))\n\t\t\t\t\t\tc = c-1\n\t\t\t\t\t\twidgets = widgets.rstrip(',')\n\t\t\t\t\telif a == 'name' :\n\t\t\t\t\t\tif str(getAttr(a, n))!= '':\n\t\t\t\t\t\t\tlabel = str(getAttr(a, n))\n\t\t\t\t\t\tc = c-1\t\n\t\t\t\t\t\tdata = data.rstrip(',')\n\t\t\t\t\telse:\n\t\t\t\t\t\tdata += getAttr('$atompmId', n)+':'+ext\n\t\t\t\t\t\t#print str(getAttr('$atompmId', n))+str(a)+b[-1]+':'+str(getAttr(a, n))+ext\n\t\t\t\t\t\twidgets += '{\"id\":\"'+getAttr('$atompmId', n)+'\",\"type\":\"input\",\"label\":\"'+label+'('+b[-1]+')'+str(a)+'\",\"default\":\"'+getAttr(a, n)+'\"}'\n\t\t\t\t\t\t#print widgets\n\t\t\telif a == 'Message':\n\t\t\t\tif getAttr(a, n) is not None :\t\t\t\t\n\t\t\t\t\ttxt = str(getAttr(a, n))\n\t\t\t\t\ttxt = txt.replace(',', ';')\n\t\t\t\t\tmsg += getAttr('$atompmId', n)+':'+txt+','\n\telse:\n\t\tParameterId = str(getAttr('$atompmId', n))\n\t\t#print ParameterId\nwidgets += '],\"title\":\"Parameters\"}'\n#print '=========================================================' + widgets\ndata = '{'+data\ndata += '}'\nmsg = msg.rstrip(',')\n#print data\n#print msg\n#label += widgets\nhttpReq(\n 'PUT',\n None,\n '/GET/console',\n {'text':'CLIENT_BDAPI :: {\"func\":\"_openNewDialog\",\"args\":{\"args\":'+widgets+',\"labels\":\"'+data+'\",\"paramId\":\"'+ParameterId+'\",\"msg\":\"'+msg+'\"}}'})" + "value": "data = ''\nc = 0\nmsg = ''\ntxt = ''\nParameterId = 0\nwidgets = '{\"widgets\":['\n\npLabels = getAllNodes()\nnodes = getNodesFromLabels(pLabels)\nnodes = sorted(nodes, key=lambda a:int(a['$atompmId']))\n\nfor i, n in enumerate(nodes):\n\t#print(\"Node: \" + str(n))\n\n\tif n['$type'] != u'/Formalisms/Workflows/Workflows/Parameters' :\n\t\text = ''\n\t\tlabel = ''\n\n\t\tpLabel = pLabels[i]\n\t\tfor a in sorted(getAttrNames(pLabel),reverse=True):\n\n\t\t\tif a[0] != '$' and a not in ['parameterList','current','Duration','Executing','Message','Name','Mode','tarParam','srcParam','id','chosen','iterations','isTrue','condition'] and str(n[a])!= '%' :\n\t\t\t\ts = str(n['$ft__'])\n\t\t\t\tb = s.split('/')\n\t\t\t\tif b[-1] not in ['InitialNode','FinalNode','ForkNode','JoinNode','DecisionNode','IterationNode','Link','Flow','Alternative','Dependency','ExecTransformation','GenerateAS','GenerateCS', 'EditModel','VerifyAS']:\n\t\t\t\t\tif data and a != 'extension':\n\t\t\t\t\t\tdata += ','\n\t\t\t\t\tif c > 0 and a != 'name':\n\t\t\t\t\t\twidgets += ','\n\t\t\t\t\tc +=1\n\t\t\t\t\tif a == 'extension' and str(n[a]) != '':\n\t\t\t\t\t\text = str(n[a])\n\t\t\t\t\t\tc = c-1\n\t\t\t\t\t\twidgets = widgets.rstrip(',')\n\t\t\t\t\telif a == 'name' :\n\t\t\t\t\t\tif str(n[a])!= '':\n\t\t\t\t\t\t\tlabel = str(n[a])\n\t\t\t\t\t\tc = c-1\n\t\t\t\t\t\tdata = data.rstrip(',')\n\t\t\t\t\telse:\n\t\t\t\t\t\tdata += n['$atompmId']+':'+ext\n\t\t\t\t\t\t#print str(n['$atompmId'])+str(a)+b[-1]+':'+str(n[a])+ext\n\t\t\t\t\t\twidgets += '{\"id\":\"'+n['$atompmId']+'\",\"type\":\"input\",\"label\":\"'+label+'('+b[-1]+')'+str(a)+'\",\"default\":\"'+n[a]+'\"}'\n\t\t\t\t\t\t#print widgets\n\t\t\telif a == 'Message':\n\n\t\t\t\tif n[a] is not None :\n\t\t\t\t\ttxt = n[a]\n\t\t\t\t\ttxt = txt.replace(',', ';')\n\t\t\t\t\tmsg += n['$atompmId']+':'+txt+','\n\telse:\n\n\t\tParameterId = str(n['$atompmId'])\n\t\t#print(ParameterId)\nwidgets += '],\"title\":\"Parameters\"}'\n#print '=========================================================' + str(widgets)\ndata = '{'+data\ndata += '}'\nmsg = msg.rstrip(',')\n#print data\n#print msg\n#label += widgets\nhttpReq(\n\t'PUT',\n\tNone,\n\t'/GET/console',\n\t{'text':'CLIENT_BDAPI :: {\"func\":\"_openNewDialog\",\"args\":{\"args\":'+widgets+',\"labels\":\"'+data+'\",\"paramId\":\"'+ParameterId+'\",\"msg\":\"'+msg+'\"}}'})" }, "$type": "/Formalisms/__Transformations__/TransformationRule/TransformationRule/RHS" },