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 old deprecated drawing methods #814

Merged
merged 1 commit into from
May 18, 2021
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
8 changes: 0 additions & 8 deletions enable/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,6 @@ def _do_layout(self):
"""
pass

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

def _draw_selection(self, gc, view_bounds=None, mode="normal"):
""" Renders a selected subset of a component's data.

Expand Down
52 changes: 0 additions & 52 deletions enable/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,6 @@ def _component_position_changed(self, component):
if self.auto_size:
self.compact()

# ------------------------------------------------------------------------
# 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)

# ------------------------------------------------------------------------
# Property setters & getters
# ------------------------------------------------------------------------
Expand Down Expand Up @@ -583,44 +572,3 @@ def __components_items_changed(self, event):
def __components_changed(self, event):
self._layout_needed = True
self.invalidate_draw()

# -------------------------------------------------------------------------
# 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this can also be removed because there are newer methods _draw_container_* where * is the respective layer.

Note that Scrolled._draw makes use of this _draw_container but at the moment, _draw_container doesn't do anything

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't verified that _draw_container can actually be removed - that was just my hunch given the brief amount of time spent reviewing this PR. You'll want to check chaco as well and handle this in a separate PR

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)

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)