Expose rxvtk::from_event in python
this new API allows to create an observable of a vtkCommand
event in python.
async def Observe(observable):
async for event in observable:
print(event)
async def main():
...
observer = ReactiveCommand(sphere, vtkCommand.PropertyModifiedEvent)
task = asyncio.create_task(Observe(observer.GetObservable()))
...
observer.Unsubscribe()
await task
# sample output
# [<paraview.modules.vtkRemotingServerManager.vtkSMSourceProxy(0x55613949cfb0) at 0x7f097d6c7520>, 73, None]
# [<paraview.modules.vtkRemotingServerManager.vtkSMSourceProxy(0x55613949cfb0) at 0x7f097d6c7520>, 73, None]
# [<paraview.modules.vtkRemotingServerManager.vtkSMSourceProxy(0x55613949cfb0) at 0x7f097d6c7520>, 73, None]
# [<paraview.modules.vtkRemotingServerManager.vtkSMSourceProxy(0x55613949cfb0) at 0x7f097d6c7520>, 73, None]
# [<paraview.modules.vtkRemotingServerManager.vtkSMSourceProxy(0x55613949cfb0) at 0x7f097d6c7520>, 73, None]
Limitations:
-
callData
i.e the third argument ofvirtual void vtkCommand::Execute(vtkObject * caller,unsigned long eventId, void * callData)
is not wrapped. There is no way currently of unsubscribing besides destroying thevtkObject
we are observing.
There is no technical reason for it to be in ParaT
class but I think it looks convenient.
Edited by Christos Tsolakis