From 32e6e0b7342ae054f6f5443ab33774448624ea60 Mon Sep 17 00:00:00 2001 From: Tal Leming Date: Tue, 14 Jun 2011 15:44:18 +0000 Subject: [PATCH] Add support for Glyphs. git-svn-id: http://svn.robofab.com/trunk@246 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c --- Lib/robofab/world.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Lib/robofab/world.py b/Lib/robofab/world.py index 97ffa4408..03c62d725 100644 --- a/Lib/robofab/world.py +++ b/Lib/robofab/world.py @@ -35,9 +35,11 @@ class RFWorld: # collect versions self.pyVersion = sys.version[:3] self.inPython = False - self.flVersion = None self.inFontLab = False - + self.flVersion = None + self.inGlyphsApp = False + self.glyphsAppVersion = None + # are we in FontLab? try: from FL import fl @@ -45,6 +47,16 @@ class RFWorld: self.inFontLab = True self.flVersion = fl.version except ImportError: pass + # are we in Glyphs? + try: + import objectsGS + from AppKit import NSBundle + bundle = NSBundle.mainBundle() + self.applicationName = bundle.infoDictionary()["CFBundleName"] + self.inGlyphsApp = True + self.glyphsAppVersion = bundle.infoDictionary()["CFBundleVersion"] + except ImportError: pass + # we are in NoneLab if not self.inFontLab: self.inPython = True @@ -59,7 +71,7 @@ class RFWorld: # see if we have DialogKit self.supportsDialogKit = False - + def __repr__(self): return "[Robofab is running on %s. Python version: %s, Mac stuff: %s, PC stuff: %s, FontLab stuff: %s, FLversion: %s]"%(self.platform, self.pyVersion, self.mac, self.pc, self.inFontLab, self.flVersion) @@ -72,7 +84,6 @@ class RFWorld: print m print '-'*30 print - world = RFWorld() @@ -82,7 +93,8 @@ if world.inFontLab: from robofab.interface.all.dialogs import SelectFont, SelectGlyph from robofab.objects.objectsFL import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts lineBreak = "\n" - +elif world.inGlyphsApp: + from robofab.objects.objectsFL import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts elif world.inPython: from robofab.objects.objectsRF import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts