def populateColors(self): """Populate colors""" if "bg" in self.ref.properties: self.bgColor = buildColor(self.ref.properties["bg"]) if "fg" in self.ref.properties: self.fgColor = buildColor(self.ref.properties["fg"]) if "border" in self.ref.properties: self.border = buildColor(self.ref.properties["border"])
def validate(self): """Validates the CML comment""" self.validateRecordType(CMLcc.CODE) CMLVersion.validate(self.ref) if "bg" in self.ref.properties: self.bgColor = buildColor(self.ref.properties["bg"]) if "fg" in self.ref.properties: self.fgColor = buildColor(self.ref.properties["fg"]) if "border" in self.ref.properties: self.border = buildColor(self.ref.properties["border"]) if self.bgColor is None: if self.fgColor is None: if self.border is None: raise Exception("The '" + CMLcc.CODE + "' CML comment does not supply neither " "background nor foreground color nor " "border color")
def validate(self): """Validates the CML gb comment""" self.validateRecordType(CMLgb.CODE) CMLVersion.validate(self.ref) if 'title' in self.ref.properties: self.title = self.ref.properties['title'] if 'id' in self.ref.properties: self.id = self.ref.properties['id'].strip() if "bg" in self.ref.properties: self.bgColor = buildColor(self.ref.properties["bg"]) if "fg" in self.ref.properties: self.fgColor = buildColor(self.ref.properties["fg"]) if "border" in self.ref.properties: self.border = buildColor(self.ref.properties["border"]) if self.id is None: raise Exception("The '" + CMLgb.CODE + "' CML comment does not supply id") if self.id.strip() == '': raise Exception("The '" + CMLgb.CODE + "' CML comment does not supply id")