########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Friday 13 April 2007 13:36:58 
#    
#       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/Plot_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#
# $Id: Plot_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 ReadTable ##
    from Vision.StandardNodes import ReadTable
    ReadTable_111 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
    masterNet.addNode(ReadTable_111,126,16)
    ReadTable_111.inputPortByName['filename'].widget.set("Data/plot_data.dat", run=False)
    ReadTable_111.inputPortByName['sep'].widget.set(",", run=False)
    ReadTable_111.inputPortByName['datatype'].widget.set("float", run=False)
    apply(ReadTable_111.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore ReadTable named ReadTable in network masterNet"
    print_exc()
    ReadTable_111=None

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

try:
    ## saving node Set Matplotlib options ##
    from Vision.matplotlibNodes import MatPlotLibOptions
    Set_Matplotlib_options_113 = MatPlotLibOptions(constrkw = {}, name='Set Matplotlib options', library=matplotliblib)
    masterNet.addNode(Set_Matplotlib_options_113,361,270)
    Set_Matplotlib_options_113.inputPortByName['matplotlibOptions'].widget.set({'gridOn': 1}, run=False)
except:
    print "WARNING: failed to restore MatPlotLibOptions named Set Matplotlib options in network masterNet"
    print_exc()
    Set_Matplotlib_options_113=None

try:
    ## saving node Draw Area ##
    from Vision.matplotlibNodes import MPLDrawAreaNE
    Draw_Area_114 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
    masterNet.addNode(Draw_Area_114,352,158)
    Draw_Area_114.inputPortByName['title'].widget.set("About as simple  as it gets, folks", run=False)
    Draw_Area_114.inputPortByName['xlabel'].widget.set("time(s)", run=False)
    Draw_Area_114.inputPortByName['ylabel'].widget.set("voltage(mV)", run=False)
except:
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
    print_exc()
    Draw_Area_114=None

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

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

masterNet.freeze()

## saving connections for network Plot ##
if Set_Matplotlib_options_113 is not None and Plot_112 is not None:
    try:
        masterNet.connectNodes(
            Set_Matplotlib_options_113, Plot_112, "matplotlibOptions", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Set_Matplotlib_options_113 and Plot_112 in network masterNet"
if Draw_Area_114 is not None and Plot_112 is not None:
    try:
        masterNet.connectNodes(
            Draw_Area_114, Plot_112, "drawAreaDef", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Draw_Area_114 and Plot_112 in network masterNet"
if ReadTable_111 is not None and Index_115 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_111, Index_115, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_111 and Index_115 in network masterNet"
if ReadTable_111 is not None and Index_116 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_111, Index_116, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_111 and Index_116 in network masterNet"
if Index_115 is not None and Plot_112 is not None:
    try:
        masterNet.connectNodes(
            Index_115, Plot_112, "data", "y", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_115 and Plot_112 in network masterNet"
if Index_116 is not None and Plot_112 is not None:
    try:
        masterNet.connectNodes(
            Index_116, Plot_112, "data", "x", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_116 and Plot_112 in network masterNet"
masterNet.unfreeze()
#masterNet.run()

