mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer error message when user attempts to set title/author via Edit metadata dialog and one of the files is open in another program.
This commit is contained in:
parent
ff03988bb0
commit
e2cc48381d
@ -88,11 +88,22 @@ class TitleEdit(EnLineEdit):
|
|||||||
|
|
||||||
def commit(self, db, id_):
|
def commit(self, db, id_):
|
||||||
title = self.current_val
|
title = self.current_val
|
||||||
if self.COMMIT:
|
try:
|
||||||
getattr(db, 'set_'+ self.TITLE_ATTR)(id_, title, notify=False)
|
if self.COMMIT:
|
||||||
else:
|
getattr(db, 'set_'+ self.TITLE_ATTR)(id_, title, notify=False)
|
||||||
getattr(db, 'set_'+ self.TITLE_ATTR)(id_, title, notify=False,
|
else:
|
||||||
commit=False)
|
getattr(db, 'set_'+ self.TITLE_ATTR)(id_, title, notify=False,
|
||||||
|
commit=False)
|
||||||
|
except (IOError, OSError) as err:
|
||||||
|
if getattr(err, 'errno', -1) == 13: # Permission denied
|
||||||
|
import traceback
|
||||||
|
fname = err.filename if err.filename else 'file'
|
||||||
|
error_dialog(self, _('Permission denied'),
|
||||||
|
_('Could not open %s. Is it being used by another'
|
||||||
|
' program?')%fname, det_msg=traceback.format_exc(),
|
||||||
|
show=True)
|
||||||
|
return False
|
||||||
|
raise
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@dynamic_property
|
@dynamic_property
|
||||||
@ -225,8 +236,19 @@ class AuthorsEdit(MultiCompleteComboBox):
|
|||||||
|
|
||||||
def commit(self, db, id_):
|
def commit(self, db, id_):
|
||||||
authors = self.current_val
|
authors = self.current_val
|
||||||
self.books_to_refresh |= db.set_authors(id_, authors, notify=False,
|
try:
|
||||||
|
self.books_to_refresh |= db.set_authors(id_, authors, notify=False,
|
||||||
allow_case_change=True)
|
allow_case_change=True)
|
||||||
|
except (IOError, OSError) as err:
|
||||||
|
if getattr(err, 'errno', -1) == 13: # Permission denied
|
||||||
|
import traceback
|
||||||
|
fname = err.filename if err.filename else 'file'
|
||||||
|
error_dialog(self, _('Permission denied'),
|
||||||
|
_('Could not open %s. Is it being used by another'
|
||||||
|
' program?')%fname, det_msg=traceback.format_exc(),
|
||||||
|
show=True)
|
||||||
|
return False
|
||||||
|
raise
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@dynamic_property
|
@dynamic_property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user