Repository: spyder-ide/spyder

Issue:
Missing `Checking for updates` message in the status for the Windows and MacOS installers
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

## Problem Description

No status bar message regarding the check for updates being done is visible when running Spyder from the installers (Windows and macOS):


### What steps reproduce the problem?

1. Install Spyder from the Windows or macOS installers: 
    * Windows: https://github.com/spyder-ide/spyder/actions/runs/8178116646
    * macOS: https://github.com/spyder-ide/spyder/actions/runs/8178118093
2. Be sure thar the `Check for updates on startup` option is checked
3. Launch Spyder and see that the `Checking for updates` message is missing in the status bar (the status widget for the updates gets visible only after you accept to install an update)

![update](https://github.com/spyder-ide/spyder/assets/16781833/aaee270c-4ab6-4b51-b273-b7e49cbc3980)

![image](https://github.com/spyder-ide/spyder/assets/16781833/38fe376e-9310-4f8a-aca4-a2b0373bea5d)


### What is the expected output? What do you see instead?

See the `Checking for updates` message in the status bar 

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 5.5.2rc1  (standalone)
* Python version: 3.8.10 64-bit
* Qt version: 5.15.2
* PyQt5 version: 5.15.10
* Operating System: Windows-10-10.0.19045-SP0




Discussion:

Resolving patch:
diff --git a/spyder/plugins/application/container.py b/spyder/plugins/application/container.py
--- 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
--- 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
--- 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', '<br>').replace(' ', '&nbsp;')
-
-            error_msg = _(
-                'It was not possible to check for Spyder updates due to the '
-                'following error:'
-                '<br><br>'
-                '<tt>{}</tt>'
-            ).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):
                 '<tt>{}</tt>'
             ).format(formatted_error)
             logger.debug(err, stack_info=True)
+
         self.error = error_msg
         try:
             self.sig_ready.emit(self.installer_path)


Test patch: