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: Migrate application teardown to use the new teardown mechanism #1

Merged
merged 60 commits into from
Oct 6, 2021
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
600c186
Add plugin teardown operations to the plugin registry
andfoy Oct 5, 2021
afd3350
Use the teardown mechanism when closing Spyder
andfoy Oct 5, 2021
83aecf9
Remove direct ipythonconsole reference from the editor
andfoy Oct 5, 2021
6f92c15
Prevent hard reference to the editor on the mainwindow
andfoy Oct 5, 2021
787ad73
Start application migration to use the teardown mechanism
andfoy Oct 5, 2021
5073161
Enable tests in forks
andfoy Oct 5, 2021
bfd5a4f
Disconnect console and shortcuts
andfoy Oct 5, 2021
1fab6c0
Add remove_item_from_application_menu method in main menu
andfoy Oct 5, 2021
e6b1b2b
Disconnect from main menu
andfoy Oct 5, 2021
b15eb20
Prevent non-existing action removal
andfoy Oct 5, 2021
fd1392a
Apply review comments
andfoy Oct 5, 2021
654b3c8
Remove shortcuts teardown method
andfoy Oct 5, 2021
ee68db1
Migrate breakpoints to use the new teardown mechanism
andfoy Oct 5, 2021
4e7f501
Update remove_item_from_application_menu call
andfoy Oct 5, 2021
c9a3ddd
Migrate completions plugin to use the teardown mechanism
andfoy Oct 5, 2021
9280f2e
Remove kite-defined actions
andfoy Oct 5, 2021
a6a7b2c
Fix minor issue in Kite
andfoy Oct 5, 2021
31472ca
Reimplement can_close
andfoy Oct 5, 2021
b5f143a
Update remove_item_from_application_menu calls
andfoy Oct 5, 2021
af4023f
Add remove_application_menu to main menu
andfoy Oct 5, 2021
9378680
Remove unregister method
andfoy Oct 5, 2021
9d7db43
Migrate Console, Explorer and Find in files to use the new teardown m…
andfoy Oct 5, 2021
1c566da
Minor typo correction
andfoy Oct 5, 2021
e73ff04
Prevent non-existinng search_menu_actions list
andfoy Oct 5, 2021
89c5add
Update calls to remove_item_from_application_menu
andfoy Oct 5, 2021
ff48d7a
Migrate help to use the new teardown mechanism
andfoy Oct 5, 2021
0cf843b
Update call to remove_item_from_application_menu
andfoy Oct 5, 2021
4756457
Apply review comments
andfoy Oct 5, 2021
7e20ca5
Migrate history and layouts to use the new teardown mmechanism
andfoy Oct 5, 2021
0e4dd64
Update calls to main menu and toolbar to use ids
andfoy Oct 5, 2021
2b6cf84
Address review comments
andfoy Oct 5, 2021
1d28e79
Migrate Outline explorer, plots, preferences and profiler to use the …
andfoy Oct 5, 2021
de3980d
Update profiler calls to remove_item_from_application_menu
andfoy Oct 5, 2021
1df611e
Address review comments
andfoy Oct 5, 2021
fbb6814
Migrate projects to use the new teardown mechanism
andfoy Oct 5, 2021
5908d3b
Update calls to remove_item_from_application_menu
andfoy Oct 5, 2021
8601e2e
Address review comments
andfoy Oct 5, 2021
88e3b4a
Address further review comments
andfoy Oct 5, 2021
83907bc
Minor error correction
andfoy Oct 5, 2021
861e324
Restore sig_stop_completions connection
andfoy Oct 5, 2021
6c6b22d
Migrate pylint, run and shortcuts to use the new teardown mechanism
andfoy Oct 5, 2021
690eb3c
Remove hard reference to editor in pylint
andfoy Oct 5, 2021
c4b0539
Update calls to remove_item_from_application_menu
andfoy Oct 5, 2021
807f017
Address review comments
andfoy Oct 5, 2021
4d69705
Final review comments
andfoy Oct 5, 2021
64f18f9
Migrate statusbar, toolbar and tours to use the new teardown mechanism
andfoy Oct 5, 2021
ac1c237
Update calls to remove_item_from_application_menu
andfoy Oct 5, 2021
abe924d
Address review comments
andfoy Oct 5, 2021
718a1ac
Add proper signature to statusbar on_close method
andfoy Oct 5, 2021
22b75f6
Address review comments
andfoy Oct 5, 2021
08e5f98
Migrate variable explorer and working directory to use the new teardo…
andfoy Oct 5, 2021
f6192cf
Update calls to remove_item_from_application_menu
andfoy Oct 5, 2021
9fe8e0a
Apply review comments
andfoy Oct 5, 2021
6f66707
Remove duplicate on__close
andfoy Oct 5, 2021
aaf3295
Add preference page to enable and disable plugins
andfoy Oct 5, 2021
ee88227
Restart Spyder after a plugin is enabled/disabled
andfoy Oct 5, 2021
f123f7f
Disable also Spyder 4 plugins
andfoy Oct 5, 2021
741c645
Fix test_preferences_checkboxes_not_checked_regression
andfoy Oct 5, 2021
2c2feee
Address review comments
andfoy Oct 5, 2021
9c5cb29
Always add external plugin metadata
andfoy Oct 6, 2021
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
Prev Previous commit
Next Next commit
Address review comments
andfoy committed Oct 6, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
zalegrala Zach Leslie
commit 2c2feeefa419202a930bc380b35a9c8110586749
Original file line number Diff line number Diff line change
@@ -4,17 +4,17 @@
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)

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

