tulipgui
module API¶
Utility functions¶
-
tlpgui.
getAvailableViews
()¶ New in version 4.4.
Returns a list of the views names currently available in Tulip.
Return type: list of string
-
tlpgui.
createView
(viewName, graph[, dataSet = tlp.DataSet(), show = True])¶ New in version 4.4.
Creates and adds a new Tulip view. If called through a Python Script editor in the main Tulip GUI, the view will be added in the Tulip workspace. If called through the classical Python shell, a dialog containing the view will be created and displayed. Returns an instance of the newly created view.
Parameters: - viewName (string) – the name of the view to create (use
tlpgui.getAvailableViews()
to know which ones are installed) - graph (
tulip.tlp.Graph
) – the graph to set on the new view - dataSet (
tulip.tlp.DataSet
) – the optional parameters of the view - show (boolean) – show the view if
True
Return type: - viewName (string) – the name of the view to create (use
-
tlpgui.
createNodeLinkDiagramView
(graph[, dataSet = tlp.DataSet(), show = True])¶ New in version 4.4.
Convenient function for creating the principal view offered by Tulip : a node link diagram. Its call is equivalent to:
nodeLinkView = tlp.createView("Node Link Diagram view", graph)
Parameters: - graph (
tulip.tlp.Graph
) – the graph to visualize - dataSet (
tulip.tlp.DataSet
) – the optional parameters of the view - show (boolean) – show the view if
True
Return type: - graph (
-
tlpgui.
getOpenedViews
()¶ New in version 4.4.
Returns a list of the views currently opened.
Return type: list of tlpgui.View
-
tlpgui.
getViewsOfGraph
(graph)¶ New in version 4.4.
Returns a list of views associated to a particular graph.
Parameters: graph ( tulip.tlp.Graph
) – the graph on which to find viewsReturn type: list of tlpgui.View
-
tlpgui.
closeView
(view)¶ New in version 4.4.
Closes and destroys an opened view.
Parameters: view ( tlpgui.View
) – the view to close
-
tlpgui.
closeAllViews
()¶ New in version 4.4.
Closes and destroys all opened views (except the Python Script ones).
-
tlpgui.
closeViewsRelatedToGraph
(graph)¶ New in version 4.4.
Closes and destroys all the views associated to a particular graph.
Parameters: graph ( tulip.tlp.Graph
) – the graph on which to close views
-
tlpgui.
createInteractor
(interactorName)¶ New in version 4.4.
Creates a Tulip interactor. An interactor enables to add user interaction (usually trough the use of mouse and keyboards) to a Tulip view. Use function
tlpgui.getInteractorsCompatibleWithView()
to get the names of the interactors compatible with a particular view. Use methodtlpgui.View.setInteractors()
to modify the default interactors associated to a view.Parameters: interactorName (string) – the name of the interactor to create Return type: tlpgui.Interactor
Throws: an execption if the interactor name does not exist
-
tlpgui.
getInteractorsCompatibleWithView
(viewName)¶ New in version 4.4.
Returns a list of interactors names compatible with a specific view.
Parameters: viewName (string) – the name of the view for which to retrieve the compatible interactors Return type: list of string Throws: an exception if the view name does not exist
tlpgui.ColorScalesManager¶
-
class
tlpgui.
ColorScalesManager
¶ New in version 4.10.
That static class aims to facilitate working with Tulip color scales. It allows to easily retrieve Tulip predefined ones but also to register new ones in a persistent database for further reuse.
-
getColorScale
(colorScaleName)¶ Returns the color scale registered with the provided name.
Warning
If there is no such colorscale, the returned one will be empty.
Return type: a dictionnary with float keys between 0.0 an 1.0 and tlp.Color
values representing the color scale
-
getColorScalesList
()¶ Returns a list of the registered color scales names.
Return type: list of strings
-
registerColorScale
(colorScaleName, colorScale)¶ Registers a color scale in the persistent database for further reuse.
Warning
If there is already a color scale registered with such a name, it will not be overwritten.
Parameters: - colorScaleName (string) – the name of the color scale to register
- colorScale (a
tlp.ColorScale
instance, a list oftlp.Color
or a dictionnary with float keys (between 0.0 and 1.0) andtlp.Color
values) – the color scale to set
-
removeColorScale
(colorScaleName)¶ Removes the color scale registered with the provided name from the persistent database.
Parameters: colorScaleName (string) – the name of the color scale to remove
-
tlpgui.Interactor¶
-
class
tlpgui.
Interactor
¶ New in version 4.4.
Bases:
tulip.tlp.Plugin
An interactor enables to add user interaction (usually through the use of mouse and keyboards) to a Tulip view. Use function
tlpgui.getInteractorsCompatibleWithView()
to get the names of the interactors compatible with a particular view. Use functiontlpgui.createInteractor()
to instantiate a specific interactor. Use methodtlpgui.View.setInteractors()
to modify the default interactors associated to a view.-
isCompatible
(viewName)¶ Returns if the interactor is compatible with a specific view.
-
tlpgui.View¶
-
class
tlpgui.
View
¶ New in version 4.4.
Bases:
tulip.tlp.Plugin
This is the base class for Tulip data views. Use the following functions to get instances on such object :
-
currentInteractor
()¶ Return type: tlpgui.Interactor
-
draw
()¶ Draws/Updates the view.
-
graph
()¶ Returns the graph currently attached to the view.
Return type: tulip.tlp.Graph
-
interactors
()¶ Returns the interactors currently installed on the view.
Return type: list of tlpgui.Interactor
-
resize
(width, height)¶ Resizes the view windows. That method has effects only when working trough the classical Python interpreter.
Parameters: - width (integer) – the new width of the view window
- height (integer) – the new height of the view window
-
saveSnapshot
(picturePath, width, height)¶ Takes a snapshot of the view and saves it to an image file on disk. The view is not required to be visible for that feature to work. Returns
True
if the operation succeeded.Parameters: - picturePath (string) – the absolute path of the image file with extension (used to infer image type)
- width (integer) – the image width
- height (integer) – the image height
Return type: boolean
-
setCurrentInteractor
(interactor)¶ Set the current active interactor on the view.
Parameters: interactor ( tlpgui.Interactor
) – the interactor to set active
-
setGraph
(graph)¶ Sets the graph for the view. The current parameters will be kept.
Parameters: graph ( tulip.tlp.Graph
) – the graph from which the view will be drawn.
-
setInteractors
(interactors)¶ Installs a new set of interactors on the view.
Parameters: interactors (list of tlpgui.Interactor
) – the new interactors to install
-
setPos
(x, y)¶ Set the position on screen of the view windows. That method has effects only when working trough the classical Python interpreter.
Parameters: - x (integer) – the new x position of the view window
- y (integer) – the new y position of the view window
-
setState
(dataSet)¶ Sets the parameters for the view.
Parameters: dataSet ( tulip.tlp.DataSet
) – the view parameters
-
setVisible
(visible)¶ Hides / Shows the view window. That method has effects only when working trough the classical Python interpreter.
Parameters: visible (boolean) – the state of the view window visibility
-
state
()¶ Returns the current parameters of the view.
Return type: tulip.tlp.DataSet
-
tlpgui.GlMainView¶
-
class
tlpgui.
GlMainView
¶ Bases:
tlpgui.View
This is the based class of Tulip OpenGL views.
-
centerView
()¶ Centers the OpenGL scene in the view window.
-
drawOverview
()¶ Forces the redraw of the overview window.
-
overviewVisible
()¶ Returns the visibility state of the overview window.
Return type: boolean
-
setOverviewVisible
(state)¶ Sets the visibility state of the overview window.
Parameters: state (boolean) – the visibility state of the overview window.
-
setViewOrtho
(state)¶ Activates/desactivate the orthogonal projection for OpenGL rendering. Perspective projection is used when orthogonal one is disabled.
Parameters: state (boolean) – the state of the orthogonal projection
-
tlpgui.NodeLinkDiagramComponent¶
-
class
tlpgui.
NodeLinkDiagramComponent
¶ New in version 4.4.
Bases:
tlpgui.GlMainView
That class represents the main type of view offered by Tulip : a node link diagram.
-
getInputData
()¶ Returns the current rendering input data for the node link diagram view.
Return type: tulipogl.tlpogl.GlGraphInputData
-
getRenderingParameters
()¶ Returns a copy of the current rendering parameters for the node link diagram view.
Return type: tulipogl.tlpogl.GlGraphRenderingParameters
-
quickAccessBarVisible
()¶ Returns the visibility state of the quick access bar.
Return type: boolean
-
setQuickAccessBarVisible
(state)¶ Sets the visibility state of the quick access bar.
Parameters: state (boolean) – the visibility state of the quick access bar
-
setRenderingParameters
(parameters)¶ Sets the rendering parameters for the node link diagram view.
Parameters: parameters ( tulipogl.tlpogl.GlGraphRenderingParameters
) – the new rendering parameters
-