Commit Graph

2662 Commits

Author SHA1 Message Date
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
75048c473b
TickSliderItem: Use Tick.removeAllowed (#1441)
* Fix: TickSliderItem ignores Tick.removeAllowed

This prohibits removing ticks from a `TickSliderItem` if they were set to `tick.removeAllowed=False`.

Test code:
```python3
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore
import numpy as np

app = pg.mkQApp()

class CustomWidget(pg.GraphicsView):
    def __init__(self, parent=None, *args, **kargs):
        pg.GraphicsView.__init__(self, parent, useOpenGL=False, background=None)
        self.item = pg.TickSliderItem(*args, **kargs)

        for pos in (0, 0.5, 1):
            tick = self.item.addTick(pos)
            tick.removeAllowed = False # Possibility 1

        # Possibility 2
        for tick, value in self.item.listTicks():
            tick.removeAllowed = False

        self.setCentralItem(self.item)
        self.setFixedHeight(31)

w = CustomWidget()
w.show()

app.exec_()
```

* Make 'removeAllowed' regular property of 'Tick'

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-16 11:54:46 -08:00
2xB
01aee93a16
Fix: TickSliderItem method uses function from subclass GradientEditorItem (#1439)
* Fix: TickSliderItem method uses function from subclass GradientEditorItem

* Improved code layout

Previously, creating a `GradientEditorItem` lead to 34 executions
of `updateGradient`, with these improvements, only 2 are needed.
Further, removed duplicate code and used signals whenever possible.

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-11-16 10:56:58 -08:00
Stephanie Seeman
b21967d20d
default colors for enum ColorMap type (#1428)
* default colors for enum ColorMap type

* Update ColorMapWidget.py

if to elif

Co-authored-by: ALLENINST\stephanies <stephanies@alleninstitute.org>
2020-11-11 09:03:50 -08:00
Charles Brunet
4575decf6f
Prevent item duplication in Node context menu (#1361)
* Prevent item duplication in Node context menu

* Prevent duplicated items on Terminal context menu

* try better solution to prevent item duplication
2020-11-11 09:02:46 -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
Carlos Pascual
3aa3e9b991
Emit signal when GraphicScene.addItem() is used (#1388)
* Emit signal when GraphicScene.addItem() is used

Emit a signal (sigItemAdded) just after adding an item to a scene.
The item object is emited as the only signal argument.
This signal is useful for code that may want to react to newly added
items of a plot.

* Emit signal when GraphicScene.removeItem() is used

Emit a signal (sigItemRemoved) just after removing an item from a scene.
The item object is emited as the only signal argument.
This signal is useful for code that may want to react to removed
items in a plot.
2020-11-06 14:06:53 -08:00
ernierock
98c01a3667
Update GridItem.py (#1423)
Bug in GridItem.setTextPen() : on line 49 **kargs should be **kwargs. setTextPen does not work (until this simple fix is applied)
2020-11-06 14:04:34 -08:00
Gabriele Buondonno
cae1c66c78
Fix width, height and background in SVG exporter (#1401)
* [SVGExporter] Fix width and height

* [SVGExporter] Fix background color

* [SVGExporter] Remove f-strings

* [Exporter] Fix for QtGui.QGraphicsScene

* Revert "[Exporter] Fix for QtGui.QGraphicsScene"

This reverts commit 5bdd25ea40.

* [test_svg] Fix unit test
2020-10-27 21:27:31 -07: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
Toussaic
ae4522109e
User-defined keywords of getArrayRegion (#1416)
The three parameters "shape, vectors, origin" can't be passed as parameters because they are computed, which raise an error when kwds is passed to affineSlice.
2020-10-26 22:04:38 -07:00
Luke Campagnola
7d2fbe7596
Fix name/title handling (#1356)
- Parameters now respond to title change in setOpts
- Add Parameter.title()
- Action parameter uses default name/title handling in addition to setting button text (fixes #1320)
2020-10-26 21:56:26 -07:00
iam-git
451075b448
DataTreeWidget: sorting crashfix (#1419) 2020-10-24 16:58:51 -07:00
lidstrom83
0dacc57e02
Emit event with mouse clicks for some items (#1414)
Harmonizes behavior with PlotCurveItem.
2020-10-22 11:17:59 -07:00
Ogi Moore
27ca1747f1
Call GraphicsItem.viewTransformChanged() (#1413)
* Call GraphicsItem.viewTransformChanged()

* Needed to apply to labels too
2020-10-22 11:17:33 -07:00
lidstrom83
cff19f3271
Hide WidgetParameterItem.defaultBtn if param has no default (#1411)
Co-authored-by: Daniel Lidstrom <dlidstrom@russelltech.com>
2020-10-22 08:28:03 -07:00
Ogi Moore
1b89c47cc2
Add fontSize kwarg (taken from PR #129) (#1410) 2020-10-21 22:18:36 -07:00
lidstrom83
b44dcc135f
Fixed mouse interaction issues with DockLabel (#1408)
Co-authored-by: Daniel Lidstrom <dlidstrom@russelltech.com>
2020-10-21 20:52:44 -07:00
Ogi Moore
0b52c8453e
prepend conda-forge channel prior to env creation (#1409) 2020-10-21 20:48:19 -07:00
Dennis Göries
55a9e19e43
ScatterItem: Fix name setting (#1405) 2020-10-20 20:02:53 -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
Nils Nemitz
65e90faec5
dynamic range limiting in PlotDataItem (#1140)
* dynamic range limiting in PlotDataItem

* revised version of cynamic range limiting

* replaced == with is operator

* removed unicode +- character, converted to ascii

* code/docstring cleanup

* clean state with changes

* silenced numpy all-NaN warnings

* reverted PlotWidget.py to original

* reverted PlotWidget.py to original

* reverted PlotWidget.py to original

* rewrapped/reformated setDynamicRangeLimits docstring

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-10-18 22:34:41 -07:00
Julius Juodakis
39f9c6a6aa
caching for viewRect of LinearRegionItem to reduce CPU load (#1391)
* caching for boundaryRect of LinearRegionItem

* caching viewRect at GraphicsItem
2020-10-18 16:42:40 -07:00
Ogi Moore
2c02d58134
Do not apply transparent background in Qt4 (#1403)
* Do not apply transparent background in Qt4

* Tests need to reflect this change too
2020-10-17 23:01:16 -07:00
Ogi Moore
9f86eef2b9
handle case of version string having no '+' (#1402) 2020-10-17 22:22:29 -07:00
Dennis Göries
b5de577c28
LegendItem: Enable customization of label text size and tests (#1397)
* LegendItem: Enable customization of label text size and tests

* One more CI

* Remove deleteLater of QAPP in legend item test

* Remove assert statement in setLabelTextSize

* Modify legend test without assertion
2020-10-15 10:56:34 -07:00
Ogi Moore
5eb671217c
Docs should have no warnings on pcolormeshitem (#1400) 2020-10-15 10:12:36 -07:00
Kenneth Lyons
1f76ac0e2c
Add a docs build job to CI (#1328)
* Add a docs build job to CI

* Add sphinxopts to fail on warning

* Test sphinx warning

* Redid ci stage conditionals

* update conf.py to remove deprecation warning

* introduce 3rd stage for proper conditionals

* Attempt to fix malformed table

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-10-15 08:43:23 -07:00
Dennis Göries
3b6eb02520
AxisItem: Account for empty strings in the visibility of text and units (#1367)
* Rebase

* make the tests work

* add test and rather more cleanup

* Cleanup for axisitem visibility test

* Another cleanup in test axis item
2020-10-14 20:40:54 -07:00
Mitchel Paulin
e7b11cb39a
Fixed bug where removeTempArea would be called on home even if it was not defined (#1349)
* Fixed bug where removeTempArea would be called on home even if it was not defined

* Made the check for whether or not home is defined more explicit
2020-10-14 10:07:12 -07:00
Ogi Moore
9413dc8005
Disable mouse rate limiting (#1399) 2020-10-13 22:33:00 -07:00
Allard Hendriksen
9d99a3e7b0
Fix incorrect rendering of overlapping object in renderToArray() (#1306)
This commit adds a depth buffer in renderToArray().

This fixes the issue that overlapping objects are rendered incorrectly
when using renderToArray() on a GLViewWidget.

This might be related to issue #743.
2020-10-13 19:47:49 -07:00
Dennis Göries
287d564d7d
GraphicsView: Add basic tests ... (#1396) 2020-10-13 09:06:34 -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
Dennis Göries
325a15a6ef
SignalProxy: Correct initialization without slot argument and tests (#1392)
* SignalProxy: Correct initialization without slot argument and provide tests

* Add missing slot is None case on disconnect

* Start new tests

* Exception block

* Test no module

* Different signal

* Debugging the signal connect

* Re initialize proxy after disconnect

* Add more test cases for blockSignal

* Change test case for signal count

* Give up for python 2 and pyside

* Exclude for Python 2.7 and PySide

* Convert float to integers in timer start period
2020-10-13 08:50:22 -07:00
Ogi Moore
4946a57987
Merge pull request #1382 from dgoeries/code-quality-legend
LegendItem: A bit auto flake8
2020-10-12 22:28:00 -07:00
Ogi Moore
539394e20c
Merge pull request #1362 from bruchar1/make-terminal-sortable
DataTreeWidget exception with multivalue Terminal (flowchart)
2020-10-12 21:46:28 -07:00
Ogi Moore
2955b26fb2
Merge pull request #1383 from dgoeries/transparent-palette
GraphicsView: Set a transparent background palette
2020-10-12 19:44:53 -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
Ogi Moore
ea08dda62d
Merge pull request #1387 from irgolic/patch-1
ScatterPlotItem: Make + and x symbols thicker
2020-10-10 13:10:57 -07:00
rafael
fbf1a2fe18
ScatterPlotItem: Make + and x symbols thicker
This is something we're overriding in Orange3 (biolab/orange3#5007), as we change the symbols' alpha_value to show selected symbols. The default + and x symbols are too thin to show a noticeable change in alpha_value.

But I thought you might agree that the symbols look nicer this way.
2020-10-01 12:57:04 +02:00
Kyle Sunden
0a8ad6b1aa
Merge pull request #1386 from ixjlyons/dev-to-master
Remove a few remaining mentions of the develop branch
2020-09-30 23:30:47 -05:00
Kenneth Lyons
8b9ac0557b Remove a few remaining mentions of the develop branch 2020-09-30 21:04:09 -07:00
Ogi Moore
b0a7c44357
Merge pull request #1384 from k-dominik/patch-1
fix typo in documentation
2020-09-29 10:00:46 -07:00
Dominik Kutra
5842f42632
fix typo in documentation
found a tiny typo when reading the docs...

thank you guys for this awesome library 🚀
2020-09-29 17:29:52 +02:00
Dennis Goeries
9a51fc3662 GraphicsView: Set a trnasparent background palette 2020-09-26 14:36:43 +02:00
Dennis Goeries
6dc0b2c16d LegendItem: A bit auf auto flake8 2020-09-26 14:09:21 +02:00
Etienne Dumur
bd51fa7c87 Clean code, improve boundingRect 2020-09-23 09:27:23 +02:00
Kenneth Lyons
a90c443b7a
Fix PlotItem.setAxisItems (#1376)
* Fix PlotItem.setAxisItems

- Use extend so visibleAxes remains a flat list.
- More robust logic for detecting adding an AxisItem instance to
  mulitple plots and suggest a workaround in the error message.

* Simplify membership check

* Add test for PlotItem setAxisitem logic
2020-09-22 20:25:02 -07:00