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 1 commit
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
Next Next commit
Don't show internet conection errors on startup when trying to check …
…for new releases.
  • Loading branch information
rlaverde committed Mar 8, 2017
commit a71023a0f4ba2cc45581f2a4663842cb3f7089fe
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 or error_msg is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be ... or error_msg is not None?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm no, the idea is not to show the dialog when there is an error:

Maybe it will be easy to understand:
if not (self.startup and error_message is not None):

Or
if self.startup and error_message is not None: return

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm no, the idea is not to show the dialog when there is an error

I don't agree. The idea (for me) is to not show the dialog if there are errors but only at startup (because it's very annoying). However, if you want to manually check for updates, Spyder should an error message in case it can't do it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the idea, the expression will evaluate True when startup is False (regardless if error_message is None or not)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but if error_msg is different from None, we also want to show the dialog. And that's not the case here because we enter this block if error_msg is None (which is a contradiction for me and what motivated me to write my first comment).

self.error = error_msg
self.sig_ready.emit()