Created
January 23, 2016 12:29
-
-
Save weiweihuanghuang/2480e1e021487a0e66db to your computer and use it in GitHub Desktop.
Show master in the Preview Field or Window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Show master | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Show the amster in preview field or preview window. | |
""" | |
import GlyphsApp | |
from Foundation import NSApplication | |
numberOfInstances = len( Glyphs.font.instances ) | |
Doc = Glyphs.currentDocument | |
PreviewField = Doc.windowController().activeEditViewController() | |
PreviewPanel = None | |
for p in NSApplication.sharedApplication().delegate().valueForKey_("pluginInstances"): | |
if p.__class__.__name__ == "NSKVONotifying_GlyphsPreviewPanel": | |
PreviewPanel = p | |
try: | |
currentInstanceNumber = PreviewField.selectedInstance() | |
if currentInstanceNumber < numberOfInstances: | |
PreviewField.setSelectedInstance_( 0 ) | |
if PreviewPanel: | |
PreviewPanel.setSelectedInstance_( 0 ) | |
else: | |
PreviewField.setSelectedInstance_( 0 ) | |
if PreviewPanel: | |
PreviewPanel.setSelectedInstance_( 0 ) | |
except Exception, e: | |
print "Error:", e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment