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

Inheritance diagram of openalea.grapheditor.qtgraphview.DefaultGraphicalFloatingEdge, openalea.grapheditor.qtgraphview.DefaultGraphicalVertex

Scene

Inheritance diagram of openalea.grapheditor.qtgraphview.Scene

GraphElementListenerBase

Inheritance diagram of openalea.grapheditor.baselisteners.GraphElementListenerBase

Table Of Contents

This Page