########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Wednesday 18 April 2007 08:43:15 
#    
#       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/DrawArea_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#
# $Id: DrawArea_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 Plot ##
    from Vision.matplotlibNodes import PlotNE
    Plot_6 = PlotNE(constrkw = {}, name='Plot', library=matplotliblib)
    masterNet.addNode(Plot_6,160,342)
    Plot_6.inputPortByName['color'].widget.set("magenta", run=False)
    Plot_6.inputPortByName['line_linewidth'].widget.set(3.60555555556, run=False)
    apply(Plot_6.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore PlotNE named Plot in network masterNet"
    print_exc()
    Plot_6=None

try:
    ## saving node Draw Area ##
    from Vision.matplotlibNodes import MPLDrawAreaNE
    Draw_Area_7 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
    masterNet.addNode(Draw_Area_7,312,210)
    Draw_Area_7.inputPortByName['left'].widget.set(0.158333333333, run=False)
    Draw_Area_7.inputPortByName['bottom'].widget.set(0.172222222222, run=False)
    Draw_Area_7.inputPortByName['width'].widget.set(0.663888888889, run=False)
    Draw_Area_7.inputPortByName['height'].widget.set(0.652777777778, run=False)
    Draw_Area_7.inputPortByName['title'].widget.set("About as simple as it gets , folks", run=False)
    Draw_Area_7.inputPortByName['xlabel'].widget.set("time(s)", run=False)
    Draw_Area_7.inputPortByName['ylabel'].widget.set("voltage(mV)", run=False)
    Draw_Area_7.inputPortByName['ylimit'].widget.set("[0,1.0]", run=False)
    Draw_Area_7.inputPortByName['xticklabels'].widget.set(0, run=False)
    Draw_Area_7.inputPortByName['autoscaleon'].widget.set(0, run=False)
except:
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
    print_exc()
    Draw_Area_7=None

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

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

try:
    ## saving node ReadTable ##
    from Vision.StandardNodes import ReadTable
    ReadTable_10 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
    masterNet.addNode(ReadTable_10,142,33)
    ReadTable_10.inputPortByName['filename'].widget.set("Data/plot_data.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

masterNet.freeze()

## saving connections for network DrawArea ##
if Draw_Area_7 is not None and Plot_6 is not None:
    try:
        masterNet.connectNodes(
            Draw_Area_7, Plot_6, "drawAreaDef", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Draw_Area_7 and Plot_6 in network masterNet"
if Index_8 is not None and Plot_6 is not None:
    try:
        masterNet.connectNodes(
            Index_8, Plot_6, "data", "y", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_8 and Plot_6 in network masterNet"
if Index_9 is not None and Plot_6 is not None:
    try:
        masterNet.connectNodes(
            Index_9, Plot_6, "data", "x", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_9 and Plot_6 in network masterNet"
if ReadTable_10 is not None and Index_8 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_10, Index_8, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_10 and Index_8 in network masterNet"
if ReadTable_10 is not None and Index_9 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_10, Index_9, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_10 and Index_9 in network masterNet"
masterNet.unfreeze()
#masterNet.run()

