1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
5 # Jockey is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
10 # Jockey is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 if type(val) != types.TupleType and type(val) != types.ListType:
21 return (" not a valid coordinate.")
23 return "Coordinate must be a pair of numbers.\n"
25 error = NumType(val[0])
26 if error: return error
28 error = NumType(val[1])
29 if error: return error
32 def IntervalType(val):
33 if type(val) in (types.IntType, types.LongType,
34 types.FloatType, types.FunctionType):
36 return "Expecting a number or a function"
38 def CoordOrNoneType(val):
39 if type(val) not in (types.TupleType, types.ListType):
40 return "Expecting a tuple or a list."
42 return "Coordinate must be a pair of numbers.\n"
44 if v != None and NumType(val[0]) != None:
45 return "Expecting a pair of numbers"
49 if type(val) in (types.IntType, types.LongType, types.FloatType):
52 return "Expecting a number, found \"" + str(val) + "\""
55 if type(val) in (types.IntType, types.LongType, types.FloatType):
58 return "Expecting a unit, found \"" + str(val) + "\""
61 if type(val) not in (types.TupleType, types.ListType):
62 return "Expecting tuple or list."
64 return "Expecting (xoff, yoff, fill)."
68 if type(val) in (types.StringType, types.FunctionType):
70 return "Format must be a string or a function"