mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 15:27:47 +08:00
ENH: Default to blitting
Since the Qt4 Agg backend is always used, it's always safe to use blitting.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user