diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 0910f85dac..5753a7c974 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -309,18 +309,7 @@ class Main(MainWindow, Ui_MainWindow): self.library_path = dir db = LibraryDatabase2(self.library_path) self.library_view.set_database(db) - if self.olddb is not None: - pd = QProgressDialog('', '', 0, 100, self) - pd.setWindowModality(Qt.ApplicationModal) - pd.setCancelButton(None) - pd.setWindowTitle(_('Migrating database')) - pd.show() - number_of_books = db.migrate_old(self.olddb, pd) - self.olddb.close() - if number_of_books == 0: - os.remove(self.olddb.dbpath) - self.olddb = None - prefs['library_path'] = self.library_path + prefs['library_path'] = self.library_path self.library_view.sortByColumn(*dynamic.get('sort_column', ('timestamp', Qt.DescendingOrder))) if not self.library_view.restore_column_widths(): self.library_view.resizeColumnsToContents() @@ -1392,39 +1381,14 @@ class Main(MainWindow, Ui_MainWindow): def initialize_database(self): self.library_path = prefs['library_path'] - self.olddb = None if self.library_path is None: # Need to migrate to new database layout - QMessageBox.information(self, 'Database format changed', - '''\ -
calibre's book storage format has changed. Instead of storing book files in a database, the -files are now stored in a folder on your filesystem. You will now be asked to choose the folder -in which you want to store your books files. Any existing books will be automatically migrated. - ''') - self.database_path = prefs['database_path'] - if not os.access(os.path.dirname(self.database_path), os.W_OK): - error_dialog(self, _('Database does not exist'), - _('The directory in which the database should be: %s no longer exists. Please choose a new database location.')%self.database_path).exec_() - self.database_path = choose_dir(self, 'database path dialog', - _('Choose new location for database')) - if not self.database_path: - self.database_path = os.path.expanduser('~').decode(sys.getfilesystemencoding()) - if not os.path.exists(self.database_path): - os.makedirs(self.database_path) - self.database_path = os.path.join(self.database_path, 'library1.db') - prefs['database_path'] = self.database_path - home = os.path.dirname(self.database_path) - if not os.path.exists(home): - home = os.getcwd() dir = unicode(QFileDialog.getExistingDirectory(self, - _('Choose a location for your ebook library.'), home)) + _('Choose a location for your ebook library.'), os.getcwd())) if not dir: - dir = os.path.dirname(self.database_path) + dir = os.path.expanduser('~/Library') self.library_path = os.path.abspath(dir) - try: - self.olddb = LibraryDatabase(self.database_path) - except: - traceback.print_exc() - self.olddb = None + if not os.path.exists(self.library_path): + os.makedirs(self.library_path) def read_settings(self):