コード例 #1
0
ファイル: legend.py プロジェクト: BenChristenson/chaco
    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
コード例 #2
0
    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
コード例 #3
0
    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
コード例 #4
0
    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
コード例 #5
0
ファイル: tooltip.py プロジェクト: brycehendrix/chaco
    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
コード例 #6
0
    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
コード例 #7
0
    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)
コード例 #8
0
ファイル: legend.py プロジェクト: BenChristenson/chaco
 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
コード例 #9
0
 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