|
1 | 1 |
|
2 | 2 | QWT_VERSION_STR = '6.1.2' |
3 | 3 |
|
| 4 | +import warnings |
| 5 | + |
4 | 6 | from qwt.qwt_plot import QwtPlot |
5 | | -from qwt.qwt_symbol import QwtSymbol |
| 7 | +from qwt.qwt_symbol import QwtSymbol as QSbl # see deprecated section |
6 | 8 | from qwt.qwt_scale_engine import QwtLinearScaleEngine, QwtLogScaleEngine |
7 | 9 | from qwt.qwt_text import QwtText |
8 | 10 | from qwt.qwt_plot_canvas import QwtPlotCanvas |
9 | | -from qwt.qwt_plot_curve import QwtPlotCurve, QwtPlotItem |
| 11 | +from qwt.qwt_plot_curve import QwtPlotCurve as QPC # see deprecated section |
| 12 | +from qwt.qwt_plot_curve import QwtPlotItem |
10 | 13 | from qwt.qwt_scale_map import QwtScaleMap |
11 | 14 | from qwt.qwt_interval import QwtInterval |
12 | 15 | from qwt.qwt_legend import QwtLegend |
13 | 16 | from qwt.qwt_plot_marker import QwtPlotMarker |
14 | | -from qwt.qwt_plot_grid import QwtPlotGrid |
| 17 | +from qwt.qwt_plot_grid import QwtPlotGrid as QPG # see deprecated section |
15 | 18 | from qwt.qwt_color_map import QwtLinearColorMap |
16 | 19 |
|
17 | 20 | from qwt.toqimage import toQImage |
|
26 | 29 |
|
27 | 30 | from qwt.qwt_plot_renderer import QwtPlotRenderer |
28 | 31 |
|
| 32 | + |
| 33 | +## ============================================================================ |
| 34 | +## Deprecated classes and attributes (to be removed in next major release) |
| 35 | +## ============================================================================ |
| 36 | +# Remove deprecated QwtPlotItem.setAxis (replaced by setAxes) |
| 37 | +# Remove deprecated QwtPlotCanvas.invalidatePaintCache (replaced by replot) |
| 38 | +## ============================================================================ |
| 39 | +class QwtDoubleInterval(QwtInterval): |
| 40 | + def __init__(self, minValue=0., maxValue=-1., borderFlags=None): |
| 41 | + warnings.warn("`QwtDoubleInterval` has been removed in Qwt6: "\ |
| 42 | + "please use `QwtInterval` instead", RuntimeWarning) |
| 43 | + super(QwtDoubleInterval, self).__init__(minValue, maxValue, borderFlags) |
| 44 | +## ============================================================================ |
| 45 | +class QwtLog10ScaleEngine(QwtLogScaleEngine): |
| 46 | + def __init__(self): |
| 47 | + warnings.warn("`QwtLog10ScaleEngine` has been removed in Qwt6: "\ |
| 48 | + "please use `QwtLogScaleEngine` instead", |
| 49 | + RuntimeWarning) |
| 50 | + super(QwtLog10ScaleEngine, self).__init__(10) |
| 51 | +## ============================================================================ |
| 52 | +class QwtPlotPrintFilter(object): |
| 53 | + def __init__(self): |
| 54 | + raise NotImplementedError("`QwtPlotPrintFilter` has been removed in Qwt6: "\ |
| 55 | + "please rely on `QwtPlotRenderer` instead") |
| 56 | +## ============================================================================ |
| 57 | +class QwtPlotCurve(QPC): |
| 58 | + @property |
| 59 | + def Yfx(self): |
| 60 | + raise NotImplementedError("`Yfx` attribute has been removed "\ |
| 61 | + "(curve types are no longer implemented in Qwt6)") |
| 62 | + @property |
| 63 | + def Xfy(self): |
| 64 | + raise NotImplementedError("`Yfx` attribute has been removed "\ |
| 65 | + "(curve types are no longer implemented in Qwt6)") |
| 66 | +## ============================================================================ |
| 67 | +class QwtSymbol(QSbl): |
| 68 | + def draw(self, painter, *args): |
| 69 | + warnings.warn("`draw` has been removed in Qwt6: "\ |
| 70 | + "please rely on `drawSymbol` and `drawSymbols` instead", |
| 71 | + RuntimeWarning) |
| 72 | + from qwt.qt.QtCore import QPointF |
| 73 | + if len(args) == 2: |
| 74 | + self.drawSymbols(painter, [QPointF(*args)]) |
| 75 | + else: |
| 76 | + self.drawSymbol(painter, *args) |
| 77 | +## ============================================================================ |
| 78 | +class QwtPlotGrid(QPG): |
| 79 | + def majPen(self): |
| 80 | + warnings.warn("`majPen` has been removed in Qwt6: "\ |
| 81 | + "please use `majorPen` instead", |
| 82 | + RuntimeWarning) |
| 83 | + return self.majorPen() |
| 84 | + def minPen(self): |
| 85 | + warnings.warn("`minPen` has been removed in Qwt6: "\ |
| 86 | + "please use `minorPen` instead", |
| 87 | + RuntimeWarning) |
| 88 | + return self.minorPen() |
| 89 | + def setMajPen(self, *args): |
| 90 | + warnings.warn("`setMajPen` has been removed in Qwt6: "\ |
| 91 | + "please use `setMajorPen` instead", |
| 92 | + RuntimeWarning) |
| 93 | + return self.setMajorPen(*args) |
| 94 | + def setMinPen(self, *args): |
| 95 | + warnings.warn("`setMinPen` has been removed in Qwt6: "\ |
| 96 | + "please use `setMinorPen` instead", |
| 97 | + RuntimeWarning) |
| 98 | + return self.setMinorPen(*args) |
| 99 | +## ============================================================================ |
| 100 | + |
| 101 | + |
29 | 102 | #TODO: implement QwtClipper: needed for SVG export for example |
0 commit comments