mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #2449 (Crashing on mac os X 10.5.7 when cancel metadata search)
This commit is contained in:
parent
40bae0cf4a
commit
2bad2c5162
@ -187,6 +187,8 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
|
|||||||
def terminate(self):
|
def terminate(self):
|
||||||
if hasattr(self, 'fetcher') and self.fetcher.isRunning():
|
if hasattr(self, 'fetcher') and self.fetcher.isRunning():
|
||||||
self.fetcher.terminate()
|
self.fetcher.terminate()
|
||||||
|
if hasattr(self, '_hangcheck') and self._hangcheck.isActive():
|
||||||
|
self._hangcheck.stop()
|
||||||
|
|
||||||
|
|
||||||
def __enter__(self, *args):
|
def __enter__(self, *args):
|
||||||
|
@ -419,22 +419,22 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
publisher = qstring_to_unicode(self.publisher.currentText())
|
publisher = qstring_to_unicode(self.publisher.currentText())
|
||||||
if isbn or title or author or publisher:
|
if isbn or title or author or publisher:
|
||||||
d = FetchMetadata(self, isbn, title, author, publisher, self.timeout)
|
d = FetchMetadata(self, isbn, title, author, publisher, self.timeout)
|
||||||
|
self._fetch_metadata_scope = d
|
||||||
with d:
|
with d:
|
||||||
d.exec_()
|
if d.exec_() == QDialog.Accepted:
|
||||||
if d.result() == QDialog.Accepted:
|
book = d.selected_book()
|
||||||
book = d.selected_book()
|
if book:
|
||||||
if book:
|
self.title.setText(book.title)
|
||||||
self.title.setText(book.title)
|
self.authors.setText(authors_to_string(book.authors))
|
||||||
self.authors.setText(authors_to_string(book.authors))
|
if book.author_sort: self.author_sort.setText(book.author_sort)
|
||||||
if book.author_sort: self.author_sort.setText(book.author_sort)
|
if book.publisher: self.publisher.setEditText(book.publisher)
|
||||||
if book.publisher: self.publisher.setEditText(book.publisher)
|
if book.isbn: self.isbn.setText(book.isbn)
|
||||||
if book.isbn: self.isbn.setText(book.isbn)
|
summ = book.comments
|
||||||
summ = book.comments
|
if summ:
|
||||||
if summ:
|
prefix = qstring_to_unicode(self.comments.toPlainText())
|
||||||
prefix = qstring_to_unicode(self.comments.toPlainText())
|
if prefix:
|
||||||
if prefix:
|
prefix += '\n'
|
||||||
prefix += '\n'
|
self.comments.setText(prefix + summ)
|
||||||
self.comments.setText(prefix + summ)
|
|
||||||
else:
|
else:
|
||||||
error_dialog(self, _('Cannot fetch metadata'),
|
error_dialog(self, _('Cannot fetch metadata'),
|
||||||
_('You must specify at least one of ISBN, Title, '
|
_('You must specify at least one of ISBN, Title, '
|
||||||
|
Loading…
x
Reference in New Issue
Block a user