Description: Modify examples so that they do not run forever When invoked in script mode (-c) pymol up until v2 used to exit; newer versions will loop the aninamtion forever. This patch puts an explicit stop at the end of each script where there is an animation being generated to make it stop playing. . While this potentially makes the examples less useful to run from the command line themselves without editing, it at least fixes the tests. Author: Stuart Prescott Bug: #897191 --- a/examples/cookbook/area_diff.pml +++ b/examples/cookbook/area_diff.pml @@ -69,4 +69,5 @@ set surface_solvent mplay +mstop --- a/examples/cookbook/scenes2movie.pml +++ b/examples/cookbook/scenes2movie.pml @@ -59,3 +59,4 @@ mview interpolate rewind mplay +mstop --- a/examples/devel/cgo_label_hack.py +++ b/examples/devel/cgo_label_hack.py @@ -1,4 +1,5 @@ import math +import time from pymol.cgo import * from pymol import cmd @@ -64,3 +65,6 @@ cmd.clip('far',-5) cmd.mplay() +time.sleep(3) + +cmd.mstop() --- a/examples/devel/cgo02.py +++ b/examples/devel/cgo02.py @@ -1,6 +1,7 @@ from pymol.cgo import * from pymol import cmd import math +import time # this is an example of creating a cgo object consisting of multiple # states which form a movie @@ -47,4 +48,6 @@ cmd.clip('far',-5) cmd.mplay() - +time.sleep(3) + +cmd.mstop() --- a/examples/devel/cgo03.py +++ b/examples/devel/cgo03.py @@ -1,6 +1,7 @@ from pymol.cgo import * from pymol import cmd import math +import time # a more comple example of using cgo's to create a fancy animation. @@ -84,4 +85,6 @@ cmd.turn('x',-60) cmd.mplay() - +time.sleep(3) + +cmd.mstop() --- a/examples/devel/webgui02.py +++ b/examples/devel/webgui02.py @@ -8,6 +8,7 @@ except ImportError: import time import cgi +import string import threading import traceback import os, sys, re --- a/examples/devel/scenes_to_movie01.pml +++ b/examples/devel/scenes_to_movie01.pml @@ -73,5 +73,5 @@ rewind mplay - +mstop --- a/examples/devel/chempy_model03.py +++ b/examples/devel/chempy_model03.py @@ -7,12 +7,7 @@ import time # first we need a model -if os.path.exists("$PYMOL_PATH/test/dat/pept.pdb"): - cmd.load("$PYMOL_PATH/test/dat/pept.pdb","demo") -else: - from inspect import getsourcefile - current_file_dir = os.path.dirname(os.path.abspath(getsourcefile(lambda:0))) - cmd.load(os.path.join(current_file_dir, "../../test/dat/pept.pdb"), "demo") +cmd.load("$PYMOL_PATH/test/dat/pept.pdb","demo") # let's dress it up a little bit @@ -43,3 +38,7 @@ cmd.mplay() # by default, PyMOL plays ~30 fps. # "set movie_delay=0" to see maximum speed... + +time.sleep(3) + +cmd.mstop() --- a/examples/devel/gl03.py +++ b/examples/devel/gl03.py @@ -5,6 +5,7 @@ object which updates coordinates every f ''' import numpy +import time from OpenGL.GL import * from pymol.callback import Callback from pymol import cmd @@ -105,3 +106,6 @@ cmd.turn('x',20) cmd.mset('1-62') cmd.mplay() +time.sleep(3) + +cmd.mstop() --- a/data/demo/cgo03.py +++ b/data/demo/cgo03.py @@ -1,6 +1,7 @@ from pymol.cgo import * from pymol import cmd import math +import time # a more comple example of using cgo's to create a fancy animation. @@ -88,4 +89,6 @@ cmd.turn('x',-60) cmd.mplay() - +time.sleep(3) + +cmd.mstop() --- a/examples/devel/mutate02.py +++ b/examples/devel/mutate02.py @@ -1,5 +1,7 @@ # This example mutates every residue of a chain to alanine. +import string + # load a structure cmd.load("$TUT/1hpv.pdb")