mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #751
This commit is contained in:
parent
77e877e564
commit
706059d838
@ -127,7 +127,6 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
|
||||
self.formats_changed = False
|
||||
self.cover_changed = False
|
||||
self.cpixmap = None
|
||||
self.changed = False
|
||||
self.cover.setAcceptDrops(True)
|
||||
self.connect(self.cover, SIGNAL('cover_changed()'), self.cover_dropped)
|
||||
QObject.connect(self.cover_button, SIGNAL("clicked(bool)"), \
|
||||
@ -331,6 +330,4 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
|
||||
self.db.set_comment(self.id, qstring_to_unicode(self.comments.toPlainText()))
|
||||
if self.cover_changed:
|
||||
self.db.set_cover(self.id, pixmap_to_data(self.cover.pixmap()))
|
||||
self.changed = True
|
||||
QDialog.accept(self)
|
||||
|
||||
|
@ -125,6 +125,11 @@ class BooksModel(QAbstractTableModel):
|
||||
db = LibraryDatabase(os.path.expanduser(db))
|
||||
self.db = db
|
||||
|
||||
def refresh_ids(self, ids):
|
||||
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))
|
||||
|
||||
def close(self):
|
||||
self.db.close()
|
||||
self.db = None
|
||||
|
@ -2,13 +2,14 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import os, sys, textwrap, collections, traceback, shutil, time
|
||||
from xml.parsers.expat import ExpatError
|
||||
from functools import partial
|
||||
from PyQt4.QtCore import Qt, SIGNAL, QObject, QCoreApplication, \
|
||||
QVariant, QThread, QString, QSize, QUrl
|
||||
from PyQt4.QtGui import QPixmap, QColor, QPainter, QMenu, QIcon, QMessageBox, \
|
||||
QToolButton, QDialog, QSizePolicy, QDesktopServices
|
||||
QToolButton, QDialog, QDesktopServices
|
||||
from PyQt4.QtSvg import QSvgRenderer
|
||||
|
||||
from calibre import __version__, __appname__, islinux, sanitize_file_name, launch, \
|
||||
from calibre import __version__, __appname__, islinux, sanitize_file_name, \
|
||||
Settings, pictureflowerror, iswindows, isosx
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
from calibre.ebooks.metadata.meta import get_metadata, get_filename_pat, set_filename_pat
|
||||
@ -75,6 +76,7 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
self.delete_memory = {}
|
||||
self.conversion_jobs = {}
|
||||
self.persistent_files = []
|
||||
self.metadata_dialogs = []
|
||||
self.viewer_job_id = 1
|
||||
self.default_thumbnail = None
|
||||
self.device_error_dialog = ConversionErrorDialog(self, _('Error communicating with device'), ' ')
|
||||
@ -568,16 +570,14 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
d = error_dialog(self, _('Cannot edit metadata'), _('No books selected'))
|
||||
d.exec_()
|
||||
return
|
||||
changed = False
|
||||
for row in rows:
|
||||
if MetadataSingleDialog(self, row.row(),
|
||||
self.library_view.model().db).changed:
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
self.library_view.model().resort(reset=False)
|
||||
self.library_view.model().research()
|
||||
d = MetadataSingleDialog(self, row.row(),
|
||||
self.library_view.model().db)
|
||||
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])
|
||||
|
||||
def edit_bulk_metadata(self, checked):
|
||||
'''
|
||||
Edit metadata of selected books in library in bulk.
|
||||
|
@ -869,7 +869,14 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
self.cache = self.conn.execute('SELECT * from meta ORDER BY '+sort).fetchall()
|
||||
self.data = self.cache
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
def refresh_ids(self, ids):
|
||||
indices = map(self.index, ids)
|
||||
for id, idx in zip(ids, indices):
|
||||
row = self.conn.execute('SELECT * from meta WHERE id=?', (id,)).fetchone()
|
||||
self.data[idx] = row
|
||||
return indices
|
||||
|
||||
def filter(self, filters, refilter=False, OR=False):
|
||||
'''
|
||||
Filter data based on filters. All the filters must match for an item to
|
||||
|
@ -220,7 +220,7 @@ def build_linux():
|
||||
vmware = ('vmware', '-q', '-x', '-n', vm)
|
||||
subprocess.Popen(vmware)
|
||||
print 'Waiting for linux to boot up...'
|
||||
time.sleep(60)
|
||||
time.sleep(75)
|
||||
check_call('ssh linux make -C /mnt/hgfs/giskard/work/calibre all egg linux_binary')
|
||||
check_call('ssh linux sudo poweroff')
|
||||
|
||||
@ -301,7 +301,7 @@ def main():
|
||||
upload_docs()
|
||||
upload_user_manual()
|
||||
check_call('rm -f dist/*.bz2 dist/*.exe dist/*.dmg')
|
||||
check_call('python setup.py register upload')
|
||||
check_call('python setup.py register bdist_egg --exclude-source-files upload')
|
||||
check_call('''rm -rf dist/* build/*''')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user