From ac45db67c9b0348aeec7a0edd44b86c14a36a01a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Nov 2016 12:22:21 +0530 Subject: [PATCH] Fix creating an empty library with the same structure as current library not creating custom columns on the first restart after creating the new custom columns. Fixes #1641278 [Custom columns don't copy on create new library](https://bugs.launchpad.net/calibre/+bug/1641278) --- src/calibre/gui2/ui.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index dcc9d9ce0f..e3abdf441f 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -641,6 +641,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ default_prefs = olddb.prefs except: olddb = None + if copy_structure and olddb is not None and default_prefs is not None: + default_prefs['field_metadata'] = olddb.new_api.field_metadata.all_metadata() try: db = LibraryDatabase(newloc, default_prefs=default_prefs) except apsw.Error: