Add actual deprecation warnings
This commit is contained in:
parent
bd548e00c9
commit
ff71b6be6b
@ -2,7 +2,7 @@
|
||||
from .Qt import QtCore, QtGui
|
||||
from .Point import Point
|
||||
import numpy as np
|
||||
|
||||
import warnings
|
||||
|
||||
class SRTTransform(QtGui.QTransform):
|
||||
"""Transform that can always be represented as a combination of 3 matrices: scale * rotate * translate
|
||||
@ -35,7 +35,11 @@ class SRTTransform(QtGui.QTransform):
|
||||
return self._state['scale']
|
||||
|
||||
def getAngle(self):
|
||||
## deprecated; for backward compatibility
|
||||
warnings.warn(
|
||||
'SRTTransform.getAngle() is deprecated, use SRTTransform.getRotation() instead'
|
||||
'will be removed in 0.13',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
return self.getRotation()
|
||||
|
||||
def getRotation(self):
|
||||
|
@ -6,7 +6,7 @@ from .Terminal import *
|
||||
from ..pgcollections import OrderedDict
|
||||
from ..debug import *
|
||||
import numpy as np
|
||||
|
||||
import warnings
|
||||
|
||||
translate = QtCore.QCoreApplication.translate
|
||||
|
||||
@ -191,6 +191,12 @@ class Node(QtCore.QObject):
|
||||
## this is just bad planning. Causes too many bugs.
|
||||
def __getattr__(self, attr):
|
||||
"""Return the terminal with the given name"""
|
||||
warnings.warn(
|
||||
"Use of note.terminalName is deprecated, use node['terminalName'] instead"
|
||||
"Will be removed from 0.13.0",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
if attr not in self.terminals:
|
||||
raise AttributeError(attr)
|
||||
else:
|
||||
|
@ -9,6 +9,7 @@ import weakref
|
||||
from .. import functions as fn
|
||||
from .. import getConfigOption
|
||||
from .GraphicsWidget import GraphicsWidget
|
||||
import warnings
|
||||
|
||||
__all__ = ['AxisItem']
|
||||
class AxisItem(GraphicsWidget):
|
||||
@ -459,6 +460,12 @@ class AxisItem(GraphicsWidget):
|
||||
"""
|
||||
# Deprecated usage, kept for backward compatibility
|
||||
if scale is None:
|
||||
warnings.warn(
|
||||
'AxisItem.setScale(None) is deprecated, will be removed in 0.13.0'
|
||||
'instead use AxisItem.enableAutoSIPrefix(bool) to enable/disable'
|
||||
'SI prefix scaling',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
scale = 1.0
|
||||
self.enableAutoSIPrefix(True)
|
||||
|
||||
|
@ -39,7 +39,7 @@ class GraphicsItem(object):
|
||||
self._cachedView = None
|
||||
if register is not None and register:
|
||||
warnings.warn(
|
||||
"'register' argument is deprecated and does nothing",
|
||||
"'register' argument is deprecated and does nothing, will be removed in 0.13",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
|
@ -171,10 +171,8 @@ class GridItem(UIGraphicsItem):
|
||||
linePen.setCosmetic(False)
|
||||
if ax == 0:
|
||||
linePen.setWidthF(self.pixelWidth())
|
||||
#print "ax 0 height", self.pixelHeight()
|
||||
else:
|
||||
linePen.setWidthF(self.pixelHeight())
|
||||
#print "ax 1 width", self.pixelWidth()
|
||||
p.setPen(linePen)
|
||||
p1 = np.array([0.,0.])
|
||||
p2 = np.array([0.,0.])
|
||||
@ -195,7 +193,6 @@ class GridItem(UIGraphicsItem):
|
||||
y = p1[1] + unit[1]
|
||||
texts.append((QtCore.QPointF(x, y), "%g"%p1[ax]))
|
||||
tr = self.deviceTransform()
|
||||
#tr.scale(1.5, 1.5)
|
||||
p.setWorldTransform(fn.invertQTransform(tr))
|
||||
|
||||
if textPen is not None and len(texts) > 0:
|
||||
|
@ -9,6 +9,7 @@ from .ScatterPlotItem import ScatterPlotItem
|
||||
from .. import functions as fn
|
||||
from .. import debug as debug
|
||||
from .. import getConfigOption
|
||||
import warnings
|
||||
|
||||
|
||||
class PlotDataItem(GraphicsObject):
|
||||
@ -438,11 +439,21 @@ class PlotDataItem(GraphicsObject):
|
||||
"""
|
||||
#self.clear()
|
||||
if kargs.get("stepMode", None) is True:
|
||||
import warnings
|
||||
warnings.warn(
|
||||
'stepMode=True is deprecated, use stepMode="center" instead',
|
||||
DeprecationWarning, stacklevel=3
|
||||
)
|
||||
if 'decimate' in kargs.keys():
|
||||
warnings.warn(
|
||||
'decimate kwarg has been deprecated, it has no effect',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
if 'identical' in kargs.keys():
|
||||
warnings.warn(
|
||||
'identical kwarg has been deprecated, it has no effect',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
profiler = debug.Profiler()
|
||||
y = None
|
||||
x = None
|
||||
|
@ -510,7 +510,11 @@ class PlotItem(GraphicsWidget):
|
||||
"""
|
||||
Enable auto-scaling. The plot will continuously scale to fit the boundaries of its data.
|
||||
"""
|
||||
print("Warning: enableAutoScale is deprecated. Use enableAutoRange(axis, enable) instead.")
|
||||
warnings.warn(
|
||||
'PlotItem.enableAutoScale is deprecated, and will be removed in 0.13'
|
||||
'Use PlotItem.enableAutoRange(axis, enable) instead',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
self.vb.enableAutoRange(self.vb.XYAxes)
|
||||
|
||||
def addItem(self, item, *args, **kargs):
|
||||
@ -567,7 +571,11 @@ class PlotItem(GraphicsWidget):
|
||||
self.legend.addItem(item, name=name)
|
||||
|
||||
def addDataItem(self, item, *args):
|
||||
print("PlotItem.addDataItem is deprecated. Use addItem instead.")
|
||||
warnings.warn(
|
||||
'PlotItem.addDataItem is deprecated and will be removed in 0.13. '
|
||||
'Use PlotItem.addItem instead',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
self.addItem(item, *args)
|
||||
|
||||
def listDataItems(self):
|
||||
@ -576,7 +584,12 @@ class PlotItem(GraphicsWidget):
|
||||
return self.dataItems[:]
|
||||
|
||||
def addCurve(self, c, params=None):
|
||||
print("PlotItem.addCurve is deprecated. Use addItem instead.")
|
||||
warnings.warn(
|
||||
'PlotItem.addCurve is deprecated and will be removed in 0.13. '
|
||||
'Use PlotItem.addItem instead.',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
self.addItem(c, params)
|
||||
|
||||
def addLine(self, x=None, y=None, z=None, **kwds):
|
||||
@ -1163,7 +1176,11 @@ class PlotItem(GraphicsWidget):
|
||||
self.showAxis(axis, False)
|
||||
|
||||
def showScale(self, *args, **kargs):
|
||||
print("Deprecated. use showAxis() instead")
|
||||
warnings.warn(
|
||||
'PlotItem.showScale has been deprecated and will be removed in 0.13. '
|
||||
'Use PlotItem.showAxis() instead',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
return self.showAxis(*args, **kargs)
|
||||
|
||||
def hideButtons(self):
|
||||
|
@ -22,6 +22,7 @@ from .. import functions as fn
|
||||
from .GraphicsObject import GraphicsObject
|
||||
from .UIGraphicsItem import UIGraphicsItem
|
||||
from .. import getConfigOption
|
||||
import warnings
|
||||
|
||||
translate = QtCore.QCoreApplication.translate
|
||||
|
||||
@ -1890,16 +1891,20 @@ class CircleROI(EllipseROI):
|
||||
|
||||
|
||||
class PolygonROI(ROI):
|
||||
## deprecated. Use PloyLineROI instead.
|
||||
|
||||
|
||||
def __init__(self, positions, pos=None, **args):
|
||||
warnings.warn(
|
||||
'PolygonROI has been deprecated, will be removed in 0.13'
|
||||
'use PolyLineROI instead',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
if pos is None:
|
||||
pos = [0,0]
|
||||
ROI.__init__(self, pos, [1,1], **args)
|
||||
for p in positions:
|
||||
self.addFreeHandle(p)
|
||||
self.setZValue(1000)
|
||||
print("Warning: PolygonROI is deprecated. Use PolyLineROI instead.")
|
||||
|
||||
def listPoints(self):
|
||||
return [p['item'].pos() for p in self.handles]
|
||||
|
@ -119,7 +119,8 @@ def renderSymbol(symbol, size, pen, brush, device=None):
|
||||
|
||||
def makeSymbolPixmap(size, pen, brush, symbol):
|
||||
warnings.warn(
|
||||
"This is an internal function that is no longer being used.",
|
||||
"This is an internal function that is no longer being used. "
|
||||
"Will be removed in 0.13",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
img = renderSymbol(symbol, size, pen, brush)
|
||||
@ -462,7 +463,6 @@ class ScatterPlotItem(GraphicsObject):
|
||||
*hoverSize* A single size to use for hovered spots. Set to -1 to keep size unchanged. Default is -1.
|
||||
*hoverPen* A single pen to use for hovered spots. Set to None to keep pen unchanged. Default is None.
|
||||
*hoverBrush* A single brush to use for hovered spots. Set to None to keep brush unchanged. Default is None.
|
||||
*identical* *Deprecated*. This functionality is handled automatically now.
|
||||
*antialias* Whether to draw symbols with antialiasing. Note that if pxMode is True, symbols are
|
||||
always rendered with antialiasing (since the rendered symbols can be cached, this
|
||||
incurs very little performance cost)
|
||||
@ -474,7 +474,8 @@ class ScatterPlotItem(GraphicsObject):
|
||||
"""
|
||||
if 'identical' in kargs:
|
||||
warnings.warn(
|
||||
"The *identical* functionality is handled automatically now.",
|
||||
"The *identical* functionality is handled automatically now. "
|
||||
"Will be removed in 0.13.",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
oldData = self.data ## this causes cached pixmaps to be preserved while new data is registered.
|
||||
@ -614,7 +615,8 @@ class ScatterPlotItem(GraphicsObject):
|
||||
|
||||
def setPoints(self, *args, **kargs):
|
||||
warnings.warn(
|
||||
"Use setData instead.",
|
||||
"ScatterPlotItem.setPoints is deprecated, use ScatterPlotItem.setData "
|
||||
"instead. Will be removed in 0.13",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
return self.setData(*args, **kargs)
|
||||
@ -863,7 +865,8 @@ class ScatterPlotItem(GraphicsObject):
|
||||
|
||||
def getSpotOpts(self, recs, scale=1.0):
|
||||
warnings.warn(
|
||||
"This is an internal method that is no longer being used.",
|
||||
"This is an internal method that is no longer being used. Will be "
|
||||
"removed in 0.13",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
if recs.ndim == 0:
|
||||
@ -892,7 +895,8 @@ class ScatterPlotItem(GraphicsObject):
|
||||
|
||||
def measureSpotSizes(self, dataSet):
|
||||
warnings.warn(
|
||||
"This is an internal method that is no longer being used.",
|
||||
"This is an internal method that is no longer being used. "
|
||||
"Will be removed in 0.13.",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
for size, pen in zip(*self._style(['size', 'pen'], data=dataSet)):
|
||||
@ -998,7 +1002,8 @@ class ScatterPlotItem(GraphicsObject):
|
||||
|
||||
def mapPointsToDevice(self, pts):
|
||||
warnings.warn(
|
||||
"This is an internal method that is no longer being used.",
|
||||
"This is an internal method that is no longer being used. "
|
||||
"Will be removed in 0.13",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
# Map point locations to device
|
||||
@ -1014,7 +1019,8 @@ class ScatterPlotItem(GraphicsObject):
|
||||
|
||||
def getViewMask(self, pts):
|
||||
warnings.warn(
|
||||
"This is an internal method that is no longer being used.",
|
||||
"This is an internal method that is no longer being used. "
|
||||
"Will be removed in 0.13",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
# Return bool mask indicating all points that are within viewbox
|
||||
|
@ -11,6 +11,7 @@ from .widgets.PlotWidget import *
|
||||
from .imageview import *
|
||||
from .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget
|
||||
from .widgets.GraphicsView import GraphicsView
|
||||
import warnings
|
||||
|
||||
|
||||
class GraphicsWindow(GraphicsLayoutWidget):
|
||||
@ -21,6 +22,11 @@ class GraphicsWindow(GraphicsLayoutWidget):
|
||||
is intended for use from the interactive python prompt.
|
||||
"""
|
||||
def __init__(self, title=None, size=(800,600), **kargs):
|
||||
warnings.warn(
|
||||
'GraphicsWindow is deprecated, use GraphicsLayoutWidget instead,'
|
||||
'will be removed in 0.13',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
mkQApp()
|
||||
GraphicsLayoutWidget.__init__(self, **kargs)
|
||||
self.resize(*size)
|
||||
@ -34,6 +40,10 @@ class TabWindow(QtGui.QMainWindow):
|
||||
(deprecated)
|
||||
"""
|
||||
def __init__(self, title=None, size=(800,600)):
|
||||
warnings.warn(
|
||||
'TabWindow is deprecated, will be removed in 0.13',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
mkQApp()
|
||||
QtGui.QMainWindow.__init__(self)
|
||||
self.resize(*size)
|
||||
@ -54,6 +64,11 @@ class PlotWindow(PlotWidget):
|
||||
(deprecated; use :class:`~pyqtgraph.PlotWidget` instead)
|
||||
"""
|
||||
def __init__(self, title=None, **kargs):
|
||||
warnings.warn(
|
||||
'PlotWindow is deprecated, use PlotWidget instead,'
|
||||
'will be removed in 0.13',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
mkQApp()
|
||||
self.win = QtGui.QMainWindow()
|
||||
PlotWidget.__init__(self, **kargs)
|
||||
@ -76,6 +91,11 @@ class ImageWindow(ImageView):
|
||||
(deprecated; use :class:`~pyqtgraph.ImageView` instead)
|
||||
"""
|
||||
def __init__(self, *args, **kargs):
|
||||
warnings.warn(
|
||||
'ImageWindow is deprecated, use ImageView instead'
|
||||
'will be removed in 0.13',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
mkQApp()
|
||||
self.win = QtGui.QMainWindow()
|
||||
self.win.resize(800,600)
|
||||
|
@ -14,6 +14,7 @@ import types, copy, threading, os, re
|
||||
import pickle
|
||||
import numpy as np
|
||||
from ..python2_3 import basestring
|
||||
import warnings
|
||||
|
||||
|
||||
## By default, the library will use HDF5 when writing files.
|
||||
@ -320,7 +321,11 @@ class MetaArray(object):
|
||||
return self.asarray().astype(dtype)
|
||||
|
||||
def view(self, typ):
|
||||
## deprecated; kept for backward compatibility
|
||||
warnings.warn(
|
||||
'MetaArray.view is deprecated and will be removed in 0.13. '
|
||||
'Use MetaArray.asarray() instead.',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
if typ is np.ndarray:
|
||||
return self.asarray()
|
||||
else:
|
||||
|
@ -4,7 +4,7 @@ import OpenGL.GL.framebufferobjects as glfbo
|
||||
import numpy as np
|
||||
from .. import Vector
|
||||
from .. import functions as fn
|
||||
|
||||
import warnings
|
||||
##Vector = QtGui.QVector3D
|
||||
|
||||
ShareWidget = None
|
||||
@ -359,7 +359,7 @@ class GLViewWidget(QtWidgets.QOpenGLWidget):
|
||||
*relative* String that determines the direction of dx,dy,dz.
|
||||
If "global", then the global coordinate system is used.
|
||||
If "view", then the z axis is aligned with the view
|
||||
direction, and x and y axes are inthe plane of the
|
||||
direction, and x and y axes are in the plane of the
|
||||
view: +x points right, +y points up.
|
||||
If "view-upright", then x is in the global xy plane and
|
||||
points to the right side of the view, y is in the
|
||||
@ -374,8 +374,13 @@ class GLViewWidget(QtWidgets.QOpenGLWidget):
|
||||
False (global). These values are deprecated but still recognized.
|
||||
"""
|
||||
# for backward compatibility:
|
||||
if isinstance(relative, bool):
|
||||
warnings.warn(
|
||||
"'relative' as a boolean is deprecated, and will not be recognized in 0.13. "
|
||||
"Acceptable values are 'global', 'view', or 'view-upright'",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
relative = {True: "view-upright", False: "global"}.get(relative, relative)
|
||||
|
||||
if relative == 'global':
|
||||
self.opts['center'] += QtGui.QVector3D(dx, dy, dz)
|
||||
elif relative == 'view-upright':
|
||||
|
@ -5,6 +5,7 @@ import os, weakref, re
|
||||
from ..pgcollections import OrderedDict
|
||||
from ..python2_3 import asUnicode, basestring
|
||||
from .ParameterItem import ParameterItem
|
||||
import warnings
|
||||
|
||||
PARAM_TYPES = {}
|
||||
PARAM_NAMES = {}
|
||||
@ -703,7 +704,11 @@ class Parameter(QtCore.QObject):
|
||||
def __getattr__(self, attr):
|
||||
## Leaving this undocumented because I might like to remove it in the future..
|
||||
#print type(self), attr
|
||||
|
||||
warnings.warn(
|
||||
'Use of Parameter.subParam is deprecated and will be removed in 0.13 '
|
||||
'Use Parameter.param(name) instead.',
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
if 'names' not in self.__dict__:
|
||||
raise AttributeError(attr)
|
||||
if attr in self.names:
|
||||
|
@ -77,7 +77,6 @@ class SpinBox(QtGui.QAbstractSpinBox):
|
||||
'step': D('0.01'), ## if 'dec' is false, the spinBox steps by 'step' every time
|
||||
## if 'dec' is True, the step size is relative to the value
|
||||
## 'step' needs to be an integral divisor of ten, ie 'step'*n=10 for some integer value of n (but only if dec is True)
|
||||
'log': False, # deprecated
|
||||
'dec': False, ## if true, does decimal stepping. ie from 1-10 it steps by 'step', from 10 to 100 it steps by 10*'step', etc.
|
||||
## if true, minStep must be set in order to cross zero.
|
||||
|
||||
@ -402,13 +401,6 @@ class SpinBox(QtGui.QAbstractSpinBox):
|
||||
val = self.val
|
||||
|
||||
for i in range(int(abs(n))):
|
||||
|
||||
if self.opts['log']:
|
||||
raise Exception("Log mode no longer supported.")
|
||||
# step = abs(val) * self.opts['step']
|
||||
# if 'minStep' in self.opts:
|
||||
# step = max(step, self.opts['minStep'])
|
||||
# val += step * s
|
||||
if self.opts['dec']:
|
||||
if val == 0:
|
||||
step = self.opts['minStep']
|
||||
|
Loading…
Reference in New Issue
Block a user