diff --git a/spyder/plugins/updatemanager/widgets/update.py b/spyder/plugins/updatemanager/widgets/update.py index 88c72896d8f..8fe722c6ccb 100644 --- a/spyder/plugins/updatemanager/widgets/update.py +++ b/spyder/plugins/updatemanager/widgets/update.py @@ -228,6 +228,7 @@ def _process_check_update(self): # Get results from worker update_available = self.update_worker.update_available error_msg = self.update_worker.error + checkbox = self.update_worker.checkbox # Always set status, regardless of error, DEV, or startup self.set_status(PENDING if update_available else NO_STATUS) @@ -243,7 +244,7 @@ def _process_check_update(self): # Do not alert the user to anything pass elif error_msg is not None: - error_messagebox(self, error_msg) + error_messagebox(self, error_msg, checkbox) elif update_available: self.start_update() else: @@ -532,10 +533,11 @@ def update_progress(self, progress, total): self._progress_bar.setValue(progress) -def error_messagebox(parent, error_msg): - box = UpdateMessageBox( - icon=QMessageBox.Warning, text=error_msg, parent=parent - ) +def error_messagebox(parent, error_msg, checkbox=False): + # Use a message box with a checkbox to disable updates when required, or a + # standard one otherwise. + box_class = UpdateMessageCheckBox if checkbox else UpdateMessageBox + box = box_class(icon=QMessageBox.Warning, text=error_msg, parent=parent) box.setWindowTitle(_("Spyder update error")) box.setStandardButtons(QMessageBox.Ok) box.setDefaultButton(QMessageBox.Ok) diff --git a/spyder/plugins/updatemanager/workers.py b/spyder/plugins/updatemanager/workers.py index 5e372786438..8d008c2d6a1 100644 --- a/spyder/plugins/updatemanager/workers.py +++ b/spyder/plugins/updatemanager/workers.py @@ -51,6 +51,12 @@ '

Please contact your network administrator for assistance.' ) +OS_ERROR_MSG = _( + "An error occurred while checking for Spyder updates, possibly related to " + "your operating system configuration or file access.

If you're not " + "sure what to do about it, you can disable checking for updates below. " + "

The error was:

{error}" +) def _rate_limits(page): """Log rate limits for GitHub.com""" @@ -190,6 +196,7 @@ def __init__(self, stable_only): self.latest_release = None self.update_available = False self.error = None + self.checkbox = False self.channel = None def _check_update_available( @@ -294,6 +301,10 @@ def start(self): except HTTPError as err: error_msg = HTTP_ERROR_MSG.format(status_code=page.status_code) logger.warning(err, exc_info=err) + except OSError as err: + error_msg = OS_ERROR_MSG.format(error=err) + self.checkbox = True + logger.warning(err, exc_info=err) except Exception as err: # Send untracked errors to our error reporter error_data = dict(