########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Tuesday 17 April 2007 10:52:38 
#    
#       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/python/packages/share1.5/Vision/doc/Examples/matplotlib/ColorBar_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#
# $Id: ColorBar_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#

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

from Vision.StandardNodes import stdlib
masterNet.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")

try:
    ## saving node Contour ##
    from Vision.matplotlibNodes import ContourNE
    Contour_34 = ContourNE(constrkw = {}, name='Contour', library=matplotliblib)
    masterNet.addNode(Contour_34,157,256)
    Contour_34.inputPortByName['contour'].widget.set("filledcontour", run=False)
    Contour_34.inputPortByName['length_colors'].widget.set("10", run=False)
    Contour_34.inputPortByName['cmap'].widget.set("prism", run=False)
    Contour_34.inputPortByName['colors'].widget.set("lightsalmon", run=False)
    apply(Contour_34.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore ContourNE named Contour in network masterNet"
    print_exc()
    Contour_34=None

try:
    ## saving node ReadTable ##
    from Vision.StandardNodes import ReadTable
    ReadTable_37 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
    masterNet.addNode(ReadTable_37,124,12)
    ReadTable_37.inputPortByName['filename'].widget.set("Data/contour_data_3.dat", run=False)
    ReadTable_37.inputPortByName['sep'].widget.set(",", run=False)
    ReadTable_37.inputPortByName['datatype'].widget.set("float", run=False)
    apply(ReadTable_37.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore ReadTable named ReadTable in network masterNet"
    print_exc()
    ReadTable_37=None

try:
    ## saving node As Type ##
    from Vision.StandardNodes import AsType
    As_Type_40 = AsType(constrkw = {}, name='As Type', library=stdlib)
    masterNet.addNode(As_Type_40,145,192)
except:
    print "WARNING: failed to restore AsType named As Type in network masterNet"
    print_exc()
    As_Type_40=None

try:
    ## saving node ColorBar ##
    from Vision.matplotlibNodes import ColorBarNE
    ColorBar_41 = ColorBarNE(constrkw = {}, name='ColorBar', library=matplotliblib)
    masterNet.addNode(ColorBar_41,205,406)
except:
    print "WARNING: failed to restore ColorBarNE named ColorBar in network masterNet"
    print_exc()
    ColorBar_41=None

masterNet.freeze()

## saving connections for network ColorBar ##
if ReadTable_37 is not None and As_Type_40 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_37, As_Type_40, "data", "inArrayList", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_37 and As_Type_40 in network masterNet"
if As_Type_40 is not None and Contour_34 is not None:
    try:
        masterNet.connectNodes(
            As_Type_40, Contour_34, "outArray", "arraylistz", blocking=True)
    except:
        print "WARNING: failed to restore connection between As_Type_40 and Contour_34 in network masterNet"
if Contour_34 is not None and ColorBar_41 is not None:
    try:
        masterNet.connectNodes(
            Contour_34, ColorBar_41, "axes", "plot", blocking=True)
    except:
        print "WARNING: failed to restore connection between Contour_34 and ColorBar_41 in network masterNet"
if Contour_34 is not None and ColorBar_41 is not None:
    try:
        masterNet.connectNodes(
            Contour_34, ColorBar_41, "contour", "current_image", blocking=True)
    except:
        print "WARNING: failed to restore connection between Contour_34 and ColorBar_41 in network masterNet"
masterNet.unfreeze()
#masterNet.run()

