- 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 Settingswindow
import Scytherthread import Scytherthread
import Icon import Icon
import About
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -138,8 +139,9 @@ class MainWindow(wx.Frame):
(ID_STATESPACE, 'Generate &statespace\tF2','TODO' , (ID_STATESPACE, 'Generate &statespace\tF2','TODO' ,
self.OnStatespace) , self.OnStatespace) ,
(None, None, None, None), (None, None, None, None),
(ID_CHECK, '&Check protocol\tF5','TODO', ### Disabled for now (given that it is not reliable enough yet)
self.OnCheck) , #(ID_CHECK, '&Check protocol\tF5','TODO',
# self.OnCheck) ,
(ID_AUTOVERIFY, 'Verify &automatic claims\tF6','TODO', (ID_AUTOVERIFY, 'Verify &automatic claims\tF6','TODO',
self.OnAutoVerify) self.OnAutoVerify)
]) ])
@ -178,15 +180,9 @@ class MainWindow(wx.Frame):
# Event handlers: # Event handlers:
def OnAbout(self, event): def OnAbout(self, event):
msg = "Scyther" dlg = About.AboutScyther(self)
msg += "\n" dlg.ShowModal()
msg += "\nScyther and Scyther GUI" dlg.Destroy()
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()
def OnExit(self, event): def OnExit(self, event):
self.Close() # Close the main window. self.Close() # Close the main window.

View File

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

View File

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