136 def setFromString(self,reqstring):
137 """Set requirements from a space-separated string with flag req pairs
138 e.g. 'SCTB 3 EMEC G' (numbers or letters for status)"""
139 self.req={}
140 namelist=self.names.allNames()
141 tokens=str(reqstring).
split()
142 ix=0
143 while (ix+1<len(tokens)):
144 flagname=tokens[ix]
145 val=colourVal(tokens[ix+1])
146 if (val is not None):
147 used=False
148
149 for name in namelist:
150 if (flagname==name[0:len(flagname)]):
151 self.req[self.names.num(name)]=val
152 used=True
153 if (not used):
154 print ("Name %s does not match any status flag" % flagname)
155 else:
156 print ("Value %s does not define a status" % tokens[ix+1])
157 ix+=2
158
std::vector< std::string > split(const std::string &s, const std::string &t=":")