mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Decrease size of icns files in the OS X app bundle
By running the PNG images through a PNG optimizer. Also specify a thumbnail image to use for files associated with calibre. Fixes #295 (Icon association for book files on Mac)
This commit is contained in:
parent
057afd434c
commit
d758d88191
@ -13,7 +13,7 @@ base = d(a(__file__))
|
|||||||
os.chdir(base)
|
os.chdir(base)
|
||||||
|
|
||||||
imgsrc = j(d(d(base)), 'imgsrc')
|
imgsrc = j(d(d(base)), 'imgsrc')
|
||||||
sources = {'calibre':j(d(base), 'calibre.png'), 'ebook-edit':j(imgsrc, 'tweak.svg'), 'ebook-viewer':j(imgsrc, 'viewer.svg')}
|
sources = {'calibre':j(d(base), 'calibre.png'), 'ebook-edit':j(imgsrc, 'tweak.svg'), 'ebook-viewer':j(imgsrc, 'viewer.svg'), 'book':j(imgsrc, 'book.svg')}
|
||||||
|
|
||||||
for name, src in sources.iteritems():
|
for name, src in sources.iteritems():
|
||||||
iconset = name + '.iconset'
|
iconset = name + '.iconset'
|
||||||
@ -37,6 +37,9 @@ for name, src in sources.iteritems():
|
|||||||
shutil.copy2(iname, iname2x)
|
shutil.copy2(iname, iname2x)
|
||||||
if sz > 512:
|
if sz > 512:
|
||||||
os.remove(iname)
|
os.remove(iname)
|
||||||
|
for name in (iname, iname2x):
|
||||||
|
if os.path.exists(name):
|
||||||
|
subprocess.check_call(['optipng', '-o7', name])
|
||||||
finally:
|
finally:
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
|
||||||
|
@ -321,8 +321,6 @@ class Py2App(object):
|
|||||||
c = join(self.build_dir, 'Contents')
|
c = join(self.build_dir, 'Contents')
|
||||||
for x in ('Frameworks', 'MacOS', 'Resources'):
|
for x in ('Frameworks', 'MacOS', 'Resources'):
|
||||||
os.makedirs(join(c, x))
|
os.makedirs(join(c, x))
|
||||||
for x in ('book.icns',):
|
|
||||||
shutil.copyfile(join('icons', x), join(self.resources_dir, x))
|
|
||||||
for x in glob.glob(join('icons', 'icns', '*.iconset')):
|
for x in glob.glob(join('icons', 'icns', '*.iconset')):
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
'iconutil', '-c', 'icns', x, '-o', join(
|
'iconutil', '-c', 'icns', x, '-o', join(
|
||||||
@ -343,6 +341,7 @@ class Py2App(object):
|
|||||||
env['CALIBRE_LAUNCHED_FROM_BUNDLE']='1'
|
env['CALIBRE_LAUNCHED_FROM_BUNDLE']='1'
|
||||||
docs = [{'CFBundleTypeName':'E-book',
|
docs = [{'CFBundleTypeName':'E-book',
|
||||||
'CFBundleTypeExtensions':list(BOOK_EXTENSIONS),
|
'CFBundleTypeExtensions':list(BOOK_EXTENSIONS),
|
||||||
|
'CFBundleTypeIconFile':'book.icns',
|
||||||
'CFBundleTypeRole':'Viewer',
|
'CFBundleTypeRole':'Viewer',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user