Repository: spyder-ide/spyder

Issue:
Feedback about auto-update mechanism for installers
Before releasing 5.4.0, I'd like for us to address two issues with this new mechanism:

1. Spyder can't be closed quickly after startup because the thread that checks for updates takes too much time to complete and we wait for it to finish before closing. Is there a way to simply kill that thread? If that's not possible, I think we could start it with a timer that waits a minute or two after Spyder starts to check for updates. That would work similarly to the way we check for dependencies.
2. I think we should only show the status bar widget that handles updates for our Windows and Mac installers. We have multiple ways to install Spyder and I think in those cases that widget would be of little value to users.




Discussion:
@ccordoba12 I was checking this and I think the updates also have a timer already but with a lower timeout. Should I increase it? Currently for the updates the timer is set to 3000 while for the dependencies is set to 10000

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
@@ -102,19 +102,20 @@ def __init__(self, name, plugin, parent=None):
     # -------------------------------------------------------------------------
     def setup(self):
 
-        self.application_update_status = ApplicationUpdateStatus(parent=self)
-        self.application_update_status.sig_check_for_updates_requested.connect(
-            self.check_updates
-        )
-        self.application_update_status.sig_install_on_close_requested.connect(
-            self.set_installer_path)
-        self.application_update_status.set_no_status()
-
         # Compute dependencies in a thread to not block the interface.
         self.dependencies_thread = QThread(None)
 
         # Attributes
         self.dialog_manager = DialogManager()
+        self.application_update_status = None
+        if is_pynsist() or running_in_mac_app():
+            self.application_update_status = ApplicationUpdateStatus(
+                parent=self)
+            (self.application_update_status.sig_check_for_updates_requested
+             .connect(self.check_updates))
+            (self.application_update_status.sig_install_on_close_requested
+                 .connect(self.set_installer_path))
+            self.application_update_status.set_no_status()
         self.give_updates_feedback = False
         self.thread_updates = None
         self.worker_updates = None
@@ -379,7 +380,7 @@ def check_updates(self, startup=False):
         # while loading.
         # Fixes spyder-ide/spyder#15839
         self.updates_timer = QTimer(self)
-        self.updates_timer.setInterval(3000)
+        self.updates_timer.setInterval(60000)
         self.updates_timer.setSingleShot(True)
         self.updates_timer.timeout.connect(self.thread_updates.start)
         self.updates_timer.start()
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
@@ -102,17 +102,19 @@ def on_editor_available(self):
 
     @on_plugin_available(plugin=Plugins.StatusBar)
     def on_statusbar_available(self):
-        # Add status widget
-        statusbar = self.get_plugin(Plugins.StatusBar)
-        statusbar.add_status_widget(self.application_update_status)
+        # Add status widget if created
+        if self.application_update_status:
+            statusbar = self.get_plugin(Plugins.StatusBar)
+            statusbar.add_status_widget(self.application_update_status)
 
     # -------------------------- PLUGIN TEARDOWN ------------------------------
 
     @on_plugin_teardown(plugin=Plugins.StatusBar)
     def on_statusbar_teardown(self):
-        # Remove status widget
-        statusbar = self.get_plugin(Plugins.StatusBar)
-        statusbar.remove_status_widget(self.application_update_status.ID)
+        # Remove status widget if created
+        if self.application_update_status:
+            statusbar = self.get_plugin(Plugins.StatusBar)
+            statusbar.remove_status_widget(self.application_update_status.ID)
 
     @on_plugin_teardown(plugin=Plugins.Preferences)
     def on_preferences_teardown(self):
diff --git a/spyder/plugins/application/widgets/install.py b/spyder/plugins/application/widgets/install.py
--- a/spyder/plugins/application/widgets/install.py
+++ b/spyder/plugins/application/widgets/install.py
@@ -64,6 +64,8 @@ def __init__(self, parent):
         self._progress_bar.setFixedWidth(180)
         self.cancel_button = QPushButton()
         self.cancel_button.setIcon(ima.icon('DialogCloseButton'))
+        self.cancel_button.setFixedHeight(50)
+        self.cancel_button.setFixedWidth(50)
         progress_layout.addWidget(self._progress_bar, alignment=Qt.AlignLeft)
         progress_layout.addWidget(self.cancel_button)
         self._progress_widget.setLayout(progress_layout)


Test patch: