From 7673b4b5351e6dafb2e9f11ace5ec1d0492bff12 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 21 Jan 2016 18:55:44 +0100 Subject: [PATCH] * python/spot.py: Make it possible to call str('dot') on formula. --- python/spot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/spot.py b/python/spot.py index 6094a49a3..282f4c26f 100644 --- a/python/spot.py +++ b/python/spot.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2014, 2015 Laboratoire de +# Copyright (C) 2014, 2015, 2016 Laboratoire de # Recherche et Développement de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -188,9 +188,7 @@ class formula: # can still be used outside of IPython if IPython is not # installed. from IPython.display import SVG - ostr = ostringstream() - print_dot_psl(ostr, self) - return SVG(_ostream_to_svg(ostr)) + return SVG(_str_to_svg(self.to_str('d'))) def to_str(self, format='spot', parenth=False): if format == 'spot' or format == 'f': @@ -207,6 +205,10 @@ class formula: return str_latex_psl(self, parenth) elif format == 'sclatex' or format == 'X': return str_sclatex_psl(self, parenth) + elif format == 'dot' or format == 'd': + ostr = ostringstream() + print_dot_psl(ostr, self) + return ostr.str().encode('utf-8') else: raise ValueError("unknown string format: " + format) -- GitLab