- Refactoring, explanations, added button.
This commit is contained in:
parent
347010bfa4
commit
9ce483095d
@ -147,12 +147,10 @@ class AttackWindow(wx.Frame):
|
|||||||
# Make zoom buttons
|
# Make zoom buttons
|
||||||
if Preference.usePIL():
|
if Preference.usePIL():
|
||||||
buttons = wx.BoxSizer(wx.HORIZONTAL)
|
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)
|
buttons.Add(bt,0)
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnZoom100, bt)
|
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnFit, bt)
|
||||||
bt = wx.Button(self,wx.ID_ZOOM_FIT)
|
|
||||||
buttons.Add(bt,0)
|
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnZoomFit, bt)
|
|
||||||
sizer.Add(buttons, 0, wx.ALIGN_LEFT)
|
sizer.Add(buttons, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
# Add attacks (possible with tabs)
|
# Add attacks (possible with tabs)
|
||||||
@ -197,13 +195,14 @@ class AttackWindow(wx.Frame):
|
|||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
def OnZoom100(self,evt):
|
def OnZoom100(self,evt):
|
||||||
self.Refresh()
|
|
||||||
self.fit = False
|
self.fit = False
|
||||||
self.update()
|
self.update()
|
||||||
|
self.Refresh()
|
||||||
|
|
||||||
def OnZoomFit(self,evt):
|
def OnZoomFit(self,evt):
|
||||||
self.Refresh()
|
|
||||||
self.fit = True
|
self.fit = True
|
||||||
self.update()
|
self.update()
|
||||||
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -380,15 +380,15 @@ class ResultWindow(wx.Frame):
|
|||||||
grid.Add(bmpfield,(ypos,xpos),(1,1),wx.ALIGN_CENTER_VERTICAL|wx.ALL,10)
|
grid.Add(bmpfield,(ypos,xpos),(1,1),wx.ALIGN_CENTER_VERTICAL|wx.ALL,10)
|
||||||
else:
|
else:
|
||||||
# new style text control Ok/Fail
|
# new style text control Ok/Fail
|
||||||
rank = cl.getRank()
|
rankc = cl.getColour()
|
||||||
rankt = [('Fail','red'),
|
if cl.okay:
|
||||||
('Fail','dark red'),
|
rankt = "Ok"
|
||||||
('Ok','dark green'),
|
else:
|
||||||
('Ok','forest green')]
|
rankt = "Fail"
|
||||||
txt = wx.StaticText(self,-1,rankt[rank][0])
|
txt = wx.StaticText(self,-1,rankt)
|
||||||
font = wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD)
|
font = wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD)
|
||||||
txt.SetFont(font)
|
txt.SetFont(font)
|
||||||
txt.SetForegroundColour(rankt[rank][1])
|
txt.SetForegroundColour(rankc)
|
||||||
grid.Add(txt,(ypos,xpos),(1,1),wx.ALL,10)
|
grid.Add(txt,(ypos,xpos),(1,1),wx.ALL,10)
|
||||||
xpos += 1
|
xpos += 1
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class SettingsWindow(wx.Panel):
|
|||||||
else:
|
else:
|
||||||
defsize = 11
|
defsize = 11
|
||||||
self.fontsize = int(Preference.get('fontsize',defsize))
|
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 = wx.SpinCtrl(self, -1, "",style=wx.RIGHT)
|
||||||
ctrl.SetRange(6,32)
|
ctrl.SetRange(6,32)
|
||||||
ctrl.SetValue(self.fontsize)
|
ctrl.SetValue(self.fontsize)
|
||||||
|
@ -93,6 +93,24 @@ class Claim(object):
|
|||||||
else:
|
else:
|
||||||
return 3
|
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):
|
def getComment(self):
|
||||||
"""
|
"""
|
||||||
returns a sentence describing the results for this claim
|
returns a sentence describing the results for this claim
|
||||||
@ -117,14 +135,6 @@ class Claim(object):
|
|||||||
return remark + "."
|
return remark + "."
|
||||||
|
|
||||||
|
|
||||||
def getVerified(self):
|
|
||||||
"""
|
|
||||||
returns an element of [None,'Verified','Falsified']
|
|
||||||
"""
|
|
||||||
opts = ['Falsified',None,None,'Verified']
|
|
||||||
return opts[self.getRank()]
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""
|
"""
|
||||||
Resulting string
|
Resulting string
|
||||||
|
27
gui/todo.txt
27
gui/todo.txt
@ -1,15 +1,28 @@
|
|||||||
URGENT
|
URGENT
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
TO BE DONE
|
TO BE DONE
|
||||||
|
|
||||||
|
- Config file should use Python's confParse module.
|
||||||
|
- Save preferences in local file on close.
|
||||||
|
|
||||||
WOULD LIKE TO HAVE
|
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.
|
- Ideally we somehow color the correct/incorrect tags in the editor.
|
||||||
- Line numbering is needed for the editor window otherwise you cannot
|
- Line numbering is needed for the editor window otherwise you cannot
|
||||||
interpret attacks. Probably use wx.Py editor things.
|
interpret attacks. Probably use wx.Py editor things.
|
||||||
- Preferences window.
|
- Scyther executable should be able to be set by means of preferences.
|
||||||
- Save in local file on close.
|
- Save attacks (dot/xml/png) to file.
|
||||||
- Scyther executable should be able to be set by means of preferences.
|
|
||||||
(Using a file select dialog)
|
IN AN IDEAL WORLD...
|
||||||
- Refactoring: constructing the comment of a claim (now in
|
|
||||||
Gui/Scytherthread) should really be in Scyther/Claim.
|
- Use Python modules to generate the attack graphs from the XML, also
|
||||||
|
allow for eg. ASCII output.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user