mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix changing mimetypes in the opf file not being detected when closing the opf file or running any automated tool like Check Book
This commit is contained in:
parent
c9318785d0
commit
441709f44b
@ -138,6 +138,9 @@ class Container(object): # {{{
|
|||||||
raise InvalidBook('Could not locate opf file: %r'%opfpath)
|
raise InvalidBook('Could not locate opf file: %r'%opfpath)
|
||||||
|
|
||||||
# Update mime map with data from the OPF
|
# Update mime map with data from the OPF
|
||||||
|
self.refresh_mime_map()
|
||||||
|
|
||||||
|
def refresh_mime_map(self):
|
||||||
for item in self.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'):
|
for item in self.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'):
|
||||||
href = item.get('href')
|
href = item.get('href')
|
||||||
name = self.href_to_name(href, self.opf_name)
|
name = self.href_to_name(href, self.opf_name)
|
||||||
|
@ -715,8 +715,12 @@ class Boss(QObject):
|
|||||||
ed = editors[name]
|
ed = editors[name]
|
||||||
with container.open(name, 'wb') as f:
|
with container.open(name, 'wb') as f:
|
||||||
f.write(ed.data)
|
f.write(ed.data)
|
||||||
if container is current_container():
|
if name == container.opf_name:
|
||||||
ed.is_synced_to_container = True
|
container.refresh_mime_map()
|
||||||
|
if container is current_container():
|
||||||
|
ed.is_synced_to_container = True
|
||||||
|
if name == container.opf_name:
|
||||||
|
self.gui.file_list.build(container)
|
||||||
|
|
||||||
def commit_all_editors_to_container(self):
|
def commit_all_editors_to_container(self):
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user