From d79c894cab905cd98487192b0e5f1049875b7caa Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Sat, 22 Nov 2008 16:53:58 +0000 Subject: [PATCH] print an error message if graphviz is not found --- helm/software/matita/matitaMathView.ml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/helm/software/matita/matitaMathView.ml b/helm/software/matita/matitaMathView.ml index 63cf77a16..329e27e4f 100644 --- a/helm/software/matita/matitaMathView.ml +++ b/helm/software/matita/matitaMathView.ml @@ -1102,15 +1102,21 @@ class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history) Lazy.force load_easter_egg method private redraw_gviz ?center_on () = - let tmpfile, oc = Filename.open_temp_file "matita" ".dot" in - let fmt = Format.formatter_of_out_channel oc in - MetadataDeps.DepGraph.render fmt gviz_graph; - close_out oc; - gviz#load_graph_from_file ~gviz_cmd:"tred | dot" tmpfile; - (match center_on with - | None -> () - | Some uri -> gviz#center_on_href (UriManager.string_of_uri uri)); - HExtlib.safe_remove tmpfile + if Sys.command "which dot" = 0 then + let tmpfile, oc = Filename.open_temp_file "matita" ".dot" in + let fmt = Format.formatter_of_out_channel oc in + MetadataDeps.DepGraph.render fmt gviz_graph; + close_out oc; + gviz#load_graph_from_file ~gviz_cmd:"tred | dot" tmpfile; + (match center_on with + | None -> () + | Some uri -> gviz#center_on_href (UriManager.string_of_uri uri)); + HExtlib.safe_remove tmpfile + else + MatitaGtkMisc.report_error ~title:"graphviz error" + ~message:("Graphviz is not installed but is necessary to render "^ + "the graph of dependencies amoung objects. Please install it.") + ~parent:win#toplevel () method private dependencies direction uri () = let dbd = LibraryDb.instance () in -- 2.39.2