PythonQwt 0.10.4__tar.gz → 0.10.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/CHANGELOG.md +22 -0
  2. {PythonQwt-0.10.4/PythonQwt.egg-info → PythonQwt-0.10.6}/PKG-INFO +1 -1
  3. {PythonQwt-0.10.4 → PythonQwt-0.10.6/PythonQwt.egg-info}/PKG-INFO +1 -1
  4. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/PythonQwt.egg-info/SOURCES.txt +8 -0
  5. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/README.md +9 -0
  6. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/__init__.py +1 -1
  7. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/dyngrid_layout.py +5 -3
  8. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/graphic.py +6 -13
  9. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/legend.py +9 -7
  10. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/painter.py +15 -31
  11. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot.py +86 -134
  12. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_canvas.py +12 -14
  13. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_layout.py +8 -2
  14. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_renderer.py +37 -23
  15. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/scale_map.py +13 -21
  16. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/scale_widget.py +4 -1
  17. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/symbol.py +15 -18
  18. PythonQwt-0.10.6/qwt/tests/data/basesymbol.png +0 -0
  19. PythonQwt-0.10.6/qwt/tests/data/bodedemo.png +0 -0
  20. PythonQwt-0.10.6/qwt/tests/data/builtinsymbol.png +0 -0
  21. PythonQwt-0.10.6/qwt/tests/data/curvebenchmark1.png +0 -0
  22. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/curvebenchmark2.png +0 -0
  23. PythonQwt-0.10.6/qwt/tests/data/data.png +0 -0
  24. PythonQwt-0.10.6/qwt/tests/data/graphic.png +0 -0
  25. PythonQwt-0.10.6/qwt/tests/data/image.png +0 -0
  26. PythonQwt-0.10.6/qwt/tests/data/loadtest.png +0 -0
  27. PythonQwt-0.10.6/qwt/tests/data/mapdemo.png +0 -0
  28. PythonQwt-0.10.6/qwt/tests/data/path.png +0 -0
  29. PythonQwt-0.10.6/qwt/tests/data/pixmap.png +0 -0
  30. PythonQwt-0.10.6/qwt/tests/data/simple.png +0 -0
  31. PythonQwt-0.10.6/qwt/tests/data/svgdocument.png +0 -0
  32. PythonQwt-0.10.6/qwt/tests/data/symbol.svg +411 -0
  33. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/testlauncher.png +0 -0
  34. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_bodedemo.py +43 -24
  35. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_curvebenchmark1.py +12 -10
  36. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_curvebenchmark2.py +1 -1
  37. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_loadtest.py +4 -4
  38. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_simple.py +15 -2
  39. PythonQwt-0.10.6/qwt/tests/test_symbols.py +201 -0
  40. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/utils.py +17 -8
  41. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/text.py +13 -10
  42. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/setup.py +2 -2
  43. PythonQwt-0.10.4/qwt/tests/data/bodedemo.png +0 -0
  44. PythonQwt-0.10.4/qwt/tests/data/curvebenchmark1.png +0 -0
  45. PythonQwt-0.10.4/qwt/tests/data/data.png +0 -0
  46. PythonQwt-0.10.4/qwt/tests/data/image.png +0 -0
  47. PythonQwt-0.10.4/qwt/tests/data/loadtest.png +0 -0
  48. PythonQwt-0.10.4/qwt/tests/data/mapdemo.png +0 -0
  49. PythonQwt-0.10.4/qwt/tests/data/simple.png +0 -0
  50. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/LICENSE +0 -0
  51. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/MANIFEST.in +0 -0
  52. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/PythonQwt.egg-info/dependency_links.txt +0 -0
  53. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/PythonQwt.egg-info/entry_points.txt +0 -0
  54. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/PythonQwt.egg-info/requires.txt +0 -0
  55. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/PythonQwt.egg-info/top_level.txt +0 -0
  56. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/_static/PythonQwt_logo.png +0 -0
  57. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/_static/QwtPlot_example.png +0 -0
  58. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/_static/panorama.png +0 -0
  59. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/_static/symbol_path_example.png +0 -0
  60. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/conf.py +0 -0
  61. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/bodedemo.rst +0 -0
  62. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/cartesian.rst +0 -0
  63. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/cpudemo.rst +0 -0
  64. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/curvebenchmark1.rst +0 -0
  65. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/curvebenchmark2.rst +0 -0
  66. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/curvedemo1.rst +0 -0
  67. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/curvedemo2.rst +0 -0
  68. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/data.rst +0 -0
  69. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/errorbar.rst +0 -0
  70. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/eventfilter.rst +0 -0
  71. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/image.rst +0 -0
  72. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/index.rst +0 -0
  73. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/logcurve.rst +0 -0
  74. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/mapdemo.rst +0 -0
  75. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/multidemo.rst +0 -0
  76. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/simple.rst +0 -0
  77. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/examples/vertical.rst +0 -0
  78. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/index.rst +0 -0
  79. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/installation.rst +0 -0
  80. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/overview.rst +0 -0
  81. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/plot_example.py +0 -0
  82. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/graphic.rst +0 -0
  83. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/index.rst +0 -0
  84. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/interval.rst +0 -0
  85. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/plot.rst +0 -0
  86. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/plot_directpainter.rst +0 -0
  87. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/plot_layout.rst +0 -0
  88. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/plot_series.rst +0 -0
  89. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/scale.rst +0 -0
  90. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/symbol.rst +0 -0
  91. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/text.rst +0 -0
  92. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/toqimage.rst +0 -0
  93. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/reference/transform.rst +0 -0
  94. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/doc/symbol_path_example.py +0 -0
  95. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/_math.py +0 -0
  96. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/color_map.py +0 -0
  97. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/column_symbol.py +0 -0
  98. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/interval.py +0 -0
  99. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/null_paintdevice.py +0 -0
  100. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/painter_command.py +0 -0
  101. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_curve.py +0 -0
  102. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_directpainter.py +0 -0
  103. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_grid.py +0 -0
  104. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_marker.py +0 -0
  105. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/plot_series.py +0 -0
  106. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/qthelpers.py +0 -0
  107. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/scale_div.py +0 -0
  108. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/scale_draw.py +0 -0
  109. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/scale_engine.py +0 -0
  110. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/__init__.py +0 -0
  111. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/comparative_benchmarks.py +0 -0
  112. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/conftest.py +0 -0
  113. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/PythonQwt.svg +0 -0
  114. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/cartesian.png +0 -0
  115. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/cpudemo.png +0 -0
  116. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/curvedemo1.png +0 -0
  117. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/curvedemo2.png +0 -0
  118. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/errorbar.png +0 -0
  119. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/eventfilter.png +0 -0
  120. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/logcurve.png +0 -0
  121. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/multidemo.png +0 -0
  122. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/stylesheet.png +0 -0
  123. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/data/vertical.png +0 -0
  124. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_cartesian.py +0 -0
  125. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_cpudemo.py +0 -0
  126. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_curvedemo1.py +0 -0
  127. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_curvedemo2.py +0 -0
  128. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_data.py +0 -0
  129. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_errorbar.py +0 -0
  130. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_eventfilter.py +0 -0
  131. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_image.py +0 -0
  132. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_logcurve.py +0 -0
  133. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_mapdemo.py +0 -0
  134. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_multidemo.py +0 -0
  135. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_stylesheet.py +0 -0
  136. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/tests/test_vertical.py +0 -0
  137. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/toqimage.py +0 -0
  138. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/qwt/transform.py +0 -0
  139. {PythonQwt-0.10.4 → PythonQwt-0.10.6}/setup.cfg +0 -0
