Commit Graph

2787 Commits

Author SHA1 Message Date
Ogi Moore
29bdf9949e Skip GLTextIem on some conditions on macOS 2021-06-08 21:11:24 -07:00
Nils Nemitz
7d41e8a878
Color map linearization (#1797)
* extended color map functions

* assertion string, documentation pass, comment purge

* fix some documentation links

* simplify assert statement

* removed comments and redundancy, renamed modulated bar

* include modulatedBarData in documentation

* test running matplotlib with dummy backend

* skip color maps example on OSX/PySide6.1.1

* removed skipping of tests

* reverted some accidental whitespace, removed unneeded numpy import

* removed unneded alpha parameter
2021-06-08 20:41:46 -07:00
Nils Nemitz
f002d70adc
Expose number of subsamples in ImageItem auto-level determination (#1638)
* exposed number of subsamples in auto-level determination

* Removing print statement at @NilsNemitz's request

* make levelSamples count pixels, not pixels * channels

* minimum number of samples can be 2 if we look at pixels anyway

* adjusted minimum levelSamples to 4: Otherwise a 2x2 image downsamples to a single pixel

* extended docstring for level to make the user aware of auto-level subsampling

* subsample towards square array for auto-leveling

* eliminated duplicated code between level downsampling and samples and QuickMinMax method

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-06-08 10:25:47 -07:00
Ogi Moore
823988d51c
Merge pull request #1821 from pijyoi/case_sensitive_exception 2021-06-08 05:39:35 -07:00
KIU Shueng Chuan
1715d5a6fa error on presence of "Exception:" and "Error:" 2021-06-08 15:13:17 +08:00
Nils Nemitz
61f067bf7c
Add axis convenience methods and matrix display example (#1726)
* add axis convenient methods and matrix display example

* wrestled wayward space back into docstring

* color map names are case sensitive on Linux

* docstring fix for PlotItem

* protect AxisItem.linkToView from being obscured by DateAxisItem override

* replaced setOrigin method by promoted setPos and setScale

* made tri-state axes switching explicit

* reverted setRect behavior, documentation pass for ImageItem

* minor text adjustment

* implmented some suggested revisions

* fix input parsing for setRect and add tests so that I don't break it again

* don't try to re-add transform after clearing it

* changed example and doc image generators to pg.exec()

* removed commented-out code

* cleaned up transform eqaulity assertion

* restored devoured comment

* restored devoured comment
2021-06-07 07:44:19 -07:00
Ogi Moore
3a3d05b16f
Merge pull request #1817 from pijyoi/split_finite
implement QPolygonF codepath for connect="finite"
2021-06-06 21:55:51 -07:00
bsobhani
d863907163
add function to disable autoscaling (#1819) 2021-06-06 21:19:23 -07:00
shikishima-TasakiLab
f13002b251
Add "GLTextItem" (#1776)
* Add GLTextItem

* Fixed DocString.

* Delete unnecessary function.

* Add `from .items.GLTextItem import *`

* Add an example.

* [Combines two `isinstance()` into one.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046120)

* [Combines two `isinstance()` into one.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046120)

* [The long code has been broken up into separate lines.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046234)

* [Moved `pos`, `color`, `text`, and `font` to the `__init__` method.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633047216)

* Add `import initExample` and fix `mkQApp().exec_()` to `pg.exec()` (https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046878, https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046781)

* Fix `pg.exec()` to `pg.mkQApp().exec()`

* Revert "Fix `pg.exec()` to `pg.mkQApp().exec()`"

This reverts commit 67d397d803.

* Remove type-hints.

* Fix `glColor4d(float(self.color[0]), float(self.color[1]), float(self.color[2]), float(self.color[3]))` to `glColor4d(*self.color)`

* Add `value = fn.glColor(value)`

* Remove debug print.

* Add GLGridItem and GLAxisItem

* Remove if-check for "color" argument

* Draw text without using GLUT.

* Divide the text position by the device pixel ratio

* Fixed bare exceptions to ValueError and TypeError.

* Add 'GLTextItem.py' to utils.py.

* Fixed a bare exception to ArgumentErrror.

* Add `__all__ = ['GLTextItem']`
2021-06-05 08:19:54 -07:00
KIU Shueng Chuan
ecc3563f6d special-case all-finite 2021-06-05 20:13:07 +08:00
KIU Shueng Chuan
8997cfa07c test the QPolygonF codepath 2021-06-05 15:09:59 +08:00
KIU Shueng Chuan
c8e6920443 use multiple polygons for "finite" 2021-06-05 15:09:59 +08:00
Ogi Moore
e206ea5ae9
Merge pull request #1796 from j9ac9k/test-polyline
If arrayToQPath uses connect=all, use a different construction for QPainterPath
2021-06-04 21:33:45 -07:00
Ogi Moore
145ab2e9e3 Merge branch 'master' into test-polyline 2021-06-04 21:06:52 -07:00
Ogi Moore
5c54577c26
Merge pull request #1807 from j9ac9k/merge-test-data
Merge test data + make tests directory which contain tests
2021-06-04 21:06:11 -07:00
Ogi Moore
55e42aabfd make numpy style docstring of arrayToQPath
The function had many comments/explanations, decided to convert to
numpy docstring style, which is the direction pyqtgraph is going in
as it stands
2021-06-03 22:53:09 -07:00
Ogi Moore
649757eb31 Remove use of QPolygonF in non-finite cases
With some experimentation, it was determined that when the QPainterPath
is drawn with a QPen that has a thickness greater than 1, the end result
is quite broken.  Due to us trying to exploit non-advertised behavior
we are removing this optimization step.
2021-06-03 22:53:09 -07:00
Ogi Moore
31b4210f4e
Merge branch 'master' into merge-test-data 2021-06-02 22:15:46 -07:00
Ogi Moore
bd11e5e401
Merge pull request #1816 from ntjess/rich-param-cmp
Fix #1814
2021-06-02 09:19:28 -07:00
njessurun
c0ebf8a432 Fix #1814 2021-06-02 11:03:22 -04:00
Ogi Moore
c0b9f3e26e
Merge pull request #1795 from pijyoi/avoid_writable_qimage
don't rely on QImage-wrapped buffer being writable
2021-06-01 23:05:01 -07:00
Ogi Moore
45cf6fa232 Remove comment about QImage data references
Comment was out of date and no longer relevant, removing at @pijyoi's
suggestion.
2021-06-01 22:50:02 -07:00
Nils Nemitz
39f705fd7f
Sanitize input for plotItem.showGrid (was documentation fix for plotItem.showGrid alpha setting) (#1809)
* documentation fix for plotItem.showGrid alpha setting

* revert to 0-1 scale
2021-06-01 22:43:58 -07:00
Ogi Moore
0da1958ff1
Merge pull request #1768 from pijyoi/rgb32_alpha_chan
Format_RGB32 will always have alpha equal 255
2021-06-01 22:25:08 -07:00
3DAlgoLab
28b1499f09
Force cameraPosition() to return Vector class. (#1799)
* Update GLViewWidget.py

Fix the wrong conversion of QVector3D to numpy array.

* new way to fix the conversion error

* Recover prev. version of pixelSize

Co-authored-by: Jaeyoon Jeong <diem389@gmail.com>
2021-06-01 22:21:50 -07:00
Ogi Moore
4264219144 Add PyQt6 version check for QByteArray creation 2021-06-01 22:01:58 -07:00
Ogi Moore
f01f3d473f Have debug.printExc emits RuntimeWarning
Several bugs have snuck through due to being wrapped with printExc,
which would prevent the exception from raising, but printing the trace
to the console.  In pytest, this output is not captured at all, and is
invisible unless the -s parameter is added.

This PR changes the print statement to a runtime warning, which pytest
will capture.
2021-05-31 21:06:16 -07:00
Ogi Moore
c7675ca8bb Fix unraisable exception in test_examples
The way we called subprocess.Popen, it looks like we didn't close all
the pipes; this PR addresses the warning that pytest generates when
running the examples.

In addition, we toggle the pytest setting to error on any warning
2021-05-31 21:06:16 -07:00
Ogi Moore
d72be799d7 Catch and Address Warnings in test_svg and pytest.ini
On Windows, pyreadline is emitting a deprecation warning we can ignore.
Furthermore, test_svg was using NamedTemporaryFile in a manner that was
causing permission denied errors, so this commit switches to the use of
pytest friendly temporary files
2021-05-31 21:06:16 -07:00
Ogi Moore
d859cec95a Replace uses of tempfile.mktemp with tempfile.NamedTemporaryFile
This issue was flagged as a security issue in the static code analyzer
2021-05-31 21:06:16 -07:00
Ogi Moore
ceeacf4e5f Remove test_exit_crash.py
This file contains two tests, one of which has been skipped forever,
and the second (test_pg_exit) has been a flakey test that does not test
in general, testing a use-case we likely do not see any more.  So
therefore I am removing this test from the library.
2021-05-31 21:06:16 -07:00
Ogi Moore
ab792a73a6 Address in-tree-build deprecation issue in pip 2021-05-31 21:06:16 -07:00
Ogi Moore
4224fe5664 Avoid permissions issues on windows CI 2021-05-31 21:06:16 -07:00
Ogi Moore
1d55fde41a Suppress non-relevant deprecation warning 2021-05-31 21:06:16 -07:00
Ogi Moore
d519630d14 Fix check for equality between floats
While this fix prevents an assertion error, the assertion error was
being suppressed; and was only noticeable via pytest -s where the error
was printed to console.  Future work should be done to minimize the use
of bare exceptions so these tests do not fail silently
2021-05-31 21:06:16 -07:00
Ogi Moore
648b8c7df4 Fix issue with int comparson impacting Qt6 2021-05-31 21:06:16 -07:00
Ogi Moore
ee951331be Close the example app after it launches 2021-05-31 21:06:16 -07:00
Ogi Moore
e7a30b9324 Clean up test files
Remove if __name__ == "__main__" bits, replace some == None to is None
checks

Cleanup variety of static code checker issue

Removed missing imports, restructured some logic to make a little
cleaner, fixed a function in test_dockarea, unfortunately broke the test
so now I tell pytest to expect the Exception.
2021-05-31 21:06:16 -07:00
Ogi Moore
0160de22fb Remove QApplication.instance() deleteLater call
the test_signalproxy.py had a fixture for the QApplication instance,
only problem is at the end of each use of the fixture, it would mark
the application instance for deletion, which is most definitely not what
we want
2021-05-31 21:06:16 -07:00
Ogi Moore
a6971c768d Move and Update test-data repo into pyqtgraph repo
To reduce complexity, and make it easier to add more images and tests,
the images in the `test-data` repository should be merged with the main
repository.  Furthermore, we can remove a lot of the subprocess work in
the image_testing.py file, as we no longer need to have it interact with
git.

The images are not the same.  Images were regenerated with Qt6, and now
have proper big and little endian handling thanks to @pijyoi

Second commit is a slightly modified variant of
2e135ab282d6007b34a3854921be54d0e9efb241 authored by @pijyoi
it is to convert qimages to RGBA8888 for testing.  Image
files were regenerated images for the big/little handling

Fixed issue with bogus test from test_NonUniformImage and generated a
new image
2021-05-31 21:05:00 -07:00
KIU Shueng Chuan
cabcf6cd29 pairs: allocate and manipulate dest polygon buffer directly 2021-05-27 23:31:05 -07:00
KIU Shueng Chuan
8f4104a9ab use qpolygonf underlying buffer as backstore 2021-05-27 19:07:50 -07:00
Ogi Moore
270fc59cab Insert NaN values for connect='pairs' in Qt6
Since the QPainterPath.addPolygon(QPolygonF) does not filter out the NaN
values, we can insert NaN values to create discontinuities in the Lines,
and thus supporting connect='pairs' functionality
2021-05-27 09:38:23 -07:00
Ogi Moore
78e678c1b9 Support connect=finite for qt6 2021-05-27 09:37:23 -07:00
Luke Campagnola
e29f86578f
Revert Point.angle behavior change (#1806)
* Revert behavior change of Point.angle

* Propagate Point.angle revert
2021-05-27 08:51:06 -07:00
Martin Chase
1735effea7
fix click bug on removable ROIs; test (#1804) 2021-05-26 17:14:08 -07:00
Ogi Moore
62165bbe45 Revert "Speed up arrayToQPath when connect='pairs'"
This reverts commit d62d3b182f.

Through testing, this was shown to perform quite poorly.
2021-05-25 23:30:06 -07:00
Ogi Moore
c6f1d2df94 Cleanup old code, conform comments to pep8 2021-05-25 22:32:26 -07:00
Ogi Moore
07ba7be2a4 Add basic tests for arrayToQPath 2021-05-25 22:32:26 -07:00
Ogi Moore
d62d3b182f Speed up arrayToQPath when connect='pairs'
As discussed earlier, the process of QDataStream >> QPainterPath is
quite slow, so this commit makes an improvement on QPainterPath creation
for the case of connect='pairs' by using a naive method of moving the
path and drawing a line on the path.  This was the fastest method
identified during testing.
2021-05-25 21:58:58 -07:00