Commit Graph

2024 Commits

Author SHA1 Message Date
KIU Shueng Chuan 9355ecf469 support padded QImage 2021-07-31 20:58:51 +08:00
KIU Shueng Chuan 75654b8495 handle zero-sized QPolygonF
depending on the implementation, a zero-sized QPolygonF may not
have any underlying buffer allocated and may return a null pointer when
queried for its "data()"

this null pointer is returned to Python as a "None" which breaks code
not expecting it.
2021-07-31 17:25:03 +08:00
KIU Shueng Chuan 9913f7c1e7 import shiboken{2,6} as shiboken 2021-07-31 15:58:56 +08:00
Ogi Moore 0cfc9cd440 Add GLGradientLegendItem to pyqtgraph
Huge thank you to @feketeimre for the initial PR for this feature
Thank you to @pijyoi for re-implementing with no changes needed to
GLViewWidget and supporting QOpenGLWidget vs. QGLWidget.
2021-07-30 20:19:27 -07:00
Ogi Moore d3755520d0
Merge pull request #1892 from pijyoi/glpainteritem 2021-07-30 18:23:51 -07:00
Martin Schulz 96cccd96ec
make antialiasing optional for paintGL in PlotCurveItem (#1932)
* make antialiasing optional for paintGL in PlotCurveItem

* reversion to standard values if aa is disabled

* remove unnecessary lines
2021-07-30 12:19:02 -07:00
Nils Nemitz 5084d9b537
Reduce ColorMap inefficiencies (#1927)
* Avoid regenerating QColor lists, speed up generation where unavoidable

* whitespace and typo reduction
2021-07-29 20:50:10 -07:00
Martin Chase eb8965c2f4
Restore previous signature on TargetItem.setPos() (#1928)
* Restore previous signature on TargetItem.setPos()

* star means something to sphinx

Co-authored-by: Luke Campagnola <luke.campagnola@gmail.com>
2021-07-27 18:04:24 -07:00
Nils Nemitz 7009084e4c
more readable names for color map references in ColorBarItem API (#1908)
* more readable names for color map references

* changed example code

* activated deprecation warnings

* added accessor methods for cmap/colorMap
2021-07-23 14:45:57 -07:00
ntjess 81823768c0
feature More parameter item types (#1844)
* feature More parameter item types

Pen: Pops up a dialouge that allows the user to customize a pen. Setting pen value is not working yet.
Progress bar: For indication things.
Slider: Easier way to set values that dont require precision.
Fonts: Picking font types. Next thing could be a Font dialog.
Calendar: For picking dates or intervals
Open/save file/files/directory: Pops up an open/save file/directory dialog to select a file/directory. Filter string and caption can be defined too.

A PenSelectorDialog widget was created for the pen parameter item too.

Also added these parameter items to the example.

* PyQt/Side6 compatibility fixup

* Revisions from intial PR

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialog.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/parametertree/parameterTypes.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/parametertree/parameterTypes.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialog.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Update pyqtgraph/widgets/PenSelectorDialogbox.py

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

Apply suggestions from code review

Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>

* Bugfix: module instead of class import on param tree example

* Enrich the slider parameter

* Address pijyoi comments on pen style parameter

* Different file picker for easier porting

* Better organization and formatting, minor refactoring

* PyQt6/PySide6 fixup for file dialog

* Minor adjustment to file picker

* Bugfix: for 'None' sigChanged

'None' is explicitly allowed for a WidgetParameterItem's `sigChanged` value. However, this raises an error on a changed value unless the commit's fix is applied

* Calendar works better as sub item

* Fixes bugs in pen parameter's dialog + makes it resizable

* more bugfixes and recommended changes, lets pen serialize its options

* better pen save state

* Fixes file parameter qualms

* Fixes font parameter qualms

* Fixes calendar parameter qualms

* Fixes multiply-defined slider optsChanged

* Fixes pen parameter qualms

* ptree example minor bugfix

* Pen dialog bugfixes

* File dialog bugfixes / mild improvements

* unto ptree save state regression

* file fixup

* Adds parameter descriptions to docstrings

* Improved parameter documentation

* adds 'relativeTo' option for file parameter

* Less abuse of Qt enums during or-operations

* More uniform handling of relative paths

* More cleanup of enum setting

* better name for window title (matches qt name)

* Favor os.path over pathlib

* Exposes 'directory', 'windowTitle' to file parameter

* Fixup and add comparison to parameter tree state restoration

* Exposes "cosmetic" in pen parameter

* Indicate defaults in parameter documentation

* QtEnumParameter works for enums outside QtCore.Qt

* see if altering pytest report fixes ci bug

* Cleanup unused import and redundant `self.widget` assignments

Co-authored-by: Fekete Imre <feketeimre87@gmail.com>
Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>
2021-07-23 14:40:49 -07:00
Nils Nemitz 8f96c78715
Extend ColorMap with HSL cycles and subset generation (#1911)
* Extend ColorMap with HSL cycles and subset generation

* relaxed color palette data

* added hex to be installed in colors/maps/
2021-07-23 14:38:17 -07:00
Ogi Moore d396d33799
Remove the use of pyqtgraph.ptime (#1914)
* Remove the use of pyqtgraph.ptime

With us supporting python3.7+, we have no more need for the ptime module
and can instead safely use perf_counter for everything.

* Address small issues PR turned up

* Reword comment in ImageView
2021-07-22 20:57:50 -07:00
Martin Chase 1d40d50b89
push bullet lists over 2 spaces to get them to show up as such in the… (#1912)
* push bullet lists over 2 spaces to get them to show up as such in the docs

* separate the literal block from the bullet list
2021-07-21 07:12:35 -07:00
KIU Shueng Chuan 1184e3fcce avoid converting dict to set 2021-07-19 08:31:54 +08:00
KIU Shueng Chuan 394b0dd75c implement set/get for cameraParams 2021-07-19 06:57:07 +08:00
KIU Shueng Chuan 8a6640c419 treat self.opts as private. provide accessors 2021-07-19 04:52:49 +08:00
Ogi Moore 66ec0996f4
Merge pull request #1610 from j9ac9k/boost-plotline-performance
Boost plotline performance
2021-07-18 13:44:01 -07:00
Nils Nemitz 8b4db67ae9 None-check self.label before access 2021-07-18 17:24:55 +09:00
Ogi Moore d5990bf32c Uncomment ViewBox.itemChange
This handles calls for ViewBox.prepareForPaint
2021-07-17 22:30:36 -07:00
Ogi Moore ed66eef203
Merge pull request #1902 from pijyoi/simpler_mvp
simplify modelview projection computation
2021-07-17 22:03:32 -07:00
Ogi Moore 58aac09387
Merge pull request #1903 from pijyoi/cleanup_glv
Cleanup GLViewWidget
2021-07-17 21:59:40 -07:00
Kenneth Lyons ba7129a719
Add option to limit LinearRegionitem bounds to a secondary item (#1834)
* Added clipItem option to LinearRegionItem

* Added a clipItem option to LinearRegionItem

Handle case when no self.viewBox() is yet available

* Implement LinearRegionItem clipItem

* Undo unnecessary change

* Update clipItem doc

* Fixup docstring formatting

* Cleanup

* Support clearing clipItem via setBounds. Fix initialization bug

* Add tests for LinearRegionItem clipItem

* Better clipItem demo in crosshair example

* Another test to verify claim in docstring

Co-authored-by: Arjun Chennu <arjun.chennu@gmail.com>
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
Co-authored-by: Arjun Chennu <achennu@mpi-bremen.de>
2021-07-17 21:02:06 -07:00
KIU Shueng Chuan cbc9b4d310 catch specific KeyError exception 2021-07-18 10:45:58 +08:00
KIU Shueng Chuan 6f49ede5c1 glDisable(GL_TEXTURE_3D) -> glDisable(GL_TEXTURE_2D) 2021-07-18 09:09:57 +08:00
KIU Shueng Chuan fa77dae941 render upright image (was previously transposed image) 2021-07-17 21:19:48 +08:00
KIU Shueng Chuan 5283eeb71b remove override of devicePixelRatio() 2021-07-17 18:55:55 +08:00
KIU Shueng Chuan aca627ac8c GLTextItem: use device independent pixels for viewport 2021-07-17 18:39:59 +08:00
KIU Shueng Chuan 31e10fdc1d raise ValueError instead of ctypes.ArgumentError
ctypes.ArgumentError got imported through PyOpenGL import *
2021-07-17 18:29:42 +08:00
KIU Shueng Chuan f85a1015ad fix GLTextItem to use relative imports 2021-07-17 18:28:09 +08:00
KIU Shueng Chuan 6ca81fdddb Revert "restore opts['viewport'] after clobbering"
This reverts commit 7a17cda956.
2021-07-17 18:25:21 +08:00
KIU Shueng Chuan 7a17cda956 restore opts['viewport'] after clobbering 2021-07-17 16:14:25 +08:00
KIU Shueng Chuan dfd5b5dc1b fix attribute access in failure branch 2021-07-17 16:06:44 +08:00
KIU Shueng Chuan 5b2674c9d5 change some deviceWidth() to width()
viewport / region use device pixels: deviceWidth()
anywhere else uses device independent pixels : width()
2021-07-17 15:59:14 +08:00
KIU Shueng Chuan f43f795950 don't check opengl version again during paint
we already fail upfront at initializeGL(), so any error that occurs
here won't be due to OpenGL version < 2.0
2021-07-17 15:59:14 +08:00
KIU Shueng Chuan 9bf6c01f58 fix renderToArray() broken for hidpi
define opts['viewport'] to be in device pixels.

note from the removed comments that there was one place assuming
opts['viewport'] was in device pixels and the other assuming that it was
in device independent pixels.
2021-07-17 14:49:47 +08:00
KIU Shueng Chuan bc52a2afe0 return ValueError for wrong argument, not RuntimeError 2021-07-17 13:46:11 +08:00
KIU Shueng Chuan fab505a431 remove unneeded call to makeCurrent()
in any case, context will not be valid until the widget is shown.
2021-07-17 13:32:33 +08:00
KIU Shueng Chuan 1814ff535d fail upfront for OpenGL ES instead of during item add 2021-07-17 13:30:20 +08:00
KIU Shueng Chuan f698ccc06e load background color from configOption 2021-07-17 13:05:40 +08:00
KIU Shueng Chuan ce4c6d95ed fix setCameraPosition not setting ele and azi in euler mode 2021-07-17 11:04:32 +08:00
KIU Shueng Chuan b5fc3d2a7e add comment about definition of viewport 2021-07-17 10:40:27 +08:00
KIU Shueng Chuan 1b00d3448a reimplement readQImage()
tested that call to repaint() is not needed
2021-07-17 10:34:27 +08:00
KIU Shueng Chuan 5d7dd101f2 load matrix instead of multiplying to identity 2021-07-17 10:21:26 +08:00
KIU Shueng Chuan 025ca08574 delete empty resizeGL() 2021-07-17 10:17:31 +08:00
KIU Shueng Chuan ee9b1565bd don't redefine width() and height()
Qt widgets define width() and height() to be in device independent
pixels. Don't change that meaning.
2021-07-17 10:14:53 +08:00
KIU Shueng Chuan e158034c07 remove devicePixelRatio argument. only needed for Qt4 2021-07-17 09:49:51 +08:00
KIU Shueng Chuan 31f9d0024a simplify modelview projection computation
1) no need to get rect(), which is actually defined as
	QRect(0, 0, width(), height())
2) use col-maj data() instead of row-maj copyDataTo()
   - glLoadMatrixf() takes col-maj
2021-07-17 07:56:21 +08:00
Martin Chase bcb629495c put new location in deprecation warning 2021-07-16 15:59:23 -07:00
KIU Shueng Chuan 7442ab1e52 PlotCurveItem: setup modelview and projection 2021-07-15 23:16:26 +08:00
Scott Talbert db8180d88e Fix GLTextItem with Python 3.10
drawText() expects int arguments and Python 3.10 does not allow for
implicit rounding.
2021-07-11 22:04:00 -04:00
Jennifer Manriquez 0c074ea005 Raise TypeError instead of Exception 2021-07-08 13:35:22 -05:00
Kyle Sunden 53fc415813
Update version number 2021-07-08 01:18:00 -05:00
Nils Nemitz 523b31e97f
Draw GradientLegend in ViewBox coordinates (#1864)
* draw GradientLegend in ViewBox coordinates

* some cleanup

* do not proceed with dummy values

* correct bar and label order, add some styling options

* remove debugging code
2021-07-03 21:43:39 -07:00
Ogi Moore 4b7dfdef88
Merge pull request #1876 from ixjlyons/fix-lineroi-coords
Fix LineROI handle positions
2021-07-03 08:23:13 -07:00
Kenneth Lyons 7ebae20c5d Fix LineROI handle positions 2021-07-03 07:51:23 -07:00
KIU Shueng Chuan e9ee11f010 simplify calls needed to initialize items 2021-07-03 15:53:17 +08:00
KIU Shueng Chuan 6fc02711a8 bug: PyQt6 does not have localPos()
this bug must have existed since the removal of the mouse shims
from Qt.py.
2021-07-02 10:14:19 +08:00
KIU Shueng Chuan e76328ab0e bug: PyQt6 does not have localPos()
this bug must have existed since the removal of the mouse shims
from Qt.py.
2021-07-01 15:11:55 +08:00
KIU Shueng Chuan 96f7ce1325 remove empty initializeGL() 2021-07-01 08:56:47 +08:00
KIU Shueng Chuan b843214f66 remove Qt4 mouse wheel handling 2021-07-01 08:56:47 +08:00
KIU Shueng Chuan 1a29cf7579 defer init if we do not have an OpenGL context yet 2021-07-01 08:56:33 +08:00
Nils Nemitz e79dacf805
Fix Matplotlib color map import, add CC0 maps locally (#1865)
* accept Matplotlib colormap data as numpy array, add CC0 Matplotlib maps locally

* add cividis, prioritize lower case in example/atlas
2021-06-26 08:41:57 -07:00
Nils Nemitz c07b95812c clear out ticks instead of hiding them 2021-06-26 20:42:11 +09:00
Ogi Moore 93fa8664cb
Merge pull request #1846 from pijyoi/import_hygiene
reduce pollution of pg namespace
2021-06-25 23:26:26 -07:00
KIU Shueng Chuan 5d55f3facf remove imports subdir 2021-06-26 07:54:03 +08:00
Ogi Moore 418a181691 Use built-in int as dtype 2021-06-25 08:45:02 -07:00
KIU Shueng Chuan 3a1b74df6f move Qt.py to Qt/__init__.py 2021-06-25 21:33:05 +08:00
KIU Shueng Chuan 11bf824c0a deprecate ordereddict.OrderedDict on instantiation 2021-06-25 21:19:34 +08:00
KIU Shueng Chuan 427128ece1 add imports used by ACQ4 2021-06-25 21:19:34 +08:00
KIU Shueng Chuan 81baa182c5 add __all__ to various files 2021-06-25 21:19:33 +08:00
Ogi Moore 27ad41a10c Add deprecation warning to MetaArray.__init__ 2021-06-23 21:27:21 -07:00
Martin Chase f764e2d3ff
progress dialog fix (#1861) 2021-06-23 19:34:55 -07:00
Nils Nemitz 775f1d629c
Separate out mouse events stolen by AxisItem (#1845)
* separate out mouse events on main plot area

* work in scenepositions so that detection also works in a layout

* added comments/remove debug statements
2021-06-22 16:17:39 -07:00
Ogi Moore addb92f592
Merge pull request #1853 from NilsNemitz/getColor-getStops
make getColors and getStops behavior more consistent; add tests
2021-06-22 11:50:34 -07:00
KIU Shueng Chuan 30f4af5913 remote: exchange pids if running in Windows venv 2021-06-22 21:59:39 +08:00
Nils Nemitz 362fbaa53a fixed docstring 2021-06-22 03:32:12 +09:00
Nils Nemitz f79d0dfa14 make getColors and getStops behavior more consistent; add tests 2021-06-22 01:19:07 +09:00
Jennifer Manriquez 2899143e84 Allow border=False in GraphicsLayout 2021-06-16 19:35:42 -05:00
Ogi Moore 61dedcb4a5
Merge pull request #1794 from pijyoi/numba_lookup 2021-06-15 16:42:54 -07:00
KIU Shueng Chuan 5dcea9bdac rename private function and its arguments 2021-06-16 06:50:51 +08:00
KIU Shueng Chuan f63d1e4206 document PyQt boxing and unboxing 2021-06-15 11:40:27 +08:00
KIU Shueng Chuan 7c6d9fe6d5 cleanup python2 and unused imports 2021-06-15 11:06:37 +08:00
KIU Shueng Chuan 89f6c7da81 remove codepaths other than pixmap fragments codepath 2021-06-15 09:43:31 +08:00
KIU Shueng Chuan abeae0b7fa init so that pointers are present 2021-06-15 06:50:31 +08:00
KIU Shueng Chuan a1845cddbc don't truncate floating point target coords 2021-06-14 19:24:39 +08:00
KIU Shueng Chuan 6839ec937a reuse pixmap fragment objects 2021-06-14 06:49:52 +08:00
KIU Shueng Chuan 380ec2e0b2 implement usage of QPainter.drawPixmapFragments 2021-06-13 08:00:45 +08:00
KIU Shueng Chuan 98a020d1bb ROI.py::renderShapeMask : fix little-endian assumption 2021-06-12 20:25:28 +08:00
KIU Shueng Chuan afe47def28 fix ScatterPlot render issues on PyQt6 6.1 2021-06-12 14:05:47 +08:00
Ogi Moore e892ad37aa Add missing enums 2021-06-10 21:28:19 -07:00
Ogi Moore 7e8d34ecd8
Merge pull request #1824 from pijyoi/less_endian
remove little-endian assumption for image export
2021-06-09 15:02:48 -07:00
Martin Chase 2fb04b754c
Fix BusyCursor to use internal stack provided by setOverrideCursor/restoreOverrideCursor (#1827)
* un-busy as many times as needed

* lint

* add test to prove cursor behavior

* tentative change in the hopes that all supported qt versions behave properly

* remove unnecessary code

* use contextmanager decorator instead of class

* use full path to WaitCursor

* restore docstring; refactor variable for clarity

* fix docstring whitespace

* break up long lines

* use variable to shorten instead
2021-06-09 13:32:24 -07:00
KIU Shueng Chuan 6a2bfa5c84 fix PyQt6 long spelling for enums 2021-06-10 03:33:04 +08:00
KIU Shueng Chuan 765f9648cd remove little-endian assumption for image export 2021-06-10 03:18:12 +08:00
Ogi Moore 3c352dd1a9 Fix documentation misalignment 2021-06-08 21:23:49 -07:00
Ogi Moore 2f1f297f39 Fix case of int-conversion for MouseButtons
This has been demonstrated to not work in PyQt6.
2021-06-08 21:23:49 -07:00
Ogi Moore cc081af528 New Template Files for PyQt6 6.1
Update PySide6 templates to Qt 6.1
2021-06-08 21:23:49 -07:00
Ogi Moore 195a1a6fa3 Remove Qt 6.0 support
Simplify some PyQt6 code branches
2021-06-08 21:23:49 -07:00
Ogi Moore d455da9aec Use Qt6 Enum Namespace
This namespace appears to be valid in PySide2/PyQt5 5.12+ so we may as
well migrate to the newer namespace ourselves.
2021-06-08 21:23:49 -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