mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Linux installer: Create a 128x128 calibre icon as apparently GNOME can't handle large icons
This commit is contained in:
parent
ca6691887e
commit
d1a773f2ee
@ -3,12 +3,14 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
''' Post installation script for linux '''
|
||||
|
||||
import sys, os, shutil, cPickle, textwrap, stat
|
||||
import sys, os, cPickle, textwrap, stat
|
||||
from subprocess import check_call
|
||||
|
||||
from calibre import __appname__, prints, guess_type
|
||||
from calibre.constants import islinux, isfreebsd
|
||||
from calibre.customize.ui import all_input_formats
|
||||
from calibre.ptempfile import TemporaryDirectory
|
||||
from calibre import CurrentDir
|
||||
|
||||
|
||||
entry_points = {
|
||||
@ -323,26 +325,26 @@ class PostInstall:
|
||||
|
||||
def setup_desktop_integration(self):
|
||||
try:
|
||||
from PyQt4.QtCore import QFile
|
||||
from tempfile import mkdtemp
|
||||
from PyQt4.Qt import QFile, QImage, Qt
|
||||
|
||||
self.info('Setting up desktop integration...')
|
||||
|
||||
|
||||
tdir = mkdtemp()
|
||||
cwd = os.getcwdu()
|
||||
try:
|
||||
os.chdir(tdir)
|
||||
render_svg(QFile(I('mimetypes/lrf.svg')), os.path.join(tdir, 'calibre-lrf.png'))
|
||||
with TemporaryDirectory() as tdir:
|
||||
with CurrentDir(tdir):
|
||||
render_svg(QFile(I('mimetypes/lrf.svg')), 'calibre-lrf.png')
|
||||
check_call('xdg-icon-resource install --noupdate --context mimetypes --size 128 calibre-lrf.png application-lrf', shell=True)
|
||||
self.icon_resources.append(('mimetypes', 'application-lrf', '128'))
|
||||
check_call('xdg-icon-resource install --noupdate --context mimetypes --size 128 calibre-lrf.png text-lrs', shell=True)
|
||||
self.icon_resources.append(('mimetypes', 'application-lrs',
|
||||
'128'))
|
||||
QFile(I('library.png')).copy(os.path.join(tdir, 'calibre-gui.png'))
|
||||
p = QImage(I('lt.png')).scaledToHeight(128,
|
||||
Qt.SmoothTransformation)
|
||||
p.save('calibre-gui.png')
|
||||
QFile(I('l.png')).copy('calibre-gui.png')
|
||||
check_call('xdg-icon-resource install --noupdate --size 128 calibre-gui.png calibre-gui', shell=True)
|
||||
self.icon_resources.append(('apps', 'calibre-gui', '128'))
|
||||
render_svg(QFile(I('viewer.svg')), os.path.join(tdir, 'calibre-viewer.png'))
|
||||
render_svg(QFile(I('viewer.svg')), 'calibre-viewer.png')
|
||||
check_call('xdg-icon-resource install --size 128 calibre-viewer.png calibre-viewer', shell=True)
|
||||
self.icon_resources.append(('apps', 'calibre-viewer', '128'))
|
||||
|
||||
@ -379,9 +381,6 @@ class PostInstall:
|
||||
f.close()
|
||||
self.mime_resources.append('calibre-mimetypes')
|
||||
check_call('xdg-mime install ./calibre-mimetypes', shell=True)
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
shutil.rmtree(tdir)
|
||||
except Exception:
|
||||
if self.opts.fatal_errors:
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user