version = '1.0'

import os 
class DISCLAIMER:
    disclaimer = """
    G2G Version %s

Disclaimer
    This program and its related software are provided "as is".  
    The program is the property of the Federal government and 
    is the result of a research that was carried out in the 
    Structural Biophysics Laboratory of the National Cancer 
    Institute, NIH.  The authors make no warranties, either 
    express and implied, as to any issues and matters 
    whatsoever with regard to the software.  In particular, any 
    and all warranties of merchantability and fitness for any 
    particular purpose are explicitly excluded.  In no event will 
    the NIH,  the Structural Biophysics Laboratory,  the 
    National Cancer Institute,  or the authors be liable for any  
    loss  of  profits or productivities, any  incidental,  special,  
    exemplary,  or  consequential damages  of  any  nature 
    whatsoever (including without limitation, loss of  use or 
    other commercial or research loss) resulting or  relating  to 
    the use or performance of the software.    
""" % version
    
    def saveLines(self, lines, fp,  fmode='w', vb=0, **rest):
        """ save lines list into a disk file """
        ln = "# save to file: %s " % fp 
        fh = open(fp, fmode)
        for line in lines:
            line = rstrip(line)
            fh.write(line + '\n')
        fh.close()
        
    def prnDis(self):
        fn = "Disclaimer_readed"
        if os.path.exists(fn):
            return 
        print self.disclaimer
        ans = raw_input("Do you still want to continue? [Y/N] ")
        if ans in ['N','n']: 
            import sys
            sys.exit(0)
        self.saveLines(["Disclaimer is readed and agreed"], fn)
        
        
    def prnRDCDis(self):
        """ print RDC disclaimer"""
        print self.disclaimer
        rdc_dis = """ 
        
        **********************************************************************************
        *  If the initial structure resolution is really low, neither of SVD and Powell  *
        *  search methods will extract a meaningful alignment tensor.                    *
        **********************************************************************************
        
        """
        
        print rdc_dis
        
        ans = raw_input("Do you still want to continue? [Y/N] ")
        if ans in ['N','n']: 
            import sys
            sys.exit(0)
    
    def setVersion(self):
        global version
        self.version = version
        