########################################################################
#
#    Vision Network - Python source code - file generated by vision
#    Monday 16 April 2007 10:16: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/PlotDate_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
#
# $Id: PlotDate_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 PlotDate ##
    from Vision.matplotlibNodes import PlotDateNE
    PlotDate_0 = PlotDateNE(constrkw = {}, name='PlotDate', library=matplotliblib)
    masterNet.addNode(PlotDate_0,59,360)
    PlotDate_0.inputPortByName['tz'].widget.set("US/Pacific", run=False)
    apply(PlotDate_0.configure, (), {'expanded': True})
except:
    print "WARNING: failed to restore PlotDateNE named PlotDate in network masterNet"
    print_exc()
    PlotDate_0=None

try:
    ## saving node ReadTable ##
    from Vision.StandardNodes import ReadTable
    ReadTable_1 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
    masterNet.addNode(ReadTable_1,102,17)
    ReadTable_1.inputPortByName['filename'].widget.set("Data/plot_date_data.dat", run=False)
    ReadTable_1.inputPortByName['sep'].widget.set(",", run=False)
    ReadTable_1.inputPortByName['datatype'].widget.set("float", 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 Draw Area ##
    from Vision.matplotlibNodes import MPLDrawAreaNE
    Draw_Area_2 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
    masterNet.addNode(Draw_Area_2,378,178)
    Draw_Area_2.inputPortByName['bottom'].widget.set(0.222222222222, run=False)
    Draw_Area_2.inputPortByName['height'].widget.set(0.702777777778, run=False)
    Draw_Area_2.inputPortByName['title'].widget.set("Plot Date", run=False)
except:
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
    print_exc()
    Draw_Area_2=None

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

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

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

masterNet.freeze()

## saving connections for network PlotDate ##
if Draw_Area_2 is not None and PlotDate_0 is not None:
    try:
        masterNet.connectNodes(
            Draw_Area_2, PlotDate_0, "drawAreaDef", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Draw_Area_2 and PlotDate_0 in network masterNet"
if Set_Matplotlib_options_3 is not None and PlotDate_0 is not None:
    try:
        masterNet.connectNodes(
            Set_Matplotlib_options_3, PlotDate_0, "matplotlibOptions", "drawAreaDef", blocking=True)
    except:
        print "WARNING: failed to restore connection between Set_Matplotlib_options_3 and PlotDate_0 in network masterNet"
if ReadTable_1 is not None and Index_4 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_1, Index_4, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_1 and Index_4 in network masterNet"
if ReadTable_1 is not None and Index_5 is not None:
    try:
        masterNet.connectNodes(
            ReadTable_1, Index_5, "data", "data", blocking=True)
    except:
        print "WARNING: failed to restore connection between ReadTable_1 and Index_5 in network masterNet"
if Index_5 is not None and PlotDate_0 is not None:
    try:
        masterNet.connectNodes(
            Index_5, PlotDate_0, "data", "y", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_5 and PlotDate_0 in network masterNet"
if Index_4 is not None and PlotDate_0 is not None:
    try:
        masterNet.connectNodes(
            Index_4, PlotDate_0, "data", "x", blocking=True)
    except:
        print "WARNING: failed to restore connection between Index_4 and PlotDate_0 in network masterNet"
masterNet.unfreeze()
#masterNet.run()

