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: Add dialog to confirm downloaded installer installation and update related code organization (Application) #19700

Merged
merged 4 commits into from
Oct 11, 2022
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
16 changes: 16 additions & 0 deletions spyder/plugins/application/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# Standard library imports
import os
import subprocess
import sys
import glob

Expand Down Expand Up @@ -94,6 +95,9 @@ def __init__(self, name, plugin, parent=None):
self.current_dpi = None
self.dpi_messagebox = None

# Keep track of the downloaded installer executable for updates
self.installer_path = None

# ---- PluginMainContainer API
# -------------------------------------------------------------------------
def setup(self):
Expand All @@ -102,6 +106,8 @@ def setup(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.
Expand Down Expand Up @@ -228,6 +234,11 @@ def on_close(self):
self.dependencies_thread.quit()
self.dependencies_thread.wait()

# Run installer after Spyder is closed
cmd = ('start' if os.name == 'nt' else 'open')
dalthviz marked this conversation as resolved.
Show resolved Hide resolved
if self.installer_path:
subprocess.Popen(' '.join([cmd, self.installer_path]), shell=True)

@Slot()
def show_about(self):
"""Show Spyder About dialog."""
Expand Down Expand Up @@ -373,6 +384,11 @@ def check_updates(self, startup=False):
self.updates_timer.timeout.connect(self.thread_updates.start)
self.updates_timer.start()

@Slot(str)
def set_installer_path(self, installer_path):
"""Set installer executable path to be run when closing."""
self.installer_path = installer_path

# ---- Dependencies
# -------------------------------------------------------------------------
@Slot()
Expand Down
Loading