[vtkusers] [python] aborting/stopping observer...

fred fredmfp at gmail.com
Sun Apr 26 08:54:42 EDT 2009


Hi all,

First of all, I read the VTK FAQ, browsed vtkCommand.h, the web, all
vtkGenericRenderWindowInteractor attributes under iptyhon...

No clue. Nothing :-(

The problem I want to fix is to disable initial
MouseWheelBackwardEvent/MouseWheelForwardEvent because I want to set
others callbacks for these events.

If not, I do have zoom in/out + my own callback. I only want my
callback, of course.

When you print the interactor, you get something like this:
vtkGenericRenderWindowInteractor (0x7175080)
  Debug: Off
  Modified Time: 893832
  Reference Count: 2
  Registered Events:
    Registered Observers:
      vtkObserver (0x73e3120)
        Event: 22
        EventName: CharEvent
        Command: 0x69c8c40
        Priority: 0.55
        Tag: 50
.../...
      vtkObserver (0x71891c0)
        Event: 27
        EventName: MouseWheelForwardEvent
        Command: 0x7189ed0
        Priority: 0
        Tag: 32
      vtkObserver (0x718ee20)
        Event: 28
        EventName: MouseWheelBackwardEvent
        Command: 0x7189ed0
        Priority: 0
        Tag: 33
.../...
  InteractorStyle:    0x7175170
  RenderWindow:    0x718e6b0
  Picker: 0x718e530
  Observer Mediator: 0x73e31a0
  LightFollowCamera: On
  DesiredUpdateRate: 15
  StillUpdateRate: 0.0001
  Initialized: 1
  Enabled: 1
  EnableRender: 1
  EventPosition: ( 455, 339 )
  LastEventPosition: ( 455, 339 )
  EventSize: ( 0, 0 )
  Viewport Size: ( 1052, 780 )
  Number of Fly Frames: 15
  Dolly: 0.3
  ControlKey: 1
  AltKey: 0
  ShiftKey: 0
  KeyCode: ^W
  KeySym: (null)
  RepeatCount: 0
  Timer Duration: 10
  TimerEventId: 0
  TimerEventType: 0
  TimerEventDuration: 0
  TimerEventPlatformId: 0
  TimerEventResetsTimer: 1

If you can access all last attributes,
you can't access each vtkObserver (really, I did not find how I could to
it).

I would like to access them to abort/stop the ones related to the
initial MouseWheelBackwardEvent/MouseWheelForwardEvent (*AborfFlag* VTK
methods)

My first idea was to remove them with remove_observers(), which works fine.

But in this case, how can I get back the normal behavior with mouse
wheel when I finished to play with my callback? As you don't have the
observers tag (and you can't access them), I have no clue.

I was also thinking of tweak interactor_style, rather than
adding/removing observers, subclassing InteractorStyleSwitch (I only
want to change the behavior of the two callbacks above). But it seems
that these VTK classes can not be subclassed, IIUC. :-(

Did I miss something obvious?
I hope.

Any clue?



I read the post from C. Botha

http://www.vtk.org/pipermail/vtk-developers/2007-September/004721.html

which looks similar to my issue, but what news since his post?


TIA.


Cheers,

-- 
Fred



More information about the vtkusers mailing list