You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
We'll need to fasten the development of interaction through pure python Tulip.
It is currently possible through the python script view to create pseudo interactors. They are observable classes waiting for events, here is a dummy example we worked on with @guywiz :
from tulip import *
import random
import time
class Interactor(tlp.Observable):
"""docstring for Interactor"""
def __init__(self, graph):
super(tlp.Observable, self).__init__()
self.graph = graph
def treatEvent(self, event):
if event.getType() == tlp.GraphEvent.TLP_ADD_NODE:
print 'Add node event'
node = event.getNode()
self.graph.getBooleanProperty('viewSelection')[node] = True
self.changeNodeColor()
def changeNodeColor(self):
c = tlp.Color(random.randint(0,255), random.randint(0,255), random.randint(0,255))
self.graph.getColorProperty('viewColor').setAllNodeValue(c)
updateVisualization()
def main(graph):
inter = Interactor(graph)
graph.addListener(inter)
while(True):
time.sleep(.1)
This interactor, when a node is added to the graph, automatically selects the node and changes randomly the color of all nodes.
Note that this doesn't work if we register it with graph.addObserver(inter)
Tulip already allows the development of plugins, and to register them automatically through the development perspective. I think we can provide a mechanism to register (and unregister) Observables they would be a special class of plugins, with the automatic management of the loop, and the check function would fit perfectly that purpose.
The text was updated successfully, but these errors were encountered:
We'll need to fasten the development of interaction through pure python Tulip.
It is currently possible through the python script view to create pseudo interactors. They are observable classes waiting for events, here is a dummy example we worked on with @guywiz :
This interactor, when a node is added to the graph, automatically selects the node and changes randomly the color of all nodes.
Note that this doesn't work if we register it with
graph.addObserver(inter)
Tulip already allows the development of plugins, and to register them automatically through the development perspective. I think we can provide a mechanism to register (and unregister) Observables they would be a special class of plugins, with the automatic management of the loop, and the check function would fit perfectly that purpose.
The text was updated successfully, but these errors were encountered: