Commit Graph

387 Commits

Author SHA1 Message Date
Kenneth Lyons
66c77118dc
Support suffix for int parameters (#1528)
* Support suffix for int parameters

* Fix spinbox test for new int formatting

* Tune up SpinBox tests a bit
2021-02-03 12:30:05 -08:00
Ogi Moore
f5a823bf38
Merge pull request #1533 from pijyoi/kill_qt4_shim
Remove scale rotate translate Qt4 shims
2021-01-31 22:12:11 -08:00
KIU Shueng Chuan
185f9c7dad remove scale, rotate and translate shims 2021-02-01 09:06:23 +08:00
Ogi Moore
7b3fdda1e4 Merge branch 'master' into ptree 2021-01-31 13:36:53 -08:00
KIU Shueng Chuan
2f4ceee1ce fix RemoteSpeedTest shutdown errors
fix BufferError: cannot close exported pointers exist
for some reason, even though the ctypes object falls out of function
scope, it causes a lingering reference.
in any case, the use of ctypes is no longer necessary.

Don't change temporary files mid-way for Darwin
This fixes the CI issues on Darwin.

close the remote process on app shutdown.
2021-01-28 07:19:54 +08:00
Ogi Moore
309195ceea
Fix windows hidpi (#1516)
* set environment variables before starting QApp

* fix-422

* Better support of hidpi

* Fix Typo in App-Name

* Remove fontScaleFactor bits

* Add documenation for hidpi displays

* Fix pg not defined
2021-01-27 10:59:07 -08:00
Ogi Moore
85773e4530
Revert "have mkQApp configure QApplication such that it handles HIDPI displays on Windows (#1509)" (#1515)
This reverts commit 98f6b2f1a5.
2021-01-27 10:42:38 -08:00
Ogi Moore
98f6b2f1a5
have mkQApp configure QApplication such that it handles HIDPI displays on Windows (#1509)
* set environment variables before starting QApp

* fix-422

* Better support of hidpi

* Fix Typo in App-Name

* Remove fontScaleFactor bits

* Add documenation for hidpi displays
2021-01-27 10:05:56 -08:00
pijyoi
1044a7b6c4
Add almost all examples to ExampleApp (#1511)
* fix: delete generated designerExample_*.py files

designerExample.py loads designerExample.ui directly

* remove unused examples/utils.py

* add almost all examples in folder

* use mkQApp and don't set style nor palette

not needed for an example and also avoids a PyQt6 6.0 refcount bug in
app.setStyle()

* bold interesting examples

* test_examples.py needs to know about Namespace too

* Revert "remove unused examples/utils.py"

This reverts commit 2eddead459.

* categorize examples lists in utils.py
2021-01-26 13:45:53 -08:00
KIU Shueng Chuan
59fd72a3d1 exampleLoaderTemplate.ui : add Qt6 and remove Qt4 2021-01-23 11:43:34 +08:00
KIU Shueng Chuan
6c760f3de1 add PyQt6 to CI
skip tests that don't work for Qt6

add Qt6 and remove Qt4 from test_examples.py

update README.md

switch mouse tests to use QPointF

this eliminates all the special casing for different bindings
2021-01-23 08:31:00 +08:00
KIU Shueng Chuan
ab41c03358 generate _pyqt6.py files
VideoTemplate_pyside6.py : regenerate for cuda feature
2021-01-23 08:29:39 +08:00
Torsten Sommer
510626c15f
Add NonUniformImage, example and tests. (#509)
* Add NonUniformImage, example and tests.

* Use updated test-data tag

* Fix line ending, remove lut.setLevels keyword arguments call

Co-authored-by: Ogi <ognyan.moore@gmail.com>
2021-01-19 21:43:58 -08:00
Martin Chase
f2b4a15b2d
Performance enhancement: use CUDA in ImageItem (#1466)
* Add CLI args to video speed test for easier / automated benchmarking

* use a buffer-qimage so we can avoid allocing so much

this should improve performance under windows

* playing with numba

* oh, mins/maxes in the other order

* maybe put the cupy in here and see what happens

* pre-alloc for gpu and cpu

* handle possibility of not having cupy

* no numba in this branch

* organize imports

* name them after their use, not their expected device

* cupy.take does not support clip mode, so do it explicitly

* add CUDA option to the VideoSpeedTest

* rename private attr xp to _xp

* handle resizes at the last moment

* cupy is less accepting of lists as args

* or somehow range isn't allowed? what histogram is this?

* construct the array with python objects

* get the python value right away

* put LUT into cupy if needed

* docstring about cuda toolkit version

* better handling and display of missing cuda lib

* lint

* import need

* handle switching between cupy and numpy in a single ImageItem

* only use xp when necessary

we can now depend on numpy >= 1.17, which means __array_function__-implementing cupy can
seamlessly pass into numpy functions. the remaining uses of xp are for our functions which
need to allocate new data structures, an operation that has to be substrate-specific.

remove empty_cupy; just check if the import succeeded, instead.

* use an option to control use of cupy

* convert cupy.ceil array to int for easier mathing

* RawImageWidget gets to use the getCupy function now, too

* raise error to calm linters; rename for clarity

* Add Generated Template Files

* document things better

* cruft removal

* warnings to communicate when cupy is expected but somehow broken

* playing with settings to suss out timeout

* playing with more stuff to suss out timeout

* replace with empty list

* skip test_ExampleApp on linux+pyside2 only

Co-authored-by: Luke Campagnola <luke.campagnola@gmail.com>
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-01-19 21:26:24 -08:00
KIU Shueng Chuan
966ae7a3df import template files using importlib
this lets us support the various bindings w/o having to add binding
specific code.

it breaks PyQt4 support since PyQt4 template files are suffixed as
"_pyqt" rather than "_pyqt4"
2021-01-15 08:25:08 +08:00
KIU Shueng Chuan
5732ca8213 initExample.py: add PySide6 and PyQt6
drop PyQt4 and PySide
2021-01-15 08:25:07 +08:00
KIU Shueng Chuan
359f441973 ExampleApp.py : remove Qt4 paletteChanged signal compatibility 2021-01-15 08:25:07 +08:00
KIU Shueng Chuan
3584736155 generate template files for pyside6 2021-01-15 08:25:07 +08:00
KIU Shueng Chuan
92016d3d5a add imports of _pyside6 files 2021-01-15 08:25:06 +08:00
KIU Shueng Chuan
b0f7dda102 QFont.setWeight(75) is redundant
QFont.setBold(True) calls QFont.setWeight(QFont.Weight.Bold)

in Qt 5, QFont.Weight.Bold == 75
in Qt 6, QFont.Weight.Bold == 700

in PySide6, QFont.setWeight() no longer accepts an integer value.
2021-01-15 08:25:05 +08:00
Nils Nemitz
85719fd8df
Colormap extension (#1424)
* extend ColorMap functionality for palette management

* manual merge with changes in master branch

* extend ColorMap functionality for palette management

* manual merge with changes in master branch

* light mode / dark mode swapping demo

* color map updates

* added ColorCET and Matplotlib import for color maps

* minor cleanup

* restored lost indent

* Code cleanup

* Add colorcet as optional dependency

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-01-04 22:01:30 -08:00
Dennis Göries
b622e22877
LegendItem: Make ItemSample customizable (#1404)
* LegendItem: Introduce itemStyles and provide ToggleItem

Show example

* Minor cleanup of the legend item and test

* Make ItemSample customizable

* Remove example modifications

* Changes for sampleType according to review
2021-01-04 21:02:08 -08:00
Ogi Moore
5d33ccff8d Cleanup ExamplesApp 2020-12-22 22:10:59 -08:00
Ogi Moore
6eace48663 Skip openGL tests on some macOS configs 2020-12-22 10:26:19 -08:00
Ogi Moore
f4df660363 Skip test_ExampleApp 2020-12-22 10:26:19 -08:00
Daniel Lidstrom
8105385230 Add not enabled example 2020-12-21 23:10:44 -08:00
Daniel Lidstrom
6a8f7779dc Add tool tip support to action and group parameters 2020-12-21 23:09:19 -08:00
Daniel Lidstrom
0703e3db9b Ensure synchronization of parameter and widget's values 2020-12-20 18:43:11 -08:00
Daniel Lidstrom
ba304faa05 Provide size hints for nicer looking trees that don't need to be manually sized 2020-12-17 17:45:04 -08:00
lidstrom83
3af23725ca
Scatter Plot Improvements (#1420)
* Added hovering demo to ScatterPlot example

* Use Qt's serialization for SymbolAtlas.symbolMap keys

Yields significant performance improvements when updating the scatter plot's options. See e.g. the plot hover example.

* Further optimized scatter plot picking

* Fix ScatterPlot example tool tip

* Clean up while I'm here

* Compatibility

* Some simple optimizations for ScatterPlotItem

Speedups for ScatterPlotSpeedTest.py:
~50% without pxMode
~ 0% pxMode with useCache
~30% pxMode without useCache

* ~3x speedup in scatter plot speed test with pxMode

* More optimization low-hanging fruit for the scatter plot

* Removed hover example to lazily pass tests

* Avoid segfault

* Re-add hover example to ScatterPlot.py

* Switch to id-based keying for scatter plot symbol atlas

- Use cases exist where serialization-based keying is a significant bottleneck, e.g. updating without atlas invalidation when a large variety pens or brushes are present.
- To avoid a performance hit, the onus is on the user to carefully reuse pen and brush objects.

* Optimized caching in scatter plot hovering example

* Fixed and optimized scatter plot hovering example

* Minor scatter plot optimization

* Cleanup

* Store hovered points in a set for the hovering example

* Keep a limited number symbol atlas entries around for future reuse

* Added a docstring note to remind the user to reuse QPen and QBrush objects for better performance

* Tidied up hovering example

* Typo

* Avoid unnecessary atlas rebuilds

* Refactored SymbolAtlas

* Efficient appending to SymbolAtlas

* SymbolAtlas rewrite

* Cleanup and profiling

* Add randomized brushes to speed test

* Add loc indexer to ScatterPlotItem

* Profile ScatterPlotItem.paint to identify bottlenecks

* Reuse targetRect to improve paint performance

* Readability improvements (opinionated)

* Only need to set x and y of targetRect

- w and h can stay set to 0 (not entirely sure why)
- this is a bit faster than setting all of x, y, w, h

* Minor renaming

* Strip off API changes and leave to another PR

* Renaming

* Compatibility

* Use drawPixmap(x, y, pm, sx, sy, sw, sh) signature to avoid needing to update QRectFs

* Use different drawing approaches for each Qt binding for performance reasons

* Fix a bug introduced two commits ago

Incidentally, I think there is a similar bug in the main branch currently.

* Minor performance and readability improvements

* Strip out source and target QRectF stuff

* Bring source and target QRectF stuff back in a less coupled way

* Leave deprecating getSpotOpts for another PR

* Compatibility fix

* Added docstrings and use SymbolAtlas__len__ where possible

* Fix export issue

* Add missing import

* Add deprecation warnings

* Avoid using deprecated methods

* Fix and cleanup max spot size measurements

* Make creation of style opts entries explicit

* Add hovering API to ScatterPlotItem

* Compatibility

* Marshal pen and brush lists in setPen and setBrush

* Fixed platform dependent bug
2020-12-16 11:07:39 -08:00
2xB
433b061e81
Fix TickSliderItem: Avoid ghost ticks | Improved customPlot.py code (#1459)
* Fix TickSliderItem: Avoid ghost ticks | Improved customPlot.py code

If `TickSliderItem.setTickValue` was called when a full repaint of the `TickSliderItem` was
not already scheduled, the tick was visible at the old and the new position. This could e.g. be seen
when using the autoscale button in the `customPlot.py` example.

Further, code from `customPlot.py` is improved to make use of `Tick.setVisible` instead of adding and
removing ticks based on their visibility.

* customPlot.py: Explain bool conversion

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-26 22:28:03 -08:00
2xB
5adb1b9a5b
Fixes for examples\customPlot.py (#1448)
* Fix examples\customPlot.py: Not object-oriented

Copy-paste error: I referenced a specific object instead of self. Fixed.

* Fix examples\customPlot.py: Allow calling setTicks more than once

This fixes a bug where TickSliderItem is expected to return ticks.keys() but while it returns ticks.items().
Also: Minor code correction.

* Fix examples\customPlot.py: Avoid scaling differences

Consider padding of TickSliderItem for link between ViewBox and ticks

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-19 10:19:32 -08:00
2xB
020b7077cb
TickSliderItem: allowRemove property added (#1442)
* TickSliderItem: allowRemove property added

Following #744, this PR suggests the addition of a property
`allowRemove` to `TickSliderItem` and therefore also to
`GradientEditorItem`. It sets the default of whether ticks can
be removed by the user and therefore contemplates `allowAdd`.

I would be interested in other opinions on this design decision,
as #744 suggests to reuse `allowAdd` for the prohibition of
tick removal.
I personally suggest this solution, since it does not change
the effect of the current API.

Fix #744

* customPlot.py: Added markers to example using TickSliderItem

* examples\GradientWidget.py: Demonstrate use of allowRemove

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-16 16:18:26 -08:00
2xB
c359d5fad9
Fix ViewBox axis zoom in RectMode and examples/customPlot.py (#1443)
* Fix examples/customPlot.py: mouseDragEvent misses axis argument

Fixes #1277

* customPlot.py: Update methodolgy to disable menu

If there's an argument for this, we should use it

* customPlot.py: Show how to disable axis interaction

* Fix ViewBox: Moving axis in RectMode not implemented => use normal move mode

Grabbing an axis in RectMode leads to the zoom rectangle being displayed
in unreasonable positions. In this case, fall back to normal mode.

* customPlot.py: Only disable right-click zoom for demonstration

In cases where continuous zooming is not wished (e.g. in case of
complicated rebinning after zooming), this might come in handy
and there is no reason not to show it.

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-16 14:27:40 -08:00
2xB
100c793174
Fix ExampleApp: Use pg module from directory when run without installation (#1432)
Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-09 14:57:01 -08:00
lidstrom83
0a7a54c3f6
Permit entry of non-finite values into float SpinBox (#1422)
* Permit nan, inf, and -inf for float SpinBox

Bounds are enforced against inf and -inf inputs, but not for nan.

* Ensure SpinBox text is updated when out-of-bounds value is entered

* Make inf and nan entry in SpinBox case-insensitive

* Make SpinBox example behave as advertised

* Make non-finite SpinBox values optionally allowed

* Python 2 compatibility
2020-10-27 21:26:05 -07:00
Ogi Moore
7e57e07068
example app now works with Qt4 and Python2 again (#1302)
* example app now workw with Qt4 and Python2 again

* Example App is now part of the test suite

* Add initExample

* No scary warning when launching examples

* Fix scary examples.__main__ warning

* Use courier new font as its on all platforms

* Remove commented out code

* Add newline

* Updated docs, example app now tested

* Non-relative import for example app

* Proper importing now
2020-10-19 11:51:12 -07:00
Carlos Pascual
23a46b5fb9
Add "left" and "right" step Modes (#1360)
* Add "lstep" and "rstep" step Modes

stepMode is currently either True or False. If it is True,
it requires the user to make len(x) = len(y)+1. This is
inconvenient because it makes it difficult to change the
stepMode on a given curve (just as one would change, e.g.,
its color).

This commit extends the current situation by introducing
two more step modes: "lstep" and "rstep", which do not require
passing an extra x value. In turn, this modes associate each
y value to either the left or the right boundary of the step.

For example, the "rstep" mode is handy when plotting "life"
digital signals in which x,y data pairs are appended as they
are read.

This commit does not modify the behaviour in case of stepMode=True

* Replace step mode names: lstep,rstep -> left,right

* Improve docs for stepMode

Reword docstring and add it to PlotDataItem class too

* Document left and right stepModes as added in v 0.12.0

TODO: confirm the exact version number to use here

* Add comments stress the need for "is True"

Some conditional statements in the code regarding stepMode are
done with "is True". This is actually required since other
possible values such as "left" also evaluate as true but should
not be caught.

* Deprecate boolean API for stepMode

Introduce stepMode="mid" as a replacement of stepMode=True,
but keeping full backwards compatibility with the old API.
Adapt docs, examples and tests accordingly.

* Raise ValueError on unsupported stepMode values

* Rename "mid" step mode to "center"

* Remove "added in 0.12.0" note

See https://github.com/pyqtgraph/pyqtgraph/pull/1360#discussion_r502746919

* Add deprecation warning when stepMode=True

Issue a DeprecationWarning if stepMode=True is being passed to the
constructor or setData() of PlotDataItem or PlotCurveItem.

Note: warnings module is imported locally so that it is esier to
remove once this check is no longer needed.

* Fix wrong syntax in last commit

Fix usage of "default" kwarg in dict.get()
2020-10-13 08:52:07 -07:00
Ogi Moore
3f7a9bb642
Merge pull request #1273 from edumur/develop
Implemented pColorMeshItem
2020-10-12 09:24:10 -07:00
Etienne Dumur
5ab0cef017 Solve artifacts issues
Add a parameter "antialiasing".
Remove profiler
Add pyqtgraph mkPen
2020-10-12 12:45:13 +02:00
Kenneth Lyons
3ea32ff447
Merge pull request #1374 from ixjlyons/test-warnings-cleanup
Test warnings cleanup
2020-09-20 14:52:49 -07:00
Kenneth Lyons
16ea8ada0c Use raw strings to get rid of DeprecationWarning
DeprecationWarning is for invalid escape sequence ('\'). Decided to use
raw strings rather than double-backslashes because the text processing
is using raw strings anwyay.
2020-09-20 13:59:44 -07:00
angulartist
58aa9306df Enhancement: [Issue/812]: just pass plotArgs keyword arguments 2020-07-19 19:16:07 +02:00
Etienne Dumur
72c03ea096 Rename PColorMesh example 2020-07-17 08:18:52 +02:00
Etienne Dumur
f8aee11190 Add PColorMeshItem example to the app 2020-07-15 10:30:41 +02:00
Etienne Dumur
98c6c56358 Make clearer the non-grid meshing of the Item 2020-06-28 15:05:29 +02:00
Etienne Dumur
919ee54b59 Add edgecolor parameter
Allow user to set the polygons edge color.
2020-06-28 14:50:44 +02:00
Etienne Dumur
d32d61a1e2 Various improvements
Make an example displaying more clearly the Item capability.
Correct few bugs in the Item class.
Improve overall comments.
2020-06-28 14:49:20 +02:00
Etienne Dumur
3cbe65d46d Correct PColorMeshItem names 2020-06-26 18:12:17 +02:00
Etienne Dumur
cbbd8287ad Remove matplotlib dependencies 2020-06-25 22:07:41 +02:00