def overlay(self, component, gc, view_bounds=None, mode="normal"): """ Draws this component overlaid on another component. Implements AbstractOverlay. """ self.do_layout() valign, halign = self.align if valign == "u": y = component.y2 - self.outer_height else: y = component.y if halign == "r": x = component.x2 - self.outer_width else: x = component.x self.outer_position = [x, y] if self.clip_to_component: c = self.component with gc: gc.clip_to_rect(c.x, c.y, c.width, c.height) PlotComponent._draw(self, gc, view_bounds, mode) else: PlotComponent._draw(self, gc, view_bounds, mode) return
def _draw(self, *args, **kw): """ Draws the plot frame. Overrides PlotComponent and Container, explicitly calling the PlotComponent version of _draw(). """ PlotComponent._draw(self, *args, **kw) return
def overlay(self, component, gc, view_bounds=None, mode='normal'): """ Draws the tooltip overlaid on another component. Overrides AbstractOverlay. """ self.do_layout() PlotComponent._draw(self, gc, view_bounds, mode) return
def draw(self, gc, view_bounds=None, mode="normal"): """ Draws the plot frame. Frames are the topmost Chaco component that knows about layout, and they are the start of the layout pipeline. When they are asked to draw, they can assume that their own size has been set properly and this in turn drives the layout of the contained components within the trame. """ self.do_layout() #if gc.window and gc.window.is_sizing: if 0: with gc: gc.translate_ctm(*self.position) #TODO: We are ignoring Container... PlotComponent.draw(self, gc, view_bounds, "interactive") else: super(BasePlotFrame, self).draw(gc, view_bounds, mode) return
def do_layout(self, size=None, force=False): """ Tells this frame to do layout at a given size. Overrides PlotComponent. If this frame needs to fit components in at least one dimension, then it checks whether any of them need to do layout; if so, the frame needs to do layout also. """ if not self._layout_needed and not force and self.fit_components != "": for slot in self._frame_slots.values(): if slot._layout_needed: self._layout_needed = True break return PlotComponent.do_layout(self, size, force)
def _draw_overlay(self, gc, view_bounds=None, mode="normal"): if self.component is not None: self._draw_as_overlay(gc, view_bounds, mode) else: PlotComponent._draw_overlay(self, gc, view_bounds, mode) return