Permalink
Browse files

Make enaml imports lazy.

This is to avoid that imports from pyface.tasks.api import enaml,
which is 1) undesirable and 2) breaks Canopy if it finds the new
PyFace while using the old Enaml.
  • Loading branch information...
1 parent 8846ee1 commit cfbca90072ec40fa44d152c5d5f67b5e8d9dac85 Pietro Berkes committed Nov 21, 2013
Showing with 4 additions and 5 deletions.
  1. +1 −2 pyface/tasks/enaml_dock_pane.py
  2. +3 −3 pyface/tasks/enaml_pane.py
@@ -1,6 +1,5 @@
# Enthought library imports.
from traits.api import Instance
-from enaml.widgets.toolkit_object import ToolkitObject
# Local imports.
from pyface.tasks.dock_pane import DockPane
@@ -14,7 +13,7 @@ class EnamlDockPane(DockPane):
###########################################################################
#: The Enaml component defining the contents of the DockPane.
- component = Instance(ToolkitObject)
+ component = Instance('enaml.widgets.toolkit_object.ToolkitObject')
def create_component(self):
""" Return an Enaml component defining the contents of the DockPane.
@@ -1,8 +1,6 @@
""" Base class defining common code for EnamlTaskPane and EnamlEditor. """
# Enthought library imports.
-from enaml.widgets.toolkit_object import ToolkitObject
-from enaml.widgets.constraints_widget import ProxyConstraintsWidget
from traits.api import HasTraits, Instance
@@ -14,7 +12,7 @@ class EnamlPane(HasTraits):
###########################################################################
#: The Enaml component defining the contents of the TaskPane.
- component = Instance(ToolkitObject)
+ component = Instance('enaml.widgets.toolkit_object.ToolkitObject')
def create_component(self):
""" Return an Enaml component defining the contents of the pane.
@@ -32,6 +30,8 @@ def create_component(self):
def create(self, parent):
""" Create the toolkit-specific control that represents the editor. """
+ from enaml.widgets.constraints_widget import ProxyConstraintsWidget
+
self.component = self.create_component()
# We start with an invisible component to avoid flicker. We restore the

0 comments on commit cfbca90

Please sign in to comment.