mailr21391 - in /trunk/pipe_control: molmol.py pymol_control.py


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

Header


Content

Posted by edward on November 06, 2013 - 10:21:
Author: bugman
Date: Wed Nov  6 10:21:38 2013
New Revision: 21391

URL: http://svn.gna.org/viewcvs/relax?rev=21391&view=rev
Log:
Improvements to the pymol.view and molmol.view user functions for finding the 
PDB files.

Now the possibility that this is being run from a results subdirectory is 
taken into consideration.
If the file cannot be found, the os.pardir parent directory is added to the 
start of the relative
path and the file checked for.


Modified:
    trunk/pipe_control/molmol.py
    trunk/pipe_control/pymol_control.py

Modified: trunk/pipe_control/molmol.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/molmol.py?rev=21391&r1=21390&r2=21391&view=diff
==============================================================================
--- trunk/pipe_control/molmol.py (original)
+++ trunk/pipe_control/molmol.py Wed Nov  6 10:21:38 2013
@@ -138,13 +138,19 @@
                     if not access(file_path, F_OK):
                         file_path = None
 
-                # The file path using the relative path.
+                # The file path using the absolute path.
                 if file_path == None and hasattr(mol, 'file_path_abs') and 
mol.file_path_abs != None:
                     file_path = mol.file_path_abs + sep + mol.file_name
                     if not access(file_path, F_OK):
                         file_path = None
 
-                # Fall back.
+                # Hmmm, maybe the absolute path no longer exists and we are 
in a results subdirectory?
+                if file_path == None and hasattr(mol, 'file_path') and 
mol.file_path != None:
+                    file_path = pardir + sep + mol.file_path + sep + 
mol.file_name
+                    if not access(file_path, F_OK):
+                        file_path = None
+
+                # Fall back to the current directory.
                 if file_path == None:
                     file_path = mol.file_name
 

Modified: trunk/pipe_control/pymol_control.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/pymol_control.py?rev=21391&r1=21390&r2=21391&view=diff
==============================================================================
--- trunk/pipe_control/pymol_control.py (original)
+++ trunk/pipe_control/pymol_control.py Wed Nov  6 10:21:38 2013
@@ -30,7 +30,7 @@
     import pymol
 from math import pi
 from numpy import float64, transpose, zeros
-from os import F_OK, access, sep
+from os import F_OK, access, pardir, sep
 PIPE, Popen = None, None
 if dep_check.subprocess_module:
     from subprocess import PIPE, Popen
@@ -158,13 +158,19 @@
                     if not access(file_path, F_OK):
                         file_path = None
 
-                # The file path using the relative path.
+                # The file path using the absolute path.
                 if file_path == None and hasattr(mol, 'file_path_abs') and 
mol.file_path_abs != None:
                     file_path = mol.file_path_abs + sep + mol.file_name
                     if not access(file_path, F_OK):
                         file_path = None
 
-                # Fall back.
+                # Hmmm, maybe the absolute path no longer exists and we are 
in a results subdirectory?
+                if file_path == None and hasattr(mol, 'file_path') and 
mol.file_path != None:
+                    file_path = pardir + sep + mol.file_path + sep + 
mol.file_name
+                    if not access(file_path, F_OK):
+                        file_path = None
+
+                # Fall back to the current directory.
                 if file_path == None:
                     file_path = mol.file_name
 




Related Messages


Powered by MHonArc, Updated Wed Nov 06 14:20:02 2013