def checkLine(self, name, value): checkName(self, name, value) if not isinstance(value, (str, vcs.line.Tl)): raise ValueError, name + " must be an line primitive or the name of an exiting one." if isinstance(value, str): if not value in _vcs.listelements("line"): raise ValueError, name + " is not an existing line primitive" value = self.x.getline(value) return value
def checkLine(self, name, value): checkName(self, name, value) if not isinstance(value, (str, vcs.line.Tl)): raise ValueError, name + ' must be an line primitive or the name of an exiting one.' if isinstance(value, str): if not value in _vcs.listelements('line'): raise ValueError, name + ' is not an existing line primitive' value = self.x.getline(value) return value
def checkFont(self,name,value): if (value == None): pass elif isNumber(value,min=1): value=int(value) # try to see if font exists nm = _vcs.getfontname(value) elif isinstance(value,str): value = _vcs.getfontnumber(value) else: nms = _vcs.listelements("font") raise ValueError, 'Error for attribute %s: The font attribute values must be a valid font number or a valid font name. valid names are: %s' % (name,', '.join(nms)) return value