diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py index ce451ff75b..26e2058a96 100644 --- a/src/calibre/gui2/dialogs/metadata_single.py +++ b/src/calibre/gui2/dialogs/metadata_single.py @@ -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) - diff --git a/src/calibre/gui2/library.py b/src/calibre/gui2/library.py index dd70a99533..f8a0c51244 100644 --- a/src/calibre/gui2/library.py +++ b/src/calibre/gui2/library.py @@ -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 diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index a760a7d4a3..6176bf074c 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -2,13 +2,14 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' 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. diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py index 31994df5fc..ec5040176e 100644 --- a/src/calibre/library/database.py +++ b/src/calibre/library/database.py @@ -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 diff --git a/upload.py b/upload.py index 16d50a9ec2..f4d2bccf02 100644 --- a/upload.py +++ b/upload.py @@ -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__':