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 import time
34 import sys
35
36
37
38
40 """ create a root and hide it
41 """
42 from Tkinter import Tk
43 root = Tk()
44 root.withdraw()
45 return root
46
47
55
56
58 """
59 """
60 import os
61 import Vision
62 iconsDir = os.path.join( Vision.__path__[0], 'Icons')
63 image_dir = os.path.join( iconsDir, 'Images')
64
65
66 from Support.version import __version__
67 version = ' ' + __version__
68
69 copyright = """(c) 1999-2007 Molecular Simulation Laboratory, The Scripps Research Institute
70 ALL RIGHTS RESERVED """
71 authors = """Authors: Michel F. Sanner, Daniel Stoffler, Guillaume Vareille"""
72 icon = os.path.join( iconsDir,'vision.png')
73 third_party = """"""
74
75 text = 'Python executable : '+sys.executable+'\n'
76 text += 'Vision script : '+__file__+'\n'
77 text += 'MGLTool packages : '+'\n'
78
79 from user import home
80 updates_rc_dir = home + os.path.sep + ".mgltools" + os.sep + 'update'
81 latest_tested_rc = updates_rc_dir + os.sep + 'latest_tested'
82 latest_rc = updates_rc_dir + os.sep + 'latest'
83
84 if os.path.exists(latest_tested_rc):
85 p = open(latest_tested_rc).read()
86 sys.path.insert(0, p)
87 text += ' tested : ' + p +'\n'
88
89 if os.path.exists(latest_rc):
90 p = open(latest_rc).read()
91 sys.path.insert(0, p)
92 text += ' nightly : ' + p +'\n'
93
94 text += version + ': ' + 'ADD PATH HERE'
95 path_data = text
96
97 from mglutil.splashregister.splashscreen import SplashScreen
98 from mglutil.splashregister.about import About
99 about = About(image_dir=image_dir, third_party=third_party,
100 path_data=path_data,
101 title='Vision', version=version,
102 copyright=copyright, authors=authors, icon=icon)
103 splash = SplashScreen(about, noSplash=False)
104
105 return splash, about
106
107
109 root = createRoot()
110 splash, about = createSplash()
111 lSplashVisibleTimeStart = time.clock()
112 ed = createVision(root, interactive=True)
113 masterNet = ed.currentNetwork
114 masterNet.isApplication = True
115 lSplashVisibleTimeEnd = time.clock()
116 while lSplashVisibleTimeEnd - lSplashVisibleTimeStart < 2:
117 lSplashVisibleTimeEnd = time.clock()
118 splash.finish()
119 return masterNet
120
121
123 ed.master.mainloop()
124
125
126
127
128
130 return ed.currentNetwork
131
132
134 return ed.currentNetwork.nodes
135
136
138 """The main function for running Vision"""
139
140
141
142 import time
143 import sys, getopt
144 import os
145 import user
146 import warnings
147 import stat
148 from string import split
149
150 if argv is None:
151 argv = ['Vision/bin/runVision.py', '-i']
152
153 help_msg = """usage: %s <options> <networknames>
154 -h or --help : print this message
155 -i or --interactive : run interactive""" % sys.argv[0]
156 try:
157 optlist, args = getopt.getopt(argv[1:], 'hi', [
158 'help', 'interactive', 'noSplash'] )
159 except:
160 print "Unknown option!"
161 print help_msg
162 sys.exit(1)
163
164 interactive = 0
165 noSplash = False
166 for opt in optlist:
167 if opt[0] in ('-h', '--help'):
168 print help_msg
169 sys.exit()
170 elif opt[0] in ('-i', '--interactive'):
171 interactive = 1
172 elif opt[0] in ('--noSplash',):
173 noSplash = True
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190 from Support.path import path_text, release_path
191 import Vision
192 sys.modules['__main__'] = sys.modules['Vision']
193 print 'Run Vision from ', Vision.__path__[0]
194
195
196 root = createRoot()
197 root.withdraw()
198
199
200
201 if noSplash is False:
202 splash, about = createSplash()
203 lSplashVisibleTimeStart = time.clock()
204
205
206
207
208 ed = createVision(root, interactive)
209 globals()['ed'] = ed
210
211
212
213
214
215 if sys.platform == 'win32' or sys.platform == 'irix646':
216 ed.configure(withThreads=0)
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233 from mglutil.util.packageFilePath import findResourceFile
234 ed.sourceFile(resourceFile='_visionrc')
235
236
237
238
239 if noSplash is False:
240 lSplashVisibleTimeEnd = time.clock()
241 while lSplashVisibleTimeEnd - lSplashVisibleTimeStart < 2:
242 lSplashVisibleTimeEnd = time.clock()
243 splash.finish()
244
245
246
247
248
249 root.deiconify()
250
251
252
253
254
255
256 if len(args):
257 ed.root.update()
258 for netName in args:
259 ed.loadNetwork(netName)
260
261
262
263
264 if interactive:
265 sys.stdin = sys.__stdin__
266 sys.stdout = sys.__stdout__
267 sys.stderr = sys.__stderr__
268 import code
269 code.interact( 'Vision Interactive Shell', local=globals() )
270 else:
271 ed.master.mainloop()
272
273 FlagCheck = 1
274 CRITICAL_DEPENDENCIES = ['Pmw', 'NetworkEditor', 'mglutil', 'Numeric']
275 NONCRITICAL_DEPENDENCIES = ['magick', 'PIL', 'opengltk', 'DejaVu', 'grail', 'MolKit', 'symserv','Volume', 'Pmv', 'matplotlib', 'Support']
276