- Enabled Scintilla editor
This commit is contained in:
parent
df62d65d5c
commit
33df1ccb5b
@ -4,9 +4,17 @@
|
|||||||
|
|
||||||
Scyther 1.0-beta6
|
Scyther 1.0-beta6
|
||||||
|
|
||||||
New features:
|
Big new features:
|
||||||
|
|
||||||
* [Gui] Added Mac support (added universal binary)
|
* [Gui] Added Mac support (added universal binary)
|
||||||
|
* [Gui] Switched to Scintilla editor component, providing undo
|
||||||
|
and line numbering.
|
||||||
|
|
||||||
|
Other new features:
|
||||||
|
|
||||||
|
* [Backend] Scyther now detects when a read event cannot match
|
||||||
|
with a send event. This significantly helps in reducing errors
|
||||||
|
in the protocol descriptions.
|
||||||
* [Language] Added claim parameter for Reachable claim;
|
* [Language] Added claim parameter for Reachable claim;
|
||||||
Reachable,R means that role R should be trusted (as well as the
|
Reachable,R means that role R should be trusted (as well as the
|
||||||
actor), but not any other claim. This can be useful for showing
|
actor), but not any other claim. This can be useful for showing
|
||||||
|
@ -6,6 +6,17 @@
|
|||||||
import wx
|
import wx
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
# Use Scintilla editor?
|
||||||
|
useStc = True # It looks nicer!
|
||||||
|
#useStc = False # It is sometimes buggy!
|
||||||
|
|
||||||
|
# Test Scintilla and if it fails, get rid of it
|
||||||
|
if useStc:
|
||||||
|
try:
|
||||||
|
import wx.stc as stc
|
||||||
|
except:
|
||||||
|
useStc = False
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
""" Import scyther-gui components """
|
""" Import scyther-gui components """
|
||||||
@ -75,6 +86,24 @@ class MainWindow(wx.Frame):
|
|||||||
|
|
||||||
self.firstCommand()
|
self.firstCommand()
|
||||||
|
|
||||||
|
def GetText(self):
|
||||||
|
"""
|
||||||
|
Interface for both types of editor
|
||||||
|
"""
|
||||||
|
if useStc:
|
||||||
|
return self.control.GetText()
|
||||||
|
else:
|
||||||
|
return self.control.GetValue()
|
||||||
|
|
||||||
|
def SetText(self,txt):
|
||||||
|
"""
|
||||||
|
Interface for both types of editor
|
||||||
|
"""
|
||||||
|
if useStc:
|
||||||
|
self.control.SetText(txt)
|
||||||
|
else:
|
||||||
|
self.control.SetValue(txt)
|
||||||
|
|
||||||
def CreateInteriorWindowComponents(self):
|
def CreateInteriorWindowComponents(self):
|
||||||
''' Create "interior" window components. In this case it is just a
|
''' Create "interior" window components. In this case it is just a
|
||||||
simple multiline text control. '''
|
simple multiline text control. '''
|
||||||
@ -92,10 +121,19 @@ class MainWindow(wx.Frame):
|
|||||||
|
|
||||||
# Top: input
|
# Top: input
|
||||||
self.top = wx.Notebook(self,-1)
|
self.top = wx.Notebook(self,-1)
|
||||||
self.control = wx.TextCtrl(self.top, style=wx.TE_MULTILINE)
|
|
||||||
|
if useStc:
|
||||||
|
# Scintilla layout with line numbers
|
||||||
|
self.control = stc.StyledTextCtrl(self.top)
|
||||||
|
self.control.SetMarginType(1, stc.STC_MARGIN_NUMBER)
|
||||||
|
self.control.SetMarginWidth(1, 30)
|
||||||
|
else:
|
||||||
|
# Simpler default
|
||||||
|
self.control = wx.TextCtrl(self.top, style=wx.TE_MULTILINE)
|
||||||
|
|
||||||
if self.load:
|
if self.load:
|
||||||
textfile = open(os.path.join(self.dirname, self.filename), 'r')
|
textfile = open(os.path.join(self.dirname, self.filename), 'r')
|
||||||
self.control.SetValue(textfile.read())
|
self.SetText(textfile.read())
|
||||||
os.chdir(self.dirname)
|
os.chdir(self.dirname)
|
||||||
textfile.close()
|
textfile.close()
|
||||||
self.top.AddPage(self.control,"Protocol description")
|
self.top.AddPage(self.control,"Protocol description")
|
||||||
@ -189,14 +227,14 @@ class MainWindow(wx.Frame):
|
|||||||
|
|
||||||
def OnSave(self, event):
|
def OnSave(self, event):
|
||||||
textfile = open(os.path.join(self.dirname, self.filename), 'w')
|
textfile = open(os.path.join(self.dirname, self.filename), 'w')
|
||||||
textfile.write(self.control.GetValue())
|
textfile.write(self.GetText())
|
||||||
textfile.close()
|
textfile.close()
|
||||||
|
|
||||||
def OnOpen(self, event):
|
def OnOpen(self, event):
|
||||||
if self.askUserForFilename(style=wx.OPEN,
|
if self.askUserForFilename(style=wx.OPEN,
|
||||||
**self.defaultFileDialogOptions()):
|
**self.defaultFileDialogOptions()):
|
||||||
textfile = open(os.path.join(self.dirname, self.filename), 'r')
|
textfile = open(os.path.join(self.dirname, self.filename), 'r')
|
||||||
self.control.SetValue(textfile.read())
|
self.SetText(textfile.read())
|
||||||
textfile.close()
|
textfile.close()
|
||||||
|
|
||||||
def OnSaveAs(self, event):
|
def OnSaveAs(self, event):
|
||||||
@ -206,7 +244,8 @@ class MainWindow(wx.Frame):
|
|||||||
os.chdir(self.dirname)
|
os.chdir(self.dirname)
|
||||||
|
|
||||||
def RunScyther(self, mode):
|
def RunScyther(self, mode):
|
||||||
s = Scytherthread.ScytherRun(self,mode)
|
spdl = self.GetText()
|
||||||
|
s = Scytherthread.ScytherRun(self,mode,spdl)
|
||||||
|
|
||||||
def OnVerify(self, event):
|
def OnVerify(self, event):
|
||||||
self.RunScyther("verify")
|
self.RunScyther("verify")
|
||||||
|
@ -444,11 +444,11 @@ class ResultWindow(wx.Frame):
|
|||||||
|
|
||||||
class ScytherRun(object):
|
class ScytherRun(object):
|
||||||
|
|
||||||
def __init__(self,mainwin,mode):
|
def __init__(self,mainwin,mode,spdl):
|
||||||
|
|
||||||
self.mainwin = mainwin
|
self.mainwin = mainwin
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.spdl = mainwin.control.GetValue()
|
self.spdl = spdl
|
||||||
self.verified = False
|
self.verified = False
|
||||||
self.options = mainwin.settings.ScytherArguments(mode)
|
self.options = mainwin.settings.ScytherArguments(mode)
|
||||||
self.main()
|
self.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user