- Many fixes.

This commit is contained in:
ccremers 2006-08-11 15:23:32 +00:00
parent 683cae8d90
commit c3ce3c37d4
3 changed files with 64 additions and 22 deletions

View File

@ -16,24 +16,32 @@ class AboutScyther(wx.Dialog):
text = ''' text = '''
<html> <html>
<body bgcolor="#ffffff"> <body bgcolor="#ffffff">
<center><table bgcolor = "#000000" width="100%" cellspacing="0" <center><h2>Scyther</h2></center>
cellpadding="0" border="1"> <hr>
<tr> <p>
<td align="center"><h1>Scyther</h1></td> <b>Scyther</b> is an automatic tool for the verification and
</tr> falsification of security protocols.
</table> </p>
</center> <p>
<p><b>Scyther</b> is cool. Scyther and Scyther GUI developed by
Scyther and Scyther GUI Cas Cremers 2004-2006.
developed by Cas Cremers 2004-2006 </p>
Credits: Gijs Hollestelle (Python wrapper around Scyther XML) <p>
For news and updates visit the Scyther pages at
http://www.win.tue.nl/~ccremers/scyther/index.html
</p>
<p>
Credits: Cas Cremers (Scyther theory, backend, and main GUI
code), Gijs Hollestelle (Python wrapper for Scyther XML output).
</p> </p>
''' '''
def __init__(self,parent): def __init__(self,parent):
wx.Dialog.__init__(self, parent, -1, 'About Scyther', wx.Dialog.__init__(self, parent, -1, 'About Scyther',
size=(440,400)) size=(400,300))
html = wx.html.HtmlWindow(self) html = wx.html.HtmlWindow(self)
if "gtk2" in wx.PlatformInfo:
html.SetStandardFonts()
html.SetPage(self.text) html.SetPage(self.text)
button = wx.Button(self, wx.ID_OK, "Okay") button = wx.Button(self, wx.ID_OK, "Okay")

View File

@ -16,14 +16,31 @@ import Scyther.Claim as Claim
class MyGrid(wx.GridBagSizer): class MyGrid(wx.GridBagSizer):
def stepInit(self): def __init__(self,parent):
wx.GridBagSizer.__init__(self,hgap=5, vgap=5)
self.ypos = 0 self.ypos = 0
self.parent = parent
def stepAdd(self,ctrl,txt): def stepAdd(self,ctrl,txt):
self.Add(ctrl,(self.ypos,0),flag=wx.ALIGN_RIGHT) self.Add(ctrl,(self.ypos,1),flag=wx.ALIGN_LEFT)
self.Add(txt,(self.ypos,1),flag=wx.ALIGN_CENTER_VERTICAL) self.Add(txt,(self.ypos,0),flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
self.ypos += 1 self.ypos += 1
def lineAdd(self):
line = wx.StaticLine(self.parent,-1)
self.Add(line,pos=(self.ypos,0),span=(1,2),flag=wx.EXPAND|wx.ALIGN_BOTTOM)
self.ypos += 1
def titleAdd(self,title,firstLine=True):
if firstLine:
self.lineAdd()
self.ypos += 1
txt = wx.StaticText(self.parent,-1,title)
font = wx.Font(12,wx.DEFAULT,wx.BOLD,wx.NORMAL)
txt.SetFont(font)
self.Add(txt,pos=(self.ypos,0),span=(1,2),flag=wx.ALIGN_CENTER)
self.ypos += 1
self.lineAdd()
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -33,9 +50,10 @@ class SettingsWindow(wx.Panel):
wx.Panel.__init__(self,parent,-1) wx.Panel.__init__(self,parent,-1)
self.win = daddy self.win = daddy
space = 10 grid = MyGrid(self)
grid = MyGrid(hgap=space,vgap=space)
grid.stepInit() ### Parameters
grid.titleAdd("Verification parameters",False)
# Bound on the number of runs # Bound on the number of runs
self.maxruns = int(Preference.get('maxruns','5')) self.maxruns = int(Preference.get('maxruns','5'))
@ -56,6 +74,7 @@ class SettingsWindow(wx.Panel):
grid.stepAdd(l2,r2) grid.stepAdd(l2,r2)
### MISC expert stuff ### MISC expert stuff
grid.titleAdd("Advanced parameters")
# Bound on the number of classes/attacks # Bound on the number of classes/attacks
self.maxattacks = int(Preference.get('maxattacks','100')) self.maxattacks = int(Preference.get('maxattacks','100'))
@ -76,6 +95,7 @@ class SettingsWindow(wx.Panel):
grid.stepAdd(l10,r10) grid.stepAdd(l10,r10)
### Graph output stuff ### Graph output stuff
grid.titleAdd("Graph output parameters")
# Bound on the number of classes/attacks # Bound on the number of classes/attacks
if sys.platform.startswith("lin"): if sys.platform.startswith("lin"):
@ -91,6 +111,7 @@ class SettingsWindow(wx.Panel):
grid.stepAdd(ctrl,txt) grid.stepAdd(ctrl,txt)
### Combine ### Combine
grid.lineAdd()
self.SetSizer(grid) self.SetSizer(grid)
self.SetAutoLayout(True) self.SetAutoLayout(True)

View File

@ -11,6 +11,7 @@ from optparse import OptionParser, SUPPRESS_HELP
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther-gui components """ """ Import scyther-gui components """
import Gui.About as About
import Gui.Preference as Preference import Gui.Preference as Preference
import Gui.Mainwindow as Mainwindow import Gui.Mainwindow as Mainwindow
import Gui.Misc as Misc import Gui.Misc as Misc
@ -76,6 +77,14 @@ class MySplashScreen(wx.SplashScreen):
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def isSplashNeeded(opts):
if not opts.command:
if opts.splashscreen and not (Preference.get('splashscreen') in ['false','off','disable','0']):
return True
return False
#---------------------------------------------------------------------------
class ScytherApp(wx.App): class ScytherApp(wx.App):
def OnInit(self): def OnInit(self):
@ -99,8 +108,7 @@ class ScytherApp(wx.App):
#The splash screen is disabled for automatic commands, and also #The splash screen is disabled for automatic commands, and also
#by a setting in the preferences file. #by a setting in the preferences file.
#""" #"""
#if not opts.command: #if isSplashNeeded(opts):
# if opts.splashscreen and not (Preference.get('splashscreen') in ['false','off','disable','0']):
# splash = MySplashScreen(basedir) # splash = MySplashScreen(basedir)
# splash.Show() # splash.Show()
@ -108,6 +116,11 @@ class ScytherApp(wx.App):
self.SetTopWindow(self.mainWindow) self.SetTopWindow(self.mainWindow)
self.mainWindow.Show() self.mainWindow.Show()
if isSplashNeeded(opts):
dlg = About.AboutScyther(self.mainWindow)
dlg.ShowModal()
dlg.Destroy()
return True return True
def OnExit(self): def OnExit(self):