Skip to content

Commit ef72cd7

Browse files
committed
Using QtPy*: tested on PyQt4, PyQt5, Python 2.7, Python 3.4+
Still fails with PySide2 * instead of internal qwt.qt layer
1 parent 9c265a4 commit ef72cd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+407
-998
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ for more details on API limitations when comparing to Qwt.
8282
### Requirements ###
8383
- Python >=2.6 or Python >=3.2
8484
- PyQt4 >=4.4 or PyQt5 >= 5.5
85+
- QtPy
8586
- NumPy >= 1.5
8687

8788
## Installation

doc/installation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Dependencies
77
Requirements:
88
* Python 2.x (x>=6) or 3.x (x>=2)
99
* PyQt4 4.x (x>=3 ; recommended x>=4) or PyQt5 5.x (x>=5)
10+
* QtPy
1011
* NumPy 1.x (x>=5)
1112
* Sphinx 1.x (x>=1) for documentation generation
1213

doc/plot_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import qwt
22
import numpy as np
33

4-
app = qwt.qt.QtGui.QApplication([])
4+
app = qtpy.QtGui.QApplication([])
55
x = np.linspace(-10, 10, 500)
66
plot = qwt.QwtPlot("Trigonometric functions")
77
plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend)

doc/symbol_path_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from qwt.qt.QtGui import QApplication, QPen, QPainterPath, QTransform
2-
from qwt.qt.QtCore import Qt, QPointF
1+
from qtpy.QtGui import QApplication, QPen, QPainterPath, QTransform
2+
from qtpy.QtCore import Qt, QPointF
33
from qwt import QwtPlot, QwtPlotCurve, QwtSymbol
44
import numpy as np
55
import os.path as osp

qwt/__init__.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,37 @@
3333

3434
import warnings
3535

36-
from .plot import QwtPlot
37-
from .symbol import QwtSymbol as QSbl # see deprecated section
38-
from .scale_engine import QwtLinearScaleEngine, QwtLogScaleEngine
39-
from .text import QwtText
40-
from .plot_canvas import QwtPlotCanvas
41-
from .plot_curve import QwtPlotCurve as QPC # see deprecated section
42-
from .plot_curve import QwtPlotItem
43-
from .scale_map import QwtScaleMap
44-
from .interval import QwtInterval
45-
from .legend import QwtLegend, QwtLegendData, QwtLegendLabel
46-
from .plot_marker import QwtPlotMarker
47-
from .plot_grid import QwtPlotGrid as QPG # see deprecated section
48-
from .color_map import QwtLinearColorMap
49-
50-
from .toqimage import array_to_qimage as toQImage
51-
52-
from .scale_div import QwtScaleDiv
53-
from .scale_draw import QwtScaleDraw
54-
from .scale_draw import QwtAbstractScaleDraw
55-
from .painter import QwtPainter
56-
57-
from .plot_series import (
36+
from qwt.plot import QwtPlot
37+
from qwt.symbol import QwtSymbol as QSbl # see deprecated section
38+
from qwt.scale_engine import QwtLinearScaleEngine, QwtLogScaleEngine
39+
from qwt.text import QwtText
40+
from qwt.plot_canvas import QwtPlotCanvas
41+
from qwt.plot_curve import QwtPlotCurve as QPC # see deprecated section
42+
from qwt.plot_curve import QwtPlotItem
43+
from qwt.scale_map import QwtScaleMap
44+
from qwt.interval import QwtInterval
45+
from qwt.legend import QwtLegend, QwtLegendData, QwtLegendLabel
46+
from qwt.plot_marker import QwtPlotMarker
47+
from qwt.plot_grid import QwtPlotGrid as QPG # see deprecated section
48+
from qwt.color_map import QwtLinearColorMap
49+
50+
from qwt.toqimage import array_to_qimage as toQImage
51+
52+
from qwt.scale_div import QwtScaleDiv
53+
from qwt.scale_draw import QwtScaleDraw
54+
from qwt.scale_draw import QwtAbstractScaleDraw
55+
from qwt.painter import QwtPainter
56+
57+
from qwt.plot_series import (
5858
QwtSeriesData,
5959
QwtPointArrayData,
6060
QwtSeriesStore,
6161
QwtPlotSeriesItem,
6262
)
6363

64-
from .plot_renderer import QwtPlotRenderer
64+
from qwt.plot_renderer import QwtPlotRenderer
6565

66-
from .plot_directpainter import QwtPlotDirectPainter
66+
from qwt.plot_directpainter import QwtPlotDirectPainter
6767

6868

6969
## ============================================================================
@@ -127,7 +127,7 @@ def draw(self, painter, *args):
127127
"please rely on `drawSymbol` and `drawSymbols` instead",
128128
RuntimeWarning,
129129
)
130-
from .qt.QtCore import QPointF
130+
from qtpy.QtCore import QPointF
131131

132132
if len(args) == 2:
133133
self.drawSymbols(painter, [QPointF(*args)])

qwt/_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from __future__ import division
99

10-
from .qt.QtCore import qFuzzyCompare
10+
from qtpy.QtCore import qFuzzyCompare
1111

1212
import math
1313

qwt/color_map.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
:members:
2929
"""
3030

31-
from .qt.QtGui import QColor, qRed, qGreen, qBlue, qRgb, qRgba, qAlpha
32-
from .qt.QtCore import Qt, qIsNaN
31+
from qtpy.QtGui import QColor, qRed, qGreen, qBlue, qRgb, qRgba, qAlpha
32+
from qtpy.QtCore import Qt, qIsNaN
3333

3434

3535
class ColorStop(object):

qwt/column_symbol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# Copyright (c) 2015 Pierre Raybaut, for the Python translation/optimization
66
# (see LICENSE file for more details)
77

8-
from .interval import QwtInterval
8+
from qwt.interval import QwtInterval
99

10-
from .qt.QtGui import QPolygonF, QPalette
11-
from .qt.QtCore import QRectF, Qt
10+
from qtpy.QtGui import QPolygonF, QPalette
11+
from qtpy.QtCore import QRectF, Qt
1212

1313

1414
def qwtDrawBox(p, rect, pal, lw):

qwt/dyngrid_layout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
:members:
1616
"""
1717

18-
from .qt.QtGui import QLayout
19-
from .qt.QtCore import Qt, QRect, QSize
18+
from qtpy.QtWidgets import QLayout
19+
from qtpy.QtCore import Qt, QRect, QSize
2020

2121

2222
class QwtDynGridLayout_PrivateData(object):

qwt/graphic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
:members:
1414
"""
1515

16-
from .null_paintdevice import QwtNullPaintDevice
17-
from .painter_command import QwtPainterCommand
16+
from qwt.null_paintdevice import QwtNullPaintDevice
17+
from qwt.painter_command import QwtPainterCommand
1818

19-
from .qt.QtGui import (
19+
from qtpy.QtGui import (
2020
QPainter,
2121
QPainterPathStroker,
2222
QPaintEngine,
2323
QPixmap,
2424
QTransform,
2525
QImage,
2626
)
27-
from .qt.QtCore import Qt, QRectF, QSizeF, QSize, QPointF, QRect
27+
from qtpy.QtCore import Qt, QRectF, QSizeF, QSize, QPointF, QRect
2828

2929
import numpy as np
3030

0 commit comments

Comments
 (0)