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

[spy-plugin-registry-teardown] PR: Add preference page to enable and disable plugins #12

Merged
merged 7 commits into from
Oct 6, 2021

Conversation

andfoy
Copy link
Owner

@andfoy andfoy commented Jul 19, 2021

image

Stacked PR Chain: [spy-plugin-registry-teardown]

PR Title Merges Into
spyder-ide#16012 [spy-plugin-registry-teardown] PR: Add plugin teardown operations to the plugin registry N/A
#1 [spy-plugin-registry-teardown] PR: Migrate application teardown to use the new teardown mechanism spyder-ide#16012
#2 [spy-plugin-registry-teardown] PR: Migrate breakpoints to use the new teardown mechanism #1
#3 [spy-plugin-registry-teardown] PR: Migrate completions plugin to use the new teardown mechanism #2
#4 [spy-plugin-registry-teardown] PR: Migrate Console, Explorer and Find in files to use the new teardown mechanism #3
#5 [spy-plugin-registry-teardown] PR: Migrate help to use the new teardown mechanism #4
#6 [spy-plugin-registry-teardown] PR: Migrate history and layouts to use the new teardown mechanism #5
#7 [spy-plugin-registry-teardown] PR: Migrate Outline explorer, plots, preferences and profiler to use the new teardown mechanism #6
#8 [spy-plugin-registry-teardown] PR: Migrate projects to use the new teardown mechanism #7
#9 [spy-plugin-registry-teardown] PR: Migrate pylint, run and shortcuts to use the new teardown mechanism #8
#10 [spy-plugin-registry-teardown] PR: Migrate statusbar, toolbar and tours to use the new teardown mechanism #9
#11 [spy-plugin-registry-teardown] PR: Migrate variable explorer and working directory to use the new teardown mechanism #10
#12 [spy-plugin-registry-teardown] PR: Add preference page to enable and disable plugins #11

# Do not add Spyder 4 plugins to the disable page
continue

if not PluginClass.CAN_BE_DISABLED:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to determine which plugins shouldn't be closed, e.g., Application

@andfoy andfoy force-pushed the variable_workingdir_teardown branch from a4ff31d to e2ae13e Compare August 30, 2021 19:52
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from e2ae13e to 46d7e30 Compare August 30, 2021 22:00
@andfoy andfoy force-pushed the add_preferences_page branch 2 times, most recently from 403d6bc to daaba86 Compare August 31, 2021 17:24
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from 633d41f to 7dba6e4 Compare August 31, 2021 21:19
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from 7dba6e4 to c53685c Compare August 31, 2021 22:35
@andfoy andfoy force-pushed the add_preferences_page branch 2 times, most recently from 57e1025 to 5d4c815 Compare August 31, 2021 22:44
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from 33f8152 to 97463db Compare August 31, 2021 22:49
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from 97463db to 92bb0ab Compare August 31, 2021 22:54
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from 92bb0ab to 5567df5 Compare August 31, 2021 23:02
@andfoy andfoy force-pushed the variable_workingdir_teardown branch from 5567df5 to fb3a218 Compare August 31, 2021 23:04
@andfoy andfoy force-pushed the add_preferences_page branch 2 times, most recently from 5ccf666 to fb45f2c Compare September 27, 2021 18:02
@andfoy andfoy force-pushed the variable_workingdir_teardown branch 2 times, most recently from fea7936 to 4cfad3c Compare September 27, 2021 18:11
@andfoy andfoy force-pushed the add_preferences_page branch 2 times, most recently from 3a2cd1e to 3dbaf0d Compare September 28, 2021 17:08
@@ -0,0 +1,117 @@
# -*- coding: utf-8 -*-

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this module to _confpage.py so that people don't consider it as part of our public API.

# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)

"""Spyder completion plugin configuration page."""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Spyder completion plugin configuration page."""
"""Plugin registry configuration page."""

Comment on lines 14 to 17
from spyder.config.base import _
from spyder.config.manager import CONF
from spyder.api.preferences import PluginConfigPage
from spyder.api.plugins import SpyderPlugin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from spyder.config.base import _
from spyder.config.manager import CONF
from spyder.api.preferences import PluginConfigPage
from spyder.api.plugins import SpyderPlugin
from spyder.api.plugins import SpyderPlugin
from spyder.api.preferences import PluginConfigPage
from spyder.config.base import _
from spyder.config.manager import CONF

Organize import in alphabetical order.

Comment on lines 26 to 29
_("Spyder can run with a reduced number of internal and external "
"plugins in order to provide a lighter experience. Any plugin "
"unchecked in this page will be unloaded immediately and will "
"not be loaded next time Spyder starts."))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can turn on/off any internal or external Spyder plugin to disable functionality that you don't use or have a lighter experience. Unchecked plugins in this page will be unloaded immediately and will not be loaded the next time Spyder starts.

What do you think about rewriting this message like this?

Comment on lines 92 to 93

self.main = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.main = None
# To hold a reference to the main window
self.main = None

Comment on lines +1829 to +1847
# ---- Quit and restart, and reset spyder defaults
@Slot()
def reset_spyder(self):
"""
Quit and reset Spyder and then Restart application.
"""
answer = QMessageBox.warning(self, _("Warning"),
_("Spyder will restart and reset to default settings: <br><br>"
"Do you want to continue?"),
QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
self.restart(reset=True)

@Slot()
def restart(self, reset=False, close_immediately=False):
"""Wrapper to handle plugins request to restart Spyder."""
self.application.restart(
reset=reset, close_immediately=close_immediately)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods are not necessary anymore (see below for the reasoning). Please remove them.

@@ -326,7 +327,7 @@ def apply_settings(self):
self._main.apply_settings()

@Slot()
def restart(self):
def restart(self, reset=False, close_immediately=False):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset is not used in this method. Should it be removed? It's also mentioned in the docstring, so it should be removed from it too.

"""Return widget title"""
# TODO: This is a temporary measure to get the title of the plugins

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: This is a temporary measure to get the title of the plugins
# TODO: This is a temporary measure to get the title of plugins

"""Return widget title"""
# TODO: This is a temporary measure to get the title of the plugins

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: This is a temporary measure to get the title of the plugins
# TODO: This is a temporary measure to get the title of plugins


def restart(self):
"""Restart Spyder."""
self.main.restart(close_immediately=True)
Copy link

@ccordoba12 ccordoba12 Sep 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After PR spyder-ide#15629, we now emit sig_restart_requested from the Application plugin, so that other plugins can connect to it and perform actions when a restart happens.

So, you need to find a way of using that signal here, as it was before.

@andfoy andfoy force-pushed the add_preferences_page branch 3 times, most recently from 59c1f42 to be70728 Compare October 5, 2021 16:59
Copy link

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment for you @andfoy and then this should be ready.

spyder/api/plugin_registration/registry.py Outdated Show resolved Hide resolved
@andfoy andfoy merged commit 0369d79 into variable_workingdir_teardown Oct 6, 2021
@andfoy andfoy deleted the add_preferences_page branch October 6, 2021 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants