def main(): if dont_create: print "PyObjC not found, only using a stock icon for document icons." # Can't use the constants from docerator in this case import shutil shutil.copyfile(DEFAULT_BACKGROUND, '%s.icns' % GENERIC_ICON_NAME) createLinks([name for name in vimIcons if name != GENERIC_ICON_NAME], '%s.icns' % GENERIC_ICON_NAME) return # choose an icon font global fontname, facename # Thanks to DamienG for Envy Code R (redistributed with permission): # http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released fonts = [('Envy Code R Bold.ttf', 'EnvyCodeR-Bold'), ('/System/Library/Fonts/Monaco.dfont', 'Monaco')] for font in fonts: if loadfont.loadfont(font[0]): fontname, facename = font break print "Building icons with font '" + fontname + "'." srcdir = os.getcwd() if len(sys.argv) > 1: os.chdir(sys.argv[1]) appIcon = os.path.join(srcdir, APPICON) makeIcns = os.path.join(srcdir, MAKEICNS) # create LARGE and SMALL icons first... for name, t in vimIcons.iteritems(): text, size = t if size == LINK: continue print name if name == GENERIC_ICON_NAME: # The generic icon has no text; make the appicon a bit larger docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon, text=text, sizes=iconsizes[size], makeicns=makeIcns, textrenderer=NoTextRenderer, rects={16: (0.0, 0.5533, 0.0, 0.5533)}) else: # For the other icons, leave out appicon and render text in Envy Code R docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon, text=text, sizes=iconsizes[size], makeicns=makeIcns, textrenderer=SmallTextRenderer, backgroundrenderer=NoIconRenderer) # ...create links later (to make sure the link targets exist) createLinks([name for (name, t) in vimIcons.items() if t[1] == LINK], '%s.icns' % GENERIC_ICON_NAME)
def main(): if dont_create: print "PyObjC not found, only using a stock icon for document icons." # Can't use the constants from docerator in this case import shutil shutil.copyfile(DEFAULT_BACKGROUND, '%s.icns' % GENERIC_ICON_NAME) createLinks([name for name in vimIcons if name != GENERIC_ICON_NAME], '%s.icns' % GENERIC_ICON_NAME) return # choose an icon font global fontname, facename # Thanks to DamienG for Envy Code R (redistributed with permission): # http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released fonts = [('Envy Code R Bold.ttf', 'EnvyCodeR-Bold'), ('/System/Library/Fonts/Monaco.dfont', 'Monaco')] for font in fonts: if loadfont.loadfont(font[0]): fontname, facename = font break print "Building icons with font '" + fontname + "'." srcdir = os.getcwd() if len(sys.argv) > 1: os.chdir(sys.argv[1]) appIcon = os.path.join(srcdir, APPICON) makeIcns = os.path.join(srcdir, MAKEICNS) # create LARGE and SMALL icons first... for name, t in vimIcons.iteritems(): text, size = t if size == LINK: continue print name if name == GENERIC_ICON_NAME: # The generic icon has no text; make the appicon a bit larger docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon, text=text, sizes=iconsizes[size], makeicns=makeIcns, textrenderer=NoTextRenderer, rects={16:(0.0, 0.5533, 0.0, 0.5533)}) else: # For the other icons, leave out appicon and render text in Envy Code R docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon, text=text, sizes=iconsizes[size], makeicns=makeIcns, textrenderer=SmallTextRenderer, backgroundrenderer=NoIconRenderer) # ...create links later (to make sure the link targets exist) createLinks([name for (name, t) in vimIcons.items() if t[1] == LINK], '%s.icns' % GENERIC_ICON_NAME)
# http://www.macresearch.org/cocoa-scientists-part-xx-python-scriptersmeet-cocoa try: # Make us independent of sysprefs->appearance->antialias fonts smaller than... # Needs to happen before docerator is imported. from AppKit import NSUserDefaults prefs = NSUserDefaults.standardUserDefaults() prefs.setInteger_forKey_(4, 'AppleAntiAliasingThreshold') import docerator # Load Envy Code R from a file and register it under its postscript name # Thanks to DamienG for this font (redistributed with permission): # http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released import loadfont loadfont.loadfont('Envy Code R Bold.ttf') from Foundation import NSString from AppKit import * dont_create = False except: dont_create = True # most likely because we're on tiger import os import sys # icon types LARGE = 0 # 512, 128, 32, 16; about 96kB SMALL = 1 # 128, 32, 16; about 36kB LINK = 2 # Create link to generic icon; 4kB (== smallest block size on HFS+)
try: # Make us independent of sysprefs->appearance->antialias fonts smaller than... # Needs to happen before docerator is imported. from AppKit import NSUserDefaults prefs = NSUserDefaults.standardUserDefaults() prefs.setInteger_forKey_(4, "AppleAntiAliasingThreshold") import docerator # Load Envy Code R from a file and register it under its postscript name # Thanks to DamienG for this font (redistributed with permission): # http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released import loadfont loadfont.loadfont("Envy Code R Bold.ttf") from Foundation import NSString from AppKit import * dont_create = False except: dont_create = True # most likely because we're on tiger import os import sys # icon types LARGE = 0 # 512, 128, 32, 16; about 96kB SMALL = 1 # 128, 32, 16; about 36kB
# http://www.macresearch.org/cocoa-scientists-part-xx-python-scriptersmeet-cocoa try: # Make us independent of sysprefs->appearance->antialias fonts smaller than... # Needs to happen before docerator is imported. from AppKit import NSUserDefaults prefs = NSUserDefaults.standardUserDefaults() prefs.setInteger_forKey_(4, 'AppleAntiAliasingThreshold') import docerator # Load Envy Code R from a file and register it under its postscript name # Thanks to DamienG for this font (redistributed with permission): # http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released import loadfont loadfont.loadfont('Envy Code R Bold.ttf') from Foundation import NSString from AppKit import * dont_create = False except Exception, e: print e dont_create = True # most likely because we're on tiger import os import sys # icon types LARGE = 0 # 512, 128, 32, 16; about 96kB