Do not display conversion error messages when minimized to tray

This commit is contained in:
Kovid Goyal 2010-11-18 15:55:27 -07:00
parent b1785e31d2
commit 573bd09555

View File

@ -437,12 +437,14 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
def job_exception(self, job): def job_exception(self, job):
if not hasattr(self, '_modeless_dialogs'): if not hasattr(self, '_modeless_dialogs'):
self._modeless_dialogs = [] self._modeless_dialogs = []
minz = self.is_minimized_to_tray
if self.isVisible(): if self.isVisible():
for x in list(self._modeless_dialogs): for x in list(self._modeless_dialogs):
if not x.isVisible(): if not x.isVisible():
self._modeless_dialogs.remove(x) self._modeless_dialogs.remove(x)
try: try:
if 'calibre.ebooks.DRMError' in job.details: if 'calibre.ebooks.DRMError' in job.details:
if not minz:
d = error_dialog(self, _('Conversion Error'), d = error_dialog(self, _('Conversion Error'),
_('<p>Could not convert: %s<p>It is a ' _('<p>Could not convert: %s<p>It is a '
'<a href="%s">DRM</a>ed book. You must first remove the ' '<a href="%s">DRM</a>ed book. You must first remove the '
@ -454,6 +456,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
self._modeless_dialogs.append(d) self._modeless_dialogs.append(d)
return return
if 'calibre.web.feeds.input.RecipeDisabled' in job.details: if 'calibre.web.feeds.input.RecipeDisabled' in job.details:
if not minz:
msg = job.details msg = job.details
msg = msg[msg.find('calibre.web.feeds.input.RecipeDisabled:'):] msg = msg[msg.find('calibre.web.feeds.input.RecipeDisabled:'):]
msg = msg.partition(':')[-1] msg = msg.partition(':')[-1]
@ -471,6 +474,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
prints(job.details, file=sys.stderr) prints(job.details, file=sys.stderr)
except: except:
pass pass
if not minz:
d = error_dialog(self, _('Conversion Error'), d = error_dialog(self, _('Conversion Error'),
_('<b>Failed</b>')+': '+unicode(job.description), _('<b>Failed</b>')+': '+unicode(job.description),
det_msg=job.details) det_msg=job.details)