Reference guide#
Class Inheritance diagram#
openalea.grapheditor.base module#
Download the source file ../../src/openalea/grapheditor/base.py.
- class openalea.grapheditor.base.GraphAdapterBase(graph=None)[source]#
Bases:
objectBase 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
- classmethod get_vertex_types()[source]#
Used by the GraphListenerBase class to check if the types declared here are really implemented in the strategy
- 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_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.
openalea.grapheditor.baselisteners module#
Download the source file ../../src/openalea/grapheditor/baselisteners.py.
Generic Graph Widget
- class openalea.grapheditor.baselisteners.BlackBoxModel(owner, observed)[source]#
Bases:
objectAn object that allows to unify certain model (in the MVC meaning) operations calls, wether the model is an Observed instance or just any random class.
In the case it is an Observed instance, it calls the according methods of the model. In any other case, the implementation does (almost) nothing.
- class openalea.grapheditor.baselisteners.GraphElementListenerBase(observed=None, graph=None)[source]#
Bases:
AbstractListenerBase class for elements in a GraphView
- call_notify(sender, event=None)#
Basic implementation call directly notify function Sub class can override this method to implement different call strategy (like signal slot)
- deaf(setDeaf=True)#
- initialise(observed)#
Register self as a listener to observed
- is_notification_locked()#
- notify_lock = None#
- queue_call_notifications(call, *args, **kwargs)#
Runs a call and queues notifications coming from that call to this listener. Once the call is finished, queued notifications are processed FIFO.
- class openalea.grapheditor.baselisteners.GraphListenerBase[source]#
Bases:
AbstractListenerThis object strictly watches the given graph. It deduces the correct representation out of a known list of representations.
It is MVC oriented.
- call_notify(sender, event=None)#
Basic implementation call directly notify function Sub class can override this method to implement different call strategy (like signal slot)
- change_observed(old, new)#
- deaf(setDeaf=True)#
- initialise(observed)#
Register self as a listener to observed
- is_notification_locked()#
- notify(sender, event)[source]#
This function is called by observed objects
- Parameters:
sender – the observed object which send notification
event – the data associated to the notification
- notify_lock = None#
- queue_call_notifications(call, *args, **kwargs)#
Runs a call and queues notifications coming from that call to this listener. Once the call is finished, queued notifications are processed FIFO.
openalea.grapheditor.qtgraphview module#
Download the source file ../../src/openalea/grapheditor/qtgraphview.py.
Generic Qt Graph Widget
- class openalea.grapheditor.qtgraphview.DefaultGraphicalEdge(edge=None, graph=None, src=None, dest=None)[source]#
Bases:
Edge,QGraphicsPathItem- get_view_data = None#
- store_view_data = None#
- class openalea.grapheditor.qtgraphview.DefaultGraphicalFloatingEdge(srcPoint, graph)[source]#
Bases:
FloatingEdge,QGraphicsPathItem
- class openalea.grapheditor.qtgraphview.DefaultGraphicalVertex(vertex, graph)[source]#
Bases:
Vertex,QGraphicsEllipseItem- circleSize = 20.0#
- itemChange(*args, **kwargs)#
Used mainly to capture position changes from the QGraphicsScene and store it in the model so that it can be saved.
- paint(*args, **kwargs)#
Qt-specific call to paint things.
- class openalea.grapheditor.qtgraphview.Edge(edge=None, graph=None, src=None, dst=None)[source]#
Bases:
ElementBase class for Qt based edges.
- edge()#
- class openalea.grapheditor.qtgraphview.Element(observed=None, graph=None)[source]#
Bases:
GraphElementListenerBaseBase class for elements in a qtgraphview.View.
Implements basic listeners calls for elements of a graph. A listener call is the method that is called after the main listening method (self.notify) dispatches the events. They are specified by interfaces.IGraphViewElement.
- Listener calls:
position_changed(self, (posx, posy))
add_to_view(self, view)
remove_from_view(self, view)
- class openalea.grapheditor.qtgraphview.Scene(parent)[source]#
Bases:
QGraphicsScene,GraphListenerBaseA Qt implementation of GraphListenerBase
- focusedItemChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class openalea.grapheditor.qtgraphview.Vertex(vertex, graph, defaultCenterConnector=False)[source]#
Bases:
ElementAn abstract graphic item that represents a graph vertex.
The actual implementation is done in the derived class. What this intermediate implementation does is that it provides the basics for handling edge creation from one node to the other. It also provides a state based pluggable painting system, meant to customize the painting from the application side. Of course, if it doesn’t match your needs you can override it completely in your subclass.
- class InvisibleConnector(parent, *args, **kwargs)[source]#
Bases:
QGraphicsEllipseItem,Connector- itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any#
- paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]#
- position_changed(*args)[source]#
reimplemented to do nothing. otherwise caught position changes from the model and ignored the position it was forced to
- size = 10#
- itemChange(change, value)[source]#
Used mainly to capture position changes from the QGraphicsScene and store it in the model so that it can be saved.
- notify_position_change()[source]#
Triggers a visual refresh of anything that observes the position of the vertex.
- vertex()#
- class openalea.grapheditor.qtgraphview.View(parent)[source]#
Bases:
QGraphicsView,GraphViewBaseA View implementing client customisation
- accept_drop(event)[source]#
Return the format of the object if a handler is registered for it. If not, if there is a default handler, returns True, else returns False.
- clear_scene(*args, **kwargs)#
- closeEvent(evt)[source]#
a big hack to cleanly remove items from the view and delete the python objects so that they stop leaking on some operating systems
- closing#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- copyRequest#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- cutRequest#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- deleteRequest#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- dragEnterEvent(event)[source]#
While the user hasn’t released the object, this method is called to tell qt if the view accepts the object or not.
- get_selected_items(*args, **kwargs)#
- get_selection_center(*args, **kwargs)#
- graph(*args, **kwargs)#
- notify(*args, **kwargs)#
- pasteRequest#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- post_addition(*args, **kwargs)#
- rebuild_scene(*args, **kwargs)#
- select_added_elements(*args, **kwargs)#
- setScene(scene)[source]#
Overload of QGraphicsView.setScene to correctly handle multiple views of the same scene using reference counting.
- set_graph(*args, **kwargs)#
openalea.grapheditor.edgefactory module#
Download the source file ../../src/openalea/grapheditor/edgefactory.py.
- class openalea.grapheditor.edgefactory.PolylineEdgePath[source]#
Bases:
LinearEdgePathEdge as Polyline
- WIDTH = 30#
- class openalea.grapheditor.edgefactory.SplineEdgePath[source]#
Bases:
PolylineEdgePathEdge as Spline
openalea.grapheditor.qtutils module#
Download the source file ../../src/openalea/grapheditor/qtutils.py.
- class openalea.grapheditor.qtutils.AleaQGraphicsColorWheel(radius=3.0, parent=None)[source]#
Bases:
AleaQGraphicsVanishingMixin,AleaQGraphicsButtonMixin,QGraphicsEllipseItem
- class openalea.grapheditor.qtutils.AleaQGraphicsEmitingTextItem(*args, **kwargs)[source]#
Bases:
QGraphicsTextItemA QtWidgets.QGraphicsTextItem that emits geometryModified whenever its geometry can have changed.
- geometryModified#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class openalea.grapheditor.qtutils.AleaQGraphicsFontButton(parent=None)[source]#
Bases:
AleaQGraphicsButtonMixin,QGraphicsSimpleTextItem
- class openalea.grapheditor.qtutils.AleaQGraphicsFontColorButton(parent=None)[source]#
Bases:
AleaQGraphicsFontButton
- class openalea.grapheditor.qtutils.AleaQGraphicsRoundedRectItem(radius, cache=False, *args)[source]#
Bases:
QGraphicsRectItem
- class openalea.grapheditor.qtutils.AleaQGraphicsToolbar(parent=None)[source]#
Bases:
AleaQGraphicsVanishingMixin,QGraphicsRectItem
- class openalea.grapheditor.qtutils.AleaQGraphicsVanishingMixin(vanishingTime=500, baseOpacity=0.01)[source]#
Bases:
object
- class openalea.grapheditor.qtutils.HorizontalLayout(parent=None, final=None, margins=(0.0, 0.0, 0.0, 0.0), innerMargins=(0.0, 0.0), center=False, mins=(0.0, 0.0))[source]#
Bases:
Layout
- class openalea.grapheditor.qtutils.Layout(parent=None, final=None, margins=(0.0, 0.0, 0.0, 0.0), innerMargins=(0.0, 0.0), center=False, mins=(0.0, 0.0))[source]#
Bases:
object
- class openalea.grapheditor.qtutils.MemoRects(rect, parent=None)[source]#
Bases:
QGraphicsRectItem
- class openalea.grapheditor.qtutils.VerticalLayout(parent=None, final=None, margins=(0.0, 0.0, 0.0, 0.0), innerMargins=(0.0, 0.0), center=False, mins=(0.0, 0.0))[source]#
Bases:
Layout
- openalea.grapheditor.qtutils.mixin_method(mixinOne, mixinTwo, methodname, firstWins=False, invert=False, caller=None)[source]#
A function that returns a method calling method “methodname” from mixinOne and then from mixinTwo, or the reverse order if invert is True. Can be used to quickly reimplement simple overloads.
openalea.grapheditor.interfaces module#
Download the source file ../../src/openalea/grapheditor/interfaces.py.
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.IGraphViewAnnotation[source]#
Bases:
IGraphViewElementInterface for Annotations
- class openalea.grapheditor.interfaces.IGraphViewConnectable[source]#
Bases:
objectInterface for connectable objects
- class openalea.grapheditor.interfaces.IGraphViewEdge[source]#
Bases:
IGraphViewElementInterface for edges between two vertexs.
- class openalea.grapheditor.interfaces.IGraphViewElement[source]#
Bases:
objectBase class for elements in a GraphView
- class openalea.grapheditor.interfaces.IGraphViewFloatingEdge(src)[source]#
Bases:
objectInterface for edges to be drawn during creation time, ie while the user drags.
- class openalea.grapheditor.interfaces.IGraphViewStrategies[source]#
Bases:
objectDefine implementations of this trait class to define the behaviour of the graph. For example : DataFlowGraphViewTrait, TreeGraphViewTrait, NetworkGraphViewTrait…
- class openalea.grapheditor.interfaces.IGraphViewVertex[source]#
Bases:
IGraphViewElement