mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #770
This commit is contained in:
parent
706059d838
commit
b78d78f888
@ -290,6 +290,8 @@ class FileDialog(QObject):
|
|||||||
|
|
||||||
|
|
||||||
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:
|
if self.selected_files is None:
|
||||||
return tuple(os.path.abspath(qstring_to_unicode(i)) for i in self.fd.selectedFiles())
|
return tuple(os.path.abspath(qstring_to_unicode(i)) for i in self.fd.selectedFiles())
|
||||||
return tuple(self.selected_files)
|
return tuple(self.selected_files)
|
||||||
|
@ -125,10 +125,14 @@ class BooksModel(QAbstractTableModel):
|
|||||||
db = LibraryDatabase(os.path.expanduser(db))
|
db = LibraryDatabase(os.path.expanduser(db))
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
||||||
def refresh_ids(self, ids):
|
def refresh_ids(self, ids, current_row=-1):
|
||||||
rows = self.db.refresh_ids(ids)
|
rows = self.db.refresh_ids(ids)
|
||||||
for row in rows:
|
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):
|
def close(self):
|
||||||
self.db.close()
|
self.db.close()
|
||||||
@ -212,17 +216,9 @@ class BooksModel(QAbstractTableModel):
|
|||||||
img = self.default_image
|
img = self.default_image
|
||||||
self.buffer[index] = img
|
self.buffer[index] = img
|
||||||
|
|
||||||
def current_changed(self, current, previous, emit_signal=True):
|
def get_book_display_info(self, idx):
|
||||||
data = {}
|
data = {}
|
||||||
idx = current.row()
|
|
||||||
cdata = self.cover(idx)
|
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:
|
if cdata:
|
||||||
data['cover'] = cdata
|
data['cover'] = cdata
|
||||||
tags = self.db.tags(idx)
|
tags = self.db.tags(idx)
|
||||||
@ -246,6 +242,21 @@ class BooksModel(QAbstractTableModel):
|
|||||||
sidx = self.db.series_index(idx)
|
sidx = self.db.series_index(idx)
|
||||||
sidx = self.__class__.roman(sidx) if self.use_roman_numbers else str(sidx)
|
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)
|
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:
|
if emit_signal:
|
||||||
self.emit(SIGNAL('new_bookdisplay_data(PyQt_PyObject)'), data)
|
self.emit(SIGNAL('new_bookdisplay_data(PyQt_PyObject)'), data)
|
||||||
else:
|
else:
|
||||||
|
@ -576,7 +576,7 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
self.connect(d, SIGNAL('accepted()'), partial(self.metadata_edited, d.id), Qt.QueuedConnection)
|
self.connect(d, SIGNAL('accepted()'), partial(self.metadata_edited, d.id), Qt.QueuedConnection)
|
||||||
|
|
||||||
def metadata_edited(self, id):
|
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):
|
def edit_bulk_metadata(self, checked):
|
||||||
'''
|
'''
|
||||||
|
@ -352,7 +352,8 @@ def install_man_pages(fatal_errors):
|
|||||||
for src in entry_points['console_scripts']:
|
for src in entry_points['console_scripts']:
|
||||||
prog = src[:src.index('=')].strip()
|
prog = src[:src.index('=')].strip()
|
||||||
if prog in ('prs500', 'pdf-meta', 'epub-meta', 'lit-meta',
|
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
|
continue
|
||||||
help2man = ('help2man', prog, '--name', 'part of %s'%__appname__,
|
help2man = ('help2man', prog, '--name', 'part of %s'%__appname__,
|
||||||
'--section', '1', '--no-info', '--include',
|
'--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:
|
elif iswindows:
|
||||||
return cdll.LoadLibrary('libfontconfig-1')
|
return cdll.LoadLibrary('libfontconfig-1')
|
||||||
else:
|
else:
|
||||||
return cdll.LoadLibrary('libfontconfig.so')
|
try:
|
||||||
|
return cdll.LoadLibrary('libfontconfig.so')
|
||||||
|
except:
|
||||||
|
return cdll.LoadLibrary('libfontconfig.so.1')
|
||||||
|
|
||||||
class FcPattern(Structure):
|
class FcPattern(Structure):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user