Add support for Glyphs.

git-svn-id: http://svn.robofab.com/trunk@246 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
This commit is contained in:
Tal Leming 2011-06-14 15:44:18 +00:00
parent 6bc884b229
commit 32e6e0b734

View File

@ -35,8 +35,10 @@ class RFWorld:
# collect versions # collect versions
self.pyVersion = sys.version[:3] self.pyVersion = sys.version[:3]
self.inPython = False self.inPython = False
self.flVersion = None
self.inFontLab = False self.inFontLab = False
self.flVersion = None
self.inGlyphsApp = False
self.glyphsAppVersion = None
# are we in FontLab? # are we in FontLab?
try: try:
@ -45,6 +47,16 @@ class RFWorld:
self.inFontLab = True self.inFontLab = True
self.flVersion = fl.version self.flVersion = fl.version
except ImportError: pass 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: if not self.inFontLab:
self.inPython = True self.inPython = True
@ -73,7 +85,6 @@ class RFWorld:
print '-'*30 print '-'*30
print print
world = RFWorld() world = RFWorld()
lineBreak = os.linesep lineBreak = os.linesep
@ -82,7 +93,8 @@ if world.inFontLab:
from robofab.interface.all.dialogs import SelectFont, SelectGlyph from robofab.interface.all.dialogs import SelectFont, SelectGlyph
from robofab.objects.objectsFL import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts from robofab.objects.objectsFL import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts
lineBreak = "\n" lineBreak = "\n"
elif world.inGlyphsApp:
from robofab.objects.objectsFL import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts
elif world.inPython: elif world.inPython:
from robofab.objects.objectsRF import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts from robofab.objects.objectsRF import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts