Do not show an error if the user tries to quit calibre while editing a cell in the book list. Instead, just silently abort the edit. See #1610539 (Data error when closing calibre)

This commit is contained in:
Kovid Goyal 2016-08-07 06:46:14 +05:30
parent c4d05d8a36
commit 324a5a2635

View File

@ -1048,6 +1048,9 @@ class BooksModel(QAbstractTableModel): # {{{
return True return True
def setData(self, index, value, role): def setData(self, index, value, role):
from calibre.gui2.ui import get_gui
if get_gui().shutting_down:
return False
if role == Qt.EditRole: if role == Qt.EditRole:
from calibre.gui2.ui import get_gui from calibre.gui2.ui import get_gui
try: try:
@ -1633,6 +1636,9 @@ class DeviceBooksModel(BooksModel): # {{{
return (section+1) return (section+1)
def setData(self, index, value, role): def setData(self, index, value, role):
from calibre.gui2.ui import get_gui
if get_gui().shutting_down:
return False
done = False done = False
if role == Qt.EditRole: if role == Qt.EditRole:
row, col = index.row(), index.column() row, col = index.row(), index.column()