Is there a way for a reporter to get notified when certain mouse events happen? I want to freeze a reporter’s view on a particular signal (say a Ctrl-doubleclick).
(If not, I can put it in a context menu option, but it wouldn’t be as user friendly.)
The tool.mouseDown_ methods should not be called manually. They are called by the system. I just added support for mouseDown/Up. It works like the existing mouseMoved callback.
I’m having difficulty getting this to work. I’ve added Glyphs.addCallback(self.somefunction, MOUSEDOWN), but Glyphs then doesn’t launch, saying there no global variable for MOUSEDOWN.
How should one go about running a function on mousedown in a reporter plugin?
I was using an older beta, but just updated to build 1134. I still get the same error. This is the code, in the ReporterPlugin; maybe I’m putting things in the wrong place?
Ok, so explicitly calling from GlyphsApp import MOUSEDOWN stopped the error that there was no global variable of that name. However, a simple print statement in the self.mouseDidPress function attributed to the callback isn’t working. Is this implemented in the current version? If so, and I’m being blind to something obvious let me know. I though there was something on callbacks in the SDK docs but can’t find it at all and not sure if I just imagined it
The wrapper callbacks are a bit difficult because they try to do to things at once. Thy should work with scripts and with plugins. Specially removing is a bit tricky. Until we solve that, can you use the native API:
The self.hasObserver has to be set to False in self.settings. Sometimes the willActivate is called more than once so you need to make sure you don’t add the observer twice.
In an objc reporter i got the “mouseDownNotification” and the “mouseUpNotification” working, but trying to implement the “mouseMovedNotification” exactly the same way, it doesn’t get fired. Any clues why?
For anybody else who finds this thread about mouse events. The expected MOUSEDOWN and MOUSEUP are supported as of now in Glyphs 3, but missing from the documentation.