- Bug seems to be resolved!

This commit is contained in:
ccremers 2006-12-14 20:32:24 +00:00
parent 8f1e1ae8a9
commit 38dd697f41
2 changed files with 43 additions and 39 deletions

View File

@ -421,6 +421,7 @@ class ResultWindow(wx.Frame):
class ScytherRun(object): class ScytherRun(object):
def __init__(self,mainwin,mode): def __init__(self,mainwin,mode):
self.mainwin = mainwin self.mainwin = mainwin
@ -430,7 +431,41 @@ class ScytherRun(object):
self.options = mainwin.settings.ScytherArguments(mode) self.options = mainwin.settings.ScytherArguments(mode)
self.main() self.main()
def main(self):
"""
Start process
"""
title = "Running Scyther %s process" % self.mode
# start the window and show until something happens
# if it terminates, this is a cancel, and should also kill the thread. (what happens to a spawned Scyther in that case?)
# if the thread terminames, it should close the window normally, and we end up here as well.
#val = self.verifywin.ShowModal()
self.verifywin = VerificationWindow(self.mainwin,title)
self.verifywin.Center()
self.verifywin.Show(True)
# Check sanity of Scyther thing here (as opposed to the thread)
# which makes error reporting somewhat easier
try:
Scyther.Scyther.Check()
except Scyther.Error.BinaryError, e:
# e.file is the supposed location of the binary
text = "Could not find Scyther binary at\n%s" % (e.file)
Error.ShowAndExit(text)
# start the thread
self.verifywin.SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
t = ScytherThread(self.spdl, self.options, self.verificationDone)
t.start()
# after verification, we proceed to the callback below...
def verificationDone(self, scyther, claims, summary): def verificationDone(self, scyther, claims, summary):
"""
This is where we end up after a callback from the thread, stating that verification succeeded.
"""
self.scyther = scyther self.scyther = scyther
self.claims = claims self.claims = claims
@ -446,6 +481,7 @@ class ScytherRun(object):
self.verificationErrors() self.verificationErrors()
def verificationOkay(self): def verificationOkay(self):
# Great, we verified stuff, progress to the claim report # Great, we verified stuff, progress to the claim report
title = "Scyther results : %s" % self.mode title = "Scyther results : %s" % self.mode
self.resultwin = resultwin = ResultWindow(self,self.mainwin,title) self.resultwin = resultwin = ResultWindow(self,self.mainwin,title)
@ -487,41 +523,5 @@ class ScytherRun(object):
errorwin.Center() errorwin.Center()
val = errorwin.ShowModal() val = errorwin.ShowModal()
def main(self):
"""
Start process
"""
title = "Running Scyther %s process" % self.mode
self.verifywin = VerificationWindow(self.mainwin,title)
self.verifywin.Center()
self.verifywin.Show(True)
# Check sanity of Scyther thing here (as opposed to the thread)
# which makes error reporting somewhat easier
try:
Scyther.Scyther.Check()
except Scyther.Error.BinaryError, e:
# e.file is the supposed location of the binary
text = "Could not find Scyther binary at\n%s" % (e.file)
Error.ShowAndExit(text)
# start the thread
self.verifywin.SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
t = ScytherThread(self.spdl, self.options, self.verificationDone)
t.start()
# start the window and show until something happens
# if it terminates, this is a cancel, and should also kill the thread. (what happens to a spawned Scyther in that case?)
# if the thread terminames, it should close the window normally, and we end up here as well.
val = self.verifywin.ShowModal()
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# vim: set ts=4 sw=4 et list lcs=tab\:>-:

View File

@ -166,6 +166,11 @@ class Scyther(object):
if self.program == None: if self.program == None:
raise Error.NoBinaryError raise Error.NoBinaryError
# Sanitize input somewhat
if not spdl or spdl == "":
# Scyther hickups on completely empty input
spdl = " "
# Generate temporary files for the output # Generate temporary files for the output
# Requires Python 2.3 though. # Requires Python 2.3 though.
(fde,fne) = tempfile.mkstemp() # errors (fde,fne) = tempfile.mkstemp() # errors
@ -174,8 +179,7 @@ class Scyther(object):
# Write (input) file # Write (input) file
fhi = os.fdopen(fdi,'w+b') fhi = os.fdopen(fdi,'w+b')
if spdl: fhi.write(spdl)
fhi.write(spdl)
fhi.close() fhi.close()
# Generate command line for the Scyther process # Generate command line for the Scyther process