From f9ece7d497d28599c159f1afc8052727e27accf5 Mon Sep 17 00:00:00 2001 From: ccremers Date: Thu, 10 Aug 2006 16:15:38 +0000 Subject: [PATCH] - Some improvements in interpretation of claim ranks --- gui/Gui/Scytherthread.py | 10 +++++++--- gui/Scyther/Claim.py | 25 +++++++------------------ 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/gui/Gui/Scytherthread.py b/gui/Gui/Scytherthread.py index ce38456..fe426e7 100644 --- a/gui/Gui/Scytherthread.py +++ b/gui/Gui/Scytherthread.py @@ -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 diff --git a/gui/Scyther/Claim.py b/gui/Scyther/Claim.py index b5c0689..59202ab 100644 --- a/gui/Scyther/Claim.py +++ b/gui/Scyther/Claim.py @@ -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