Skip to content

Commit

Permalink
Merge pull request #4237 from rlaverde/update-startup-no-show-error
Browse files Browse the repository at this point in the history
PR: Don't show internet conection errors on startup when trying to check for new releases
  • Loading branch information
ccordoba12 authored Mar 10, 2017
2 parents 8fa3cd4 + eec7503 commit 6bb1fab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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()

0 comments on commit 6bb1fab

Please sign in to comment.