Skip to content
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
3 changes: 0 additions & 3 deletions enable/abstract_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def do_layout(self, size=None, force=False, component=None):
for overlay in self.overlays:
if overlay.visible or overlay.invisible_layout:
overlay.do_layout(component)
return

def _draw(self, gc, view_bounds=None, mode="normal"):
""" Draws the component, paying attention to **draw_order**.
Expand All @@ -80,12 +79,10 @@ def _draw(self, gc, view_bounds=None, mode="normal"):
"""
if self.component is not None:
self.overlay(self.component, gc, view_bounds, mode)
return

def _request_redraw(self):
""" Overrides Enable Component.
"""
if self.component is not None:
self.component.request_redraw()
super(AbstractOverlay, self)._request_redraw()
return
8 changes: 0 additions & 8 deletions enable/abstract_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def _init_gc(self):
# Fixme: should use clip_to_rects
update_union = reduce(union_bounds, self._update_region)
gc.clip_to_rect(*update_union)
return

def _window_paint(self, event):
"Do a GUI toolkit specific screen update"
Expand Down Expand Up @@ -179,7 +178,6 @@ def __init__(self, **traits):
# Create a default component (if necessary):
if self.component is None:
self.component = Container()
return

def _component_changed(self, old, new):
if old is not None:
Expand Down Expand Up @@ -209,7 +207,6 @@ def _component_changed(self, old, new):
self.component.outer_height = size[1]
self._update_region = None
self.redraw()
return

def component_bounds_changed(self, bounds):
"""
Expand All @@ -231,7 +228,6 @@ def set_mouse_owner(self, mouse_owner, transform=None, history=None):
self.mouse_owner = mouse_owner
self.mouse_owner_transform = transform
self.mouse_owner_dispatch_history = history
return

def invalidate_draw(self, damaged_regions=None, self_relative=False):
if damaged_regions is not None and self._update_region is not None \
Expand Down Expand Up @@ -424,7 +420,6 @@ def set_tooltip(self, components):
def redraw(self):
""" Requests that the window be redrawn. """
self._redraw()
return

def cleanup(self):
""" Clean up after ourselves.
Expand Down Expand Up @@ -480,7 +475,6 @@ def _paint(self, event=None):
self._window_paint(event)

self._update_region = []
return

def __getstate__(self):
attribs = ("component", "bgcolor", "overlay", "_scroll_origin")
Expand Down Expand Up @@ -548,8 +542,6 @@ def _on_window_leave(self, event):
mouse_event = self._create_mouse_event(event)
self._prev_event_handler.dispatch(mouse_event, "mouse_leave")
self._prev_event_handler = None
return


#---------------------------------------------------------------------------
# Wire up the keyboard event handlers
Expand Down
1 change: 0 additions & 1 deletion enable/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def subclasses_of ( klass ):
for subclass in klass.__bases__:
for result in subclasses_of( subclass ):
yield result
return

class IDroppedOnHandler:
"Interface for draggable objects that handle the 'dropped_on' event"
Expand Down
4 changes: 0 additions & 4 deletions enable/base_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,13 @@ def __init__(self, component=None, **kwtraits):
component = kwtraits["component"]
super(BaseTool, self).__init__(**kwtraits)
self.component = component
return

def dispatch(self, event, suffix):
""" Dispatches a mouse event based on the current event state.

Overrides enable.Interactor.
"""
self._dispatch_stateful_event(event, suffix)
return

def _dispatch_stateful_event(self, event, suffix):
# Override the default enable.Interactor behavior of automatically
Expand All @@ -131,7 +129,6 @@ def _dispatch_stateful_event(self, event, suffix):
handler = getattr(self, self.event_state + "_" + suffix, None)
if handler is not None:
handler(event)
return

#------------------------------------------------------------------------
# Abstract methods that subclasses should implement
Expand Down Expand Up @@ -161,4 +158,3 @@ def deactivate(self, component=None):
"""
# Compatibility with new AbstractController interface
self._deactivate()
return
1 change: 0 additions & 1 deletion enable/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def _draw_background(self, gc, view_bounds=None, mode="default"):
if not self.overlay_border and self.border_visible:
# Tell _draw_border to ignore the self.overlay_border
self._draw_border(gc, view_bounds, mode, force_draw=True)
return

def _draw_underlay(self, gc, view_bounds=None, mode="default"):
if self.draw_axes:
Expand Down
1 change: 0 additions & 1 deletion enable/compass.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def normal_left_down(self, event):
self.request_redraw()
break
event.handled = True
return

def normal_left_dclick(self, event):
return self.normal_left_down(event)
Expand Down
27 changes: 0 additions & 27 deletions enable/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ def __init__(self, **traits):
else:
super(Component, self).__init__(**traits)
self._set_padding_traits(padding, padding_traits)
return

def draw(self, gc, view_bounds=None, mode="default"):
""" Draws the plot component.
Expand Down Expand Up @@ -423,7 +422,6 @@ def draw(self, gc, view_bounds=None, mode="default"):
self.do_layout()

self._draw(gc, view_bounds, mode)
return

def draw_select_box(self, gc, position, bounds, width, dash,
inset, color, bgcolor, marker_size):
Expand Down Expand Up @@ -492,8 +490,6 @@ def draw_select_box(self, gc, position, bounds, width, dash,
marker_size, marker_size)
gc.draw_path()

return

