mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix focus not returning to popup book details window after show notes
This commit is contained in:
parent
e1acdb6237
commit
1bbd823c32
@ -66,7 +66,7 @@ class ShowBookDetailsAction(InterfaceAction):
|
|||||||
self.dialogs[dn] = None
|
self.dialogs[dn] = None
|
||||||
try:
|
try:
|
||||||
d = BookInfo(self.gui, self.gui.library_view, index,
|
d = BookInfo(self.gui, self.gui.library_view, index,
|
||||||
self.gui.book_details.handle_click, dialog_number=dn,
|
self.gui.book_details.handle_click_from_popup, dialog_number=dn,
|
||||||
library_id=library_id, library_path=library_path, book_id=book_id)
|
library_id=library_id, library_path=library_path, book_id=book_id)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
error_dialog(self.gui, _('Book not found'), str(e)).exec()
|
error_dialog(self.gui, _('Book not found'), str(e)).exec()
|
||||||
|
@ -1314,7 +1314,8 @@ class BookDetails(DetailsLayout): # {{{
|
|||||||
url = url_for_author_search(data.where, author=data.author)
|
url = url_for_author_search(data.where, author=data.author)
|
||||||
safe_open_url(url)
|
safe_open_url(url)
|
||||||
|
|
||||||
def handle_click(self, link):
|
def handle_click_from_popup(self, link, parent=None):
|
||||||
|
parent = parent or self
|
||||||
typ, val = link.partition(':')[::2]
|
typ, val = link.partition(':')[::2]
|
||||||
from calibre.gui2.ui import get_gui
|
from calibre.gui2.ui import get_gui
|
||||||
db = get_gui().current_db.new_api
|
db = get_gui().current_db.new_api
|
||||||
@ -1370,14 +1371,17 @@ class BookDetails(DetailsLayout): # {{{
|
|||||||
if field and db.field_supports_notes(field):
|
if field and db.field_supports_notes(field):
|
||||||
item_id = data['item_id']
|
item_id = data['item_id']
|
||||||
if item_id is not None and db.notes_for(field, item_id):
|
if item_id is not None and db.notes_for(field, item_id):
|
||||||
return self.show_notes(field, item_id)
|
return self.show_notes(field, item_id, parent)
|
||||||
else:
|
else:
|
||||||
browse(link)
|
browse(link)
|
||||||
|
|
||||||
def show_notes(self, field, item_id):
|
def handle_click(self, link):
|
||||||
|
self.handle_click_from_popup(link)
|
||||||
|
|
||||||
|
def show_notes(self, field, item_id, parent=None):
|
||||||
from calibre.gui2.dialogs.show_category_note import ShowNoteDialog
|
from calibre.gui2.dialogs.show_category_note import ShowNoteDialog
|
||||||
from calibre.gui2.ui import get_gui
|
from calibre.gui2.ui import get_gui
|
||||||
ShowNoteDialog(field, item_id, get_gui().current_db.new_api, parent=self).show()
|
ShowNoteDialog(field, item_id, get_gui().current_db.new_api, parent=parent or self).show()
|
||||||
|
|
||||||
def mouseDoubleClickEvent(self, ev):
|
def mouseDoubleClickEvent(self, ev):
|
||||||
ev.accept()
|
ev.accept()
|
||||||
|
@ -303,7 +303,7 @@ class BookInfo(QDialog):
|
|||||||
|
|
||||||
def on_link_clicked(self, qurl):
|
def on_link_clicked(self, qurl):
|
||||||
link = str(qurl.toString(NO_URL_FORMATTING))
|
link = str(qurl.toString(NO_URL_FORMATTING))
|
||||||
self.link_delegate(link)
|
self.link_delegate(link, self)
|
||||||
|
|
||||||
def done(self, r):
|
def done(self, r):
|
||||||
self.save_geometry(gprefs, self.geometry_string('book_info_dialog_geometry'))
|
self.save_geometry(gprefs, self.geometry_string('book_info_dialog_geometry'))
|
||||||
|
@ -129,6 +129,7 @@ class ShowNoteDialog(Dialog):
|
|||||||
if gui is not None:
|
if gui is not None:
|
||||||
gui.do_field_item_value_changed()
|
gui.do_field_item_value_changed()
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
self.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
|
|
||||||
def find_books(self):
|
def find_books(self):
|
||||||
q = self.item_val.replace('"', r'\"')
|
q = self.item_val.replace('"', r'\"')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user