<s> import sys <EOL> from PySide import QtGui , QtCore <EOL> from graph_view import GraphView <EOL> class GraphViewWidget ( QtGui . QWidget ) : <EOL> rigNameChanged = QtCore . Signal ( ) <EOL> def __init__ ( self , parent = None ) : <EOL> super ( GraphViewWidget , self ) . __init__ ( parent ) <EOL> self . openedFile = None <EOL> self . setObjectName ( '<STR_LIT>' ) <EOL> self . setAttribute ( QtCore . Qt . WA_WindowPropagation , True ) <EOL> def setGraphView ( self , graphView ) : <EOL> self . graphView = graphView <EOL> layout = QtGui . QVBoxLayout ( self ) <EOL> layout . addWidget ( self . graphView ) <EOL> self . setLayout ( layout ) <EOL> deleteShortcut = QtGui . QShortcut ( QtGui . QKeySequence ( QtCore . Qt . Key_Delete ) , self ) <EOL> deleteShortcut . activated . connect ( self . graphView . deleteSelectedNodes ) <EOL> frameShortcut = QtGui . QShortcut ( QtGui . QKeySequence ( QtCore . Qt . Key_F ) , self ) <EOL> frameShortcut . activated . connect ( self . graphView . frameSelectedNodes ) <EOL> frameShortcut = QtGui . QShortcut ( QtGui . QKeySequence ( QtCore . Qt . Key_A ) , self ) <EOL> frameShortcut . activated . connect ( self . graphView . frameAllNodes ) <EOL> def getGraphView ( self ) : <EOL> return self . graphView <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> app = QtGui . QApplication ( sys . argv ) <EOL> widget = GraphViewWidget ( ) <EOL> graph = GraphView ( parent = widget ) <EOL> from node import Node <EOL> from port import InputPort , OutputPort , IOPort <EOL> node1 = Node ( graph , '<STR_LIT>' ) <EOL> node1 . addPort ( InputPort ( node1 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node1 . addPort ( InputPort ( node1 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node1 . addPort ( OutputPort ( node1 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT:32> , <NUM_LIT:255> , <NUM_LIT:32> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node1 . addPort ( IOPort ( node1 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT:32> , <NUM_LIT:255> , <NUM_LIT:32> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node1 . addPort ( IOPort ( node1 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT:32> , <NUM_LIT:255> , <NUM_LIT:32> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node1 . setGraphPos ( QtCore . QPointF ( - <NUM_LIT:100> , <NUM_LIT:0> ) ) <EOL> graph . addNode ( node1 ) <EOL> node2 = Node ( graph , '<STR_LIT>' ) <EOL> node2 . addPort ( InputPort ( node2 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node2 . addPort ( InputPort ( node2 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node2 . addPort ( OutputPort ( node2 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT:32> , <NUM_LIT:255> , <NUM_LIT:32> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node2 . addPort ( IOPort ( node2 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT:32> , <NUM_LIT:255> , <NUM_LIT:32> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node2 . addPort ( IOPort ( node2 , graph , '<STR_LIT>' , QtGui . QColor ( <NUM_LIT:32> , <NUM_LIT:255> , <NUM_LIT:32> , <NUM_LIT:255> ) , '<STR_LIT>' ) ) <EOL> node2 . setGraphPos ( QtCore . QPointF ( <NUM_LIT:100> , <NUM_LIT:0> ) ) <EOL> graph . addNode ( node2 ) <EOL> widget . setGraphView ( graph ) <EOL> widget . show ( ) <EOL> sys . exit ( app . exec_ ( ) ) </s>
