0

Bind to same mouse drag event as pixel inspector?

I am trying to write a tool that displays additional information about the pixel being viewed by the pixel inspector. So I made a custom minor mode, and tried binding it to the "pointer-1--shift--drag" event, like this:

import rv

class MyInspectorMode(rv.rvtypes.MinorMode):
    def __init__(self):
       rv.rvtypes.MinorMode.__init__(self)

      name = 'overridetest'
      global_bindings = None
      override_bindings = [
         ('pointer-1--shift--drag', self.printMsg, 'Print pointer loc')
      ]

      self.init(name, global_bindings, override_bindings)

   def printMsg(self, event):
      print 'Pointer loc:', event.pointer()
      event.reject()


def createMode():
    return MyInspectorMode()


While my widget works, it unfortunately also causes the pixel inspector to stop behaving correctly. Basically, I can shift-click and the pixel inspector will appear, but when I shift-drag the pixel inspector no longer moves around with the mouse.

I tried following the recommendations in this section of the documentation:

http://www.tweaksoftware.com/static/documentation/rv/current/html/rv_reference.html#toc-Section-9.5

But even then, it still doesn't seem like the event is being passed properly along to the inspector. Does anyone know what I might be doing wrong? I've attached this code as a test package just in case anyone needs to take a closer look.

Thanks,

James




overrideTest_0.1.rvpkg

3 comments

  • 0
    Avatar
    Jon Morley

    Hi James,

     

    Thank you for the heads up! I was able to reproduce the behavior you are seeing and I am trying to sort out why. It seems like what you are doing should be fine. Let me dig in and get back to you.

    Thanks,

    Jon

  • 0
    Avatar
    James Jackson

    Hi Jon,

    Awesome! Thank you so much for taking a look!

    - James

  • 0
    Avatar
    Jon Morley

    Hi James,

    I am really sorry for the slow response here. I just downloaded your package again, and after renaming it to use a hyphen instead of an underscore it seemed to work without issue. I can still shift+drag the pixel inspector around and get your Pointer loc prints. Can you please tell me if you are still having issues and if so what version of RV you are using and on what platform?

    Thanks,
    Jon

Please sign in to leave a comment.