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

Refactor chaco OverlayPlotContainer to inherit from enable OverlayContainer #758

Merged
merged 4 commits into from
Jun 7, 2021
Merged
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
21 changes: 7 additions & 14 deletions chaco/plot_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@
Instance,
List,
Property,
Str,
String,
Trait,
Tuple,
Int,
)
from enable.simple_layout import (
simple_container_get_preferred_size,
simple_container_do_layout,
)
from enable.api import OverlayContainer

try:
from enable.api import ConstraintsContainer
Expand Down Expand Up @@ -88,7 +86,7 @@ class ConstraintsPlotContainer(ConstraintsContainer):
__all__.append("ConstraintsPlotContainer")


class OverlayPlotContainer(BasePlotContainer):
class OverlayPlotContainer(OverlayContainer):
"""
A plot container that stretches all its components to fit within its
space. All of its components must therefore be resizable.
Expand All @@ -102,16 +100,11 @@ class OverlayPlotContainer(BasePlotContainer):
# Cache (width, height) of the container's preferred size.
_cached_preferred_size = Tuple

def get_preferred_size(self, components=None):
"""Returns the size (width,height) that is preferred for this component.
#: Redefine the container layers to name the main layer as "plot" instead
#: of the Enable default of "mainlayer"
container_under_layers = Tuple("background", "image", "underlay", "plot")

Overrides PlotComponent
"""
return simple_container_get_preferred_size(self, components=components)

def _do_layout(self):
"""Actually performs a layout (called by do_layout())."""
simple_container_do_layout(self)
draw_layer = Str("plot")


class StackedPlotContainer(BasePlotContainer):
Expand Down