diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 6d152dc14b..458b4d1e0a 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -419,6 +419,13 @@ class Scheduler(QObject): QObject.__init__(self, parent) self.internet_connection_failed = False self._parent = parent + self.no_internet_msg = _('Cannot download news as no internet connection ' + 'is active') + self.no_internet_dialog = d = error_dialog(self._parent, + self.no_internet_msg, _('No internet connection'), + show_copy_button=False) + d.setModal(False) + self.recipe_model = RecipeModel() self.db = db self.lock = QMutex(QMutex.Recursive) @@ -523,7 +530,6 @@ class Scheduler(QObject): finally: self.lock.unlock() - def download_clicked(self, urn): if urn is not None: return self.download(urn) @@ -534,18 +540,24 @@ class Scheduler(QObject): def download_all_scheduled(self): self.download_clicked(None) - def download(self, urn): - self.lock.lock() + def has_internet_connection(self): if not internet_connected(): if not self.internet_connection_failed: self.internet_connection_failed = True - d = error_dialog(self._parent, _('No internet connection'), - _('Cannot download news as no internet connection ' - 'is active')) - d.setModal(False) - d.show() + if self._parent.is_minimized_to_tray: + self._parent.status_bar.show_message(self.no_internet_msg, 5000) + elif not self.no_internet_dialog.isVisible(): + self.no_internet_dialog.show() return False self.internet_connection_failed = False + if self.no_internet_dialog.isVisible(): + self.no_internet_dialog.hide() + return True + + def download(self, urn): + self.lock.lock() + if not self.has_internet_connection(): + return False doit = urn not in self.download_queue self.lock.unlock() if doit: diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index e035777c5e..16fdb2e155 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -723,10 +723,10 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.write_settings() if self.system_tray_icon.isVisible(): if not dynamic['systray_msg'] and not isosx: - info_dialog(self, 'calibre', 'calibre '+\ + info_dialog(self, 'calibre', 'calibre '+ \ _('will keep running in the system tray. To close it, ' 'choose Quit in the context menu of the ' - 'system tray.')).exec_() + 'system tray.'), show_copy_button=False).exec_() dynamic['systray_msg'] = True self.hide_windows() e.ignore()