introduce script that generates widget hirachy

this scripts generates a .svg with a hirachy like:

blue means something is stable, red means, something is beta.

This script requires ete3 to be installed. You can install it via with
pip with: `pip install ete3`

Reviewed-by: Mike Blumenkrantz <>
Differential Revision:
Marcel Hollerbach 3 years ago
parent 691e156aeb
commit 14a6611f23
  1. 99

@ -0,0 +1,99 @@
import sys
import os
from ete3 import Tree, TreeStyle, AttrFace, CircleFace, faces, NodeStyle
import argparse
parser = argparse.ArgumentParser(description='Create a image showing all widgets')
parser.add_argument('sourcedir', metavar='sourcedir', help='the path where to find efls source')
G = parser.parse_args()
sys.path.insert(0, os.path.join(G.sourcedir, 'src', 'scripts', 'pyolian'))
import eolian
from eolian import Eolian_Type_Type
from eolian import Eolian_Type_Builtin_Type
SCAN_FOLDER = os.path.join(G.sourcedir, 'src', 'lib')
eolian_db = eolian.Eolian_State()
if not eolian_db.directory_add(SCAN_FOLDER):
raise(RuntimeError('Eolian, failed to scan source directory'))
# Parse all known eo files
if not eolian_db.all_eot_files_parse():
raise(RuntimeError('Eolian, failed to parse all EOT files'))
if not eolian_db.all_eo_files_parse():
raise(RuntimeError('Eolian, failed to parse all EO files'))
widget = eolian_db.class_by_name_get("Efl.Ui.Widget")
def is_widget(obj, rd = 0):
if obj == widget:
return rd
elif obj.parent != None:
return is_widget(obj.parent, rd + 1)
return -1
list_of_widgets = []
for kl in eolian_db.classes:
widget_depth = is_widget(kl)
if widget_depth != -1:
insert = {
'depth' : widget_depth,
'name' :,
'eolian_obj' : kl,
'beta' : kl.is_beta,
def layout(node):
# Add node name to laef nodes
N = AttrFace("name", fsize=9, fgcolor="black")
faces.add_face_to_node(N, node, 0)
class Widget_Tree():
def __init__(self, name, parent, is_beta): = name
self.children = []
if parent != None:
self.parent = parent
self.tree_node = parent.tree_node.add_child(None,, 1)
self.tree_node = Tree(name =, 'Efl.Ui.Widget', 1)
nstyle = NodeStyle()
if is_beta:
nstyle["fgcolor"] = "red"
nstyle["fgcolor"] = "blue"
def dump(self, prev):
print(prev +
self.children.sort(key = lambda
for c in self.children:
c.dump(prev + " ")
sorted_widgets = sorted(list_of_widgets, key=lambda x: x['depth'])
widget_tree = {}
for widget in sorted_widgets:
if widget['depth'] == 0:
widget_tree[widget['name']] = Widget_Tree(widget['name'], None, widget['beta'])
widget_tree[widget['name']] = Widget_Tree(widget['name'], widget_tree[widget['eolian_obj']], widget['beta'])
ts = TreeStyle()
ts.layout_fn = layout
ts.show_leaf_name = False
ts.show_scale = False
print("Created widget-overview.svg in $CWD")
widget_tree['Efl.Ui.Widget'].tree_node.render("widget-overview.svg", units="mm", tree_style=ts)