diff --git a/src/calibre/ebooks/epub/split.py b/src/calibre/ebooks/epub/split.py index da8d6487f4..135ae626b9 100644 --- a/src/calibre/ebooks/epub/split.py +++ b/src/calibre/ebooks/epub/split.py @@ -147,6 +147,13 @@ def fix_opf(opf, orig_file, files, anchor_map): ids = [] for f in files: ids.append(opf.manifest.add_item(f)) + index = None + for i, item in enumerate(opf.spine): + if item.id == orig.id: + index = i + break + + def split(pathtoopf, opts): diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index 33fea3b3ab..4460fea4a0 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -142,6 +142,9 @@ class ResourceCollection(object): def remove(self, resource): self._resources.remove(resource) + def replace(self, start, end, items): + pass + @staticmethod def from_directory_contents(top, topdown=True): collection = ResourceCollection() diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 191969023b..0811e10e18 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -1158,10 +1158,16 @@ class Main(MainWindow, Ui_MainWindow): newloc = d.database_location if not os.path.exists(os.path.join(newloc, 'metadata.db')): if os.access(self.library_path, os.R_OK): + from PyQt4.QtGui import QProgressDialog + pd = QProgressDialog('', '', 0, 100, self) + pd.setWindowModality(Qt.ApplicationModal) + pd.setCancelButton(None) + pd.setWindowTitle(_('Copying database')) + pd.show() self.status_bar.showMessage(_('Copying library to ')+newloc) self.setCursor(Qt.BusyCursor) self.library_view.setEnabled(False) - self.library_view.model().db.move_library_to(newloc) + self.library_view.model().db.move_library_to(newloc, pd) else: try: db = LibraryDatabase2(newloc) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 3e040988de..f11835845f 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -908,11 +908,21 @@ class LibraryDatabase2(LibraryDatabase): self.data.books_added([id], self.conn) self.notify('add', [id]) - def move_library_to(self, newloc): + def move_library_to(self, newloc, progress=None): + header = _(u'
Copying books to %s