def get_absolute_coords(self, *coords):
""" Given coordinates relative to this component's origin, returns
the "absolute" coordinates in the frame of the top-level parent
Expand Down Expand Up @@ -539,7 +535,6 @@ def request_redraw(self):
view.request_redraw()

self._request_redraw()
return

def invalidate_draw(self, damaged_regions=None, self_relative=False):
""" Invalidates any backbuffer that may exist, and notifies our parents
Expand All @@ -564,7 +559,6 @@ def invalidate_draw(self, damaged_regions=None, self_relative=False):

if self._window is not None:
self._window.invalidate_draw(damaged_regions=damaged_regions, self_relative=True)
return

def invalidate_and_redraw(self):
"""Convenience method to invalidate our contents and request redraw"""
Expand All @@ -589,7 +583,6 @@ def cleanup(self, window):
"""When a window viewing or containing a component is destroyed,
cleanup is called on the component to give it the opportunity to
delete any transient state it may have (such as backbuffers)."""
return

def set_outer_position(self, ndx, val):
"""
Expand All @@ -602,7 +595,6 @@ def set_outer_position(self, ndx, val):
self.outer_x = val
else:
self.outer_y = val
return

def set_outer_bounds(self, ndx, val):
"""
Expand All @@ -615,7 +607,6 @@ def set_outer_bounds(self, ndx, val):
self.outer_width = val
else:
self.outer_height = val
return

#------------------------------------------------------------------------
# Layout-related concrete methods
Expand Down Expand Up @@ -648,7 +639,6 @@ def do_layout(self, size=None, force=False):
for overlay in self.overlays:
if overlay.visible or overlay.invisible_layout:
overlay.do_layout()
return

def get_preferred_size(self):
""" Returns the size (width,height) that is preferred for this component
Expand Down Expand Up @@ -694,7 +684,6 @@ def _request_redraw(self):
self.container.request_redraw()
elif self._window:
self._window.redraw()
return

def _default_damaged_regions(self):
"""Returns the default damaged regions for this Component. This consists
Expand Down Expand Up @@ -776,8 +765,6 @@ def _draw(self, gc, view_bounds=None, mode="default"):
for layer in self.draw_order:
self._dispatch_draw(layer, gc, view_bounds, mode)

return

def _dispatch_draw(self, layer, gc, view_bounds, mode):
""" Renders the named *layer* of this component.

Expand All @@ -795,7 +782,6 @@ def _dispatch_draw(self, layer, gc, view_bounds, mode):
handler = getattr(self, "_draw_" + layer, None)
if handler:
handler(gc, view_bounds, mode)
return

def _draw_border(self, gc, view_bounds=None, mode="default",
force_draw=False):
Expand Down Expand Up @@ -865,15 +851,12 @@ def _draw_background(self, gc, view_bounds=None, mode="default"):
# Tell _draw_border to ignore the self.overlay_border
self._draw_border(gc, view_bounds, mode, force_draw=True)

return

def _draw_overlay(self, gc, view_bounds=None, mode="normal"):
""" Draws the overlay layer of a component.
"""
for overlay in self.overlays:
if overlay.visible:
overlay.overlay(self, gc, view_bounds, mode)
return

def _draw_underlay(self, gc, view_bounds=None, mode="normal"):
""" Draws the underlay layer of a component.
Expand All @@ -883,7 +866,6 @@ def _draw_underlay(self, gc, view_bounds=None, mode="normal"):
# just overlays drawn at a different time in the rendering loop.
if underlay.visible:
underlay.overlay(self, gc, view_bounds, mode)
return

def _get_visible_border(self):
""" Helper function to return the amount of border, if visible """
Expand Down Expand Up @@ -917,8 +899,6 @@ def dispatch(self, event, suffix):
self._old_dispatch(event, suffix)
else:
self._new_dispatch(event, suffix)
return


def _new_dispatch(self, event, suffix):
""" Dispatches a mouse event
Expand Down Expand Up @@ -971,8 +951,6 @@ def _new_dispatch(self, event, suffix):
for tool in self.tools:
tool.dispatch(event, suffix)

return

def _old_dispatch(self, event, suffix):
""" Dispatches a mouse event.

Expand Down Expand Up @@ -1026,7 +1004,6 @@ def _set_active_tool(self, tool):
tool._activate()

self.invalidate_and_redraw()
return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is one more return at the bottom of _old_dispatch which can be removed.


def _get_layout_needed(self):
return self._layout_needed
Expand Down Expand Up @@ -1092,19 +1069,16 @@ def _enforce_aspect_ratio(self, notify=True):
self.trait_set(bounds=[new_w, new_h], trait_change_notify=notify)
if new_pos:
self.trait_set(position=new_pos, trait_change_notify=notify)
return

def _bounds_changed(self, old, new):
self._enforce_aspect_ratio(notify=True)
if self.container is not None:
self.container._component_bounds_changed(self)
return

def _bounds_items_changed(self, event):
self._enforce_aspect_ratio(notify=True)
if self.container is not None:
self.container._component_bounds_changed(self)
return

def _container_changed(self, old, new):
# We don't notify our container of this change b/c the
Expand Down Expand Up @@ -1172,7 +1146,6 @@ def _set_padding(self, val):
self.padding_top = val[2]
self.padding_bottom = val[3]
self.trait_property_changed("padding", old_padding, val)
return

def _get_hpadding(self):
return 2*self._get_visible_border() + self.padding_right + \
Expand Down
1 change: 0 additions & 1 deletion enable/component_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def update_editor( self ):
editor.
"""
self._window.component = self.value
return

def _get_initial_size(self):
""" Compute the initial size of the component.
Expand Down
Loading