Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Don't show internet conection errors on startup when trying to check for new releases #4237

Merged
merged 2 commits into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ def post_visible_setup(self):
# Check for spyder updates
if DEV is None and CONF.get('main', 'check_updates_on_startup'):
self.give_updates_feedback = False
self.check_updates()
self.check_updates(startup=True)

# Show dialog with missing dependencies
self.report_missing_dependencies()
Expand Down Expand Up @@ -2816,7 +2816,7 @@ def _check_updates_ready(self):
self.give_updates_feedback = True

@Slot()
def check_updates(self):
def check_updates(self, startup=False):
"""
Check for spyder updates on github releases using a QThread.
"""
Expand All @@ -2829,7 +2829,7 @@ def check_updates(self):
self.thread_updates.terminate()

self.thread_updates = QThread(self)
self.worker_updates = WorkerUpdates(self)
self.worker_updates = WorkerUpdates(self, startup=startup)
self.worker_updates.sig_ready.connect(self._check_updates_ready)
self.worker_updates.sig_ready.connect(self.thread_updates.quit)
self.worker_updates.moveToThread(self.thread_updates)
Expand Down
9 changes: 6 additions & 3 deletions spyder/workers/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ class WorkerUpdates(QObject):
"""
sig_ready = Signal()

def __init__(self, parent):
def __init__(self, parent, startup):
QObject.__init__(self)
self._parent = parent
self.error = None
self.latest_release = None
self.startup = startup

def check_update_available(self, version, releases):
"""Checks if there is an update available.
Expand Down Expand Up @@ -95,5 +96,7 @@ def start(self):
except Exception:
error_msg = _('Unable to check for updates.')

self.error = error_msg
self.sig_ready.emit()
# Don't show dialog when starting up spyder and an error occur
if not (self.startup and error_msg is not None):
self.error = error_msg
self.sig_ready.emit()