[vtkusers] Aborting observers in python

David Gobbi david.gobbi at gmail.com
Fri Sep 23 20:01:13 EDT 2011


Hi Wayne,

I've submitted the change.  Unless it causes something to break, it will be
in the next release.

 - David


On Thu, Sep 22, 2011 at 2:20 PM, Wayne Christopher <wayne at 4raccoons.com> wrote:
> Yes, that does seem to work.  I can get the command in this way and call
> command.SetAbortFlag(1) to stop further processing.  Maybe this can be
> changed in the next release?
>
> Thanks!
>
>    Wayne
>
> On 9/22/11 8:59 AM, David Gobbi wrote:
>>
>> Hi Wayne,
>>
>> Around a year ago I did a little bit of work on improving vtkCommand
>> in python, but it has been low priority.  It might be possible to
>> access a command object in python if you are willing to play with the
>> VTK source code a bit.
>>
>> In Wrapping/vtkWrapPython.c remove the following line and recompile VTK:
>>
>> 3090:          (strcmp(theFunc->Name, "GetCommand") == 0) ||
>>
>> Then try adding an observer in python and retrieving the command object:
>>
>> commandID = obj.AddObserver(eventID, callback)
>> command = obj.GetCommand(commandID)
>>
>> If this works for you, then let me know.
>>
>>  - David
>>
>>
>>
>> On Wed, Sep 21, 2011 at 4:12 PM, Wayne Christopher<wayne at 4raccoons.com>
>>  wrote:
>>>
>>> I saw a discussion from a few years ago -
>>> http://www.vtk.org/pipermail/vtk-developers/2007-September/004725.html -
>>> about setting the abort flag in an observer to prevent further observers
>>> from being fired with the python bindings.
>>>
>>> Has anything been done about this?  I couldn't quite tell from the
>>> discussion whether there was a workaround or not.
>>>
>>> Thanks,
>>>
>>>    Wayne
>



More information about the vtkusers mailing list