Added 'prune' switch support in GUI.
Allows to use the 'stop at first attack' feature of the backend.
This commit is contained in:
parent
b352044f92
commit
8471f13da3
@ -78,7 +78,9 @@ class ScytherThread(threading.Thread):
|
|||||||
VISTA screwed up the standard C function tmpfile() (It's in a
|
VISTA screwed up the standard C function tmpfile() (It's in a
|
||||||
directory to which normal users cannot write...)
|
directory to which normal users cannot write...)
|
||||||
"""
|
"""
|
||||||
if int(Preference.get('allattacks','0')) == 0:
|
# TODO Notice the stupid default setting too ('2') which is
|
||||||
|
# needed here. This really needs cleanup.
|
||||||
|
if int(Preference.get('prune','2')) != 0:
|
||||||
if claims:
|
if claims:
|
||||||
for cl in claims:
|
for cl in claims:
|
||||||
if len(cl.attacks) > 1:
|
if len(cl.attacks) > 1:
|
||||||
|
@ -99,12 +99,12 @@ class SettingsWindow(wx.Panel):
|
|||||||
grid.titleAdd("Advanced parameters")
|
grid.titleAdd("Advanced parameters")
|
||||||
|
|
||||||
# Continue after finding the first attack
|
# Continue after finding the first attack
|
||||||
self.allattacks = int(Preference.get('allattacks','0'))
|
self.prune = int(Preference.get('prune','2'))
|
||||||
claimoptions = ['Yes','No']
|
claimoptions = ['Find all attacks','Find first attack','Find best attack']
|
||||||
r8 = wx.StaticText(self,-1,"Stop after finding one attack")
|
r8 = wx.StaticText(self,-1,"Search pruning")
|
||||||
l8 = self.ch = wx.Choice(self,-1,choices=claimoptions)
|
l8 = self.ch = wx.Choice(self,-1,choices=claimoptions)
|
||||||
l8.SetSelection(self.allattacks)
|
l8.SetSelection(self.prune)
|
||||||
self.Bind(wx.EVT_CHOICE,self.EvtAllAttacks,l8)
|
self.Bind(wx.EVT_CHOICE,self.EvtPrune,l8)
|
||||||
grid.stepAdd(l8,r8)
|
grid.stepAdd(l8,r8)
|
||||||
|
|
||||||
# Bound on the number of patterns
|
# Bound on the number of patterns
|
||||||
@ -152,9 +152,9 @@ class SettingsWindow(wx.Panel):
|
|||||||
def EvtFontsize(self,evt):
|
def EvtFontsize(self,evt):
|
||||||
self.fontsize = evt.GetInt()
|
self.fontsize = evt.GetInt()
|
||||||
|
|
||||||
def EvtAllAttacks(self,evt):
|
def EvtPrune(self,evt):
|
||||||
self.allattacks = evt.GetInt()
|
self.prune = evt.GetInt()
|
||||||
Preference.set('allattacks',self.allattacks)
|
Preference.set('prune',self.prune)
|
||||||
|
|
||||||
def EvtMaxAttacks(self,evt):
|
def EvtMaxAttacks(self,evt):
|
||||||
self.maxattacks = evt.GetInt()
|
self.maxattacks = evt.GetInt()
|
||||||
@ -173,9 +173,8 @@ class SettingsWindow(wx.Panel):
|
|||||||
tstr += "--max-runs=%s " % (str(self.maxruns))
|
tstr += "--max-runs=%s " % (str(self.maxruns))
|
||||||
# Matching type
|
# Matching type
|
||||||
tstr += "--match=%s " % (str(self.match))
|
tstr += "--match=%s " % (str(self.match))
|
||||||
# All attacks (has to go BEFORE max attacks)
|
# Prune (has to go BEFORE max attacks)
|
||||||
if self.allattacks != 0:
|
tstr += "--prune=%s" % (str(self.prune))
|
||||||
tstr += "--all-attacks "
|
|
||||||
# Max attacks/classes
|
# Max attacks/classes
|
||||||
if self.maxattacks != 0:
|
if self.maxattacks != 0:
|
||||||
tstr += "--max-attacks=%s " % (str(self.maxattacks))
|
tstr += "--max-attacks=%s " % (str(self.maxattacks))
|
||||||
|
Loading…
Reference in New Issue
Block a user