| Home | Trees | Indices | Help |
|
|---|
|
|
1 """
2 Set the environments for park.builder.refl.
3 """
4 import os, sys
5
6 AUTO_CALL = True
7
8 # Default panel size
9 DEFAULT_PANEL_SIZE = (200, 150)
10
11 # default dialog size:
12 DEFAULT_DIALOG_SIZE = (600, 500)
13
14 # default border width
15 DEFAULT_BORDER_WIDTH = 2
16
17 # debug flag
18 DEBUG = False #True #False
19
20
21 # environment name for home directory of PARK
22 PARK_PATH = 'parkPath'
23
24 # subdirectory of park client
25 PARK_CLIENT = 'parkAui'
26
27 # common subdirectories for park client
28 PARK_CLIENT_COMM_DIRS = ('common', 'plot', 'xmlUtil', 'builder')
29
30 # for the theoretical calculation
31 PARK_CLIENT_REFL_THEORY = ('model', 'refl')
32
33
35 """ Set the environment."""
36 if PARK_PATH not in os.environ:
37 try:
38 pdir = os.path.dirname(os.path.dirname(os.path.dirname(
39 os.path.dirname(os.path.abspath(__file__)))))
40 except:
41 # pdir = os.getcwd()
42 # that may doesn't work well, so raise the exception.
43 raise EnvironmentError, \
44 'environment "park" is not found or set'
45 os.environ[PARK_PATH] = pdir
46 else:
47 pdir = os.environ[PARK_PATH]
48
49 clientDir = os.path.join(pdir,PARK_CLIENT)
50 if clientDir not in sys.path:
51 sys.path.append(clientDir)
52
53 for dir0 in PARK_CLIENT_COMM_DIRS:
54 fulldir = os.path.join(clientDir, dir0)
55 if os.path.exists(fulldir) and \
56 fulldir not in sys.path:
57 sys.path.append(fulldir)
58
59 dir0 = os.path.join(clientDir, PARK_CLIENT_REFL_THEORY[0],
60 PARK_CLIENT_REFL_THEORY[1])
61 if dir0 not in sys.path:
62 sys.path.append(dir0)
63
64 if AUTO_CALL:
65 SetEnviron()
66
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Mar 17 14:22:24 2009 | http://epydoc.sourceforge.net |