Added 'prune' switch support in GUI.

Allows to use the 'stop at first attack' feature of the backend.
This commit is contained in:
Cas Cremers 2008-08-25 16:59:15 +02:00
parent b352044f92
commit 8471f13da3
2 changed files with 13 additions and 12 deletions

View File

@ -78,7 +78,9 @@ class ScytherThread(threading.Thread):
VISTA screwed up the standard C function tmpfile() (It's in a
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:
for cl in claims:
if len(cl.attacks) > 1:

View File

@ -99,12 +99,12 @@ class SettingsWindow(wx.Panel):
grid.titleAdd("Advanced parameters")
# Continue after finding the first attack
self.allattacks = int(Preference.get('allattacks','0'))
claimoptions = ['Yes','No']
r8 = wx.StaticText(self,-1,"Stop after finding one attack")
self.prune = int(Preference.get('prune','2'))
claimoptions = ['Find all attacks','Find first attack','Find best attack']
r8 = wx.StaticText(self,-1,"Search pruning")
l8 = self.ch = wx.Choice(self,-1,choices=claimoptions)
l8.SetSelection(self.allattacks)
self.Bind(wx.EVT_CHOICE,self.EvtAllAttacks,l8)
l8.SetSelection(self.prune)
self.Bind(wx.EVT_CHOICE,self.EvtPrune,l8)
grid.stepAdd(l8,r8)
# Bound on the number of patterns
@ -152,9 +152,9 @@ class SettingsWindow(wx.Panel):
def EvtFontsize(self,evt):
self.fontsize = evt.GetInt()
def EvtAllAttacks(self,evt):
self.allattacks = evt.GetInt()
Preference.set('allattacks',self.allattacks)
def EvtPrune(self,evt):
self.prune = evt.GetInt()
Preference.set('prune',self.prune)
def EvtMaxAttacks(self,evt):
self.maxattacks = evt.GetInt()
@ -173,9 +173,8 @@ class SettingsWindow(wx.Panel):
tstr += "--max-runs=%s " % (str(self.maxruns))
# Matching type
tstr += "--match=%s " % (str(self.match))
# All attacks (has to go BEFORE max attacks)
if self.allattacks != 0:
tstr += "--all-attacks "
# Prune (has to go BEFORE max attacks)
tstr += "--prune=%s" % (str(self.prune))
# Max attacks/classes
if self.maxattacks != 0:
tstr += "--max-attacks=%s " % (str(self.maxattacks))