def on_update_lines(self, sender, key, updateinfo):
        # since we have group properties, we need to redraw the whole
        # thing and can't just redraw all added or removed lines...
        backend = self.get_backend()        
        layer = self.obj
        try:
            backend.block_redraw()

            # remove obsolete line painters / mpl line objects
            if updateinfo.has_key('removed'):
                for line in updateinfo['removed'][2]:
                    _id = id(line)
                    if self.painters.has_key(_id):
                        logger.debug("Removing obsolete LinePainter")
                        p = self.painters.pop(_id)

                    # remove obsolete mpl line from line cache
                    if self.line_cache.has_key(line):
                        obj = self.line_cache.pop(line)
                        if obj in self.axes.lines:
                            self.axes.lines.remove(obj)


            for line in layer.lines:
                painter = self.get_painter(line, LinePainter)
                painter.paint()
        finally:
            backend.unblock_redraw()
            backend.queue_redraw()
 def update(self, sender, keys):
     backend = self.get_backend()
     try:
         backend.block_redraw()
         self.paint(keys=keys)
     finally:
         backend.unblock_redraw()
         backend.queue_redraw()
    def update(self, sender, keys):
        backend = self.get_backend()
        try:
            backend.block_redraw()
            
            # plot_painter := backend
            layer, plot_painter = self.obj, self.parent
            axes = self.axes

            # title
            if 'title' in keys:
                title = layer.title
                axes.set_title(title or '') # matplotlib doesn't like None as title

            # grid
            if 'grid' in keys:
                axes.grid(layer.grid)


            # lines -- these should be updated by update::lines !!!
            for line in layer.lines:
                painter = self.get_painter(line, LinePainter)
                painter.paint()

            # axes
            # This needs to be after lines, because painting the
            # lines would reset the start and end.

    #        if 'xaxis' in keys or 'yaxis' in keys:
            self.update_axis(None, [])

            # legend
            # Since the legend labels are constructed from the matplotlib
            # line objects, it is necessary to construct the legend after
            # the lines are plotted
            if 'legend' in keys:
                legend = layer.legend        
                if legend is None:
                    # remove any existing legend painter if obsolete
                    pass
                else:
                    p = self.get_painter(legend, LegendPainter)
                    p.paint()

        finally:
            backend.unblock_redraw()
            backend.queue_redraw()