- Added separate about box.

This commit is contained in:
ccremers 2006-08-11 10:43:28 +00:00
parent 40ec83be66
commit a517d729ef
4 changed files with 71 additions and 26 deletions

46
gui/Gui/About.py Normal file
View File

@ -0,0 +1,46 @@
#!/usr/bin/python
#---------------------------------------------------------------------------
""" Import externals """
import wx
import wx.html
#---------------------------------------------------------------------------
""" Import scyther-gui components """
#---------------------------------------------------------------------------
class AboutScyther(wx.Dialog):
text = '''
<html>
<body bgcolor="#ffffff">
<center><table bgcolor = "#000000" width="100%" cellspacing="0"
cellpadding="0" border="1">
<tr>
<td align="center"><h1>Scyther</h1></td>
</tr>
</table>
</center>
<p><b>Scyther</b> is cool.
Scyther and Scyther GUI
developed by Cas Cremers 2004-2006
Credits: Gijs Hollestelle (Python wrapper around Scyther XML)
</p>
'''
def __init__(self,parent):
wx.Dialog.__init__(self, parent, -1, 'About Scyther',
size=(440,400))
html = wx.html.HtmlWindow(self)
html.SetPage(self.text)
button = wx.Button(self, wx.ID_OK, "Okay")
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(html, 1, wx.EXPAND|wx.ALL,5)
sizer.Add(button,0,wx.ALIGN_CENTER|wx.ALL,5)
self.SetSizer(sizer)
self.Layout()

View File

@ -12,6 +12,7 @@ import os.path
import Settingswindow
import Scytherthread
import Icon
import About
#---------------------------------------------------------------------------
@ -138,8 +139,9 @@ class MainWindow(wx.Frame):
(ID_STATESPACE, 'Generate &statespace\tF2','TODO' ,
self.OnStatespace) ,
(None, None, None, None),
(ID_CHECK, '&Check protocol\tF5','TODO',
self.OnCheck) ,
### Disabled for now (given that it is not reliable enough yet)
#(ID_CHECK, '&Check protocol\tF5','TODO',
# self.OnCheck) ,
(ID_AUTOVERIFY, 'Verify &automatic claims\tF6','TODO',
self.OnAutoVerify)
])
@ -178,15 +180,9 @@ class MainWindow(wx.Frame):
# Event handlers:
def OnAbout(self, event):
msg = "Scyther"
msg += "\n"
msg += "\nScyther and Scyther GUI"
msg += "\ndeveloped by Cas Cremers 2004-2006"
msg += "\n"
msg += "\nCredits: Gijs Hollestelle (Python wrapper around Scyther XML)"
dialog = wx.MessageDialog(self,msg, 'About scyther-gui', wx.OK)
dialog.ShowModal()
dialog.Destroy()
dlg = About.AboutScyther(self)
dlg.ShowModal()
dlg.Destroy()
def OnExit(self, event):
self.Close() # Close the main window.

View File

@ -148,8 +148,9 @@ class AttackThread(threading.Thread):
setAttr("fontname=\"Helvetica\"")
else:
setAttr("fontname=\"Arial\"")
fontsize = self.parent.mainwin.settings.fontsize
setAttr("fontsize=%s" % fontsize)
if self.parent and self.parent.mainwin:
fontsize = self.parent.mainwin.settings.fontsize
setAttr("fontsize=%s" % fontsize)
setAttr("height=\"0.01\"",NODE)
setAttr("width=\"0.01\"",NODE)
setAttr("margin=\"0.08,0.03\"",NODE)

View File

@ -46,8 +46,10 @@ def parseArgs():
#---------------------------------------------------------------------------
class MySplashScreen(wx.SplashScreen):
def __init__(self):
bmp = wx.Image(os.path.join("Images","scyther-splash.png")).ConvertToBitmap()
def __init__(self,basedir):
path = os.path.join(basedir,"Images")
image = os.path.join(path,"scyther-splash.png")
bmp = wx.Image(image).ConvertToBitmap()
wx.SplashScreen.__init__(self, bmp,
wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
5000, None, -1)
@ -90,17 +92,17 @@ class ScytherApp(wx.App):
bindir = Preference.get("bindir",Scyther.getBinDir())
Scyther.setBinDir(bindir)
"""
Create and show the splash screen. It will then create and show
the main frame when it is time to do so.
The splash screen is disabled for automatic commands, and also
by a setting in the preferences file.
"""
if not opts.command:
if opts.splashscreen and not (Preference.get('splashscreen') in ['false','off','disable','0']):
splash = MySplashScreen()
splash.Show()
#"""
#Create and show the splash screen. It will then create and show
#the main frame when it is time to do so.
#
#The splash screen is disabled for automatic commands, and also
#by a setting in the preferences file.
#"""
#if not opts.command:
# if opts.splashscreen and not (Preference.get('splashscreen') in ['false','off','disable','0']):
# splash = MySplashScreen(basedir)
# splash.Show()
self.mainWindow = Mainwindow.MainWindow(opts,args)
self.SetTopWindow(self.mainWindow)