Invoking a plugin from menu

edited June 2016 in Ruby Scripting
Hi!
I have created a Plugin/ PluginFactory objects to allow the user to set origin of a layout. This works very well. And I would like to ask 2 more questions:
1. Can I invoke the plugin from a menu item (i.e, not only from the toolbar button)?
2. Once the user presses the button, and the plugin performs what it has to do (mouse_click_event procedure), I would like the plugin to shut down (i.e, make klayout go back to “normal”). Can I do it programmatically?
Thanks a lot!
Allon

Comments

  • edited June 2016

    Hi Allon,

    1.) A plugin can register and act on menu entries. You can basically grab the mouse in such a handler and act on mouse events. Is that what you are looking for?

    2.) If you go for the solution of 1.) you can decide yourself when the plugin gets inactive. You need to call ungrab_mouse in that case.

    Matthias

  • edited November -1
    Thanks Matthias. I will try and reply if successful.
Sign In or Register to comment.