mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-28 17:02:59 +02:00
Fix #770
This commit is contained in:
parent
706059d838
commit
b78d78f888
15 changed files with 4879 additions and 4484 deletions
|
|
@ -289,7 +289,9 @@ def __init__(self, title='Choose Files',
|
|||
|
||||
|
||||
|
||||
def get_files(self):
|
||||
def get_files(self):
|
||||
if islinux and self.fd.result() != self.fd.Accepted:
|
||||
return tuple()
|
||||
if self.selected_files is None:
|
||||
return tuple(os.path.abspath(qstring_to_unicode(i)) for i in self.fd.selectedFiles())
|
||||
return tuple(self.selected_files)
|
||||
|
|
|
|||
|
|
@ -125,10 +125,14 @@ def set_database(self, db):
|
|||
db = LibraryDatabase(os.path.expanduser(db))
|
||||
self.db = db
|
||||
|
||||
def refresh_ids(self, ids):
|
||||
def refresh_ids(self, ids, current_row=-1):
|
||||
rows = self.db.refresh_ids(ids)
|
||||
for row in rows:
|
||||
self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'), self.index(row, 0), self.index(row, self.columnCount(None)-1))
|
||||
if row == current_row:
|
||||
self.emit(SIGNAL('new_bookdisplay_data(PyQt_PyObject)'),
|
||||
self.get_book_display_info(row))
|
||||
self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'),
|
||||
self.index(row, 0), self.index(row, self.columnCount(None)-1))
|
||||
|
||||
def close(self):
|
||||
self.db.close()
|
||||
|
|
@ -212,17 +216,9 @@ def load(self):
|
|||
img = self.default_image
|
||||
self.buffer[index] = img
|
||||
|
||||
def current_changed(self, current, previous, emit_signal=True):
|
||||
def get_book_display_info(self, idx):
|
||||
data = {}
|
||||
idx = current.row()
|
||||
cdata = self.cover(idx)
|
||||
for key in self.buffer.keys():
|
||||
if abs(key - idx) > self.buffer_size:
|
||||
self.buffer.pop(key)
|
||||
for i in range(max(0, idx-self.buffer_size), min(self.count(), idx+self.buffer_size)):
|
||||
if not self.buffer.has_key(i):
|
||||
self.load_queue.append(i)
|
||||
|
||||
if cdata:
|
||||
data['cover'] = cdata
|
||||
tags = self.db.tags(idx)
|
||||
|
|
@ -246,6 +242,21 @@ def current_changed(self, current, previous, emit_signal=True):
|
|||
sidx = self.db.series_index(idx)
|
||||
sidx = self.__class__.roman(sidx) if self.use_roman_numbers else str(sidx)
|
||||
data[_('Series')] = _('Book <font face="serif">%s</font> of %s.')%(sidx, series)
|
||||
|
||||
return data
|
||||
|
||||
def current_changed(self, current, previous, emit_signal=True):
|
||||
|
||||
idx = current.row()
|
||||
|
||||
for key in self.buffer.keys():
|
||||
if abs(key - idx) > self.buffer_size:
|
||||
self.buffer.pop(key)
|
||||
for i in range(max(0, idx-self.buffer_size), min(self.count(), idx+self.buffer_size)):
|
||||
if not self.buffer.has_key(i):
|
||||
self.load_queue.append(i)
|
||||
|
||||
data = self.get_book_display_info(idx)
|
||||
if emit_signal:
|
||||
self.emit(SIGNAL('new_bookdisplay_data(PyQt_PyObject)'), data)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ def edit_metadata(self, checked):
|
|||
self.connect(d, SIGNAL('accepted()'), partial(self.metadata_edited, d.id), Qt.QueuedConnection)
|
||||
|
||||
def metadata_edited(self, id):
|
||||
self.library_view.model().refresh_ids([id])
|
||||
self.library_view.model().refresh_ids([id], self.library_view.currentIndex().row())
|
||||
|
||||
def edit_bulk_metadata(self, checked):
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -352,7 +352,8 @@ def install_man_pages(fatal_errors):
|
|||
for src in entry_points['console_scripts']:
|
||||
prog = src[:src.index('=')].strip()
|
||||
if prog in ('prs500', 'pdf-meta', 'epub-meta', 'lit-meta',
|
||||
'markdown-calibre', 'calibre-debug', 'fb2-meta'):
|
||||
'markdown-calibre', 'calibre-debug', 'fb2-meta',
|
||||
'calibre-fontconfig'):
|
||||
continue
|
||||
help2man = ('help2man', prog, '--name', 'part of %s'%__appname__,
|
||||
'--section', '1', '--no-info', '--include',
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -44,7 +44,10 @@ def load_library():
|
|||
elif iswindows:
|
||||
return cdll.LoadLibrary('libfontconfig-1')
|
||||
else:
|
||||
return cdll.LoadLibrary('libfontconfig.so')
|
||||
try:
|
||||
return cdll.LoadLibrary('libfontconfig.so')
|
||||
except:
|
||||
return cdll.LoadLibrary('libfontconfig.so.1')
|
||||
|
||||
class FcPattern(Structure):
|
||||
_fields_ = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue