- Refactoring, explanations, added button.

This commit is contained in:
ccremers 2006-08-11 09:41:12 +00:00
parent 347010bfa4
commit 9ce483095d
5 changed files with 52 additions and 30 deletions

View File

@ -147,12 +147,10 @@ class AttackWindow(wx.Frame):
# Make zoom buttons
if Preference.usePIL():
buttons = wx.BoxSizer(wx.HORIZONTAL)
bt = wx.Button(self,wx.ID_ZOOM_100)
bt = wx.ToggleButton(self,-1,"Fit to window")
bt.SetValue(self.fit)
buttons.Add(bt,0)
self.Bind(wx.EVT_BUTTON, self.OnZoom100, bt)
bt = wx.Button(self,wx.ID_ZOOM_FIT)
buttons.Add(bt,0)
self.Bind(wx.EVT_BUTTON, self.OnZoomFit, bt)
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnFit, bt)
sizer.Add(buttons, 0, wx.ALIGN_LEFT)
# Add attacks (possible with tabs)
@ -197,13 +195,14 @@ class AttackWindow(wx.Frame):
self.Refresh()
def OnZoom100(self,evt):
self.Refresh()
self.fit = False
self.update()
self.Refresh()
def OnZoomFit(self,evt):
self.Refresh()
self.fit = True
self.update()
self.Refresh()

View File

@ -380,15 +380,15 @@ class ResultWindow(wx.Frame):
grid.Add(bmpfield,(ypos,xpos),(1,1),wx.ALIGN_CENTER_VERTICAL|wx.ALL,10)
else:
# new style text control Ok/Fail
rank = cl.getRank()
rankt = [('Fail','red'),
('Fail','dark red'),
('Ok','dark green'),
('Ok','forest green')]
txt = wx.StaticText(self,-1,rankt[rank][0])
rankc = cl.getColour()
if cl.okay:
rankt = "Ok"
else:
rankt = "Fail"
txt = wx.StaticText(self,-1,rankt)
font = wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD)
txt.SetFont(font)
txt.SetForegroundColour(rankt[rank][1])
txt.SetForegroundColour(rankc)
grid.Add(txt,(ypos,xpos),(1,1),wx.ALL,10)
xpos += 1

View File

@ -83,7 +83,7 @@ class SettingsWindow(wx.Panel):
else:
defsize = 11
self.fontsize = int(Preference.get('fontsize',defsize))
txt = wx.StaticText(self,-1,"Attack graph font size")
txt = wx.StaticText(self,-1,"Attack graph font size (in points)")
ctrl = wx.SpinCtrl(self, -1, "",style=wx.RIGHT)
ctrl.SetRange(6,32)
ctrl.SetValue(self.fontsize)

View File

@ -93,6 +93,24 @@ class Claim(object):
else:
return 3
def getVerified(self):
"""
returns an element of [None,'Verified','Falsified']
"""
opts = ['Falsified',None,None,'Verified']
return opts[self.getRank()]
def getColour(self):
"""
Returns a colour that expresses the state
"""
colours = ['red',
'dark red',
'dark green',
'pale green']
return colours[self.getRank()]
def getComment(self):
"""
returns a sentence describing the results for this claim
@ -117,14 +135,6 @@ class Claim(object):
return remark + "."
def getVerified(self):
"""
returns an element of [None,'Verified','Falsified']
"""
opts = ['Falsified',None,None,'Verified']
return opts[self.getRank()]
def __str__(self):
"""
Resulting string

View File

@ -1,15 +1,28 @@
URGENT
-
TO BE DONE
- Config file should use Python's confParse module.
- Save preferences in local file on close.
WOULD LIKE TO HAVE
- Attacks are not kept centered well.
- Font selector for graphs.
- Nice graph scaling for all platforms (now only supported under Linux
using the Python Imaging Library through postscript)
- Support for using an external editor.
- toggle for 'watch file'.
- toggle for 'auto-verify on change' or something like that.
- Ideally we somehow color the correct/incorrect tags in the editor.
- Line numbering is needed for the editor window otherwise you cannot
interpret attacks. Probably use wx.Py editor things.
- Preferences window.
- Save in local file on close.
- Scyther executable should be able to be set by means of preferences.
(Using a file select dialog)
- Refactoring: constructing the comment of a claim (now in
Gui/Scytherthread) should really be in Scyther/Claim.
- Scyther executable should be able to be set by means of preferences.
- Save attacks (dot/xml/png) to file.
IN AN IDEAL WORLD...
- Use Python modules to generate the attack graphs from the XML, also
allow for eg. ASCII output.