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: Improve update UX and automatically download latest installers #18619

Merged
merged 50 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d14e822
Changes on check updates
jsbautista Jul 11, 2022
67767c5
WIP check updates
jsbautista Jul 14, 2022
d8f9f81
WIP check updates
jsbautista Jul 15, 2022
2121418
WIP check updates
jsbautista Jul 18, 2022
5384e70
WIP check updates
jsbautista Jul 18, 2022
5d874d7
WIP check updates
jsbautista Jul 26, 2022
5d87045
WIP check updates
jsbautista Jul 28, 2022
929d924
WIP check updates
jsbautista Jul 28, 2022
437297a
WIP check updates
jsbautista Aug 2, 2022
d381e28
WIP check updates
jsbautista Aug 2, 2022
4e76de8
Apply suggestions from code review
jsbautista Aug 5, 2022
85153d7
WIP check updates
jsbautista Aug 5, 2022
fb083bd
WIP check updates
jsbautista Aug 9, 2022
bb54437
Apply suggestions from code review
jsbautista Aug 10, 2022
150954d
WIP check updates
jsbautista Aug 12, 2022
0334291
WIP check updates
jsbautista Aug 16, 2022
efbf368
WIP check updates
jsbautista Aug 16, 2022
662dd62
WIP check updates
jsbautista Aug 16, 2022
ed20f59
WIP check updates
jsbautista Aug 17, 2022
d92f7c3
Apply suggestions from code review
jsbautista Aug 17, 2022
4349394
Apply suggestions from code review
jsbautista Aug 17, 2022
6fd2b27
WIP check updates
jsbautista Aug 17, 2022
201ee4b
Apply suggestions from code review
jsbautista Aug 18, 2022
d99b244
WIP check updates
jsbautista Aug 18, 2022
0cb460e
Apply suggestions from code review
jsbautista Aug 19, 2022
22d31b6
WIP check updates
jsbautista Aug 22, 2022
c79e778
Apply suggestions from code review
jsbautista Aug 23, 2022
13b5b37
Commit suggestion
jsbautista Aug 23, 2022
78b5f44
commit to try to handle the macOS case
jsbautista Aug 23, 2022
ca65c59
commit to try to handle the macOS case
jsbautista Aug 24, 2022
cad4794
Apply suggestions from code review
jsbautista Aug 26, 2022
ab1bdd7
Apply suggestions from code review
jsbautista Aug 26, 2022
264a854
check updates
jsbautista Aug 29, 2022
0053341
Update spyder/plugins/application/widgets/install.py
jsbautista Aug 30, 2022
3220a31
Apply suggestions from code review
jsbautista Aug 31, 2022
595c8ec
Update spyder/plugins/application/widgets/install.py
jsbautista Sep 1, 2022
218c20f
check updates
jsbautista Sep 1, 2022
5e1870c
Update spyder/plugins/application/container.py
jsbautista Sep 1, 2022
c63b2a8
Update spyder/plugins/application/widgets/install.py
jsbautista Sep 1, 2022
6a8bb76
check updates
jsbautista Sep 2, 2022
84addc3
delete old updates
jsbautista Sep 5, 2022
29c3b98
Apply suggestions from code review
jsbautista Sep 6, 2022
ead5d96
Apply suggestions
jsbautista Sep 8, 2022
e6c17dd
Merge branch '5.xUpdateSpyder' of https://github.com/jsbautista/spyde…
jsbautista Sep 8, 2022
daac4b1
Apply suggestions from code review
jsbautista Sep 9, 2022
e12713f
Apply suggestions
jsbautista Sep 9, 2022
2095abe
Apply suggestions
jsbautista Sep 9, 2022
62c83a9
pycodestyle
jsbautista Sep 9, 2022
1d38d96
Apply suggestions from code review
jsbautista Sep 13, 2022
8ba83a7
status bar changes
jsbautista Sep 13, 2022
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
50 changes: 39 additions & 11 deletions spyder/plugins/application/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
from qtpy.QtWidgets import QAction, QMessageBox, QPushButton

# Local imports
from spyder import __docs_url__, __forum_url__, __trouble_url__
from spyder import __docs_url__, __forum_url__, __trouble_url__, __version__
from spyder import dependencies
from spyder.api.translations import get_translation
from spyder.api.widgets.main_container import PluginMainContainer
from spyder.utils.installers import InstallerMissingDependencies
from spyder.config.utils import is_anaconda
from spyder.config.base import get_conf_path, get_debug_level
from spyder.config.base import (get_conf_path, get_debug_level, is_pynsist,
running_in_mac_app)
from spyder.plugins.application.widgets.status import ApplicationUpdateStatus
from spyder.plugins.console.api import ConsoleActions
jsbautista marked this conversation as resolved.
Show resolved Hide resolved
from spyder.utils.qthelpers import start_file, DialogManager
from spyder.widgets.about import AboutDialog
Expand Down Expand Up @@ -99,6 +101,13 @@ def __init__(self, name, plugin, parent=None):
# ---- PluginMainContainer API
# -------------------------------------------------------------------------
def setup(self):

