mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Allow the GUI to be launched on OSX from the terminal using /usr/bin/calibre. Fix the application icon on OSX
This commit is contained in:
parent
25fab41a1d
commit
445fd0f6b7
Binary file not shown.
@ -3,7 +3,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
''' Create an OSX installer '''
|
''' Create an OSX installer '''
|
||||||
|
|
||||||
import sys, re, os, shutil, subprocess, stat, glob
|
import sys, re, os, shutil, subprocess, stat, glob, zipfile
|
||||||
from setup import VERSION, APPNAME, scripts, main_modules, basenames, main_functions
|
from setup import VERSION, APPNAME, scripts, main_modules, basenames, main_functions
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from py2app.build_app import py2app
|
from py2app.build_app import py2app
|
||||||
@ -28,7 +28,7 @@ loader = open(loader_path, 'w')
|
|||||||
site_packages = glob.glob(dirpath+'/*/*/site-packages.zip')[0]
|
site_packages = glob.glob(dirpath+'/*/*/site-packages.zip')[0]
|
||||||
print >>loader, '#!'+python
|
print >>loader, '#!'+python
|
||||||
print >>loader, 'import sys'
|
print >>loader, 'import sys'
|
||||||
print >>loader, 'sys.path.append(', repr(site_packages), ')'
|
print >>loader, 'sys.path.insert(0, ', repr(site_packages), ')'
|
||||||
print >>loader, 'sys.frozen = "macosx_app"'
|
print >>loader, 'sys.frozen = "macosx_app"'
|
||||||
print >>loader, 'sys.frameworks_dir =', repr(frameworks_dir)
|
print >>loader, 'sys.frameworks_dir =', repr(frameworks_dir)
|
||||||
print >>loader, 'import os'
|
print >>loader, 'import os'
|
||||||
@ -259,6 +259,11 @@ sys.frameworks_dir = os.path.join(os.path.dirname(os.environ['RESOURCEPATH']), '
|
|||||||
print >>f, 'import sys, os'
|
print >>f, 'import sys, os'
|
||||||
f.write(src)
|
f.write(src)
|
||||||
f.close()
|
f.close()
|
||||||
|
print
|
||||||
|
print 'Adding GUI main.py'
|
||||||
|
f = zipfile.ZipFile(os.path.join(self.dist_dir, APPNAME+'.app', 'Contents', 'Resources', 'lib', 'python2.5', 'site-packages.zip'), 'a', zipfile.ZIP_DEFLATED)
|
||||||
|
f.write('src/calibre/gui2/main.py', 'calibre/gui2/main.py')
|
||||||
|
f.close()
|
||||||
print
|
print
|
||||||
print 'Building disk image'
|
print 'Building disk image'
|
||||||
BuildAPP.makedmg(os.path.join(self.dist_dir, APPNAME+'.app'), APPNAME+'-'+VERSION)
|
BuildAPP.makedmg(os.path.join(self.dist_dir, APPNAME+'.app'), APPNAME+'-'+VERSION)
|
||||||
|
@ -1131,7 +1131,8 @@ def main(args=sys.argv):
|
|||||||
|
|
||||||
pid = os.fork() if islinux else -1
|
pid = os.fork() if islinux else -1
|
||||||
if pid <= 0:
|
if pid <= 0:
|
||||||
app = Application(args)
|
app = Application(args)
|
||||||
|
app.setWindowIcon(QIcon(':/library'))
|
||||||
QCoreApplication.setOrganizationName(ORG_NAME)
|
QCoreApplication.setOrganizationName(ORG_NAME)
|
||||||
QCoreApplication.setApplicationName(APP_UID)
|
QCoreApplication.setApplicationName(APP_UID)
|
||||||
single_instance = None if SingleApplication is None else SingleApplication('calibre GUI')
|
single_instance = None if SingleApplication is None else SingleApplication('calibre GUI')
|
||||||
|
@ -22,7 +22,28 @@ class BusinessWeek(BasicNewsRecipe):
|
|||||||
dict(id=['footer', 'navigation', 'archive', 'side_search', 'blog_sidebar', 'side_tool', 'side_index']),
|
dict(id=['footer', 'navigation', 'archive', 'side_search', 'blog_sidebar', 'side_tool', 'side_index']),
|
||||||
dict(name=['script', 'noscript'])]
|
dict(name=['script', 'noscript'])]
|
||||||
|
|
||||||
feeds = [(u'Top Stories', u'http://www.businessweek.com/topStories/rss/topStories.rss'), (u'Top News', u'http://www.businessweek.com/rss/bwdaily.rss'), (u'Asia', u'http://www.businessweek.com/rss/asia.rss'), (u'Autos', u'http://www.businessweek.com/rss/autos/index.rss'), (u'Classic Cars', u'http://www.businessweek.com/rss/autos/classic_cars/index.rss'), (u'Europe', u'http://www.businessweek.com/rss/europe.rss'), (u'Hybrids', u'http://www.businessweek.com/rss/hybrids/index.rss'), (u'Auto Reviews', u'http://www.businessweek.com/rss/autos/reviews/index.rss'), (u'Innovation & Design', u'http://www.businessweek.com/rss/innovate.rss'), (u'Architecture', u'http://www.businessweek.com/rss/architecture.rss'), (u'Brand Equity', u'http://www.businessweek.com/rss/brandequity.rss'), (u'Auto Design', u'http://www.businessweek.com/rss/carbuff.rss'), (u'Game Room', u'http://www.businessweek.com/rss/gameroom.rss'), (u'Technology', u'http://www.businessweek.com/rss/technology.rss'), (u'Investing', u'http://www.businessweek.m/rss/investor.rss'), (u'Small Business', u'http://www.businessweek.com/rss/smallbiz.rss'), (u'Careers', u'http://www.businessweek.com/rss/careers.rss'), (u'B-Schools', u'http://www.businessweek.com/rss/bschools.rss'), (u'Magazine Selections', u'http://www.businessweek.com/rss/magazine.rss'), (u'CEO Guide to Tech', u'http://www.businessweek.com/rss/ceo_guide_tech.rss')]
|
feeds = [
|
||||||
|
(u'Top Stories', u'http://www.businessweek.com/topStories/rss/topStories.rss'),
|
||||||
|
(u'Top News', u'http://www.businessweek.com/rss/bwdaily.rss'),
|
||||||
|
(u'Asia', u'http://www.businessweek.com/rss/asia.rss'),
|
||||||
|
(u'Autos', u'http://www.businessweek.com/rss/autos/index.rss'),
|
||||||
|
(u'Classic Cars', u'http://www.businessweek.com/rss/autos/classic_cars/index.rss'),
|
||||||
|
(u'Hybrids', u'http://www.businessweek.com/rss/hybrids/index.rss'),
|
||||||
|
(u'Europe', u'http://www.businessweek.com/rss/europe.rss'),
|
||||||
|
(u'Auto Reviews', u'http://www.businessweek.com/rss/autos/reviews/index.rss'),
|
||||||
|
(u'Innovation & Design', u'http://www.businessweek.com/rss/innovate.rss'),
|
||||||
|
(u'Architecture', u'http://www.businessweek.com/rss/architecture.rss'),
|
||||||
|
(u'Brand Equity', u'http://www.businessweek.com/rss/brandequity.rss'),
|
||||||
|
(u'Auto Design', u'http://www.businessweek.com/rss/carbuff.rss'),
|
||||||
|
(u'Game Room', u'http://www.businessweek.com/rss/gameroom.rss'),
|
||||||
|
(u'Technology', u'http://www.businessweek.com/rss/technology.rss'),
|
||||||
|
(u'Investing', u'http://www.businessweek.m/rss/investor.rss'),
|
||||||
|
(u'Small Business', u'http://www.businessweek.com/rss/smallbiz.rss'),
|
||||||
|
(u'Careers', u'http://www.businessweek.com/rss/careers.rss'),
|
||||||
|
(u'B-Schools', u'http://www.businessweek.com/rss/bschools.rss'),
|
||||||
|
(u'Magazine Selections', u'http://www.businessweek.com/rss/magazine.rss'),
|
||||||
|
(u'CEO Guide to Tech', u'http://www.businessweek.com/rss/ceo_guide_tech.rss'),
|
||||||
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return url.replace('http://www.businessweek.com/', 'http://www.businessweek.com/print/')
|
return url.replace('http://www.businessweek.com/', 'http://www.businessweek.com/print/')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user