mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for bug in Qt causing a crash on unhandled exception in current_changed
This commit is contained in:
parent
7e645a0e30
commit
e467468783
@ -578,11 +578,17 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
def current_changed(self, current, previous, emit_signal=True):
|
def current_changed(self, current, previous, emit_signal=True):
|
||||||
if current.isValid():
|
if current.isValid():
|
||||||
idx = current.row()
|
idx = current.row()
|
||||||
data = self.get_book_display_info(idx)
|
try:
|
||||||
if emit_signal:
|
data = self.get_book_display_info(idx)
|
||||||
self.new_bookdisplay_data.emit(data)
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
error_dialog(None, _('Unhandled error'), _(
|
||||||
|
'Failed to read book data from calibre library. Click "Show details" for more information'), det_msg=traceback.format_exc(), show=True)
|
||||||
else:
|
else:
|
||||||
return data
|
if emit_signal:
|
||||||
|
self.new_bookdisplay_data.emit(data)
|
||||||
|
else:
|
||||||
|
return data
|
||||||
|
|
||||||
def get_book_info(self, index):
|
def get_book_info(self, index):
|
||||||
if isinstance(index, numbers.Integral):
|
if isinstance(index, numbers.Integral):
|
||||||
@ -1601,11 +1607,17 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
def current_changed(self, current, previous, emit_signal=True):
|
def current_changed(self, current, previous, emit_signal=True):
|
||||||
if current.isValid():
|
if current.isValid():
|
||||||
idx = current.row()
|
idx = current.row()
|
||||||
data = self.get_book_display_info(idx)
|
try:
|
||||||
if emit_signal:
|
data = self.get_book_display_info(idx)
|
||||||
self.new_bookdisplay_data.emit(data)
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
error_dialog(None, _('Unhandled error'), _(
|
||||||
|
'Failed to read book data from calibre library. Click "Show details" for more information'), det_msg=traceback.format_exc(), show=True)
|
||||||
else:
|
else:
|
||||||
return data
|
if emit_signal:
|
||||||
|
self.new_bookdisplay_data.emit(data)
|
||||||
|
else:
|
||||||
|
return data
|
||||||
|
|
||||||
def paths(self, rows):
|
def paths(self, rows):
|
||||||
return [self.db[self.map[r.row()]].path for r in rows]
|
return [self.db[self.map[r.row()]].path for r in rows]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user