diff --git a/spyder/plugins/application/container.py b/spyder/plugins/application/container.py index 1b1039ef4dd..ae7fcaf1486 100644 --- a/spyder/plugins/application/container.py +++ b/spyder/plugins/application/container.py @@ -111,10 +111,7 @@ def setup(self): parent=self ) - # Users can only use this widget in our apps. - if not is_pynsist() and not running_in_mac_app(): - self.application_update_status.hide() - else: + if self.is_installer(): self.application_update_status.set_no_status() (self.application_update_status.sig_check_for_updates_requested @@ -297,10 +294,10 @@ def _check_updates_ready(self): box.setText(error_msg) box.set_check_visible(False) box.show() - if self.application_update_status.isVisible(): + if self.is_installer(): self.application_update_status.set_no_status() elif update_available: - if self.application_update_status.isVisible(): + if self.is_installer(): self.application_update_status.set_status_pending( latest_release) @@ -312,7 +309,7 @@ def _check_updates_ready(self): box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) box.setDefaultButton(QMessageBox.Yes) - if not is_pynsist() and not running_in_mac_app(): + if not self.is_installer(): installers_url = url_i + "#standalone-installers" msg = ( header + @@ -342,8 +339,7 @@ def _check_updates_ready(self): not box.result() # The installer dialog was skipped or ( box.result() == QMessageBox.No - and not is_pynsist() - and not running_in_mac_app() + and not self.is_installer() ) ): # Update-at-startup checkbox visible only if manual update @@ -426,10 +422,10 @@ def _check_updates_ready(self): elif feedback: box.setText(_("Spyder is up to date.")) box.show() - if self.application_update_status.isVisible(): + if self.is_installer(): self.application_update_status.set_no_status() else: - if self.application_update_status.isVisible(): + if self.is_installer(): self.application_update_status.set_no_status() self.set_conf(option, box.is_checked()) @@ -450,7 +446,7 @@ def check_updates(self, startup=False): self.check_updates_action.setDisabled(True) self.check_updates_action.setText(_("Checking for updates...")) - if self.application_update_status.isVisible(): + if self.is_installer(): self.application_update_status.set_status_checking() if self.thread_updates is not None: @@ -481,6 +477,9 @@ def set_installer_path(self, installer_path): """Set installer executable path to be run when closing.""" self.installer_path = installer_path + def is_installer(self): + return is_pynsist() or running_in_mac_app() + # ---- Dependencies # ------------------------------------------------------------------------- @Slot() diff --git a/spyder/plugins/application/plugin.py b/spyder/plugins/application/plugin.py index 7c2841d98ae..015e70770ba 100644 --- a/spyder/plugins/application/plugin.py +++ b/spyder/plugins/application/plugin.py @@ -147,9 +147,9 @@ def on_mainwindow_visible(self): container.give_updates_feedback = False container.check_updates(startup=True) - # Hide status bar widget for updates if it doesn't need to be visible. + # Users only need to see this widget in our apps. # Note: This can only be done at this point to take effect. - if not self.application_update_status.isVisible(): + if not container.is_installer(): self.application_update_status.setVisible(False) # Handle DPI scale and window changes to show a restart message. diff --git a/spyder/workers/updates.py b/spyder/workers/updates.py index 00de01db3b2..db958f1ba40 100644 --- a/spyder/workers/updates.py +++ b/spyder/workers/updates.py @@ -166,24 +166,20 @@ def start(self): error_msg = HTTP_ERROR_MSG.format(status_code=page.status_code) logger.debug(err, stack_info=True) except Exception as err: - error = traceback.format_exc() - formatted_error = error.replace('\n', '
').replace(' ', ' ') - - error_msg = _( - 'It was not possible to check for Spyder updates due to the ' - 'following error:' - '

' - '{}' - ).format(formatted_error) + # Only log the error when it's a generic one because we can't give + # users proper feedback on how to address it. Otherwise we'd show + # a long traceback that most probably would be incomprehensible to + # them. logger.debug(err, stack_info=True) - # 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 - try: - self.sig_ready.emit() - except RuntimeError: - pass + # At this point we **must** emit the signal below so that the "Check + # for updates" action in the Help menu is enabled again after the check + # has finished (it's disabled while the check is running). + self.error = error_msg + try: + self.sig_ready.emit() + except RuntimeError: + pass class WorkerDownloadInstaller(QObject): @@ -336,6 +332,7 @@ def start(self): '{}' ).format(formatted_error) logger.debug(err, stack_info=True) + self.error = error_msg try: self.sig_ready.emit(self.installer_path)