- Some improvements in interpretation of claim ranks

This commit is contained in:
ccremers 2006-08-10 16:15:38 +00:00
parent f8400ac02f
commit f9ece7d497
2 changed files with 14 additions and 21 deletions

View File

@ -395,11 +395,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
txt = wx.StaticText(self,-1,cl.getOkay())
rank = cl.getRank()
rankt = [('Fail','red'),
('Fail','dark red'),
('Ok','dark green'),
('Ok','forest green')]
txt = wx.StaticText(self,-1,rankt[rank][0])
font = wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD)
txt.SetFont(font)
rankcolours = ['dark red','red','dark green','forest green']
txt.SetForegroundColour(rankcolours[cl.getRank()])
txt.SetForegroundColour(rankt[rank][1])
grid.Add(txt,(ypos,xpos),(1,1),wx.ALL,10)
xpos += 1

View File

@ -71,15 +71,6 @@ class Claim(object):
def stateName(self,count=1,caps=False):
return stateDescription(self.state,count,caps)
def getOkay(self):
"""
returns "Ok" or "Fail"
"""
if self.okay:
return "Ok"
else:
return "Fail"
def getRank(self):
"""
Return claim rank
@ -88,15 +79,16 @@ class Claim(object):
2 - probably okay
3 - really okay
"""
n = len(self.attacks)
if not self.okay:
# not okay
if self.complete:
if (self.state and self.complete) or ((not self.state) and (n > 0)):
return 0
else:
return 1
else:
# okay!
if not self.complete:
if not ((self.state and (n > 0)) or ((not self.state) and self.complete)):
return 2
else:
return 3
@ -129,8 +121,9 @@ class Claim(object):
"""
returns an element of [None,'Verified','Falsified']
"""
rl = ['Falsified',None,None,'Verified']
return rl[self.getRank()]
opts = ['Falsified',None,None,'Verified']
return opts[self.getRank()]
def __str__(self):
"""
@ -141,11 +134,7 @@ class Claim(object):
s+= " %s" % self.parameter
# determine status
s+= " : %s status : %i %s" % (self.getOkay(),self.failed,self.stateName(self.failed))
vt = self.getVerified()
if vt:
s+= ", and thus the claim is %s" % vt
s+= ". %s" % self.getComment()
s+= "\t: %s" % self.getComment()
return s