Reporter or General Plugin?

I would like to create a plugin to run some QA and highlight certain nodes in EditView. I already have my Python QA; now, I would like to make the plugin.

I need functions from Reporter to draw things on EditView, but I also need to show a Vanilla Window to choose and run QA. What is the best method to do that?

Make a plugin to display things in EditView, and another one to set preferences of first one ?

You don’t need to be a reporter plugin to draw in Edit View, it’s just more convenient that way as you don’t have to set up the View menu item and the drawing callback hooks yourself.

Inversely, you can also use Vanilla from a reporter plugin.

However, the distinction between the different plugin types will be less relevant going forward. Starting with Glyphs 3.2, you can have multiple different plugins in a single .glyphsPlugin bundle. We will publish more details on that soon.

So I would choose a .glyphsPlugin bundle, put a reporter plugin in there, and call the Vanilla functions from the reporter plugin. If the Vanilla-part of the plugin does not fit into the reporter, add a separate general plugin into the same .glyphPlugin bundle and have the two talk to each other.

How to do this exactly is difficult to tell without knowing more about your plugins features and needs.

1 Like

How should the window be triggered? Always when the plugin is active or on demand by the user?

Ideally always displayed when the plugin is active

Then it might be easier with a general plugin. You need your own menu item. if that is clicked, you show your window and add a drawing callback. And when the window is closed, you remove it again.

1 Like

Do you have an example about how to implement a drawing method in General plugin and access Layer from Editview ?

The easiest would be to check existing plugins. The python version of speepunk has an always on window.
And after thinking about it, doing a reporter might actually be the better option. There are willActivate() and willDeactivate() callback. There you can show/hide your window. But make sure that you only have one window.

1 Like

Last question, how to implement these callbacks in the Reporter Plugin ?

You add methods with those names. They belong to the reporter plugin API.

Like this :

Screenshot 2024-02-29 at 10.06.55

Now, I’m experiencing something very peculiar. After adding these two methods and running GlyphsApp, the app still bounces (even when this plugin is removed), and I can only open it in Plugin Disabled mode.

The only way to make it work as before is:

  1. Remove all plugins manually from the Plugins folder.
  2. Run and quit Glyphs.
  3. Reinstall all previously installed plugins.

Here is the plugin I used, and cause this bug :
PluginName.glyphsReporter.zip (18.9 KB)

Do not add the @objc.python_method to methods that the ObjectiveC part of the app needs to access. That decorator is only needed to methods that are only used within the plugin (and some helper methods for the python wrapper).

1 Like

@HugoJ did you have a look at my Skedge plugin? It is quite similar to what you want, no? It has a window which is always open when the plugin is active, and it draws into the edit view.

One thing from Skedge which you don’t need is the execution of the window code all the time, that is specific to Skedge, as it is supposed to render the user’s code. But you can see an example how to inject the drawing callback.

That would work for now, until the updated architecture is live, that Florian was talking about.

@Mark Of course, I know it :wink:
It’s not too far from what I’m trying to achieve, but as Georg explained, it’s easier to show a window from a Reporter Plugin than to add a drawing callback in a General Plugin.

@GeorgSeifert I have another question. Is it possible to run a part of the code not when the application starts, but after a font has been loaded?

I’m using Font.userData to store the data I use in my plugin, and since the plugin is loaded before fonts, I can’t access this data.

You need to observe the current document. That way you get notified when it changes, too. I’ll need to find some sample code.

1 Like

You can add a callback go get notified if a document is activated.

Glyphs.addCallback(self.changeDocument_, DOCUMENTACTIVATED)

That is triggered when a document becomes active.

1 Like

Hello, I didn’t quite follow the discussion properly. Is there a possibility to draw from a filter plugin?

I currently have a .glyphsFilter, but would like to call some drawing methods similar to a reporter plugin. Is this possible?

EDIT: My bad, I already asked this exact question a year ago (which was answered): Simplest way of displaying items (like reporter plugin) in filter plugin?