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 deprecated draw methods in "Component" and "Container" #794

Closed
rahulporuri opened this issue Apr 21, 2021 · 1 comment · Fixed by #814
Closed

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

rahulporuri opened this issue Apr 21, 2021 · 1 comment · Fixed by #814

Comments

@rahulporuri
Copy link
Contributor

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)

@aaronayres35
Copy link
Contributor

ref: #781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants