From 07eb9fdc4543f42e2659bc255081060e2caa0c6e Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Wed, 6 Nov 2024 22:34:55 +0530 Subject: use ext:node-set to get the node set from the result tree fragment --- blocks/.flake8 | 2 +- blocks/Xcos/MxGraphParser.py | 27 +- blocks/eda-frontend/public/splitblock.xsl | 442 ++++++++++++++---------------- 3 files changed, 224 insertions(+), 247 deletions(-) diff --git a/blocks/.flake8 b/blocks/.flake8 index 7f9fb299..526673c0 100644 --- a/blocks/.flake8 +++ b/blocks/.flake8 @@ -6,4 +6,4 @@ ignore = F401,F403,W504 extend-exclude = docs,env*,migrations,node_modules,Xcos/common,Xcos/blocks,Xcos/ports,Xcos/links max-complexity = 12 -max-line-length = 260 +max-line-length = 275 diff --git a/blocks/Xcos/MxGraphParser.py b/blocks/Xcos/MxGraphParser.py index 350bfb18..773cd1f4 100755 --- a/blocks/Xcos/MxGraphParser.py +++ b/blocks/Xcos/MxGraphParser.py @@ -49,7 +49,7 @@ outmodel.set('as', 'model') def check_point_on_array(array, point, left_right_direction=True): if array is None: return False, array, [] - + pointX = float(point['x']) pointY = float(point['y']) @@ -376,26 +376,19 @@ for root in model: split_point = None split_point2 = None - print('attribid:', attribid) - print('targetVertex:', targetVertex, 'blkgeometry:', targetVertex in blkgeometry) - print('sourceVertex:', sourceVertex, 'blkgeometry:', sourceVertex in blkgeometry) - print('tarx' in attrib and 'tary' in attrib) if 'tarx' in attrib and 'tary' in attrib and (attrib['tarx'] != '0' or attrib['tary'] != '0'): point = {'x': attrib['tarx'], 'y': attrib['tary']} split_point = point - print('SPOINT:', split_point) waypoints.insert(0, point) elif sourceVertex in blkgeometry: vertex = blkgeometry[sourceVertex] point = {'x': vertex['x'], 'y': vertex['y']} waypoints.insert(0, point) - if 'tar2x' in attrib and 'tar2y' in attrib and (attrib['tar2x'] != '0' or attrib['tar2y'] != '0'): point = {'x': attrib['tar2x'], 'y': attrib['tar2y']} split_point2 = point - print('SPOINT2:', split_point2) waypoints.append(point) elif targetVertex in blkgeometry: vertex = blkgeometry[targetVertex] @@ -432,20 +425,20 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoi for attribid2 in sourceVertex, targetVertex: try: linkSegments = newEdgeDict[attribid2] - print('linkSegments:',linkSegments) + print('linkSegments:', linkSegments) except KeyError: continue print('split_point:', split_point, linkSegments) result, i, left_array, right_array = identify_segment(linkSegments, split_point) print('LR:', left_array, right_array) - print('waypoints:',waypoints) + print('waypoints:', waypoints) if not result: sys.exit(0) (linkid, sourceVertex2, targetVertex2, sourceType2, targetType2, style2, waypoints2, addSplit2, split_point, split_point2) = linkSegments[i] - print('SP2:',split_point2) + print('SP2:', split_point2) array3 = waypoints - print('ARRAY3:',array3) + print('ARRAY3:', array3) componentOrdering += 1 geometry = {} @@ -467,23 +460,23 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoi outputCount = 0 port1 = nextattribid (inputCount, outputCount, nextattribid, nextAttribForSplit) = addPort1ForSplit(outroot, splitblockid, sourceVertex2, targetVertex2, sourceType, targetType, sourceType2, targetType2, inputCount, outputCount, nextattribid, nextAttribForSplit, left_array) - print('nextAttribForSplit1:',nextAttribForSplit) + print('nextAttribForSplit1:', nextAttribForSplit) port2 = nextattribid (inputCount, outputCount, nextattribid, nextAttribForSplit) = addPort2ForSplit(outroot, splitblockid, sourceVertex2, targetVertex2, sourceType, targetType, sourceType2, targetType2, inputCount, outputCount, nextattribid, nextAttribForSplit, right_array) - print('nextAttribForSplit2:',nextAttribForSplit) + print('nextAttribForSplit2:', nextAttribForSplit) port3 = nextattribid (inputCount, outputCount, nextattribid, nextAttribForSplit) = addPort3ForSplit(outroot, splitblockid, sourceVertex, targetVertex, sourceType, targetType, sourceType2, targetType2, inputCount, outputCount, nextattribid, nextAttribForSplit, array3) - print('nextAttribForSplit3:',nextAttribForSplit) + print('nextAttribForSplit3:', nextAttribForSplit) newEdgeDict[attribid2][i] = ((nextAttribForSplit, sourceVertex2, port1, sourceType2, targetType, style2, left_array, addSplit2, split_point2)) nextAttribForSplit += 1 newEdgeDict[attribid2].insert(i + 1, (nextAttribForSplit, port2, targetVertex2, sourceType, targetType2, style2, right_array, addSplit2, split_point2)) nextAttribForSplit += 1 for (__, __, __, __, __, __, tmp_array, __, tmp_split_point) in newEdgeDict[attribid2]: - print('NEWEDGE2:', attribid2, tmp_array, tmp_split_point ) + print('NEWEDGE2:', attribid2, tmp_array, tmp_split_point) newEdgeDict[attribid] = [(nextAttribForSplit, port3, targetVertex, sourceType, targetType, style, waypoints, addSplit, split_point)] nextAttribForSplit += 1 for (__, __, __, __, __, __, tmp_array, __, tmp_split_point) in newEdgeDict[attribid]: - print('NEWEDGE3:', attribid, tmp_array, tmp_split_point ) + print('NEWEDGE3:', attribid, tmp_array, tmp_split_point) print() for key, newEdges in newEdgeDict.items(): diff --git a/blocks/eda-frontend/public/splitblock.xsl b/blocks/eda-frontend/public/splitblock.xsl index cfc18a5c..edb8977b 100644 --- a/blocks/eda-frontend/public/splitblock.xsl +++ b/blocks/eda-frontend/public/splitblock.xsl @@ -1,7 +1,12 @@ - + + - + @@ -47,10 +52,10 @@ - - + + - + @@ -65,59 +70,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + - - - --> - - - - - - - - + + - + - + @@ -126,9 +119,9 @@ - + - + @@ -143,12 +136,12 @@ - + - + - + @@ -185,9 +178,9 @@ sourcePoint - + @@ -196,56 +189,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -288,26 +281,29 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -329,35 +325,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -379,13 +373,13 @@ - + - + - + No match found @@ -393,13 +387,13 @@ - + - + - + No match found @@ -407,13 +401,13 @@ - + - + - + No match found @@ -421,13 +415,13 @@ - + - + - + No match found @@ -435,136 +429,126 @@ - - - - + + + + - - - - - - - No match found - - - - - - - - - - - - - - - - - - - No match found - - + + + + + + No match found + + + + - - - - - - - - - - - - - - - No match found - - + + + + + + + + + + + + + + No match found + + + + - - - - - - - - - - - + + + + + + + + + + + + + + No match found + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - - - - - - - + + + + + + + - - - - - + + + + + - - + + -- cgit