start_pymol.py (pymol-v1.8.6.0.tar.bz2) | : | start_pymol.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
# (2) include the following code block at the *top* level of your | # (2) include the following code block at the *top* level of your | |||
# program script. | # program script. | |||
# | # | |||
# ================================================================ | # ================================================================ | |||
# PyMOL launch code | # PyMOL launch code | |||
# | # | |||
# === Provide arguments to PyMOL (first one must be "pymol") | # === Provide arguments to PyMOL (first one must be "pymol") | |||
pymol_argv = [ "pymol", "-q" ] | pymol_argv = [ "pymol", "-q" ] | |||
# | # | |||
# === Launch the PyMOL thread(s) | # === Launch the PyMOL thread(s) | |||
import os,threading,__main__,__builtin__ | try: | |||
import __builtin__ | ||||
except ImportError: | ||||
import builtins as __builtin__ | ||||
import os,threading,__main__ | ||||
threading.Thread(target=__builtin__.execfile, | threading.Thread(target=__builtin__.execfile, | |||
args=(os.environ['PYMOL_PATH']+"/modules/launch_pymol.py", | args=(os.environ['PYMOL_PATH']+"/modules/launch_pymol.py", | |||
__main__.__dict__,__main__.__dict__)).start() | __main__.__dict__,__main__.__dict__)).start() | |||
# | # | |||
# === Wait until PyMOL is ready to receive commands | # === Wait until PyMOL is ready to receive commands | |||
e=threading.Event() | e=threading.Event() | |||
while not hasattr(__main__,'pymol'): | while not hasattr(__main__,'pymol'): | |||
e.wait(0.01) | e.wait(0.01) | |||
while not pymol._cmd.ready(): | while not pymol._cmd.ready(): | |||
e.wait(0.01) | e.wait(0.01) | |||
# | # | |||
# PyMOL is now launched, you can now import "pymol" modules. | # PyMOL is now launched, you can now import "pymol" modules. | |||
# =============================================================== | # =============================================================== | |||
from pymol import cmd | from pymol import cmd | |||
cmd.load("$PYMOL_PATH/test/dat/pept.pdb") | cmd.load("$PYMOL_PATH/test/dat/pept.pdb") | |||
print " The surface area is: %8.3f"%cmd.get_area() | print(" The surface area is: %8.3f"%cmd.get_area()) | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |