OpenAlea Grapheditor’s API

API

class openalea.grapheditor.base.GraphAdapterBase(graph=None)[source]

Base class for adapter to graph

add_edge(source, target, *args, **kwargs)[source]

Create an edge in the model between source and target.

Upon succes it must emit the following event tuple: (“edge_added”, (“edge_type”, edge, sourceObs, targetObs)).

  • “edge-type” is a edge-type string defined in the strategy used for a particular graph type.
  • edge, sourceObs and targetObs are the observable objects

representing an egde and its two anchors.

add_vertex(vertex, *args, **kwargs)[source]

Add an existing vertex to the model.

Upon succes it must emit the following event tuple: (“vertex_added”, (“vertex_type”, vertex)).

  • “vertex-type” is a vertex-type string defined in the strategy used for a particular graph type.
  • “vertex” is the observable object representing a vertex.
classmethod get_edge_types()[source]

Used by the GraphListenerBase class to check if the types declared here are really implemented in the strategy

get_vertex(vid=None)[source]

Return the vertex object matching vid. By default this is just vid!

get_vertex_input(graphicalV, pid)[source]
get_vertex_inputs(graphicalV)[source]
get_vertex_output(graphicalV, pid)[source]
get_vertex_outputs(graphicalV)[source]
classmethod get_vertex_types()[source]

Used by the GraphListenerBase class to check if the types declared here are really implemented in the strategy

is_input(input)[source]
is_output(output)[source]
is_vertex_protected(vertex)[source]
new_vertex(vtype=None, position=None)[source]

Create a new vertex at the defined position and add it to the model

remove_edge(source, target)[source]

Removes the specified vertex from the model.

Upon success it must emit the following event tuple: (“edge_removed”, (edge,)).

  • edge is the observable object representing an edge.
remove_edges(edgeList)[source]

Removes a list of vertices by forwarding them to self.remove_vertex

remove_vertex(vertex)[source]

Removes the specified vertex from the model.

Upon success it must emit the following event tuple: (“vertex_removed”, (vertex,)).

  • vertex is the observable object representing a vertex.
remove_vertices(vertexList)[source]

Removes a list of vertices by forwarding them to self.remove_vertex

replace_vertex(oldVertex, newVertex)[source]
set_graph(graph)[source]
openalea.grapheditor.base.GraphStrategyMaker(graphView, vertexWidgetMap, edgeWidgetMap, connectorTypes=, []graphViewInitialiser=None, adapterType=None)[source]

Interfaces for the generic graph view module. The graph view widget won’t check for inheritance of the object’s it is passed. Instead, it will check the interfaces match more or less.

class openalea.grapheditor.interfaces.IGraphAdapter[source]
add_edge(*args, **kargs)[source]
add_vertex(*args, **kargs)[source]
get_edge_types()[source]
get_vertex(*args, **kargs)[source]
get_vertex_input(*args, **kargs)[source]
get_vertex_inputs(*args, **kargs)[source]
get_vertex_output(*args, **kargs)[source]
get_vertex_outputs(*args, **kargs)[source]
get_vertex_types()[source]
is_input(*args, **kargs)[source]
is_output(*args, **kargs)[source]
remove_edge(*args, **kargs)[source]
remove_vertex(*args, **kargs)[source]
remove_vertices(*args, **kargs)[source]
class openalea.grapheditor.interfaces.IGraphListener[source]
clear(*args, **kwargs)[source]
edge_added(edgeModel, srcPort, dstPort)[source]
edge_removed(edgeModel)[source]
find_closest_connectable(*args, **kwargs)[source]
initialise_from_model()[source]
is_connectable(*args, **kwargs)[source]
post_addition(*args, **kwargs)[source]
vertex_added(vtype, vertexModel)[source]
vertex_removed(vtype, vertexModel)[source]
class openalea.grapheditor.interfaces.IGraphViewAnnotation[source]

Interface for Annotations

notify(sender, event)[source]

(“metadata_changed”, “text”, “a string”, str)

set_text(text)[source]

to change the visible text

class openalea.grapheditor.interfaces.IGraphViewConnectable[source]

Interface for connectable objects

get_scene_center()[source]
set_highlighted(*args, **kwargs)[source]
class openalea.grapheditor.interfaces.IGraphViewEdge[source]

Interface for edges between two vertexs.

notify(sender, event)[source]

(“metadata_changed”, “canvasPosition”, [x,x], list)

update_line_destination(*pos)[source]

updates this edge’s ending point. Called when dest point is moved

update_line_source(*pos)[source]

updates this edge’s starting point. Called when source point is moved

class openalea.grapheditor.interfaces.IGraphViewElement[source]

Base class for elements in a GraphView

add_to_view(view)[source]

add this element to the graphical view

get_view_data(key)[source]
initialise_from_model()[source]
notify(sender, event)[source]

called by the observed objects Expected event = (“metadata_changed”, “position”, [x,x], list)

position_changed(*args)[source]

Place the element’s representation in the view space

remove_from_view(view)[source]

remove this element from the graphical view

store_view_data(**kwargs)[source]
class openalea.grapheditor.interfaces.IGraphViewFloatingEdge(src)[source]

Interface for edges to be drawn during creation time, ie while the user drags.

consolidate(model)[source]

returns whatever object is under the mouse pointer at the time the button was released

get_connections(*args)[source]
class openalea.grapheditor.interfaces.IGraphViewStrategies[source]

Define implementations of this trait class to define the behaviour of the graph. For example : DataFlowGraphViewTrait, TreeGraphViewTrait, NetworkGraphViewTrait...

create_edge_widget(etype, *args, **kwargs)[source]

Instanciates an edge matching etype

create_vertex_widget(vtype, *args, **kwargs)[source]

Instanciates a node matching vtype

create_view(parent, graph, *args, **kwargs)[source]

Instanciates the view

get_connector_types()[source]
get_graph_model_type()[source]

Returns the classobj defining the graph type

initialise_graph_view(graphView, graphModel)[source]

intialise graph view from model

class openalea.grapheditor.interfaces.IGraphViewVertex[source]
lock_position(val=True)[source]
class openalea.grapheditor.interfaces.IInterfaceMetaClass(name, bases, dic)[source]

Adds a method to the interface class that checks that the given object implements the class’ interface. Allows some sort of safe-ducktyping

check(obj)[source]

Check if obj matches this interface.

Class diagrams

Graphical edges and vertices

digraph inheritanceeee735f5b6 { rankdir=LR; size="8.0, 12.0"; "QtGui.QAbstractGraphicsShapeItem" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="QAbstractGraphicsShapeItem(QGraphicsItem parent=None, QGraphicsScene scene=None)",height=0.25,shape=box,fontsize=10]; "QtGui.QGraphicsItem" -> "QtGui.QAbstractGraphicsShapeItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtGui.QGraphicsEllipseItem" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="QGraphicsEllipseItem(QGraphicsItem parent=None, QGraphicsScene scene=None)",height=0.25,shape=box,fontsize=10]; "QtGui.QAbstractGraphicsShapeItem" -> "QtGui.QGraphicsEllipseItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtGui.QGraphicsItem" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="QGraphicsItem(QGraphicsItem parent=None, QGraphicsScene scene=None)",height=0.25,shape=box,fontsize=10]; "sip.wrapper" -> "QtGui.QGraphicsItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtGui.QGraphicsPathItem" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="QGraphicsPathItem(QGraphicsItem parent=None, QGraphicsScene scene=None)",height=0.25,shape=box,fontsize=10]; "QtGui.QAbstractGraphicsShapeItem" -> "QtGui.QGraphicsPathItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "baselisteners.GraphElementListenerBase" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Base class for elements in a GraphView",height=0.25,shape=box,fontsize=10]; "observer.AbstractListener" -> "baselisteners.GraphElementListenerBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "observer.AbstractListener" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Listener base class",height=0.25,shape=box,fontsize=10]; "qtgraphview.DefaultGraphicalFloatingEdge" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "QtGui.QGraphicsPathItem" -> "qtgraphview.DefaultGraphicalFloatingEdge" [arrowsize=0.5,style="setlinewidth(0.5)"]; "qtgraphview.FloatingEdge" -> "qtgraphview.DefaultGraphicalFloatingEdge" [arrowsize=0.5,style="setlinewidth(0.5)"]; "qtgraphview.DefaultGraphicalVertex" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "qtgraphview.Vertex" -> "qtgraphview.DefaultGraphicalVertex" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtGui.QGraphicsEllipseItem" -> "qtgraphview.DefaultGraphicalVertex" [arrowsize=0.5,style="setlinewidth(0.5)"]; "qtgraphview.Edge" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Base class for Qt based edges.",height=0.25,shape=box,fontsize=10]; "qtgraphview.Element" -> "qtgraphview.Edge" [arrowsize=0.5,style="setlinewidth(0.5)"]; "qtgraphview.Element" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Base class for elements in a qtgraphview.View.",height=0.25,shape=box,fontsize=10]; "baselisteners.GraphElementListenerBase" -> "qtgraphview.Element" [arrowsize=0.5,style="setlinewidth(0.5)"]; "qtgraphview.FloatingEdge" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "qtgraphview.Edge" -> "qtgraphview.FloatingEdge" [arrowsize=0.5,style="setlinewidth(0.5)"]; "qtgraphview.Vertex" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="An abstract graphic item that represents a graph vertex.",height=0.25,shape=box,fontsize=10]; "qtgraphview.Element" -> "qtgraphview.Vertex" [arrowsize=0.5,style="setlinewidth(0.5)"]; "sip.simplewrapper" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "sip.wrapper" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "sip.simplewrapper" -> "sip.wrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Scene

digraph inheritance3ccf52aa1c { rankdir=LR; size="8.0, 12.0"; "QtCore.QObject" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="QObject(QObject parent=None)",height=0.25,shape=box,fontsize=10]; "sip.wrapper" -> "QtCore.QObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtGui.QGraphicsScene" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="QGraphicsScene(QObject parent=None)",height=0.25,shape=box,fontsize=10]; "QtCore.QObject" -> "QtGui.QGraphicsScene" [arrowsize=0.5,style="setlinewidth(0.5)"]; "baselisteners.GraphListenerBase" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="This object strictly watches the given graph.",height=0.25,shape=box,fontsize=10]; "observer.AbstractListener" -> "baselisteners.GraphListenerBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "observer.AbstractListener" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Listener base class",height=0.25,shape=box,fontsize=10]; "qtgraphview.Scene" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="A Qt implementation of GraphListenerBase",height=0.25,shape=box,fontsize=10]; "QtGui.QGraphicsScene" -> "qtgraphview.Scene" [arrowsize=0.5,style="setlinewidth(0.5)"]; "baselisteners.GraphListenerBase" -> "qtgraphview.Scene" [arrowsize=0.5,style="setlinewidth(0.5)"]; "sip.simplewrapper" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "sip.wrapper" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25]; "sip.simplewrapper" -> "sip.wrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

GraphElementListenerBase

digraph inheritance1ba65fa599 { rankdir=LR; size="8.0, 12.0"; "baselisteners.GraphElementListenerBase" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Base class for elements in a GraphView",height=0.25,shape=box,fontsize=10]; "observer.AbstractListener" -> "baselisteners.GraphElementListenerBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "observer.AbstractListener" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Listener base class",height=0.25,shape=box,fontsize=10]; }