########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Monday 16 April 2007 11:55:59 
#    
#       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/Quiver_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#
# $Id: Quiver_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_0 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
    masterNet.addNode(ReadTable_0,37,56)
    ReadTable_0.inputPortByName['filename'].widget.set("Data/quiver_data_1.dat", run=False)
    apply(ReadTable_0.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore ReadTable named ReadTable in network masterNet"
    print_exc()
    ReadTable_0=None

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

try:
    ## saving node As Type ##
    from Vision.StandardNodes import AsType
    As_Type_2 = AsType(constrkw = {}, name='As Type', library=stdlib)
    masterNet.addNode(As_Type_2,60,242)
    apply(As_Type_2.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore AsType named As Type in network masterNet"
    print_exc()
    As_Type_2=None

try:
    ## saving node As Type ##
    from Vision.StandardNodes import AsType
    As_Type_3 = AsType(constrkw = {}, name='As Type', library=stdlib)
    masterNet.addNode(As_Type_3,241,240)
    apply(As_Type_3.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore AsType named As Type in network masterNet"
    print_exc()
    As_Type_3=None

try:
    ## saving node Quiver ##
    from Vision.matplotlibNodes import QuiverNE
    Quiver_4 = QuiverNE(constrkw = {}, name='Quiver', library=matplotliblib)
    masterNet.addNode(Quiver_4,183,414)
except:
    print "WARNING: failed to restore QuiverNE named Quiver in network masterNet"
    print_exc()
    Quiver_4=None

try:
    ## saving node Text ##
    from Vision.matplotlibNodes import Text
    Text_5 = Text(constrkw = {}, name='Text', library=matplotliblib)
    masterNet.addNode(Text_5,410,194)
    apply(Text_5.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore Text named Text in network masterNet"
    print_exc()
    Text_5=None

try:
    ## saving node MergeText ##
    from Vision.matplotlibNodes import MPLMergeTextNE
    MergeText_6 = MPLMergeTextNE(constrkw = {}, name='MergeText', library=matplotliblib)
    masterNet.addNode(MergeText_6,420,388)
except:
    print "WARNING: failed to restore MPLMergeTextNE named MergeText in network masterNet"
    print_exc()
    MergeText_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,261,347)
except:
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
    print_exc()
    Draw_Area_7=None

masterNet.freeze()

## saving connections for network Quiver ##
if ReadTable_0 is not None and As_Type_2 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_0, As_Type_2, "data", "inArrayList", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_0 and As_Type_2 in network masterNet"
if ReadTable_1 is not None and As_Type_3 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_1, As_Type_3, "data", "inArrayList", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_1 and As_Type_3 in network masterNet"
if As_Type_2 is not None and Quiver_4 is not None:
    try:
        masterNet.connectNodes(
            As_Type_2, Quiver_4, "outArray", "u", blocking=True)
    except:
        print "WARNING: failed to restore connection between As_Type_2 and Quiver_4 in network masterNet"
if As_Type_3 is not None and Quiver_4 is not None:
    try:
        masterNet.connectNodes(
            As_Type_3, Quiver_4, "outArray", "v", blocking=True)
    except:
        print "WARNING: failed to restore connection between As_Type_3 and Quiver_4 in network masterNet"
if Text_5 is not None and MergeText_6 is not None:
    try:
        masterNet.connectNodes(
            Text_5, MergeText_6, "drawAreaDef", "textlist", blocking=True)
    except:
        print "WARNING: failed to restore connection between Text_5 and MergeText_6 in network masterNet"
if MergeText_6 is not None and Quiver_4 is not None:
    try:
        masterNet.connectNodes(
            MergeText_6, Quiver_4, "drawAreaDef", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between MergeText_6 and Quiver_4 in network masterNet"
if Draw_Area_7 is not None and Quiver_4 is not None:
    try:
        masterNet.connectNodes(
            Draw_Area_7, Quiver_4, "drawAreaDef", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Draw_Area_7 and Quiver_4 in network masterNet"
masterNet.unfreeze()
#masterNet.run()

