def write_view_hierarchy_overlay_nodes()

in plugin/src/py/android_screenshot_tests/pull_screenshots.py [0:0]


def write_view_hierarchy_overlay_nodes(hierarchy, html, parent_id):
    if not hierarchy:
        return

    to_output = Queue()
    to_output.put(hierarchy)
    while not to_output.empty():
        node = to_output.get()
        left = node[KEY_LEFT]
        top = node[KEY_TOP]
        width = node[KEY_WIDTH] - 4
        height = node[KEY_HEIGHT] - 4
        id = get_view_hierarchy_overlay_node_id(node)
        node_html = """
        <div
          class="hierarchy-node"
          style="left:%dpx;top:%dpx;width:%dpx;height:%dpx;"
          id="%s-%s"></div>
        """
        html.write(node_html % (left, top, width, height, parent_id, id))

        if KEY_CHILDREN in node:
            for child in node[KEY_CHILDREN]:
                to_output.put(child)