The best way to show a layer on vanilla window

I want to show tiled view of glyph layers, kinda like Glyph Palette in Adobe apps. I tried GlyphView but it shows export status at the top right corner which I do not want. Then I tried CanvasView which I do not know how to get the scale right. What’s the best way to do this? Also I want to assign a callback (maybe double-click callback) but there seems to be no support in either of those. Could anyone help me with that too?

There is an example in the bottom of the objectGS.py file.

But it doesn’t have a (double) click callback?

I read both GlyphView and CanvasView help. I managed to solve scale issues, but I still cannot have callback of any kind.

I just added a callback implementation to the GlyphPreview in objectsGS.py.

1 Like

Thanks! I don’t mind using GlyphPreview, as long as I can remove non-export mark. Is there an option for that?

You can roll your own view class very easily. Then you have full control. I’ll see that I can do to change the default behavior.

BTW I did sth like this already. For some reason I have a hard time to get the colors right. All colors except the light green and light grey are too dark and saturated:

This is how I translate the color objcet to the NSColor:

	cc = layer.parent.colorObject
	if cc:
		R = cc.redComponent()
		G = cc.greenComponent()
		B = cc.blueComponent()
		A = cc.alphaComponent()
		NSColor.colorWithCalibratedRed_green_blue_alpha_( R, G, B, A )
1 Like