- Improved settings window.
This commit is contained in:
parent
4b98120da9
commit
ddb9e11ac5
@ -148,7 +148,8 @@ class AttackThread(threading.Thread):
|
|||||||
setAttr("fontname=\"Helvetica\"")
|
setAttr("fontname=\"Helvetica\"")
|
||||||
else:
|
else:
|
||||||
setAttr("fontname=\"Arial\"")
|
setAttr("fontname=\"Arial\"")
|
||||||
setAttr("fontsize=12")
|
fontsize = self.parent.mainwin.settings.fontsize
|
||||||
|
setAttr("fontsize=%s" % fontsize)
|
||||||
setAttr("height=\"0.01\"",NODE)
|
setAttr("height=\"0.01\"",NODE)
|
||||||
setAttr("width=\"0.01\"",NODE)
|
setAttr("width=\"0.01\"",NODE)
|
||||||
setAttr("margin=\"0.08,0.03\"",NODE)
|
setAttr("margin=\"0.08,0.03\"",NODE)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
""" Import externals """
|
""" Import externals """
|
||||||
import wx
|
import wx
|
||||||
|
import sys
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -11,6 +12,19 @@ import wx
|
|||||||
import Preference
|
import Preference
|
||||||
import Scyther.Claim as Claim
|
import Scyther.Claim as Claim
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyGrid(wx.GridBagSizer):
|
||||||
|
|
||||||
|
def stepInit(self):
|
||||||
|
self.ypos = 0
|
||||||
|
|
||||||
|
def stepAdd(self,ctrl,txt):
|
||||||
|
self.Add(ctrl,(self.ypos,0),flag=wx.ALIGN_RIGHT)
|
||||||
|
self.Add(txt,(self.ypos,1),flag=wx.ALIGN_CENTER_VERTICAL)
|
||||||
|
self.ypos += 1
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class SettingsWindow(wx.Panel):
|
class SettingsWindow(wx.Panel):
|
||||||
@ -20,8 +34,8 @@ class SettingsWindow(wx.Panel):
|
|||||||
|
|
||||||
self.win = daddy
|
self.win = daddy
|
||||||
space = 10
|
space = 10
|
||||||
grid = wx.GridBagSizer(hgap=space,vgap=space)
|
grid = MyGrid(hgap=space,vgap=space)
|
||||||
ypos = 0
|
grid.stepInit()
|
||||||
|
|
||||||
# Bound on the number of runs
|
# Bound on the number of runs
|
||||||
self.maxruns = int(Preference.get('maxruns','5'))
|
self.maxruns = int(Preference.get('maxruns','5'))
|
||||||
@ -30,9 +44,7 @@ class SettingsWindow(wx.Panel):
|
|||||||
ctrl.SetRange(0,100)
|
ctrl.SetRange(0,100)
|
||||||
ctrl.SetValue(self.maxruns)
|
ctrl.SetValue(self.maxruns)
|
||||||
self.Bind(wx.EVT_SPINCTRL,self.EvtRuns,ctrl)
|
self.Bind(wx.EVT_SPINCTRL,self.EvtRuns,ctrl)
|
||||||
grid.Add(ctrl,(ypos,0))
|
grid.stepAdd(ctrl,txt)
|
||||||
grid.Add(txt,(ypos,1))
|
|
||||||
ypos += 1
|
|
||||||
|
|
||||||
# Matchin options
|
# Matchin options
|
||||||
self.match = int(Preference.get('match','0'))
|
self.match = int(Preference.get('match','0'))
|
||||||
@ -41,9 +53,7 @@ class SettingsWindow(wx.Panel):
|
|||||||
l2 = self.ch = wx.Choice(self,-1,choices=claimoptions)
|
l2 = self.ch = wx.Choice(self,-1,choices=claimoptions)
|
||||||
l2.SetSelection(self.match)
|
l2.SetSelection(self.match)
|
||||||
self.Bind(wx.EVT_CHOICE,self.EvtMatch,l2)
|
self.Bind(wx.EVT_CHOICE,self.EvtMatch,l2)
|
||||||
grid.Add(l2,(ypos,0))
|
grid.stepAdd(l2,r2)
|
||||||
grid.Add(r2,(ypos,1))
|
|
||||||
ypos += 1
|
|
||||||
|
|
||||||
### MISC expert stuff
|
### MISC expert stuff
|
||||||
|
|
||||||
@ -52,24 +62,35 @@ class SettingsWindow(wx.Panel):
|
|||||||
stname = Claim.stateDescription(True,2,False)
|
stname = Claim.stateDescription(True,2,False)
|
||||||
atname = Claim.stateDescription(False,2,False)
|
atname = Claim.stateDescription(False,2,False)
|
||||||
txt = "%s/%s" % (stname,atname)
|
txt = "%s/%s" % (stname,atname)
|
||||||
r9 = wx.StaticText(self,-1,"Maximum number of %s for all claims combined (0 disables maximum)" % txt)
|
r9 = wx.StaticText(self,-1,"Maximum number of %s for all\nclaims combined (0 disables maximum)" % txt)
|
||||||
l9 = wx.SpinCtrl(self, -1, "",style=wx.RIGHT)
|
l9 = wx.SpinCtrl(self, -1, "",style=wx.RIGHT)
|
||||||
l9.SetRange(0,100)
|
l9.SetRange(0,100)
|
||||||
l9.SetValue(self.maxattacks)
|
l9.SetValue(self.maxattacks)
|
||||||
self.Bind(wx.EVT_SPINCTRL,self.EvtMaxAttacks,l9)
|
self.Bind(wx.EVT_SPINCTRL,self.EvtMaxAttacks,l9)
|
||||||
grid.Add(l9,(ypos,0))
|
grid.stepAdd(l9,r9)
|
||||||
grid.Add(r9,(ypos,1))
|
|
||||||
ypos += 1
|
|
||||||
|
|
||||||
self.misc = Preference.get('scytheroptions','')
|
self.misc = Preference.get('scytheroptions','')
|
||||||
r10 = wx.StaticText(self,-1,"Additional parameters for the Scyther tool")
|
r10 = wx.StaticText(self,-1,"Additional parameters for the Scyther tool")
|
||||||
l10 = wx.TextCtrl(self,-1,self.misc,size=(150,-1))
|
l10 = wx.TextCtrl(self,-1,self.misc,size=(200,-1))
|
||||||
self.Bind(wx.EVT_TEXT,self.EvtMisc,l10)
|
self.Bind(wx.EVT_TEXT,self.EvtMisc,l10)
|
||||||
grid.Add(l10,(ypos,0))
|
grid.stepAdd(l10,r10)
|
||||||
grid.Add(r10,(ypos,1))
|
|
||||||
ypos += 1
|
|
||||||
|
|
||||||
# Combine
|
### Graph output stuff
|
||||||
|
|
||||||
|
# Bound on the number of classes/attacks
|
||||||
|
if sys.platform.startswith("lin"):
|
||||||
|
defsize = 14
|
||||||
|
else:
|
||||||
|
defsize = 11
|
||||||
|
self.fontsize = int(Preference.get('fontsize',defsize))
|
||||||
|
txt = wx.StaticText(self,-1,"Attack graph font size")
|
||||||
|
ctrl = wx.SpinCtrl(self, -1, "",style=wx.RIGHT)
|
||||||
|
ctrl.SetRange(6,32)
|
||||||
|
ctrl.SetValue(self.fontsize)
|
||||||
|
self.Bind(wx.EVT_SPINCTRL,self.EvtFontsize,ctrl)
|
||||||
|
grid.stepAdd(ctrl,txt)
|
||||||
|
|
||||||
|
### Combine
|
||||||
self.SetSizer(grid)
|
self.SetSizer(grid)
|
||||||
self.SetAutoLayout(True)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
@ -79,6 +100,9 @@ class SettingsWindow(wx.Panel):
|
|||||||
def EvtRuns(self,evt):
|
def EvtRuns(self,evt):
|
||||||
self.maxruns = evt.GetInt()
|
self.maxruns = evt.GetInt()
|
||||||
|
|
||||||
|
def EvtFontsize(self,evt):
|
||||||
|
self.fontsize = evt.GetInt()
|
||||||
|
|
||||||
def EvtMaxAttacks(self,evt):
|
def EvtMaxAttacks(self,evt):
|
||||||
self.maxattacks = evt.GetInt()
|
self.maxattacks = evt.GetInt()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user