diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2013-10-22 22:42:52 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2013-10-22 22:42:52 +0200 |
commit | f7337bbc39bbcbb1e41a0aba059ac70162d47fbd (patch) | |
tree | 54a6986a415525d560bfd071342b0e0f950d3559 /lib.py | |
parent | 8180c274b2380ef505f4c4b85e3b677a29fdf823 (diff) | |
download | cluster-overview-f7337bbc39bbcbb1e41a0aba059ac70162d47fbd.tar.gz cluster-overview-f7337bbc39bbcbb1e41a0aba059ac70162d47fbd.tar.xz cluster-overview-f7337bbc39bbcbb1e41a0aba059ac70162d47fbd.zip |
lib: more graceful handling of old xdot (as in PyPI)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'lib.py')
-rw-r--r-- | lib.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -6,6 +6,7 @@ """Custom wrapping of pydot""" from os.path import extsep +from sys import stderr from pydot import Dot, Edge, Node, Subgraph REGISTRY = {} @@ -148,7 +149,8 @@ def xdot_graph(*args, **kwargs): try: import xdot except ImportError: - print 'missing xdot; use "pip install xdot" or equivalent' + print >>stderr, 'missing xdot; (currently) recommended way to grab it:' + print >>stderr, 'pip install --user https://github.com/jrfonseca/xdot.py/archive/master.zip' raise class LibDotWidget(xdot.DotWidget): @@ -262,7 +264,11 @@ def xdot_graph(*args, **kwargs): self._args = args self._kwargs = kwargs self._can_change = True - super(LibDotWindow, self).__init__(LibDotWidget()) + try: + super(LibDotWindow, self).__init__(LibDotWidget()) + except TypeError: + print >>stderr, "xdot too old, you won't get tooltips :-/" + super(LibDotWindow, self).__init__() dotcode = gen_graph(*args, **kwargs).to_string() title = dotcode[dotcode.find('digraph', 0, 512) + len('digraph') : |