self.application_update_status = ApplicationUpdateStatus(parent=self)
jsbautista marked this conversation as resolved.
Show resolved Hide resolved
self.application_update_status.sig_check_for_updates_requested.connect(
self.check_updates
)
self.application_update_status.set_no_status()

# Compute dependencies in a thread to not block the interface.
jsbautista marked this conversation as resolved.
Show resolved Hide resolved
self.dependencies_thread = QThread(None)

Expand Down Expand Up @@ -235,6 +244,7 @@ def show_windows_env_variables(self):

# ---- Updates
# -------------------------------------------------------------------------

def _check_updates_ready(self):
"""Show results of the Spyder update checking process."""

Expand Down Expand Up @@ -278,11 +288,16 @@ def _check_updates_ready(self):
box.exec_()
check_updates = box.is_checked()
else:

dalthviz marked this conversation as resolved.
Show resolved Hide resolved
if update_available:
header = _("<b>Spyder {} is available!</b><br><br>").format(
latest_release)
self.application_update_status.set_status_pending(
latest_release=latest_release)

dalthviz marked this conversation as resolved.
Show resolved Hide resolved
header = _("<b>Spyder {} is available!</b> "
"<i>(you have {})</i><br><br>").format(
latest_release, __version__)
footer = _(
"For more information visit our "
"For more information, visit our "
"<a href=\"{}\">installation guide</a>."
).format(url_i)
if is_anaconda():
Expand All @@ -296,23 +311,35 @@ def _check_updates_ready(self):
"<code>conda update anaconda</code><br>"
"<code>conda install spyder={}</code><br><br>"
).format(latest_release)
else:
elif is_pynsist() or running_in_mac_app():
box.setStandardButtons(QMessageBox.Yes |
QMessageBox.No)
content = _(
"Click <a href=\"{}\">this link</a> to "
"download it.<br><br>"
).format(url_r)
"Would you like to automatically download and "
"install it?<br><br>"
)

msg = header + content + footer
jsbautista marked this conversation as resolved.
Show resolved Hide resolved
box.setText(msg)
box.set_check_visible(True)
box.show()
box.exec_()

if box.result() == QMessageBox.Yes:
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
self.application_update_status.start_installation(
latest_release=latest_release)
elif(box.result() == QMessageBox.No):
self.application_update_status.set_status_pending(
latest_release=latest_release)
check_updates = box.is_checked()
elif feedback:
msg = _("Spyder is up to date.")
box.setText(msg)
box.set_check_visible(False)
box.exec_()
check_updates = box.is_checked()

self.application_update_status.set_no_status()
dalthviz marked this conversation as resolved.
Show resolved Hide resolved
else:
self.application_update_status.set_no_status()
# Update checkbox based on user interaction
self.set_conf(option, check_updates)

Expand All @@ -327,6 +354,7 @@ def check_updates(self, startup=False):
"""Check for spyder updates on github releases using a QThread."""
# Disable check_updates_action while the thread is working
self.check_updates_action.setDisabled(True)
self.application_update_status.set_status_checking()

if self.thread_updates is not None:
self.thread_updates.quit()
Expand Down
19 changes: 18 additions & 1 deletion spyder/plugins/application/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Application(SpyderPluginV2):
NAME = 'application'
REQUIRES = [Plugins.Console, Plugins.Preferences]
OPTIONAL = [Plugins.Help, Plugins.MainMenu, Plugins.Shortcuts,
Plugins.Editor]
Plugins.Editor, Plugins.StatusBar]
CONTAINER_CLASS = ApplicationContainer
CONF_SECTION = 'main'
CONF_FILE = False
Expand Down Expand Up @@ -101,7 +101,20 @@ def on_editor_available(self):
editor = self.get_plugin(Plugins.Editor)
self.get_container().sig_load_log_file.connect(editor.load)

@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)

# -------------------------- 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)

@on_plugin_teardown(plugin=Plugins.Preferences)
def on_preferences_teardown(self):
preferences = self.get_plugin(Plugins.Preferences)
Expand Down Expand Up @@ -443,3 +456,7 @@ def report_action(self):
def debug_logs_menu(self):
return self.get_container().get_menu(
ApplicationPluginMenus.DebugLogsMenu)

@property
def application_update_status(self):
return self.get_container().application_update_status
8 changes: 8 additions & 0 deletions spyder/plugins/application/widgets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)

"""Widgets for the Application plugin."""
Loading