diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-27 13:05:05 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-27 13:40:11 +0000 |
commit | b518b4942f66690234d587d4adc1072fa79dc8e2 (patch) | |
tree | cf39bc42de57bea9865cfab15bd0efffbe6fb20f /sources/pyside2/doc | |
parent | b34b8f9d22b86870d2e6ed4170635a3a295a7433 (diff) |
Fix inheritance_diagram.py to run with Python3
- Fix _class_info() to return a real list instead
of list view, fixing:
TypeError: can't pickle dict_values objects
- Enclose font names in quotes, fixing dot complaining
about a syntax error.
- Encode the hash string get_graph_hash(), fixing
TypeError: Unicode-objects must be encoded before hashing
- Pass on options as dict instead of list to render_dot_html(),
render_dot_latex()
Task-number: PYSIDE-363
Task-number: PYSIDE-617
Change-Id: If050b73cf35ac6a6c58c0d3e5ea713c736ea842c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/doc')
-rw-r--r-- | sources/pyside2/doc/inheritance_diagram.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sources/pyside2/doc/inheritance_diagram.py b/sources/pyside2/doc/inheritance_diagram.py index a7f376ccd..cd49906a5 100644 --- a/sources/pyside2/doc/inheritance_diagram.py +++ b/sources/pyside2/doc/inheritance_diagram.py @@ -167,7 +167,7 @@ class InheritanceGraph(object): for cls in classes: recurse(cls) - return all_classes.values() + return list(all_classes.values()) def class_name(self, cls, parts=0): """Given a class object, return a fully-qualified name. @@ -200,8 +200,8 @@ class InheritanceGraph(object): 'shape': 'box', 'fontsize': 10, 'height': 0.25, - 'fontname': 'Vera Sans, DejaVu Sans, Liberation Sans, ' - 'Arial, Helvetica, sans', + 'fontname': '"Vera Sans, DejaVu Sans, Liberation Sans, ' + 'Arial, Helvetica, sans"', 'style': '"setlinewidth(0.5)"', } default_edge_attrs = { @@ -314,7 +314,8 @@ class InheritanceDiagram(Directive): def get_graph_hash(node): - return md5(node['content'] + str(node['parts'])).hexdigest()[-10:] + hashString = node['content'] + str(node['parts']) + return md5(hashString.encode('utf-8')).hexdigest()[-10:] def html_visit_inheritance_diagram(self, node): @@ -336,7 +337,7 @@ def html_visit_inheritance_diagram(self, node): urls[child['reftitle']] = '#' + child.get('refid') dotcode = graph.generate_dot(name, urls, env=self.builder.env) - render_dot_html(self, node, dotcode, [], 'inheritance', 'inheritance', + render_dot_html(self, node, dotcode, {}, 'inheritance', 'inheritance', alt='Inheritance diagram of ' + node['content']) raise nodes.SkipNode @@ -352,7 +353,7 @@ def latex_visit_inheritance_diagram(self, node): dotcode = graph.generate_dot(name, env=self.builder.env, graph_attrs={'size': '"6.0,6.0"'}) - render_dot_latex(self, node, dotcode, [], 'inheritance') + render_dot_latex(self, node, dotcode, {}, 'inheritance') raise nodes.SkipNode |