diff --git a/resources.py b/resources.py index 4eb1c15e6a..4b0bd846df 100644 --- a/resources.py +++ b/resources.py @@ -13,7 +13,7 @@ RESOURCES = dict( opf_template = '%p/ebooks/metadata/opf.xml', ncx_template = '%p/ebooks/metadata/ncx.xml', fb2_xsl = '%p/ebooks/lrf/fb2/fb2.xsl', - metadata_sqlite = '%p/library/metadata_sqlite.sql', + metadata_sqlite = '%p/library/metadata_sqlite.sql', ) def main(args=sys.argv): @@ -41,4 +41,4 @@ def main(args=sys.argv): return 0 if __name__ == '__main__': - sys.exit(main()) \ No newline at end of file + sys.exit(main()) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 40b563f414..a8e9dca223 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -225,7 +225,7 @@ class Main(MainWindow, Ui_MainWindow): pd.show() db.migrate_old(self.olddb, pd) self.olddb = None - Settings().set('library path', self.library_path) + prefs['library_path'] = self.library_path self.library_view.sortByColumn(3, Qt.DescendingOrder) if not self.library_view.restore_column_widths(): self.library_view.resizeColumnsToContents() @@ -1106,7 +1106,7 @@ class Main(MainWindow, Ui_MainWindow): _('

An invalid database already exists at %s, delete it before trying to move the existing database.
Error: %s')%(newloc, str(err))) d.exec_() self.library_path = self.library_view.model().db.library_path - prefs['library path'] = self.library_path + prefs['library_path'] = self.library_path except Exception, err: traceback.print_exc() d = error_dialog(self, _('Could not move database'), unicode(err)) @@ -1204,31 +1204,33 @@ class Main(MainWindow, Ui_MainWindow): def initialize_database(self): - self.library_path = prefs['library path'] + self.library_path = prefs['library_path'] self.olddb = None if self.library_path is None: # Need to migrate to new database layout 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') + 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') - settings.set('database path', self.database_path) + prefs['database_path'] = self.database_path home = os.path.dirname(self.database_path) if not os.path.exists(home): home = os.getcwd() from PyQt4.QtGui import QFileDialog - dir = qstring_to_unicode(QFileDialog.getExistingDirectory(self, _('Choose a location for your ebook library.'), home)) + dir = unicode(QFileDialog.getExistingDirectory(self, + _('Choose a location for your ebook library.'), home)) if not dir: dir = os.path.dirname(self.database_path) self.library_path = os.path.abspath(dir) self.olddb = LibraryDatabase(self.database_path) - def read_settings(self): self.initialize_database() geometry = config['main_window_geometry'] diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 997bfa230f..baf85186c1 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -451,6 +451,8 @@ def _prefs(): help=_('Access key for isbndb.com')) c.add_opt('network_timeout', default=5, help=_('Default timeout for network operations (seconds)')) + c.add_opt('library_path', default=None, + help=_('Path to directory in which your library of books is stored')) c.add_opt('migrated', default=False, help='For Internal use. Don\'t modify.') return c