Ejemplo n.º 1
0
 def do_graph(self, context, *args):
     "usage: graph [<gtype> [<file> [<img_format>]]]"
     if args and args[0] == "exportsettings":
         return utils.save_graphviz_file(userdir.GRAPHVIZ_USER_FILE, constants.graph)
     rc, gtype, outf, ftype = ui_utils.graph_args(args)
     if not rc:
         context.fatal_error("Failed to create graph")
     rc, d = utils.load_graphviz_file(userdir.GRAPHVIZ_USER_FILE)
     if rc and d:
         constants.graph = d
     set_obj = mkset_obj()
     if not outf:
         rc = set_obj.show_graph(gtype)
     elif gtype == ftype:
         rc = set_obj.save_graph(gtype, outf)
     else:
         rc = set_obj.graph_img(gtype, outf, ftype)
     return rc
Ejemplo n.º 2
0
 def do_graph(self, context, *args):
     "usage: graph [<gtype> [<file> [<img_format>]]]"
     if args and args[0] == "exportsettings":
         return utils.save_graphviz_file(userdir.GRAPHVIZ_USER_FILE,
                                         constants.graph)
     rc, gtype, outf, ftype = ui_utils.graph_args(args)
     if not rc:
         context.fatal_error("Failed to create graph")
     rc, d = utils.load_graphviz_file(userdir.GRAPHVIZ_USER_FILE)
     if rc and d:
         constants.graph = d
     set_obj = mkset_obj()
     if not outf:
         rc = set_obj.show_graph(gtype)
     elif gtype == ftype:
         rc = set_obj.save_graph(gtype, outf)
     else:
         rc = set_obj.graph_img(gtype, outf, ftype)
     return rc
Ejemplo n.º 3
0
 def do_graph(self, context, t, *args):
     "usage: graph <pe> [<gtype> [<file> [<img_format>]]]"
     pe_f = self._get_diff_pe_input(t)
     if not pe_f:
         return False
     rc, gtype, outf, ftype = ui_utils.graph_args(args)
     if not rc:
         return False
     rc, d = utils.load_graphviz_file(userdir.GRAPHVIZ_USER_FILE)
     if rc and d:
         vars.graph = d
     set_obj = self._pe_config_obj(pe_f)
     if not outf:
         rc = set_obj.show_graph(gtype)
     elif gtype == ftype:
         rc = set_obj.save_graph(gtype, outf)
     else:
         rc = set_obj.graph_img(gtype, outf, ftype)
     if context.previous_level_is("cibconfig"):
         cib_factory.refresh()
     return rc
Ejemplo n.º 4
0
 def do_graph(self, context, t, *args):
     "usage: graph <pe> [<gtype> [<file> [<img_format>]]]"
     pe_f = self._get_diff_pe_input(t)
     if not pe_f:
         return False
     rc, gtype, outf, ftype = ui_utils.graph_args(args)
     if not rc:
         return False
     rc, d = utils.load_graphviz_file(userdir.GRAPHVIZ_USER_FILE)
     if rc and d:
         vars.graph = d
     set_obj = self._pe_config_obj(pe_f)
     if not outf:
         rc = set_obj.show_graph(gtype)
     elif gtype == ftype:
         rc = set_obj.save_graph(gtype, outf)
     else:
         rc = set_obj.graph_img(gtype, outf, ftype)
     if context.previous_level_is("cibconfig"):
         cib_factory.refresh()
     return rc