def checkLine(self,name,value): checkName(self,name,value) if not isinstance(value,(str,vcs_legacy.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_legacy.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_legacy.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_legacy.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_legacy.getfontname(value) elif isinstance(value,str): value = _vcs_legacy.getfontnumber(value) else: nms = _vcs_legacy.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
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_legacy.getfontname(value) elif isinstance(value, str): value = _vcs_legacy.getfontnumber(value) else: nms = _vcs_legacy.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