Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <[email protected]>
  • Loading branch information
mrclary and ccordoba12 committed Apr 9, 2024
1 parent 1c879b0 commit 02c64f5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 4 additions & 2 deletions spyder/plugins/updatemanager/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ def setup(self):
# Signals
self.update_manager.sig_set_status.connect(self.set_status)
self.update_manager.sig_disable_actions.connect(
self._set_actions_state)
self._set_actions_state
)
self.update_manager.sig_block_status_signals.connect(
self.update_manager_status.blockSignals)
self.update_manager.sig_download_progress.connect(
self.update_manager_status.set_download_progress)
self.update_manager.sig_exception_occurred.connect(
self.sig_exception_occurred)
self.sig_exception_occurred
)
self.update_manager.sig_install_on_close.connect(
self.set_install_on_close)
self.update_manager.sig_quit_requested.connect(self.sig_quit_requested)
Expand Down
3 changes: 2 additions & 1 deletion spyder/plugins/updatemanager/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def on_mainwindow_visible(self):
"""Actions after the mainwindow in visible."""
container = self.get_container()

# Hide statusbar widget on startup
# Initialize status.
# Note that NO_STATUS also hides the statusbar widget.
container.update_manager_status.set_no_status()

# Check for updates on startup
Expand Down
4 changes: 2 additions & 2 deletions spyder/plugins/updatemanager/widgets/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UpdateManagerStatus(StatusBarWidget):

def __init__(self, parent):

self.tooltip = None
self.tooltip = ""
super().__init__(parent)

# Check for updates action menu
Expand Down Expand Up @@ -89,7 +89,7 @@ def set_value(self, value):
self.custom_widget.hide()
self.show()
else:
self.tooltip = None
self.tooltip = ""
if self.custom_widget:
self.custom_widget.hide()
self.hide()
Expand Down
17 changes: 9 additions & 8 deletions spyder/plugins/updatemanager/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
import os
import os.path as osp
import shutil
from time import sleep
import traceback

Expand Down Expand Up @@ -55,7 +56,7 @@ class UpdateDownloadIncompleteError(Exception):
pass


class Worker(QObject):
class BaseWorker(QObject):
"""Base worker class for the updater"""

sig_ready = Signal()
Expand Down Expand Up @@ -85,7 +86,7 @@ class Worker(QObject):
"""


class WorkerUpdate(Worker):
class WorkerUpdate(BaseWorker):
"""
Worker that checks for releases using either the Anaconda
default channels or the Github Releases page without
Expand Down Expand Up @@ -139,6 +140,7 @@ def start(self):
logger.debug(
f"channel = {self.channel}; channel_url = {channel_url}. "
)

# Spyder installed in development mode, use GitHub
url = github_url
elif self.channel == "pypi":
Expand Down Expand Up @@ -183,7 +185,7 @@ def start(self):
error_data = dict(
text=traceback.format_exc(),
is_traceback=True,
title="Check for update error",
title="Error when checking for updates",
)
self.sig_exception_occurred.emit(error_data)
logger.error(err, exc_info=err)
Expand All @@ -200,7 +202,7 @@ def start(self):
pass


class WorkerDownloadInstaller(Worker):
class WorkerDownloadInstaller(BaseWorker):
"""
Worker that donwloads standalone installers for Windows, macOS,
and Linux without blocking the Spyder user interface.
Expand Down Expand Up @@ -276,10 +278,9 @@ def _download_installer(self):

def _clean_installer_path(self):
"""Remove downloaded file"""
if osp.exists(self.installer_path):
os.remove(self.installer_path)
if osp.exists(self.installer_size_path):
os.remove(self.installer_size_path)
installer_dir = osp.dirname(self.installer_path)
if osp.exists(installer_dir):
shutil.rmtree(installer_dir)

def start(self):
"""Main method of the worker."""
Expand Down

0 comments on commit 02c64f5

Please sign in to comment.