Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Fix showing update status bar widget in our apps at startup and other fixes to the update process (Application) #21868

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions spyder/plugins/application/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,11 @@ 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:
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
5 changes: 3 additions & 2 deletions spyder/plugins/application/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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 @@ -147,9 +148,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 (is_pynsist() or running_in_mac_app()):
self.application_update_status.setVisible(False)

# Handle DPI scale and window changes to show a restart message.
Expand Down
29 changes: 13 additions & 16 deletions spyder/workers/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
dalthviz marked this conversation as resolved.
Show resolved Hide resolved
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):
Expand Down Expand Up @@ -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)
Expand Down
Loading