diff --git a/Changes.txt b/Changes.txt index f14d734..ac9201a 100644 --- a/Changes.txt +++ b/Changes.txt @@ -4,6 +4,7 @@ Recent changes (since beta 4): - more explicit output for intruder-generated terms. - added switch '--errors=file' to redirect standard error output to a file. +- Rewrote parts of the gui code for improved stability. diff --git a/gui/Bin/scyther-linux b/gui/Bin/scyther-linux deleted file mode 100755 index 543fdeb..0000000 Binary files a/gui/Bin/scyther-linux and /dev/null differ diff --git a/gui/Bin/scyther-w32.exe b/gui/Bin/scyther-w32.exe deleted file mode 100755 index 130063a..0000000 Binary files a/gui/Bin/scyther-w32.exe and /dev/null differ diff --git a/gui/Bin/scytherview.py b/gui/Bin/scytherview.py deleted file mode 100755 index 278c9da..0000000 --- a/gui/Bin/scytherview.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/python -# -# Convert scyther dot output to a printable PDF and display it -# -# This is a simple hack to be able to quickly use the graphical output -# of Scyther if one only has graphviz, but not elementtree and wxPython. -# -# Note 1: only works under Linux currently, because of silly assumptions -# on temporary directories and pdf viewers. -# -# Note 2: this code assumes that both scyther-linux and dot can be found in the -# environment (i.e. PATH variable) -# -import os,sys,commands -import os.path - -tempcount = 0 - -def generateTemp(extension='tmp'): - # We need a temporary file to hold the generated postscript stuff before - # it is converted to pdf - global tempcount - - tempcount = tempcount + 1 - tmp = '/tmp/output_dot_%s_%i.%s' % (os.getpid(),tempcount,extension) - - try: - os.unlink(tmp) - except: - pass - return tmp - -def scyther_to_dotfile(): - """ Run Scyther, return dotfile name """ - - scythername = "scyther-linux" - args = " ".join(sys.argv[1:]) - tmpdotfile = generateTemp('dot') - - command = "%s --plain --dot-output %s > %s" % (scythername, args, tmpdotfile) - output = commands.getoutput(command) - return (output,tmpdotfile) - -def dotfile_to_pdffile(dotfile,outfile=None): - """ Generate a PDF file (name is returned) from an input dotfile - name """ - - tmp = generateTemp('ps') - - # First split the input per digraph and call dot with -Gsize arguments to make - # it fit to a landscape page - dotdata = open(dotfile, "r") - f = None - for line in dotdata.xreadlines(): - if (line.find('digraph') == 0): - f = os.popen("dot -Gsize='11.0,8.0' -Gratio=fill -Tps >>%s" % (tmp),'w') - print >>f, line - dotdata.close() - - if not f: - return None - f.close() - - if not outfile: - outfile = generateTemp('pdf') - - # Now convert the resulting stuff to a pdf - os.system('ps2pdf -sPAPERSIZE=a4 -g7014x5300 -r600 %s %s' % (tmp,outfile)) - #os.system('ps2pdf -g8300x6250 -r600 %s %s' % (tmp,outf)) - - # And remove the temp file - os.unlink(tmp) - - return outfile - -def main(): - (output,dotfile) = scyther_to_dotfile() - print output - pdffile = dotfile_to_pdffile(dotfile) - os.unlink(dotfile) - if pdffile: - commands.getoutput("xpdf %s" % pdffile) - os.unlink(pdffile) - else: - print "No graphs generated." - -main() diff --git a/gui/Scyther/__init__.py b/gui/Scyther/__init__.py index b123ebf..b16dd9f 100644 --- a/gui/Scyther/__init__.py +++ b/gui/Scyther/__init__.py @@ -7,5 +7,5 @@ import Scyther import os.path -bindir = os.path.join(__path__[0],"..","Bin") +bindir = os.path.join(__path__[0],"Bin") Scyther.setBinDir(bindir)