Skip to content

Remove deprecated draw methods in "Component" and "Container" #794

@rahulporuri

Description

@rahulporuri

enable/enable/component.py

Lines 344 to 350 in 3d138a2

def _draw_component(self, gc, view_bounds=None, mode="normal"):
""" Renders the component.
Subclasses must implement this method to actually render themselves.
Note: This method is used only by the "old" drawing calls.
"""
pass

enable/enable/container.py

Lines 383 to 392 in 3d138a2

# ------------------------------------------------------------------------
# Deprecated interface
# ------------------------------------------------------------------------
def _draw_overlays(self, gc, view_bounds=None, mode="normal"):
""" Method for backward compatability with old drawing scheme.
"""
warnings.warn("Containter._draw_overlays is deprecated.")
for component in self.overlays:
component.overlay(component, gc, view_bounds, mode)

enable/enable/container.py

Lines 597 to 616 in 3d138a2

# -------------------------------------------------------------------------
# Old / deprecated draw methods; here for backwards compatibility
# -------------------------------------------------------------------------
def _draw_component(self, gc, view_bounds=None, mode="normal"):
""" Draws the component.
This method is preserved for backwards compatibility. Overrides
the implementation in Component.
"""
with gc:
gc.set_antialias(False)
self._draw_container(gc, mode)
self._draw_background(gc, view_bounds, mode)
self._draw_underlay(gc, view_bounds, mode)
self._draw_children(
gc, view_bounds, mode
) # This was children_draw_mode
self._draw_overlays(gc, view_bounds, mode)

enable/enable/container.py

Lines 618 to 636 in 3d138a2

def _draw_children(self, gc, view_bounds=None, mode="normal"):
new_bounds = self._transform_view_bounds(view_bounds)
if new_bounds == empty_rectangle:
return
with gc:
gc.set_antialias(False)
gc.translate_ctm(*self.position)
for component in self.components:
if new_bounds:
tmp = intersect_bounds(
component.outer_position + component.outer_bounds,
new_bounds,
)
if tmp == empty_rectangle:
continue
with gc:
component.draw(gc, new_bounds, mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions