API for Panel Inspector

Is there an API for the Panel Inspector?

I would like to know how to add it properly Python.

Screenshot 2023-10-13 at 17.58.26@2x

Oh, and also, can this be invoked from the font view?

I found my way though the inspector view puzzle pieces all over the internet, so I got it working now for the GSPanelInspectorsViewControllersCallbackName.

It looks a little odd, because in my likely faulty implementation (reversed from the “normal” inspector view) it still draws its light-grey background, as if it would be an inspector view.

I still would like to be able to invoke in from the Font View, which currently does not work. I need it for the selected layers (or glyphs), like it currently is possible from the EditView.


PS: I found that it is called "GSInspectorViewControllersCallback" but "GSPanelInspectorsViewControllersCallbackName" (note the additional Name here). Not sure if that is intentionally?

Here is my current draft as a sample plugin. It is just what I came up with, it is likely not correct.
What needs to be changed for a proper appearance?

The font view uses a different callback:

- (nullable NSArray *)panelInspectorsForSelectedLayers:(nonnull NSArray *)layers;

(mentioned in GlyphsToolEventProtocol.h)

Thanks! I still got some issues though:

Could you have a quick look at the code, please? It is not much :slight_smile:

It only updates when I come back from an Edit Tab to the Font View. Not when I change the selection in the Font View.

The panelInspectorsForLayer_ however is called on each update.

Also, why does it draw the grey background, or better, how can I get rid of that?

Screenshot 2023-10-15 at 17.46.39@2x
(This time i did not highlight anything in the screenshot, that is how it looks)

I fixed it. It will now be called when the selection changes. But not when the content of the selected layers changes.

1 Like

Thanks a lot!

And what about the background? Why does it look like an inspector from the edit tab sitting in the panel?

I still seem to make something wrong there, I assume I wouldn’t have to explicitly remove all background drawings, since that is not the case with other UI elements (palette, etc)

don’t use the “PatchedGroup/GSInspectorView”. Just normal views/boxes.

Ahhh, that’s it! I didn’t really understand what that patched group was for, just took it from the other examples, and thought it adds some functionality.

Now it works like a charm, also with build 3222 and the font view. Will update the sample plugin tomorrow. Thank you!