mailr5386 - /1.3/generic_fns/pymol.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 07, 2008 - 18:31:
Author: bugman
Date: Mon Apr  7 18:31:48 2008
New Revision: 5386

URL: http://svn.gna.org/viewcvs/relax?rev=5386&view=rev
Log:
Converted pipe_open(), pipe_open_test(), and pipe_write() to methods of the 
pymol data object.


Modified:
    1.3/generic_fns/pymol.py

Modified: 1.3/generic_fns/pymol.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pymol.py?rev=5386&r1=5385&r2=5386&view=diff
==============================================================================
--- 1.3/generic_fns/pymol.py (original)
+++ 1.3/generic_fns/pymol.py Mon Apr  7 18:31:48 2008
@@ -41,6 +41,60 @@
         """Method for clearing the PyMOL command history."""
 
         self.command_history = ""
+
+
+    def pipe_open(self):
+        """Function for opening a PyMOL pipe."""
+
+        # Test that the PyMOL binary exists.
+        self.relax.IO.test_binary('pymol')
+
+        # Open the PyMOL pipe.
+        relax_data_store.pymol = popen("pymol -qpK", 'w', 0)
+
+        # Execute the command history.
+        if len(pymol_data.command_history) > 0:
+            self.pipe_write(pymol_data.command_history, store_command=0)
+            return
+
+        # Test if the PDB file has been loaded.
+        if hasattr(relax_data_store, 'pdb') and 
relax_data_store.pdb.has_key(self.run):
+            self.open_pdb()
+
+
+    def pipe_open_test(self):
+        """Function for testing if the PyMOL pipe is open."""
+
+        # Test if a pipe has been opened.
+        if not hasattr(relax_data_store, 'pymol'):
+            return 0
+
+        # Test if the pipe has been broken.
+        try:
+            relax_data_store.pymol.write('\n')
+        except IOError:
+            return 0
+
+        # The pipe is open.
+        return 1
+
+
+    def pipe_write(self, command=None, store_command=1):
+        """Function for writing to the PyMOL pipe.
+
+        This function is also used to execute a user supplied PyMOL command.
+        """
+
+        # Reopen the pipe if needed.
+        if not self.pipe_open_test():
+            self.pipe_open()
+
+        # Write the command to the pipe.
+        relax_data_store.pymol.write(command + '\n')
+
+        # Place the command in the command history.
+        if store_command:
+            pymol_data.command_history = pymol_data.command_history + 
command + "\n"
 
 
 
@@ -146,60 +200,6 @@
     self.pipe_write("load " + relax_data_store.pdb[self.run].file_name)
 
 
-def pipe_open():
-    """Function for opening a PyMOL pipe."""
-
-    # Test that the PyMOL binary exists.
-    self.relax.IO.test_binary('pymol')
-
-    # Open the PyMOL pipe.
-    relax_data_store.pymol = popen("pymol -qpK", 'w', 0)
-
-    # Execute the command history.
-    if len(pymol_data.command_history) > 0:
-        self.pipe_write(pymol_data.command_history, store_command=0)
-        return
-
-    # Test if the PDB file has been loaded.
-    if hasattr(relax_data_store, 'pdb') and 
relax_data_store.pdb.has_key(self.run):
-        self.open_pdb()
-
-
-def pipe_open_test():
-    """Function for testing if the PyMOL pipe is open."""
-
-    # Test if a pipe has been opened.
-    if not hasattr(relax_data_store, 'pymol'):
-        return 0
-
-    # Test if the pipe has been broken.
-    try:
-        relax_data_store.pymol.write('\n')
-    except IOError:
-        return 0
-
-    # The pipe is open.
-    return 1
-
-
-def pipe_write(command=None, store_command=1):
-    """Function for writing to the PyMOL pipe.
-
-    This function is also used to execute a user supplied PyMOL command.
-    """
-
-    # Reopen the pipe if needed.
-    if not self.pipe_open_test():
-        self.pipe_open()
-
-    # Write the command to the pipe.
-    relax_data_store.pymol.write(command + '\n')
-
-    # Place the command in the command history.
-    if store_command:
-        pymol_data.command_history = pymol_data.command_history + command + 
"\n"
-
-
 def tensor_pdb(run=None, file=None):
     """Display the diffusion tensor geometric structure."""
 




Related Messages


Powered by MHonArc, Updated Mon Apr 07 18:40:11 2008