From 58a66a2f358b4230f4cda92d1fe7d80a737907dd Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 29 May 2015 16:59:45 +0300 Subject: [PATCH] Drules dumper for debugging style refactorings --- tools/python/stylesheet/drules_dump.py | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tools/python/stylesheet/drules_dump.py diff --git a/tools/python/stylesheet/drules_dump.py b/tools/python/stylesheet/drules_dump.py new file mode 100755 index 0000000000..daf431a89e --- /dev/null +++ b/tools/python/stylesheet/drules_dump.py @@ -0,0 +1,28 @@ +#!/usr/bin/python +# Dumps hashes of protobuffed drules +import sys, re +import itertools +import drules_struct_pb2 + +if len(sys.argv) < 2: + print 'Usage: {} '.format(sys.argv[0]) + sys.exit(1) + +drules = drules_struct_pb2.ContainerProto() +drules.ParseFromString(open(sys.argv[1]).read()) +result = [] + +for elem in drules.cont: + if not elem.element: + continue + for el in elem.element: + zoom = el.scale + if zoom <= 0: + continue + for l in itertools.chain(el.lines, (el.caption, el.path_text, el.circle, el.area, el.symbol)): + if l.HasField('priority'): + l.ClearField('priority') + result.append('{} z{}: {}'.format(elem.name, zoom, re.sub(r'[\r\n\s]+', ' ', str(el)))) + +for line in sorted(result): + print line