mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1998936 [Slight oddity in window focus](https://bugs.launchpad.net/calibre/+bug/1998936)
This commit is contained in:
parent
141834858a
commit
0d3dc639ad
@ -9,6 +9,7 @@ import copy
|
||||
import os
|
||||
import shutil
|
||||
from functools import partial
|
||||
from contextlib import contextmanager
|
||||
from io import BytesIO
|
||||
from qt.core import (
|
||||
QAction, QApplication, QDialog, QIcon, QMenu, QMimeData, QModelIndex, QTimer,
|
||||
@ -486,12 +487,22 @@ class EditMetadataAction(InterfaceAction):
|
||||
def do_edit_metadata(self, row_list, current_row, editing_multiple):
|
||||
from calibre.gui2.metadata.single import edit_metadata
|
||||
db = self.gui.library_view.model().db
|
||||
parent = getattr(self, 'override_parent', None) or self.gui
|
||||
changed, rows_to_refresh = edit_metadata(db, row_list, current_row,
|
||||
parent=self.gui, view_slot=self.view_format_callback,
|
||||
parent=parent, view_slot=self.view_format_callback,
|
||||
edit_slot=self.edit_format_callback,
|
||||
set_current_callback=self.set_current_callback, editing_multiple=editing_multiple)
|
||||
return changed, rows_to_refresh
|
||||
|
||||
@contextmanager
|
||||
def different_parent(self, parent):
|
||||
orig = getattr(self, 'override_parent', None)
|
||||
self.override_parent = parent
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
self.override_parent = orig
|
||||
|
||||
def set_current_callback(self, id_):
|
||||
db = self.gui.library_view.model().db
|
||||
current_row = db.row(id_)
|
||||
|
@ -231,7 +231,9 @@ class BookInfo(QDialog):
|
||||
def edit_metadata(self):
|
||||
if self.current_row is not None:
|
||||
book_id = self.view.model().id(self.current_row)
|
||||
get_gui().iactions['Edit Metadata'].edit_metadata_for([self.current_row], [book_id], bulk=False)
|
||||
em = get_gui().iactions['Edit Metadata']
|
||||
with em.different_parent(self):
|
||||
em.edit_metadata_for([self.current_row], [book_id], bulk=False)
|
||||
|
||||
def configure(self):
|
||||
d = Configure(get_gui().current_db, self)
|
||||
|
Loading…
x
Reference in New Issue
Block a user