From 57f92250b39b1ebb418c0fe627568100ef78337d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 11 Dec 2017 11:58:37 +0100 Subject: [PATCH] uorb graph create.py: sort modules & topics by name length for JSON output --- Tools/uorb_graph/create.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tools/uorb_graph/create.py b/Tools/uorb_graph/create.py index 629a1c19c0..f2126a969e 100755 --- a/Tools/uorb_graph/create.py +++ b/Tools/uorb_graph/create.py @@ -544,7 +544,10 @@ class OutputJSON: nodes = [] # nodes - for module in modules: + # (sort by length, such that short names are last. The rendering order + # will be the same, so that in case of an overlap, the shorter label + # will be on top) + for module in sorted(modules, key=len, reverse=True): node = {} node['id'] = 'm_'+module node['name'] = module @@ -553,7 +556,7 @@ class OutputJSON: # TODO: add url to open module documentation? nodes.append(node) - for topic in topics: + for topic in sorted(topics, key=len, reverse=True): node = {} node['id'] = 't_'+topic node['name'] = topic