Exemplo n.º 1
0
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

  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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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

    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)
Exemplo n.º 5
0
    'MilkyTracker-Fasttracker-2-Extended-Track': 'XT'
}

# Get system document icns file and extract individual sizes
call(["iconutil", "-c", "iconset", "-o", ICONSET_DIR, SYS_DOCICON_PATH])

# Remove Mavericks-onwards high-resolution '2x' variants, as Docerator currently cannot handle them
for f in listdir(ICONSET_DIR):
    if "@2x" in f:
        remove(path.join(ICONSET_DIR, f))

# Rebuild local copy of .icns file without '2x' variants
call(["iconutil", "-c", "icns", "-o", ICNS_FILE, ICONSET_DIR])

# Remove previously extracted icons
rmtree(ICONSET_DIR)

# Generate document icons
for name, extension in FILETYPES.iteritems():
    print(name)
    docerator.makedocicon(outname='%s.icns' % name,
                          appicon=APPICON_PATH,
                          text=extension,
                          sizes=[512, 256, 128],
                          makeicns=MAKEICNS_PATH,
                          background=ICNS_FILE,
                          rects=RECTS)

# Clean up temporary document background file
remove(ICNS_FILE)
Exemplo n.º 6
0
# Make it possible to run this from docerator's root dir
import os
import sys
sys.path.append(os.getcwd())

import docerator


# for each size, have a (translation_x, scale_x, translation_y, scale_y) tuple:
# 
# These numbers were automatically generated by running
#   ../flow /Applications/Acorn.app/Contents/Resources/AcornDocIcon.icns \
#       /Applications/Acorn.app/Contents/Resources/Acorn.icns 
acornRects = {
     16: ( -0.3762,   0.5597,  -0.1590,   0.4453),
     32: ( -0.5967,   0.5431,  -0.3632,   0.5662),
    128: ( -3.0761,   0.6025,  -2.0524,   0.6073),
    256: ( -6.3940,   0.6081,  -4.3167,   0.6117),
    512: (-13.0499,   0.6110,  -8.8612,   0.6132),
}

docerator.makedocicons(text=['JPG', 'PNG', 'TIFF'], rects=acornRects,
    appicon='/Applications/Acorn.app/Contents/Resources/Acorn.icns')

docerator.makedocicon(text='Acorn', rects=acornRects,
    appicon='/Applications/Acorn.app/Contents/Resources/Acorn.icns')
Exemplo n.º 7
0
}

# Get system document icns file and extract individual sizes
call(["iconutil", "-c", "iconset", "-o", ICONSET_DIR, SYS_DOCICON_PATH])

# Remove Mavericks-onwards high-resolution '2x' variants, as Docerator currently cannot handle them
for f in listdir(ICONSET_DIR):
	if "@2x" in f:
		remove(path.join(ICONSET_DIR, f))

# Rebuild local copy of .icns file without '2x' variants
call(["iconutil", "-c", "icns", "-o", ICNS_FILE, ICONSET_DIR])

# Remove previously extracted icons
rmtree(ICONSET_DIR)

# Generate document icons
for name, extension in FILETYPES.iteritems():
	print(name)
	docerator.makedocicon(	outname='%s.icns' % name,
							appicon=APPICON_PATH,
							text=extension,
							sizes=[512, 256, 128, 32, 16],
							makeicns=MAKEICNS_PATH,
							background=ICNS_FILE,
							rects=RECTS
	)

# Clean up temporary document background file
remove(ICNS_FILE)