Get Info panel position

Hi! I’m trying to add some info to go next to tab’s info view; can I ask what’s the best way to do that, how to get its position on the screen?

I use tab.viewPort.origin to calculate the position, but it seems like a long way around and the text is jumpy because of the rounding.

tab.graphicView().infoView().bounds.origin is always (0, 0), so that’s doesn’t help either. Am I overlooking something obvious?

What do you try to put there?


should work.

Or use the insectorView API to add your own info box.

1 Like

Thank you, that’s much better!
Almost there, just showing the angle:

However, in Glyphs 2 one can add a GSInspectorView to the panel with view method, but it doesn’t work in Glyphs 3. Is it different now?

def view(self):

Also, is there a way to change its position relative to the main panel? I’d put it above the width/height rather than on the right.

FYI that should be Font.currentTab.infoView().frame() (or with your tab variable tab.infoView().frame())

you need to return an NSViewController.

What class and superclass is self?

I found that in your comment from a couple of years ago. So, self is ReporterPlugin, pretty much the same code.

Any hints on how to return NSViewController, please? Can’t find it among properties of anything.

viewController =
return viewController

You should store that viewController in a local variable that you can reuse it.

Oh I see, thank you! But seems like that crashes Glyphs

Can you send me the full code (privately if needed)?

Sure, I was going to submit it for Plugin Manager anyway:

By the way, if you can explain how to position it at some coordinates above the default panel rather then next to it, I think it would look better :slight_smile:

You know that there is a plugin that does something similar: GitHub - Mark2Mark/Show-Distance-And-Angle-Of-Nodes

Of course, I just prefer such secondary info to blend with the interface rather than sit right on top of paths

That plugin has sadly been broken since 3.2, I miss it dearly :cry:

I fixed the Distance and Angle plugin.

1 Like

Any hints on that error, please?

The view method has to return a view, not a view controller. My code snippet would need to go into inspectorViewControllersForLayer_(). But your hack to return [self] works, too. I fixed the code but can’t push the changes. Can you add me to the repo?

1 Like