########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Monday 16 April 2007 13:44:49 
#    
#       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/Histogram_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#
# $Id: Histogram_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 Histogram ##
    from Vision.matplotlibNodes import HistogramNE
    Histogram_8 = HistogramNE(constrkw = {}, name='Histogram', library=matplotliblib)
    masterNet.addNode(Histogram_8,33,377)
    Histogram_8.inputPortByName['bins'].widget.set(50, run=False)
    Histogram_8.inputPortByName['patch_facecolor'].widget.set("green", run=False)
    apply(Histogram_8.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore HistogramNE named Histogram in network masterNet"
    print_exc()
    Histogram_8=None

try:
    ## saving node Draw Area ##
    from Vision.matplotlibNodes import MPLDrawAreaNE
    Draw_Area_9 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
    masterNet.addNode(Draw_Area_9,119,326)
except:
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
    print_exc()
    Draw_Area_9=None

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

try:
    ## saving node Index ##
    from Vision.StandardNodes import Index
    Index_11 = Index(constrkw = {}, name='Index', library=stdlib)
    masterNet.addNode(Index_11,12,208)
    apply(Index_11.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore Index named Index in network masterNet"
    print_exc()
    Index_11=None

try:
    ## saving node Plot ##
    from Vision.matplotlibNodes import PlotNE
    Plot_12 = PlotNE(constrkw = {}, name='Plot', library=matplotliblib)
    masterNet.addNode(Plot_12,287,332)
    Plot_12.inputPortByName['lineStyle'].widget.set("dashed", run=False)
    Plot_12.inputPortByName['color'].widget.set("red", run=False)
    apply(Plot_12.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore PlotNE named Plot in network masterNet"
    print_exc()
    Plot_12=None

try:
    ## saving node Index ##
    from Vision.StandardNodes import Index
    Index_13 = Index(constrkw = {}, name='Index', library=stdlib)
    masterNet.addNode(Index_13,163,197)
    apply(Index_13.inputPortByName['index'].widget.configure, (), {'max': 2})
    Index_13.inputPortByName['index'].widget.set(1, run=False)
    apply(Index_13.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore Index named Index in network masterNet"
    print_exc()
    Index_13=None

try:
    ## saving node Index ##
    from Vision.StandardNodes import Index
    Index_14 = Index(constrkw = {}, name='Index', library=stdlib)
    masterNet.addNode(Index_14,325,191)
    apply(Index_14.inputPortByName['index'].widget.configure, (), {'max': 2})
    Index_14.inputPortByName['index'].widget.set(2, run=False)
    apply(Index_14.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore Index named Index in network masterNet"
    print_exc()
    Index_14=None

try:
    ## saving node MultiPlot ##
    from Vision.matplotlibNodes import MultiPlotNE
    MultiPlot_15 = MultiPlotNE(constrkw = {}, name='MultiPlot', library=matplotliblib)
    masterNet.addNode(MultiPlot_15,185,515)
except:
    print "WARNING: failed to restore MultiPlotNE named MultiPlot in network masterNet"
    print_exc()
    MultiPlot_15=None

masterNet.freeze()

## saving connections for network Histogram ##
if Draw_Area_9 is not None and Histogram_8 is not None:
    try:
        masterNet.connectNodes(
            Draw_Area_9, Histogram_8, "drawAreaDef", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Draw_Area_9 and Histogram_8 in network masterNet"
if ReadTable_10 is not None and Index_11 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_10, Index_11, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_10 and Index_11 in network masterNet"
if Index_11 is not None and Histogram_8 is not None:
    try:
        masterNet.connectNodes(
            Index_11, Histogram_8, "data", "values", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_11 and Histogram_8 in network masterNet"
if ReadTable_10 is not None and Index_13 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_10, Index_13, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_10 and Index_13 in network masterNet"
if ReadTable_10 is not None and Index_14 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_10, Index_14, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_10 and Index_14 in network masterNet"
if Index_14 is not None and Plot_12 is not None:
    try:
        masterNet.connectNodes(
            Index_14, Plot_12, "data", "x", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_14 and Plot_12 in network masterNet"
if Index_13 is not None and Plot_12 is not None:
    try:
        masterNet.connectNodes(
            Index_13, Plot_12, "data", "y", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_13 and Plot_12 in network masterNet"
if Histogram_8 is not None and MultiPlot_15 is not None:
    try:
        masterNet.connectNodes(
            Histogram_8, MultiPlot_15, "plot", "multiplot", blocking=True)
    except:
        print "WARNING: failed to restore connection between Histogram_8 and MultiPlot_15 in network masterNet"
if Plot_12 is not None and MultiPlot_15 is not None:
    try:
        masterNet.connectNodes(
            Plot_12, MultiPlot_15, "plot", "multiplot", blocking=True)
    except:
        print "WARNING: failed to restore connection between Plot_12 and MultiPlot_15 in network masterNet"
masterNet.unfreeze()
#masterNet.run()

