Jumps to next instance shown in the preview field or window. """ from Foundation import NSApplication numberOfInstances = len( Glyphs.font.instances ) Doc = Glyphs.currentDocument # Preview Area at the bottom of Edit view: PreviewField = Doc.windowController().activeEditViewController() # Window > Preview Panel: 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 - 1: PreviewField.setSelectedInstance_( currentInstanceNumber + 1 ) if PreviewPanel: PreviewPanel.setSelectedInstance_( currentInstanceNumber + 1 ) else: PreviewField.setSelectedInstance_( -2 ) if PreviewPanel: PreviewPanel.setSelectedInstance_( -2 )
Jumps to next instance shown in the preview field or window. """ import GlyphsApp from Foundation import NSApplication numberOfInstances = len(Glyphs.font.instances) Doc = Glyphs.currentDocument # Preview Area at the bottom of Edit view: PreviewField = Doc.windowController().activeEditViewController() # Window > Preview Panel: 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 - 1: PreviewField.setSelectedInstance_(currentInstanceNumber + 1) if PreviewPanel: PreviewPanel.setSelectedInstance_(currentInstanceNumber + 1) else: PreviewField.setSelectedInstance_(-2) if PreviewPanel: PreviewPanel.setSelectedInstance_(-2)
return False return True def startMimic(): """ Setup the mimic application using steps similar to :obj:`mimic.tap.makeService' and start listening for requests. """ clock = Clock() core = MimicCore.fromPlugins(clock) root = MimicRoot(core, clock) site = Site(root.app.resource()) site.displayTracebacks = False endpoint = serverFromString( reactor, b"tcp:{0}:interface=127.0.0.1".format(_PORT) ) endpoint.listen(site) if __name__ == "__main__": log.startLogging(stdout) application = NSApplication.sharedApplication() delegate = MimicAppDelegate.alloc().init() application.setDelegate_(delegate) AppHelper.runEventLoop()
from Foundation import NSApplication from PyObjCTools import AppHelper from AppKit import NSApp from app import (MyAppDelegate) import objc objc.setVerbose(True) if __name__ == '__main__': app = NSApplication.sharedApplication() app.activateIgnoringOtherApps_(True) app.setDelegate_(MyAppDelegate.create()) AppHelper.runEventLoop()
def getCaptureController(): my_app = NSApplication.sharedApplication() app_delegate = my_app.delegate() return app_delegate.captureController()