Author: bugman Date: Fri Aug 26 12:12:07 2011 New Revision: 14478 URL: http://svn.gna.org/viewcvs/relax?rev=14478&view=rev Log: Created the front end for the pymol.macro_run user function. This will be used to open and execute macros from text files. Modified: 1.3/prompt/pymol_control.py Modified: 1.3/prompt/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/pymol_control.py?rev=14478&r1=14477&r2=14478&view=diff ============================================================================== --- 1.3/prompt/pymol_control.py (original) +++ 1.3/prompt/pymol_control.py Fri Aug 26 12:12:07 2011 @@ -204,6 +204,40 @@ colour.__x11_colours_prompt_doc__ ] _build_doc(macro_apply) + + + def macro_run(self, file=None, dir='pymol'): + # Function intro text. + if self._exec_info.intro: + text = self._exec_info.ps3 + "pymol.macro_run(" + text = text + "file=" + repr(file) + text = text + ", dir=" + repr(dir) + ")" + print(text) + + # The argument checks. + arg_check.is_str(file, 'file name') + arg_check.is_str(dir, 'directory name', can_be_none=True) + + # Execute the functional code. + pymol.macro_run(file=file, dir=dir) + + # The function doc info. + macro_run._doc_title = "Open and execute the PyMOL macro file." + macro_run._doc_title_short = "PyMOL macro file execution." + macro_run._doc_args = [ + ["file", "The name of the PyMOL macro file."], + ["dir", "The directory name."], + ] + macro_run._doc_desc = """ + This user function is for opening and running a PyMOL macro located within a text file. + """ + macro_run._doc_examples = """ + To execute the macro file 's2.pml' located in the directory 'pymol', type: + + relax> pymol.macro_run(file='s2.pml') + relax> pymol.macro_run(file='s2.pml', dir='pymol') + """ + _build_doc(macro_run) def macro_write(self, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir='pymol', force=False):