alexs
March 1, 2023, 3:35pm
1
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?
tab.graphicView().infoView().frame()
should work.
Or use the insectorView API to add your own info box.
1 Like
alexs
March 2, 2023, 12:34am
3
GeorgSeifert:
insectorView
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):
return self.window.group.getNSView()
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.
Mark
March 20, 2023, 2:35pm
4
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
?
alexs
March 26, 2023, 4:45pm
6
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 = NSViewController.new()
viewController.setView_(self.window.group.getNSView())
return viewController
You should store that viewController in a local variable that you can reuse it.
alexs
March 29, 2023, 11:00pm
8
Oh I see, thank you! But seems like that crashes Glyphs
Can you send me the full code (privately if needed)?
alexs
March 30, 2023, 3:17pm
10
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
You know that there is a plugin that does something similar: GitHub - Mark2Mark/Show-Distance-And-Angle-Of-Nodes
alexs
March 30, 2023, 5:09pm
12
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
I fixed the Distance and Angle plugin.
1 Like
alexs
April 8, 2023, 5:49pm
15
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