Author: bugman Date: Fri Jun 11 14:02:28 2010 New Revision: 11231 URL: http://svn.gna.org/viewcvs/relax?rev=11231&view=rev Log: Added a method for translating pymol.cmd.do() commands into specific pymol.cmd functions. This prevents problems with commands being executed asynchronously. For example images were being saved before ray-tracing was complete. Modified: 1.3/generic_fns/pymol_control.py Modified: 1.3/generic_fns/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pymol_control.py?rev=11231&r1=11230&r2=11231&view=diff ============================================================================== --- 1.3/generic_fns/pymol_control.py (original) +++ 1.3/generic_fns/pymol_control.py Fri Jun 11 14:02:28 2010 @@ -78,13 +78,31 @@ # Execute the command. if self.exec_mode == 'module': - pymol.cmd.do(command) + self.translate_cmd(command) else: self.pymol.write(command + '\n') # Place the command in the command history. if store_command: self.command_history = self.command_history + command + "\n" + + + def translate_cmd(self, command): + """Translate the command to appropriate pymol.cmd calls. + + The translation is to prevent problems caused by pymol.cmd.do() not waiting for the command to complete. + + @param command: The PyMOL command. + @type command: str + """ + + # Ray-tracing (this totally dies in pymol.cmd.do()). + if command == 'ray': + pymol.cmd.ray() + + # Use pymol.cmd.do() for all other commands. + else: + pymol.cmd.do(command) def open_gui(self):