Inverted/negativeButton in Preview Panel vs Preview area at bottom of Edit View

If I check something like NSUserDefaults.standardUserDefaults().boolForKey_("GSPreview_Black") it will tell me if the Preview at the bottom of the screen OR the Preview Panel is inverted, but those buttons can be set independently so one might be inverted and not the other. I know I can also check the negativeButton state in both places, but it doesn’t really matter how I get the info.
In a Reporter plugin is there a way to draw something different in each Preview (Preview at bottom vs floating Preview Panel)? I’m inverting my colors in the ReporterPlugin preview() if the inverted button is checked, but if both Previews are open and only one is inverted then only one gets the right color. Not a big deal, but would be nice to draw the right colors everywhere in case both Previews are open and only one is inverted.

Switching the preview:

Font.currentTab.previewView().setBlack_(True)

and setting the panel is a bit more complicated:

for plugin in Glyphs.delegate().valueForKey_("pluginInstances"):
	if plugin.__class__.__name__ == "GlyphsPreviewPanel":
		print plugin.previewView().setBlack_(True)

I didn’t ask about how to set the inverted button. That’s the easy part. What I want to know is how to deal with the inverted state in a Reporter plugin when one of the Preview areas is inverted, but not the other. If one of them is inverted then the color needs to be inverted, but the preview() method in a Reporter plugin seems to draw the same thing in both Preview areas. Is there any way to draw one thing in the Preview Panel and another thing in the Preview at the bottom?

That seems to be impossible at the moment. I add a self.black property to the plugin wrapper.

Hi hi,

I am trying to get a notification when the user changed the preview color (or any of these buttons down there). I can access its state, no problem at all, but in a Reporter Plugin after latest API changes, I only get an update when the user moves the canvas or interacts similarly (probably due to performance reasons). This makes some of my plugins feel kinda buggy. I tired to find suiting notifications that I can add observers to the Notification Center, but no luck.

The Preview will be redrawn and the reporters should be called, too. What else do you need? Can you send me one of the plugins?

Nope, that is not happening. Just have a simple console log inside of a drawForegroundForLayer method, if you click the color button, the log ain’t coming until you move the edit view or click into it.

I’ll send you a repo invitation later :slight_smile: