mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
OS X: Allow adding of books to calibre via drag and drop on the calibre dock icon
This commit is contained in:
parent
fe5283de4a
commit
b3bcd13f3a
BIN
icons/book.icns
Normal file
BIN
icons/book.icns
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -266,6 +266,7 @@ class Py2App(object):
|
|||||||
def get_local_dependencies(self, path_to_lib):
|
def get_local_dependencies(self, path_to_lib):
|
||||||
for x in self.get_dependencies(path_to_lib):
|
for x in self.get_dependencies(path_to_lib):
|
||||||
for y in (SW+'/lib/', '/usr/local/lib/', SW+'/qt/lib/',
|
for y in (SW+'/lib/', '/usr/local/lib/', SW+'/qt/lib/',
|
||||||
|
'/opt/local/lib/',
|
||||||
'/Library/Frameworks/Python.framework/', SW+'/freetype/lib/'):
|
'/Library/Frameworks/Python.framework/', SW+'/freetype/lib/'):
|
||||||
if x.startswith(y):
|
if x.startswith(y):
|
||||||
if y == '/Library/Frameworks/Python.framework/':
|
if y == '/Library/Frameworks/Python.framework/':
|
||||||
@ -338,7 +339,7 @@ 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))
|
||||||
x = 'library.icns'
|
for x in ('library.icns', 'book.icns'):
|
||||||
shutil.copyfile(join('icons', x), join(self.resources_dir, x))
|
shutil.copyfile(join('icons', x), join(self.resources_dir, x))
|
||||||
|
|
||||||
@flush
|
@flush
|
||||||
@ -358,6 +359,10 @@ class Py2App(object):
|
|||||||
from calibre.ebooks import BOOK_EXTENSIONS
|
from calibre.ebooks import BOOK_EXTENSIONS
|
||||||
env = dict(**ENV)
|
env = dict(**ENV)
|
||||||
env['CALIBRE_LAUNCHED_FROM_BUNDLE']='1';
|
env['CALIBRE_LAUNCHED_FROM_BUNDLE']='1';
|
||||||
|
docs = [{'CFBundleTypeName':'E-book',
|
||||||
|
'CFBundleTypeExtensions':list(BOOK_EXTENSIONS),
|
||||||
|
'CFBundleTypeRole':'Viewer',
|
||||||
|
}]
|
||||||
|
|
||||||
pl = dict(
|
pl = dict(
|
||||||
CFBundleDevelopmentRegion='English',
|
CFBundleDevelopmentRegion='English',
|
||||||
@ -368,7 +373,7 @@ class Py2App(object):
|
|||||||
CFBundlePackageType='APPL',
|
CFBundlePackageType='APPL',
|
||||||
CFBundleSignature='????',
|
CFBundleSignature='????',
|
||||||
CFBundleExecutable='calibre',
|
CFBundleExecutable='calibre',
|
||||||
CFBundleTypeExtensions=list(BOOK_EXTENSIONS),
|
CFBundleDocumentTypes=docs,
|
||||||
LSMinimumSystemVersion='10.4.2',
|
LSMinimumSystemVersion='10.4.2',
|
||||||
LSRequiresNativeExecution=True,
|
LSRequiresNativeExecution=True,
|
||||||
NSAppleScriptEnabled=False,
|
NSAppleScriptEnabled=False,
|
||||||
@ -596,7 +601,7 @@ class Py2App(object):
|
|||||||
if x == 'Info.plist':
|
if x == 'Info.plist':
|
||||||
plist = plistlib.readPlist(join(self.contents_dir, x))
|
plist = plistlib.readPlist(join(self.contents_dir, x))
|
||||||
plist['LSUIElement'] = '1'
|
plist['LSUIElement'] = '1'
|
||||||
plist.pop('CFBundleTypeExtensions')
|
plist.pop('CFBundleDocumentTypes')
|
||||||
plistlib.writePlist(plist, join(cc_dir, x))
|
plistlib.writePlist(plist, join(cc_dir, x))
|
||||||
else:
|
else:
|
||||||
os.symlink(join('../..', x),
|
os.symlink(join('../..', x),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user