ó
Ń%Tc           @   sW   d  Z  d d l Z d d l m Z m Z d d l m Z d   Z d   Z d   Z	 d S(   s0   Ensure that Coot is able to properly run RCrane.i˙˙˙˙N(   t   svn_revisiont   coot_version(   t   monomer_restraints_pyc           C   s   t    d k r t St Sd S(   sŇ   Make sure that Coot is a new enough version
    
    ARGUMENTS:
        None
    RETURNS:
        True if Coot is SVN revision 3562 or newer (corresponds to the 0.6.2 release build)
        False otherwise
    ię  N(   R    t   Truet   False(    (    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/preLaunchCheck.pyt   checkVersion   s    c           C   s&   t  d  d d d k r t St Sd S(   sç   Make sure that the monomer library is up-to-date
    
    ARGUMENTS:
        None
    RETURNS:
        True if Coot is using an appropriate monomer library (the one included with Coot 0.6.2 or CCP4 6.2)
        False otherwise
    t   At
   _chem_compi   t   RNAN(   t   monomer_restraintsR   R   (    (    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/preLaunchCheck.pyt   checkMonomerLibrary*   s    
c          C   sŰ   t    su d GHd t t    GHd GHt j d t j d t j  }  |  j d  |  j d  |  j	   |  j
   t St   sÓ d GHt j d t j d t j  }  |  j d  |  j d	  |  j	   |  j
   t St Sd
 S(   sł  Run both pre-launch checks (Coot version and monomer library) and report any errors that occur
    
    ARGUMENTS:
        None
    RETURNS:
        True if the Coot version is recent enough to run RCrane and Coot is using an appropriate monomer library
        False otherwise
    EFFECTS:
        If Coot fails a pre-launch check, an error will be printed to standard output and a pop-up
        will appear explaining the error
    s,   RCrane requires Coot version 0.6.2 or newer.s   Current Coot version is s   RCrane not launched.t   typet   buttonss   RCrane ErrorsB   RCrane requires Coot version 0.6.2 or newer.  RCrane not launched.s5   Monomer library is out of date.  RCrane not launched.se  RCrane was not launched because Coot appears to be using an out-of-date monomer library.  Coot cannot refine RNA unless the monomer library is updated.

This problem is typically caused by running Coot on a computer with an old version of CCP4 (&lt;6.2) installed.  If this is the case, there are two solutions:

1) Set $COOT_REFMAC_LIB_DIR to
/path/to/Coot/share/coot/lib before running Coot.
Under Bash, this can be done with the command:
  export COOT_REFMAC_LIB_DIR=/path/to/coot/share/coot/lib
with /path/to/coot replaced by the appropriate Coot directory.

2) Upgrade your CCP4 installation to 6.2 or newer.N(   R   t   strR   t   gtkt   MessageDialogt   MESSAGE_ERRORt
   BUTTONS_OKt	   set_titlet
   set_markupt   runt   destroyR   R
   R   (   t   errorDialog(    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/preLaunchCheck.pyt   checkCootAndReportErrors:   s(    	

	


(
   t   __doc__R   t   cootR    R   R   R	   R   R
   R   (    (    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/preLaunchCheck.pyt   <module>   s   		