mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix custom columns copied to a library via the Copy to library action not showing up until a calibre restart if the destination library was accessed via the Content Server recently
This commit is contained in:
parent
50b9eb613f
commit
56d32f6f9c
@ -31,7 +31,8 @@ from calibre.utils.icu import sort_key, numeric_sort_key
|
|||||||
|
|
||||||
def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {{{
|
def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {{{
|
||||||
source_metadata = db.field_metadata.custom_field_metadata(include_composites=True)
|
source_metadata = db.field_metadata.custom_field_metadata(include_composites=True)
|
||||||
ndbname = os.path.basename(newdb.library_path)
|
dest_library_path = newdb.library_path
|
||||||
|
ndbname = os.path.basename(dest_library_path)
|
||||||
|
|
||||||
d = QDialog(gui)
|
d = QDialog(gui)
|
||||||
d.setWindowTitle(_('Different custom columns'))
|
d.setWindowTitle(_('Different custom columns'))
|
||||||
@ -83,6 +84,7 @@ def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {
|
|||||||
d.bb.rejected.connect(d.reject)
|
d.bb.rejected.connect(d.reject)
|
||||||
d.resize(d.sizeHint())
|
d.resize(d.sizeHint())
|
||||||
if d.exec_() == d.Accepted:
|
if d.exec_() == d.Accepted:
|
||||||
|
changes_made = False
|
||||||
for k, cb in missing_widgets:
|
for k, cb in missing_widgets:
|
||||||
if cb.isChecked():
|
if cb.isChecked():
|
||||||
col_meta = source_metadata[k]
|
col_meta = source_metadata[k]
|
||||||
@ -90,6 +92,13 @@ def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {
|
|||||||
col_meta['label'], col_meta['name'], col_meta['datatype'],
|
col_meta['label'], col_meta['name'], col_meta['datatype'],
|
||||||
len(col_meta['is_multiple']) > 0,
|
len(col_meta['is_multiple']) > 0,
|
||||||
col_meta['is_editable'], col_meta['display'])
|
col_meta['is_editable'], col_meta['display'])
|
||||||
|
changes_made = True
|
||||||
|
if changes_made:
|
||||||
|
# Unload the db so that the changes are available
|
||||||
|
# when it is next accessed
|
||||||
|
from calibre.gui2.ui import get_gui
|
||||||
|
library_broker = get_gui().library_broker
|
||||||
|
library_broker.unload_library(dest_library_path)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -253,6 +253,19 @@ class GuiLibraryBroker(LibraryBroker):
|
|||||||
with self:
|
with self:
|
||||||
self._prune_loaded_dbs()
|
self._prune_loaded_dbs()
|
||||||
|
|
||||||
|
def unload_library(self, library_path):
|
||||||
|
with self:
|
||||||
|
path = canonicalize_path(library_path)
|
||||||
|
for library_id, q in self.lmap.iteritems():
|
||||||
|
if samefile(path, q):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
db = self.loaded_dbs.pop(library_id, None)
|
||||||
|
if db is not None:
|
||||||
|
db.close()
|
||||||
|
db.break_cycles()
|
||||||
|
|
||||||
def remove_library(self, path):
|
def remove_library(self, path):
|
||||||
with self:
|
with self:
|
||||||
path = canonicalize_path(path)
|
path = canonicalize_path(path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user