########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Friday 25 January 2008 16:17:06 
#    
#       The Scripps Research Institute (TSRI)
#       Molecular Graphics Lab
#       La Jolla, CA 92037, USA
#
# Copyright: Daniel Stoffler, Michel Sanner and TSRI
#   
# revision: Guillaume Vareille
#  
#########################################################################
#
# $Header: /opt/cvs/WebServices/Examples/pdb2pqr_pmvnet.py,v 1.1 2008/01/26 00:30:52 sargis Exp $
#
# $Id: pdb2pqr_pmvnet.py,v 1.1 2008/01/26 00:30:52 sargis Exp $
#

from traceback import print_exc
## loading libraries ##
from Vision.StandardNodes import stdlib
masterNet.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")

from WebServices.VisionInterface.WSNodes import wslib
masterNet.getEditor().addLibraryInstance(wslib,"WebServices.VisionInterface.WSNodes", "wslib")

try:
    ## saving node pdb2pqr@ws.nbcr ##
    from WebServices.VisionInterface.WSNodes import pdb2pqrNode
    pdb2pqr_ws_nbcr_1 = pdb2pqrNode(service='http://ws.nbcr.net:8080/opal/services/Pdb2pqrOpalService', name='pdb2pqr@ws.nbcr', library=wslib)
    masterNet.addNode(pdb2pqr_ws_nbcr_1,360,146)
except:
    print "WARNING: failed to restore pdb2pqrNode named pdb2pqr@ws.nbcr in network masterNet"
    print_exc()
    pdb2pqr_ws_nbcr_1=None

try:
    ## saving node Download ##
    from WebServices.VisionInterface.WSNodes import DownloadNode
    Download_2 = DownloadNode(name='Download', library=wslib)
    masterNet.addNode(Download_2,31,108)
    Download_2.inputPortByName['url'].widget.set("http://www.pdb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1CRN", run=False)
    apply(Download_2.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore DownloadNode named Download in network masterNet"
    print_exc()
    Download_2=None

try:
    ## saving node Save Lines ##
    from Vision.StandardNodes import SaveLines
    Save_Lines_3 = SaveLines(name='Save Lines', library=stdlib)
    masterNet.addNode(Save_Lines_3,56,207)
    Save_Lines_3.inputPortByName['filename'].widget.set("1crn.pdb", run=False)
    apply(Save_Lines_3.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore SaveLines named Save Lines in network masterNet"
    print_exc()
    Save_Lines_3=None

try:
    ## saving node WebBrowser ##
    from WebServices.VisionInterface.WSNodes import WebBrowserNode
    WebBrowser_4 = WebBrowserNode(name='WebBrowser', library=wslib)
    masterNet.addNode(WebBrowser_4,331,262)
    WebBrowser_4.inputPortByName['url'].widget.set("", run=False)
    WebBrowser_4.inputPortByName['url'].unbindWidget()
except:
    print "WARNING: failed to restore WebBrowserNode named WebBrowser in network masterNet"
    print_exc()
    WebBrowser_4=None

masterNet.run()
masterNet.freeze()

## saving connections for network Network0 ##
if Download_2 is not None and Save_Lines_3 is not None:
    try:
        masterNet.connectNodes(
            Download_2, Save_Lines_3, "output", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between Download_2 and Save_Lines_3 in network masterNet"
if Save_Lines_3 is not None and pdb2pqr_ws_nbcr_1 is not None:
    try:
        masterNet.connectNodes(
            Save_Lines_3, pdb2pqr_ws_nbcr_1, "filename", "input_file", blocking=True)
    except:
        print "WARNING: failed to restore connection between Save_Lines_3 and pdb2pqr_ws_nbcr_1 in network masterNet"
if pdb2pqr_ws_nbcr_1 is not None and WebBrowser_4 is not None:
    try:
        masterNet.connectNodes(
            pdb2pqr_ws_nbcr_1, WebBrowser_4, "URL", "url", blocking=True)
    except:
        print "WARNING: failed to restore connection between pdb2pqr_ws_nbcr_1 and WebBrowser_4 in network masterNet"
masterNet.unfreeze()

#masterNet.run()
