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

Remove class_load_hooks and ClassLoadHook #321

Merged
merged 2 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion envisage/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .i_service_registry import IServiceRegistry

from .application import Application
from .class_load_hook import ClassLoadHook
from .egg_plugin_manager import EggPluginManager
from .extension_registry import ExtensionRegistry
from .extension_point import ExtensionPoint, contributes_to
Expand Down
108 changes: 0 additions & 108 deletions envisage/class_load_hook.py

This file was deleted.

40 changes: 1 addition & 39 deletions envisage/core_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Enthought library imports.
from envisage.api import ExtensionPoint, Plugin, ServiceOffer
from traits.api import List, Instance, on_trait_change, Str
from traits.api import List, on_trait_change, Str


class CorePlugin(Plugin):
Expand All @@ -28,7 +28,6 @@ class CorePlugin(Plugin):
"""

# Extension point Ids.
CLASS_LOAD_HOOKS = "envisage.class_load_hooks"
PREFERENCES = "envisage.preferences"
SERVICE_OFFERS = "envisage.service_offers"

Expand All @@ -42,32 +41,6 @@ class CorePlugin(Plugin):

#### Extension points offered by this plugin ##############################

class_load_hooks = ExtensionPoint(
List(Instance("envisage.class_load_hook.ClassLoadHook")),
id=CLASS_LOAD_HOOKS,
desc="""

Class load hooks allow you to be notified when any 'HasTraits' class
is imported or created.

See the documentation for 'ClassLoadHook' for more details.

""",
)

@on_trait_change("class_load_hooks_items")
def _class_load_hooks_changed(self, event):
""" React to new class load hooks being *added*.

Note that we don't currently do anything if class load hooks are
*removed*.

"""

self._connect_class_load_hooks(event.added)

return

preferences = ExtensionPoint(
List(Str),
id=PREFERENCES,
Expand Down Expand Up @@ -164,9 +137,6 @@ def start(self):
# preferences node.
self._load_preferences(self.preferences)

# Connect all class load hooks.
self._connect_class_load_hooks(self.class_load_hooks)

# Register all service offers.
#
# These services are unregistered by the default plugin activation
Expand All @@ -180,14 +150,6 @@ def start(self):
# Private interface.
###########################################################################

def _connect_class_load_hooks(self, class_load_hooks):
""" Connect all class load hooks. """

for class_load_hook in class_load_hooks:
class_load_hook.connect()

return

def _load_preferences(self, preferences):
""" Load all contributed preferences into a preferences node. """

Expand Down
102 changes: 0 additions & 102 deletions envisage/tests/test_class_load_hook.py

This file was deleted.

Loading