# Third party imports
from qtpy.QtWidgets import (QGroupBox, QVBoxLayout, QCheckBox,
QGridLayout, QLabel)

# Local imports
from spyder.api.plugins import SpyderPlugin
from spyder.api.preferences import PluginConfigPage
from spyder.config.base import _
from spyder.config.manager import CONF
from spyder.api.preferences import PluginConfigPage
from spyder.api.plugins import SpyderPlugin


class PluginsConfigPage(PluginConfigPage):
@@ -23,10 +23,10 @@ def setup_page(self):
self.plugins_checkboxes = {}

header_label = QLabel(
_("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."))
_("Here you can turn on/off any internal or external Spyder plugin "
"to disable functionality that is not desired or to have a lighter "
"experience. Unchecked plugins in this page will be unloaded "
"immediately and will not be loaded the next time Spyder starts."))
header_label.setWordWrap(True)

# ------------------ Internal plugin status group ---------------------
10 changes: 5 additions & 5 deletions spyder/api/plugin_registration/registry.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

# Standard library imports
import logging
from typing import Dict, List, Union, Type, Any, Set, Optional
from typing import Dict, List, Union, Type, Any, Set, Optional, Tuple

# Third-party library imports
from qtpy.QtCore import QObject, Signal
@@ -18,7 +18,7 @@
from spyder.config.base import _, running_under_pytest
from spyder.config.manager import CONF
from spyder.api.config.mixins import SpyderConfigurationAccessor
from spyder.api.plugin_registration.confpage import PluginsConfigPage
from spyder.api.plugin_registration._confpage import PluginsConfigPage
from spyder.api.plugins.enum import Plugins
from spyder.api.exceptions import SpyderAPIError
from spyder.api.plugins import (
@@ -90,6 +90,7 @@ def __init__(self):
super().__init__()
PreferencesAdapter.__init__(self)

# Reference to the main window
self.main = None

# Dictionary that maps a plugin name to a list of the plugin names
@@ -208,10 +209,9 @@ def _instantiate_spyder5_plugin(
module = PluginClass._spyder_module_name
package_name = PluginClass._spyder_package_name
version = PluginClass._spyder_version
description = instance.get_description()
description = plugin_instance.get_description()
dependencies.add(module, package_name, description,
version, None,
kind=dependencies.PLUGIN)
version, None, kind=dependencies.PLUGIN)

return plugin_instance

2 changes: 2 additions & 0 deletions spyder/api/preferences.py
Original file line number Diff line number Diff line change
@@ -129,6 +129,8 @@ def aggregate_sections_partials(self, opts):
to_update = {}
for opt in opts:
if isinstance(opt, tuple):
# This is necessary to filter tuple options that do not
# belong to a section.
if len(opt) == 2 and opt[0] is None:
opt = opt[1]

9 changes: 0 additions & 9 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
@@ -909,15 +909,6 @@ def setup(self):
try:
plugin_instance = PLUGIN_REGISTRY.register_plugin(
self, PluginClass, external=True)

# These attributes come from spyder.app.find_plugins to
# add plugins to the dependencies dialog
module = PluginClass._spyder_module_name
package_name = PluginClass._spyder_package_name
version = PluginClass._spyder_version
description = plugin_instance.get_description()
dependencies.add(module, package_name, description,
version, None, kind=dependencies.PLUGIN)
except Exception as error:
print("%s: %s" % (PluginClass, str(error)), file=STDERR)
traceback.print_exc(file=STDERR)
2 changes: 1 addition & 1 deletion spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
@@ -419,7 +419,7 @@ def _rpc_call(self, method, args, kwargs):
@staticmethod
def get_plugin_title():
"""Return widget title"""
# TODO: This is a temporary measure to get the title of the plugins
# TODO: This is a temporary measure to get the title of this plugin
# without creating an instance
title = _('Editor')
return title
2 changes: 1 addition & 1 deletion spyder/plugins/ipythonconsole/plugin.py
Original file line number Diff line number Diff line change
@@ -523,7 +523,7 @@ def toggle_view(self, checked):
@staticmethod
def get_plugin_title():
"""Return widget title"""
# TODO: This is a temporary measure to get the title of the plugins
# TODO: This is a temporary measure to get the title of this plugin
# without creating an instance
return _('IPython console')