Skip to content

Commit

Permalink
Application: Fix showing messages on update status widget for installers
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Mar 12, 2024
1 parent fe733cf commit df7f128
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 13 additions & 9 deletions spyder/plugins/application/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ def setup(self):
parent=self
)

if self.is_installer():
self.application_update_status.set_no_status()

(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
Expand Down Expand Up @@ -292,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)

Expand All @@ -307,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 +
Expand Down Expand Up @@ -337,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
Expand Down Expand Up @@ -421,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())
Expand All @@ -445,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:
Expand Down Expand Up @@ -476,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()
Expand Down
3 changes: 1 addition & 2 deletions spyder/plugins/application/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
on_plugin_available, on_plugin_teardown)
from spyder.api.widgets.menus import MENU_SEPARATOR
from spyder.config.base import (DEV, get_module_path, get_debug_level,
is_pynsist, running_in_mac_app,
running_under_pytest)
from spyder.plugins.application.confpage import ApplicationConfigPage
from spyder.plugins.application.container import (
Expand Down Expand Up @@ -150,7 +149,7 @@ def on_mainwindow_visible(self):

# Users only need to see this widget in our apps.
# Note: This can only be done at this point to take effect.
if not (is_pynsist() or running_in_mac_app()):
if not container.is_installer():
self.application_update_status.setVisible(False)

# Handle DPI scale and window changes to show a restart message.
Expand Down

0 comments on commit df7f128

Please sign in to comment.