1 """This modules stores some the nMOLDYN PREFERENCES variables that will be used throughout all nMOLDYN code.
2 """
3
4
5 import os
6 import sys
7
9 """Class whose attributes defines the nMOLDYN PREFERENCES variables.
10
11 This class is built on the Singleton principle. That means that one and just one instances of
12 that class will be created.
13 """
16
17 self.progress_rate = '10'
18
19 if sys.platform == 'win32':
20 self.logfile_path = os.environ['USERPROFILE']
21
22 elif sys.platform == 'darwin':
23 self.logfile_path = os.environ['HOME']
24
25 else:
26 self.logfile_path = os.environ['HOME']
27
28
29 self.outputfile_path = self.logfile_path
30
31
32 self.trajfile_path = self.logfile_path
33
34 self.pyro_server_configfile = ''
35
36
37 self.vmd_path = ''
38
39
40 self.ncdump_path = ''
41
42
43 self.ncgen_path = ''
44
45
46 self.acroread_path = ''
47
48
49 self.documentation_style = 'html'
50
51 self.warning_ncdump = 'yes'
52
53 self.warning_ncgen = 'yes'
54
55 self.warning_acroread = 'yes'
56
57 self.warning_vmd = 'yes'
58
59 self.warning_autoupdate = 'no'
60
61 - def help(self, name):
62
63 if name == 'progress_rate':
64 message = 'The step in percentage at which the job progress will be displayed on the console and/or on the logfile.'
65
66 elif name == 'logfile_path':
67 message = 'Directory. The nMOLDYN logfile path.'
68
69 elif name == 'outputfile_path':
70 message = 'Directory. The path for output files.'
71
72 elif name == 'trajfile_path':
73 message = 'Directory. The NetCDF trajectory default path.'
74
75 elif name == 'pyro_server_configfile':
76 message = 'Filename. The name of the file that contains the informations to set up the pyroserver.'
77
78 elif name == 'vmd_path':
79 message = 'Filename. The path for VMD molecular viewer executable.'
80
81 elif name == 'ncdump_path':
82 message = 'Filename. The path for NetCDF ncdump program.'
83
84 elif name == 'ncgen_path':
85 message = 'Filename. The path for NetCDF ncgen program.'
86
87 elif name == 'acroread_path':
88 message = 'Filename. The path for Acrobat Reader program.'
89
90 elif name == 'documentation_style':
91 message = 'html|pdf. The format for any kind of documentation (users guide, API, contextual).'
92
93 elif name == 'warning_ncdump':
94 message = 'yes|no. Should nMOLDYN send a warning if ncdump is not found ?'
95
96 elif name == 'warning_ncgen':
97 message = 'yes|no. Should nMOLDYN send a warning if ncgen is not found ?'
98
99 elif name == 'warning_acroread':
100 message = 'yes|no. Should nMOLDYN send a warning if acrobat reader is not found ?'
101
102 elif name == 'warning_vmd':
103 message = 'yes|no. Should nMOLDYN send a warning if VMD is not found ?'
104
105 elif name == 'warning_autoupdate':
106 message = 'yes|no. Should nMOLDYN search for new version when it starts ?'
107
108 else:
109 message = 'No help available for %s preference variable.' % name
110
111 return message
112
113 instance = None
114
115
120
123
125 if val is None:
126 val = ''
127 return setattr(self.instance, name, val)
128
129
130 PREFERENCES = nMOLDYNPreferences()
131