/[escript]/trunk/pyvisi/py_src/common.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/common.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 605 - (show annotations)
Mon Mar 20 07:16:27 2006 UTC (13 years, 6 months ago) by gross
File MIME type: text/x-python
File size: 2765 byte(s)
pyvisi with vtk runs noe on the altix
1 # Copyright (C) 2004-2005 Paul Cochrane
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # $Id: common.py,v 1.14 2005/11/02 04:52:07 paultcochrane Exp $
18
19 ## @file common.py
20
21 """
22 Variables common to all classes and functions
23 """
24
25 _debug = False
26 _pyvisiVersion = '0.1'
27 _pyvisiRevision = 'pre-alpha-4'
28
29 __revision__ = _pyvisiRevision
30
31 import os.path
32
33 def overrideWarning(methodName):
34 """
35 Print a warning message for functions that need to be overridden but are
36 called.
37
38 @param methodName: The method name as a string.
39 """
40 # print a warning message if get to here
41 print "\nWarning!! If you are reading this message, then the renderer"
42 print " you have chosen hasn't overridden this method as"
43 print " they should have. Please contact the maintainer of"
44 print " the renderer module, quoting the method name given"
45 print " below, to get this problem fixed."
46 print "\nMethod: %s()\n" % methodName
47
48 # barf
49 raise NotImplementedError, "Method not implemented by renderer"
50
51 def unsupportedError(rendererName):
52 """
53 Print an error message when a method is called that is defined in pyvisi
54 but is not supported at the renderer module level.
55
56 @param rendererName: the name of the renderer module
57 @type rendererName: string
58 """
59 errorString = "Sorry, but %s doesn't support this method." % rendererName
60 raise NotImplementedError, errorString
61
62 def fileCheck(fname):
63 """
64 Check to see if the specified file exists, if not, raise an exception
65
66 @param fname: the name of the file to check for
67 @type fname: string
68 """
69 if os.path.exists(fname) is None:
70 raise ValueError, "File %s doesn't exist" % fname
71
72 return
73
74 def debugMsg(message):
75 """
76 Convenience function for debugging messages.
77
78 This function will print out a debugging message if the debug variable
79 is set.
80
81 @param message: the message to output if the debug flag is set
82 @type message: string
83 """
84 if _debug:
85 print "\tBASE: %s" % message
86
87 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26