mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Fix fonts on OSX 10.5 and regression affecting adding formats
This commit is contained in:
parent
ce3391ff9a
commit
a70ac94b6a
@ -2,7 +2,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
__appname__ = 'calibre'
|
||||
__version__ = '0.4.84b6'
|
||||
__version__ = '0.4.84b7'
|
||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
'''
|
||||
Various run time constants.
|
||||
|
@ -100,7 +100,7 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
|
||||
old_extensions, new_extensions, paths = set(), set(), {}
|
||||
for row in range(self.formats.count()):
|
||||
fmt = self.formats.item(row)
|
||||
ext, path = fmt.ext, fmt.path
|
||||
ext, path = fmt.ext.lower(), fmt.path
|
||||
if 'unknown' in ext.lower():
|
||||
ext = None
|
||||
if path:
|
||||
@ -109,8 +109,8 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
|
||||
else:
|
||||
old_extensions.add(ext)
|
||||
for ext in new_extensions:
|
||||
self.db.add_format(self.row, ext, open(paths[ext], "rb"))
|
||||
db_extensions = set(self.db.formats(self.row).split(','))
|
||||
self.db.add_format(self.row, ext, open(paths[ext], 'rb'))
|
||||
db_extensions = set([f.lower() for f in self.db.formats(self.row).split(',')])
|
||||
extensions = new_extensions.union(old_extensions)
|
||||
for ext in db_extensions:
|
||||
if ext not in extensions:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import with_statement
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
@ -360,7 +360,9 @@ class LibraryDatabase2(LibraryDatabase):
|
||||
self.conn.execute('DELETE FROM data WHERE book=? AND format=?', (id, format))
|
||||
name = self.construct_file_name(id)
|
||||
ext = ('.' + format.lower()) if format else ''
|
||||
shutil.copyfileobj(stream, open(os.path.join(path, name+ext), 'wb'))
|
||||
dest = os.path.join(path, name+ext)
|
||||
with open(dest, 'wb') as f:
|
||||
shutil.copyfileobj(stream, f)
|
||||
stream.seek(0, 2)
|
||||
size=stream.tell()
|
||||
self.conn.execute('INSERT INTO data (book,format,uncompressed_size,name) VALUES (?,?,?,?)',
|
||||
|
@ -151,7 +151,7 @@ class FontScanner(Thread):
|
||||
def run(self):
|
||||
# Initialize the fontconfig library. This has to be done manually
|
||||
# for the OS X bundle as it may have its own private fontconfig.
|
||||
if getattr(sys, 'frameworks_dir', False) and not os.path.exists('/usr/X11/lib/libfontconfig.1.dylib'):
|
||||
if getattr(sys, 'frameworks_dir', False):# and not os.path.exists('/usr/X11/lib/libfontconfig.1.dylib'):
|
||||
config_dir = os.path.join(os.path.dirname(getattr(sys, 'frameworks_dir')), 'Resources', 'fonts')
|
||||
if isinstance(config_dir, unicode):
|
||||
config_dir = config_dir.encode(sys.getfilesystemencoding())
|
||||
|
Loading…
x
Reference in New Issue
Block a user