- Added more colour states, better refactoring
This commit is contained in:
parent
10840031ca
commit
97b08c0c48
@ -395,22 +395,12 @@ 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
|
||||
def makeTC(colour):
|
||||
txt = wx.StaticText(self,-1,cl.getOkay())
|
||||
font = wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD)
|
||||
txt.SetFont(font)
|
||||
txt.SetForegroundColour(colour)
|
||||
rankcolours = ['dark red','red','dark green','forest green']
|
||||
txt.SetForegroundColour(rankcolours[cl.getRank()])
|
||||
grid.Add(txt,(ypos,xpos),(1,1),wx.ALL,10)
|
||||
if cl.okay:
|
||||
if cl.getVerified():
|
||||
makeTC("forest green")
|
||||
else:
|
||||
makeTC("dark green")
|
||||
else:
|
||||
if cl.getVerified():
|
||||
makeTC("red")
|
||||
else:
|
||||
makeTC("dark red")
|
||||
xpos += 1
|
||||
|
||||
# verified?
|
||||
|
@ -71,6 +71,35 @@ 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
|
||||
0 - really failed
|
||||
1 - probably failed
|
||||
2 - probably okay
|
||||
3 - really okay
|
||||
"""
|
||||
if not self.okay:
|
||||
# not okay
|
||||
if self.complete:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
# okay!
|
||||
if not self.complete:
|
||||
return 2
|
||||
else:
|
||||
return 3
|
||||
def getComment(self):
|
||||
"""
|
||||
returns a sentence describing the results for this claim
|
||||
@ -94,35 +123,13 @@ class Claim(object):
|
||||
remark = "Exactly %i %s" % (n,atxt)
|
||||
return remark + "."
|
||||
|
||||
def getOkay(self):
|
||||
"""
|
||||
returns "Ok" or "Fail"
|
||||
"""
|
||||
if self.okay:
|
||||
return "Ok"
|
||||
else:
|
||||
return "Fail"
|
||||
|
||||
def getVerified(self):
|
||||
"""
|
||||
returns an element of [None,'Verified','Falsified']
|
||||
"""
|
||||
n = len(self.attacks)
|
||||
if self.state:
|
||||
# this is about reachability
|
||||
if n > 0:
|
||||
return "Verified"
|
||||
else:
|
||||
if self.complete:
|
||||
return "Falsified"
|
||||
else:
|
||||
# this is about attacks
|
||||
if n > 0:
|
||||
return "Falsified"
|
||||
else:
|
||||
if self.complete:
|
||||
return "Verified"
|
||||
return None
|
||||
rl = ['Falsified',None,None,'Verified']
|
||||
return rl[self.getRank()]
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user