Package nMOLDYN :: Package Core :: Module Preferences
[hide private]
[frames] | no frames]

Source Code for Module nMOLDYN.Core.Preferences

  1  """This modules stores some the nMOLDYN PREFERENCES variables that will be used throughout all nMOLDYN code. 
  2  """ 
  3   
  4  # The python distribution modules 
  5  import os 
  6  import sys 
  7               
8 -class nMOLDYNPreferences(object):
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 """
14 - class __Singleton:
15 - def __init__(self):
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 # The analysis output files path. 29 self.outputfile_path = self.logfile_path 30 31 # The trajectory files path. 32 self.trajfile_path = self.logfile_path 33 34 self.pyro_server_configfile = '' 35 36 # The vmd path. 37 self.vmd_path = '' 38 39 # The ncdump path. 40 self.ncdump_path = '' 41 42 # The ncgen path. 43 self.ncgen_path = '' 44 45 # The acroread path. 46 self.acroread_path = '' 47 48 # The format for the global documentation style. 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 # The method __new__ is the cornerstone of a Singleton class.
116 - def __new__(c):
120
121 - def __getattr__(self, name):
122 return getattr(self.instance, name)
123
124 - def __setattr__(self, name, val):
125 if val is None: 126 val = '' 127 return setattr(self.instance, name, val)
128 129 # The instance of the |nMOLDYNPreferences| class is created. 130 PREFERENCES = nMOLDYNPreferences() 131