ENH: Default to blitting

Since the Qt4 Agg backend is always used, it's always safe to use blitting.
This commit is contained in:
Tony S Yu
2012-12-09 21:11:06 -05:00
parent 588fe29b57
commit 211bba0195
3 changed files with 3 additions and 14 deletions
+2 -5
View File
@@ -1,7 +1,6 @@
import numpy as np
try:
import matplotlib as mpl
from matplotlib import lines
except ImportError:
print("Could not import matplotlib -- skimage.viewer not available.")
@@ -16,19 +15,17 @@ class CanvasToolBase(object):
Parameters
----------
"""
def __init__(self, ax, useblit=None, on_update=None, on_enter=None):
def __init__(self, ax, useblit=True, on_update=None, on_enter=None):
self.ax = ax
self.canvas = ax.figure.canvas
self.cids = []
self._artists = []
self.active = True
if useblit is None:
useblit = True if mpl.backends.backend.endswith('Agg') else False
self.useblit = useblit
if useblit:
self.canvas.draw()
self.img_background = self.canvas.copy_from_bbox(self.ax.bbox)
self.useblit = useblit
if on_update is None:
on_update = lambda *args: None
+1 -8
View File
@@ -9,11 +9,6 @@ except ImportError:
QDialog = object # hack to prevent nosetest and autodoc errors
print("Could not import PyQt4 -- skimage.viewer not available.")
try:
import matplotlib as mpl
except ImportError:
print("Could not import matplotlib -- skimage.viewer not available.")
from ..utils import RequiredAttr, init_qtapp
@@ -81,7 +76,7 @@ class Plugin(QDialog):
image_viewer = RequiredAttr("%s is not attached to ImageViewer" % name)
draws_on_image = False
def __init__(self, image_filter=None, height=0, width=400, useblit=None):
def __init__(self, image_filter=None, height=0, width=400, useblit=True):
init_qtapp()
super(Plugin, self).__init__()
@@ -98,8 +93,6 @@ class Plugin(QDialog):
self.arguments = []
self.keyword_arguments= {}
if useblit is None:
useblit = True if mpl.backends.backend.endswith('Agg') else False
self.useblit = useblit
self.cids = []
self.artists = []
-1
View File
@@ -103,7 +103,6 @@ class LineProfile(PlotPlugin):
def line_changed(self, end_pts):
x, y = np.transpose(end_pts)
self.end_pts = end_pts
scan = profile_line(self.image_viewer.original_image, end_pts,
linewidth=self.line_tool.linewidth)