@@ -1,5 +1,27 @@
1
1
  # PythonQwt Releases
2
2
 
3
+ ## Version 0.10.6
4
+
5
+ - Qt6 support:
6
+ - Handled all occurences of deprecated ``QWidget.getContentsMargins`` method.
7
+ - Removed references to NonCosmeticDefaultPen
8
+ - Fixed `QApplication.desktop` `AttributeError`
9
+ - Fixed `QPrinter.HighResolution` `AttributeError` on Linux
10
+ - Fixed `QPrinter.setColorMode` `AttributeError` on PyQt6/Linux
11
+ - Fixed `QPrinter.setOrientation` deprecation issue
12
+ - Fixed `QPrinter.setPaperSize` deprecation issue
13
+ - Improved unit tests:
14
+ - Ensure that tests are entirely executed before quitting (in unattended mode)
15
+ - Added more tests on `qwt.symbols`
16
+ - Added tests on `qwt.plot_renderer`
17
+ - `qwt.plot_renderer`: fixed resolution type
18
+ - `qwt.symbols`: fixed `QPointF` type mismatch
19
+ - Removed CHM help file generation (obsolete)
20
+
21
+ ## Version 0.10.5
22
+
23
+ - [Issue #81](https://github.com/PlotPyStack/PythonQwt/issues/81) - Signal disconnection issue with PySide 6.5.3
24
+
3
25
  ## Version 0.10.4
4
26
 
5
27
  - [Issue #80](https://github.com/PlotPyStack/PythonQwt/issues/80) - Print to PDF: AttributeError: 'NoneType' object has no attribute 'getContentsMargins'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PythonQwt
3
- Version: 0.10.4
3
+ Version: 0.10.6
4
4
  Summary: Qt plotting widgets for Python
5
5
  Home-page: https://github.com/PlotPyStack/PythonQwt
6
6
  Author: Pierre Raybaut
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PythonQwt
3
- Version: 0.10.4
3
+ Version: 0.10.6
4
4
  Summary: Qt plotting widgets for Python
5
5
  Home-page: https://github.com/PlotPyStack/PythonQwt
6
6
  Author: Pierre Raybaut
@@ -98,10 +98,13 @@ qwt/tests/test_mapdemo.py
98
98
  qwt/tests/test_multidemo.py
99
99
  qwt/tests/test_simple.py
100
100
  qwt/tests/test_stylesheet.py
101
+ qwt/tests/test_symbols.py
101
102
  qwt/tests/test_vertical.py
102
103
  qwt/tests/utils.py
103
104
  qwt/tests/data/PythonQwt.svg
105
+ qwt/tests/data/basesymbol.png
104
106
  qwt/tests/data/bodedemo.png
107
+ qwt/tests/data/builtinsymbol.png
105
108
  qwt/tests/data/cartesian.png
106
109
  qwt/tests/data/cpudemo.png
107
110
  qwt/tests/data/curvebenchmark1.png
@@ -111,12 +114,17 @@ qwt/tests/data/curvedemo2.png
111
114
  qwt/tests/data/data.png
112
115
  qwt/tests/data/errorbar.png
113
116
  qwt/tests/data/eventfilter.png
117
+ qwt/tests/data/graphic.png
114
118
  qwt/tests/data/image.png
115
119
  qwt/tests/data/loadtest.png
116
120
  qwt/tests/data/logcurve.png
117
121
  qwt/tests/data/mapdemo.png
118
122
  qwt/tests/data/multidemo.png
123
+ qwt/tests/data/path.png
124
+ qwt/tests/data/pixmap.png
119
125
  qwt/tests/data/simple.png
120
126
  qwt/tests/data/stylesheet.png
127
+ qwt/tests/data/svgdocument.png
128
+ qwt/tests/data/symbol.svg
121
129
  qwt/tests/data/testlauncher.png
122
130
  qwt/tests/data/vertical.png
@@ -85,6 +85,15 @@ plot items needed by `guiqwt`): `QwtPlotItem` (base class), `QwtPlotItem`,
85
85
  See "Overview" section in [documentation](https://pythonqwt.readthedocs.io/en/latest/)
86
86
  for more details on API limitations when comparing to Qwt.
87
87
 
88
+ ## Roadmap
89
+
90
+ The `qwt` package short-term roadmap is the following:
91
+
92
+ - [ ] Drop support for PyQt4 and PySide2
93
+ - [ ] Drop support for Python < 3.8
94
+ - [ ] Replace `setup.py` by `pyproject.toml`, using `setuptools` (e.g. see `guidata`)
95
+ - [ ] Add more unit tests: the ultimate goal is to reach 90% code coverage
96
+
88
97
  ## Dependencies
89
98
 
90
99
  ### Requirements
@@ -27,7 +27,7 @@ External resources:
27
27
  .. _GitHub: https://github.com/PlotPyStack/PythonQwt
28
28
  """
29
29
 
30
- __version__ = "0.10.4"
30
+ __version__ = "0.10.6"
31
31
  QWT_VERSION_STR = "6.1.5"
32
32
 
33
33
  import warnings
@@ -299,9 +299,11 @@ class QwtDynGridLayout(QLayout):
299
299
  return
300
300
  expandH = self.expandingDirections() & Qt.Horizontal
301
301
  expandV = self.expandingDirections() & Qt.Vertical
302
- mleft, mtop, mright, mbottom = self.getContentsMargins()
302
+ margins = self.contentsMargins()
303
+ wmargins = margins.left() + margins.right()
304
+ hmargins = margins.top() + margins.bottom()
303
305
  if expandH:
304
- xDelta = rect.width() - (mleft + mright) - (numColumns - 1) * self.spacing()
306
+ xDelta = rect.width() - wmargins - (numColumns - 1) * self.spacing()
305
307
  for col in range(numColumns):
306
308
  xDelta -= colWidth[col]
307
309
  if xDelta > 0:
@@ -313,7 +315,7 @@ class QwtDynGridLayout(QLayout):
313
315
  numRows = self.itemCount() / numColumns
314
316
  if self.itemCount() % numColumns:
315
317
  numRows += 1
316
- yDelta = rect.height() - (mtop + mbottom) - (numRows - 1) * self.spacing()
318
+ yDelta = rect.height() - hmargins - (numRows - 1) * self.spacing()
317
319
  for row in range(numRows):
318
320
  yDelta -= rowHeight[row]
319
321
  if yDelta > 0:
@@ -14,18 +14,19 @@ QwtGraphic
14
14
  """
15
15
 
16
16
  import math
17
- from qwt.null_paintdevice import QwtNullPaintDevice
18
- from qwt.painter_command import QwtPainterCommand
19
17
 
18
+ from qtpy.QtCore import QPointF, QRect, QRectF, QSize, QSizeF, Qt
20
19
  from qtpy.QtGui import (
20
+ QImage,
21
+ QPaintEngine,
21
22
  QPainter,
22
23
  QPainterPathStroker,
23
- QPaintEngine,
24
24
  QPixmap,
25
25
  QTransform,
26
- QImage,
27
26
  )
28
- from qtpy.QtCore import Qt, QRectF, QSizeF, QSize, QPointF, QRect
27
+
28
+ from qwt.null_paintdevice import QwtNullPaintDevice
29
+ from qwt.painter_command import QwtPainterCommand
29
30
 
30
31
 
31
32
  def qwtHasScalablePen(painter):
@@ -33,10 +34,6 @@ def qwtHasScalablePen(painter):
33
34
  scalablePen = False
34
35
  if pen.style() != Qt.NoPen and pen.brush().style() != Qt.NoBrush:
35
36
  scalablePen = not pen.isCosmetic()
36
- if not scalablePen and pen.widthF() == 0.0:
37
- hints = painter.renderHints()
38
- if hints & QPainter.NonCosmeticDefaultPen:
39
- scalablePen = True
40
37
  return scalablePen
41
38
 
42
39
 
@@ -65,10 +62,6 @@ def qwtExecCommand(painter, cmd, renderHints, transform, initialTransform):
65
62
  and painter.transform().isScaling()
66
63
  ):
67
64
  isCosmetic = painter.pen().isCosmetic()
68
- if isCosmetic and painter.pen().widthF() == 0.0:
69
- hints = painter.renderHints()
70
- if hints & QPainter.NonCosmeticDefaultPen:
71
- isCosmetic = False
72
65
  doMap = not isCosmetic
73
66
  if doMap:
74
67
  tr = painter.transform()
@@ -308,7 +308,8 @@ class QwtLegendLabel(QwtTextLabel):
308
308
  spacing = max([spacing, 0])
309
309
  if spacing != self.__data.spacing:
310
310
  self.__data.spacing = spacing
311
- margin = max(self.getContentsMargins())
311
+ mgn = self.contentsMargins()
312
+ margin = max([mgn.left(), mgn.top(), mgn.right(), mgn.bottom()])
312
313
  indent = margin + self.__data.spacing
313
314
  if self.__data.icon.width() > 0:
314
315
  indent += self.__data.icon.width() + self.__data.spacing
@@ -912,12 +913,12 @@ class QwtLegend(QwtAbstractLegend):
912
913
  legendLayout = self.__data.view.contentsWidget.layout()
913
914
  if legendLayout is None:
914
915
  return
915
- left, right, top, bottom = self.layout().getContentsMargins()
916
+ margins = self.layout().contentsMargins()
916
917
  layoutRect = QRect()
917
- layoutRect.setLeft(math.ceil(rect.left()) + left)
918
- layoutRect.setTop(math.ceil(rect.top()) + top)
919
- layoutRect.setRight(math.ceil(rect.right()) - right)
920
- layoutRect.setBottom(math.ceil(rect.bottom()) - bottom)
918
+ layoutRect.setLeft(math.ceil(rect.left()) + margins.left())
919
+ layoutRect.setTop(math.ceil(rect.top()) + margins.top())
920
+ layoutRect.setRight(math.ceil(rect.right()) - margins.right())
921
+ layoutRect.setBottom(math.ceil(rect.bottom()) - margins.bottom())
921
922
  numCols = legendLayout.columnsForWidth(layoutRect.width())
922
923
  itemRects = legendLayout.layoutItems(layoutRect, numCols)
923
924
  index = 0
@@ -949,7 +950,8 @@ class QwtLegend(QwtAbstractLegend):
949
950
  if label is not None:
950
951
  icon = label.data().icon()
951
952
  sz = icon.defaultSize()
952
- margin = max(label.getContentsMargins())
953
+ mgn = label.contentsMargins()
954
+ margin = max([mgn.left(), mgn.top(), mgn.right(), mgn.bottom()])
953
955
  iconRect = QRectF(
954
956
  rect.x() + margin,
955
957
  rect.center().y() - 0.5 * sz.height(),
@@ -13,24 +13,24 @@ QwtPainterClass
13
13
  :members:
14
14
  """
15
15
 
16
- from qwt.color_map import QwtColorMap
17
- from qwt.scale_map import QwtScaleMap
18
-
16
+ from qtpy import QtCore as QC
17
+ from qtpy.QtCore import QLineF, QPoint, QRect, QRectF, Qt
19
18
  from qtpy.QtGui import (
19
+ QBrush,
20
+ QColor,
21
+ QLinearGradient,
20
22
  QPaintEngine,
21
- QPixmap,
22
23
  QPainter,
24
+ QPainterPath,
23
25
  QPalette,
24
26
  QPen,
25
- QBrush,
27
+ QPixmap,
26
28
  QRegion,
27
- QLinearGradient,
28
- QPainterPath,
29
- QColor,
30
29
  )
31
- from qtpy.QtWidgets import QFrame, QStyle, QStyleOptionFocusRect, QStyleOption
32
- from qtpy.QtCore import Qt, QRect, QPoint, QRectF, QLineF
33
- from qtpy import QtCore as QC
30
+ from qtpy.QtWidgets import QFrame, QStyle, QStyleOption, QStyleOptionFocusRect
31
+
32
+ from qwt.color_map import QwtColorMap
33
+ from qwt.scale_map import QwtScaleMap
34
34
 
35
35
  QT_MAJOR_VERSION = int(QC.__version__.split(".")[0])
36
36
 
@@ -64,26 +64,10 @@ class QwtPainterClass(object):
64
64
  """A collection of `QPainter` workarounds"""
65
65
 
66
66
  def drawImage(self, painter, rect, image):
67
- alignedRect = rect.toAlignedRect()
68
- if alignedRect != rect:
69
- clipRect = rect.adjusted(0.0, 0.0, -1.0, -1.0)
70
- painter.save()
71
- painter.setClipRect(clipRect, Qt.IntersectClip)
72
- painter.drawImage(alignedRect, image)
73
- painter.restore()
74
- else:
75
- painter.drawImage(alignedRect, image)
67
+ painter.drawImage(rect, image)
76
68
 
77
69
  def drawPixmap(self, painter, rect, pixmap):
78
- alignedRect = rect.toAlignedRect()
79
- if alignedRect != rect:
80
- clipRect = rect.adjusted(0.0, 0.0, -1.0, -1.0)
81
- painter.save()
82
- painter.setClipRect(clipRect, Qt.IntersectClip)
83
- painter.drawPixmap(alignedRect, pixmap)
84
- painter.restore()
85
- else:
86
- painter.drawPixmap(alignedRect, pixmap)
70
+ painter.drawPixmap(rect, pixmap)
87
71
 
88
72
  def drawFocusRect(self, *args):
89
73
  if len(args) == 2:
@@ -397,7 +381,7 @@ class QwtPainterClass(object):
397
381
  pmPainter.setPen(c)
398
382
  pmPainter.drawLine(QLineF(devRect.left(), y, devRect.right(), y))
399
383
  pmPainter.end()
400
- self.drawPixmap(painter, rect, pixmap)
384
+ self.drawPixmap(painter, devRect, pixmap)
401
385
 
402
386
  def fillPixmap(self, widget, pixmap, offset=None):
403
387
  """
@@ -447,7 +431,7 @@ class QwtPainterClass(object):
447
431
  if widget.testAttribute(Qt.WA_StyledBackground):
448
432
  opt = QStyleOption()
449
433
  opt.initFrom(widget)
450
- opt.rect = QRectF(rect).toAlignedRect()
434
+ opt.rect = rect
451
435
  widget.style().drawPrimitive(QStyle.PE_Widget, opt, painter, widget)
452
436
  else:
453
437
  brush = widget.palette().brush(widget.backgroundRole())
@@ -21,34 +21,21 @@ QwtPlotItem
21
21
 
22
22
  import math
23
23
 
24
- from qtpy.QtWidgets import (
25
- QWidget,
26
- QSizePolicy,
27
- QFrame,
28
- QApplication,
29
- )
30
- from qtpy.QtGui import QFont, QPainter, QPalette, QColor, QBrush
31
- from qtpy.QtCore import Qt, Signal, QEvent, QSize, QRectF
24
+ import numpy as np
25
+ from qtpy.QtCore import QEvent, QRectF, QSize, Qt, Signal
26
+ from qtpy.QtGui import QBrush, QColor, QFont, QPainter, QPalette
27
+ from qtpy.QtWidgets import QApplication, QFrame, QSizePolicy, QWidget
32
28
 
33
- from qwt.text import QwtText, QwtTextLabel
34
- from qwt.scale_widget import QwtScaleWidget
35
- from qwt.scale_draw import QwtScaleDraw
36
- from qwt.scale_engine import QwtLinearScaleEngine
29
+ from qwt.graphic import QwtGraphic
30
+ from qwt.interval import QwtInterval
31
+ from qwt.legend import QwtLegendData
37
32
  from qwt.plot_canvas import QwtPlotCanvas
38
33
  from qwt.scale_div import QwtScaleDiv
34
+ from qwt.scale_draw import QwtScaleDraw
35
+ from qwt.scale_engine import QwtLinearScaleEngine
39
36
  from qwt.scale_map import QwtScaleMap
40
- from qwt.graphic import QwtGraphic
41
- from qwt.legend import QwtLegendData
42
- from qwt.interval import QwtInterval
43
-
44
- import numpy as np
45
-
46
-
47
- def qwtEnableLegendItems(plot, on):
48
- if on:
49
- plot.legendDataChanged.connect(plot.updateLegendItems)
50
- else:
51
- plot.legendDataChanged.disconnect(plot.updateLegendItems)
37
+ from qwt.scale_widget import QwtScaleWidget
38
+ from qwt.text import QwtText, QwtTextLabel
52
39
 
53
40
 
54
41
  def qwtSetTabOrder(first, second, with_children):
@@ -88,111 +75,10 @@ class ItemList(list):
88
75
  self.sortItems()
89
76
 
90
77
 
91
- class QwtPlotDict_PrivateData(object):
92
- def __init__(self):
93
- self.itemList = ItemList()
94
- self.autoDelete = True
95
-
96
-
97
- class QwtPlotDict(object):
98
- """
99
- A dictionary for plot items
100
-
101
- `QwtPlotDict` organizes plot items in increasing z-order.
102
- If `autoDelete()` is enabled, all attached items will be deleted
103
- in the destructor of the dictionary.
104
- `QwtPlotDict` can be used to get access to all `QwtPlotItem` items - or
105
- all items of a specific type - that are currently on the plot.
106
-
107
- .. seealso::
108
-
109
- :py:meth:`QwtPlotItem.attach()`, :py:meth:`QwtPlotItem.detach()`,
110
- :py:meth:`QwtPlotItem.z()`
111
- """
112
-
113
- def __init__(self):
114
- self.__data = QwtPlotDict_PrivateData()
115
-
116
- def setAutoDelete(self, autoDelete):
117
- """
118
- En/Disable Auto deletion
119
-
120
- If Auto deletion is on all attached plot items will be deleted
121
- in the destructor of `QwtPlotDict`. The default value is on.
122
-
123
- :param bool autoDelete: enable/disable
124
-
125
- .. seealso::
126
-
127
- :py:meth:`autoDelete()`, :py:meth:`insertItem()`
128
- """
129
- self.__data.autoDelete = autoDelete
130
-
131
- def autoDelete(self):
132
- """
133
- :return: true if auto deletion is enabled
134
-
135
- .. seealso::
136
-
137
- :py:meth:`setAutoDelete()`, :py:meth:`insertItem()`
138
- """
139
- return self.__data.autoDelete
140
-
141
- def insertItem(self, item):
142
- """
143
- Insert a plot item
144
-
145
- :param qwt.plot.QwtPlotItem item: PlotItem
146
-
147
- .. seealso::
148
-
149
- :py:meth:`removeItem()`
150
- """
151
- self.__data.itemList.insertItem(item)
152
-
153
- def removeItem(self, item):
154
- """
155
- Remove a plot item
156
-
157
- :param qwt.plot.QwtPlotItem item: PlotItem
158
-
159
- .. seealso::
160
-
161
- :py:meth:`insertItem()`
162
- """
163
- self.__data.itemList.removeItem(item)
164
-
165
- def detachItems(self, rtti=None):
166
- """
167
- Detach items from the dictionary
168
-
169
- :param rtti: In case of `QwtPlotItem.Rtti_PlotItem` or None (default) detach all items otherwise only those items of the type rtti.
170
- :type rtti: int or None
171
- """
172
- for item in self.__data.itemList[:]:
173
- if rtti in (None, QwtPlotItem.Rtti_PlotItem) or item.rtti() == rtti:
174
- item.attach(None)
175
-
176
- def itemList(self, rtti=None):
177
- """
178
- A list of attached plot items.
179
-
180
- Use caution when iterating these lists, as removing/detaching an
181
- item will invalidate the iterator. Instead you can place pointers
182
- to objects to be removed in a removal list, and traverse that list
183
- later.
184
-
185
- :param int rtti: In case of `QwtPlotItem.Rtti_PlotItem` detach all items otherwise only those items of the type rtti.
186
- :return: List of all attached plot items of a specific type. If rtti is None, return a list of all attached plot items.
187
- """
188
- if rtti is None or rtti == QwtPlotItem.Rtti_PlotItem:
189
- return self.__data.itemList
190
- return [item for item in self.__data.itemList if item.rtti() == rtti]
191
-
192
-
193
- class QwtPlot_PrivateData(QwtPlotDict_PrivateData):
78
+ class QwtPlot_PrivateData(object):
194
79
  def __init__(self):
195
80
  super(QwtPlot_PrivateData, self).__init__()
81
+ self.itemList = ItemList()
196
82
  self.titleLabel = None
197
83
  self.footerLabel = None
198
84
  self.canvas = None
@@ -217,7 +103,7 @@ class AxisData(object):
217
103
  self.scaleWidget = None # QwtScaleWidget
218
104
 
219
105
 
220
- class QwtPlot(QwtPlotDict, QFrame):
106
+ class QwtPlot(QFrame):
221
107
  """
222
108
  A 2-D plotting widget
223
109
 
@@ -300,7 +186,6 @@ class QwtPlot(QwtPlotDict, QFrame):
300
186
  "%s() takes 0, 1 or 2 argument(s) (%s given)"
301
187
  % (self.__class__.__name__, len(args))
302
188
  )
303
- QwtPlotDict.__init__(self)
304
189
  QFrame.__init__(self, parent)
305
190
 
306
191
  self.__layout_state = None
@@ -359,7 +244,74 @@ class QwtPlot(QwtPlotDict, QFrame):
359
244
  for idx in range(len(focusChain) - 1):
360
245
  qwtSetTabOrder(focusChain[idx], focusChain[idx + 1], False)
361
246
 
362
- qwtEnableLegendItems(self, True)
247
+ self.legendDataChanged.connect(self.updateLegendItems)
248
+
249
+ def insertItem(self, item):
250
+ """
251
+ Insert a plot item
252
+
253
+ :param qwt.plot.QwtPlotItem item: PlotItem
254
+
255
+ .. seealso::
256
+
257
+ :py:meth:`removeItem()`
258
+
259
+ .. note::
260
+
261
+ This was a member of QwtPlotDict in older versions.
262
+ """
263
+ self.__data.itemList.insertItem(item)
264
+
265
+ def removeItem(self, item):
266
+ """
267
+ Remove a plot item
268
+
269
+ :param qwt.plot.QwtPlotItem item: PlotItem
270
+
271
+ .. seealso::
272
+
273
+ :py:meth:`insertItem()`
274
+
275
+ .. note::
276
+
277
+ This was a member of QwtPlotDict in older versions.
278
+ """
279
+ self.__data.itemList.removeItem(item)
280
+
281
+ def detachItems(self, rtti=None):
282
+ """
283
+ Detach items from the dictionary
284
+
285
+ :param rtti: In case of `QwtPlotItem.Rtti_PlotItem` or None (default) detach all items otherwise only those items of the type rtti.
286
+ :type rtti: int or None
287
+
288
+ .. note::
289
+
290
+ This was a member of QwtPlotDict in older versions.
291
+ """
292
+ for item in self.__data.itemList[:]:
293
+ if rtti in (None, QwtPlotItem.Rtti_PlotItem) or item.rtti() == rtti:
294
+ item.attach(None)
295
+
296
+ def itemList(self, rtti=None):
297
+ """
298
+ A list of attached plot items.
299
+
300
+ Use caution when iterating these lists, as removing/detaching an
301
+ item will invalidate the iterator. Instead you can place pointers
302
+ to objects to be removed in a removal list, and traverse that list
303
+ later.
304
+
305
+ :param int rtti: In case of `QwtPlotItem.Rtti_PlotItem` detach all items otherwise only those items of the type rtti.
306
+ :return: List of all attached plot items of a specific type. If rtti is None, return a list of all attached plot items.
307
+
308
+ .. note::
309
+
310
+ This was a member of QwtPlotDict in older versions.
311
+ """
312
+ if rtti is None or rtti == QwtPlotItem.Rtti_PlotItem:
313
+ return self.__data.itemList
314
+ return [item for item in self.__data.itemList if item.rtti() == rtti]
363
315
 
364
316
  def setFlatStyle(self, state):
365
317
  """
@@ -1573,9 +1525,9 @@ class QwtPlot(QwtPlotDict, QFrame):
1573
1525
  if self.__data.legend.parent() is not self:
1574
1526
  self.__data.legend.setParent(self)
1575
1527
 
1576
- qwtEnableLegendItems(self, False)
1528
+ self.blockSignals(True)
1577
1529
  self.updateLegend()
1578
- qwtEnableLegendItems(self, True)
1530
+ self.blockSignals(False)
1579
1531
 
1580
1532
  lpos = self.__data.layout.legendPosition()
1581
1533
 
@@ -1686,7 +1638,7 @@ class QwtPlot(QwtPlotDict, QFrame):
1686
1638
  renderer.renderTo(self, printer)
1687
1639
 
1688
1640
  def exportTo(
1689
- self, filename, size=(800, 600), size_mm=None, resolution=72.0, format_=None
1641
+ self, filename, size=(800, 600), size_mm=None, resolution=85, format_=None
1690
1642
  ):
1691
1643
  """
1692
1644
  Export plot to PDF or image file (SVG, PNG, ...)
@@ -1694,7 +1646,7 @@ class QwtPlot(QwtPlotDict, QFrame):
1694
1646
  :param str filename: Filename
1695
1647
  :param tuple size: (width, height) size in pixels
1696
1648
  :param tuple size_mm: (width, height) size in millimeters
1697
- :param float resolution: Image resolution
1649
+ :param int resolution: Resolution in dots per Inch (dpi)
1698
1650
  :param str format_: File format (PDF, SVG, PNG, ...)
1699
1651
  """
1700
1652
  if size_mm is None:
@@ -15,26 +15,25 @@ QwtPlotCanvas
15
15
 
16
16
  import os
17
17
 
18
- from qwt.null_paintdevice import QwtNullPaintDevice
19
- from qwt.painter import QwtPainter
20
-
18
+ from qtpy import QtCore as QC
19
+ from qtpy.QtCore import QEvent, QPointF, QRect, QRectF, QSizeF, Qt
21
20
  from qtpy.QtGui import (
22
- QPaintEngine,
23
- QPen,
24
21
  QBrush,
25
- QRegion,
22
+ QGradient,
26
23
  QImage,
24
+ QPaintEngine,
25
+ QPainter,
27
26
  QPainterPath,
27
+ QPen,
28
28
  QPixmap,
29
- QGradient,
30
- QPainter,
31
- qAlpha,
32
29
  QPolygonF,
30
+ QRegion,
31
+ qAlpha,
33
32
  )
34
- from qtpy.QtWidgets import QFrame, QStyleOption, QStyle
35
- from qtpy.QtCore import Qt, QSizeF, QEvent, QPointF, QRectF, QRect
36
- from qtpy import QtCore as QC
33
+ from qtpy.QtWidgets import QFrame, QStyle, QStyleOption
37
34
 
35
+ from qwt.null_paintdevice import QwtNullPaintDevice
36
+ from qwt.painter import QwtPainter
38
37
 
39
38
  QT_MAJOR_VERSION = int(QC.__version__.split(".")[0])
40
39
  QT_API = os.environ["QT_API"]
@@ -310,8 +309,7 @@ def qwtFillBackground(*args):
310
309
  else:
311
310
  clipRegion = widget.contentsRect()
312
311
  bgWidget = qwtBackgroundWidget(widget.parentWidget())
313
- for fillRect in fillRects:
314
- rect = QRectF(fillRect).toAlignedRect()
312
+ for rect in fillRects:
315
313
  if clipRegion.intersects(rect):
316
314
  pm = QPixmap(rect.size())
317
315
  QwtPainter.fillPixmap(
@@ -135,7 +135,10 @@ class QwtPlotLayout_LayoutData(object):
135
135
  self.scale[axis].dimWithoutTitle = 0
136
136
  layout = plot.canvas().layout()
137
137
  if layout is not None:
138
- self.canvas.contentsMargins = layout.getContentsMargins()
138
+ mgn = layout.contentsMargins()
139
+ self.canvas.contentsMargins = [
140
+ mgn.left(), mgn.top(), mgn.right(), mgn.bottom()
141
+ ]
139
142
 
140
143
 
141
144
  class QwtPlotLayout_PrivateData(object):
@@ -571,7 +574,10 @@ class QwtPlotLayout(object):
571
574
  if layout is None:
572
575
  left, top, right, bottom = 0, 0, 0, 0
573
576
  else:
574
- left, top, right, bottom = layout.getContentsMargins()
577
+ mgn = layout.contentsMargins()
578
+ left, top, right, bottom = (
579
+ mgn.left(), mgn.top(), mgn.right(), mgn.bottom()
580
+ )
575
581
  for axis in QwtPlot.AXES:
576
582
  if plot.axisEnabled(axis):
577
583
  scl = plot.axisWidget(axis)