def test_influence(self):
        opts = ModelOptions()
        opts.vizType = "inf"

        mdl = parseModel(
            self.readOrgFile("tests/badOrgFiles/simpleInfluence.org"))

        conv = ModelToGraphVizConverter(opts)
        conv.getModelAsDot(mdl)
示例#2
0
def main():
    global args

    args = getArgumentParser().parse_args()

    logging.getLogger().setLevel(args.logging)
    logging.basicConfig(format="[%(levelname)s] %(message)s ")

    logging.debug("Teams: %s", str(args.teams))

    opts = ModelOptions()
    opts.skipDrawingLegend = args.skipDrawingLegend
    opts.skipDrawingTitle = args.skipDrawingTitle
    opts.skipDrawingTeams = args.skipDrawingTeams
    opts.vizType = args.vizType
    opts.outputType = args.outputType
    opts.teams = args.teams
    opts.attributeMatches = args.attributeMatches
    opts.influence = args.influence
    opts.profilePictures = args.profilePictures
    opts.profilePictureDirectory = args.profilePictureDirectory
    opts.dpi = args.dpi

    out = None

    try:
        mdl = parseModel(getFileContents())
        converter = ModelToGraphVizConverter(opts)

        out = converter.getModelAsDot(mdl)
    except Exception as exception:
        logging.error(str(exception))

    if args.dotout:
        logging.warning("Outputting graph to stdout, not running Dot")

        print(out)
    elif out is not None:
        with tempfile.NamedTemporaryFile(
                delete=args.keepDotfile) as temporaryGraphvizFile:
            temporaryGraphvizFile.write(bytes(out, "UTF-8"))
            temporaryGraphvizFile.flush()

        logging.debug("Wrote DOT file to: %s", str(temporaryGraphvizFile.name))

        outputImageFilename = args.output + "/orgviz." + args.outputType

        runDot(str(temporaryGraphvizFile.name), outputImageFilename,
               args.outputType)

        temporaryGraphvizFile.close(
        )  # will delege the org file if !args.keepDotFile