1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
#
# Jockey is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
#
# Jockey is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
import pychart_util
import types
AnyType = 9998
def IntervalType(val):
if type(val) in (types.IntType, types.LongType,
types.FloatType, types.FunctionType):
return None
return "Expecting a number or a function"
def CoordType(val):
if type(val) not in (types.TupleType, types.ListType):
return "Expecting a tuple or a list"
if len(val) != 2:
return "Coordinate must be a pair of numbers"
for v in val:
if v != None and NumberType(v):
return "Expecting a pair of numbers (got %s)" % str(v)
return None
def NumberType(val):
if type(val) in (types.IntType, types.LongType, types.FloatType):
return None
else:
return "Expecting a number"
def UnitType(val):
if type(val) in (types.IntType, types.LongType, types.FloatType):
return
else:
return "Expecting a unit"
def ShadowType(val):
if type(val) not in (types.TupleType, types.ListType):
return "Expecting tuple or list."
if len(val) != 3:
return "Expecting (xoff, yoff, fill)."
return None
def FormatType(val):
if type(val) in (types.StringType, types.FunctionType):
return None
return "Format must be a string or a function"
|