diff --git a/spyder/plugins/application/container.py b/spyder/plugins/application/container.py
index 886e29da6c9..0207adcc923 100644
--- a/spyder/plugins/application/container.py
+++ b/spyder/plugins/application/container.py
@@ -94,7 +94,8 @@ def __init__(self, name, plugin, parent=None):
# Keep track of dpi message
self.current_dpi = None
self.dpi_messagebox = None
- # Keep track of downloaded installer executable for updates
+
+ # Keep track of the downloaded installer executable for updates
self.installer_path = None
# ---- PluginMainContainer API
@@ -232,6 +233,8 @@ def on_close(self):
if self.dependencies_thread is not None:
self.dependencies_thread.quit()
self.dependencies_thread.wait()
+
+ # Run installer after Spyder is closed
cmd = ('start' if os.name == 'nt' else 'open')
if self.installer_path:
subprocess.Popen(' '.join([cmd, self.installer_path]), shell=True)
diff --git a/spyder/plugins/application/widgets/install.py b/spyder/plugins/application/widgets/install.py
index 772f82c2468..95bfed5a9c4 100644
--- a/spyder/plugins/application/widgets/install.py
+++ b/spyder/plugins/application/widgets/install.py
@@ -141,7 +141,7 @@ class UpdateInstallerDialog(QDialog):
Parameters
----------
installer_path: str
- Path to installer executable.
+ Path to the installer executable.
"""
def __init__(self, parent):
@@ -150,6 +150,7 @@ def __init__(self, parent):
self.download_thread = None
self.download_worker = None
self.installer_path = None
+
super().__init__(parent)
self.setWindowFlags(Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint)
self._parent = parent
@@ -181,7 +182,7 @@ def reject(self):
if on_installation_widget:
self.close_installer()
else:
- super(UpdateInstallerDialog, self).reject()
+ super().reject()
def setup(self):
"""Setup visibility of widgets."""
@@ -192,7 +193,7 @@ def save_latest_release(self, latest_release_version):
self.latest_release_version = latest_release_version
def start_installation(self, latest_release_version):
- """Start the update download and set downloading status."""
+ """Start downloading the update and set downloading status."""
self.latest_release_version = latest_release_version
self.cancelled = False
self._change_update_installation_status(
@@ -249,11 +250,12 @@ def confirm_installation(self, installer_path):
return
self._change_update_installation_status(status=DOWNLOAD_FINISHED)
self.installer_path = installer_path
- msg_box = QMessageBox(icon=QMessageBox.Question,
- text=_("Would you like to proceed with the "
- "installation?
"),
- parent=self._parent)
- msg_box.setWindowTitle("Spyder")
+ msg_box = QMessageBox(
+ icon=QMessageBox.Question,
+ text=_("Would you like to proceed with the installation?
"),
+ parent=self._parent
+ )
+ msg_box.setWindowTitle(_("Spyder update"))
msg_box.setAttribute(Qt.WA_ShowWithoutActivating)
if is_pynsist():
# Only add yes button for Windows installer
@@ -265,12 +267,15 @@ def confirm_installation(self, installer_path):
_("After closing"), QMessageBox.YesRole)
msg_box.addButton(QMessageBox.No)
msg_box.exec_()
+
if msg_box.clickedButton() == yes_button:
self._change_update_installation_status(status=INSTALLING)
cmd = ('start' if os.name == 'nt' else 'open')
if self.installer_path:
subprocess.Popen(
- ' '.join([cmd, self.installer_path]), shell=True)
+ ' '.join([cmd, self.installer_path]),
+ shell=True
+ )
self._change_update_installation_status(status=PENDING)
elif msg_box.clickedButton() == after_closing_button:
self.sig_install_on_close_requested.emit(self.installer_path)
@@ -285,8 +290,10 @@ def finish_installation(self):
def close_installer(self):
"""Close the installation dialog."""
- if (self.status == FINISHED
- or self.status == CANCELLED):
+ if (
+ self.status == FINISHED
+ or self.status == CANCELLED
+ ):
self.finish_installation()
else:
self.hide()
diff --git a/spyder/workers/updates.py b/spyder/workers/updates.py
index 87cc303c68e..02d2f46adee 100644
--- a/spyder/workers/updates.py
+++ b/spyder/workers/updates.py
@@ -185,8 +185,7 @@ def _download_installer(self):
name = 'Spyder_64bit_{}.exe'.format('full' if is_full_installer
else 'lite')
else:
- name = 'Spyder{}.dmg'.format('' if is_full_installer
- else '-Lite')
+ name = 'Spyder{}.dmg'.format('' if is_full_installer else '-Lite')
url = ('https://github.com/spyder-ide/spyder/releases/latest/'
f'download/{name}')
@@ -202,7 +201,7 @@ def _download_installer(self):
installer_path = osp.join(installer_dir_path, name)
self.installer_path = installer_path
- if (not osp.isfile(installer_path)):
+ if not osp.isfile(installer_path):
logger.debug(
f"Downloading installer from {url} to {installer_path}")
urlretrieve(
@@ -222,10 +221,10 @@ def start(self):
except HTTPError:
error_msg = _('Unable to retrieve installer information.')
except URLError:
- error_msg = _('Unable to connect to the internet.
Make '
- 'sure the connection is working properly.')
+ error_msg = _('Unable to connect to the internet.
'
+ 'Make sure the connection is working properly.')
except Exception:
- error_msg = _('Unable to download installer.')
+ error_msg = _('Unable to download the installer.')
self.error = error_msg
try:
self.sig_ready.emit(self.installer_path)