Commit Graph

1315 Commits

Author SHA1 Message Date
Luke Campagnola
6a76f40869 Add support for running pyside2-uic binary to dynamically compile ui files 2020-05-28 11:59:31 -07:00
Ogi Moore
35128d404a
Merge pull request #1168 from 2xB/fix-788
GroupParameterItem: Did not pass changed options to ParameterItem
2020-05-27 07:32:17 -07:00
Marko Bausch
4052f0dd11 Added context menu option to paramtree 2020-05-22 16:05:52 +02:00
Megan Kratz
ca2e5849c2 better conditional handling so as not to break something that was working before 2020-05-19 15:25:15 -06:00
Megan Kratz
360bcad47b fix for mismatched axis exception when imageAxisOrder='row-major' 2020-05-19 15:12:09 -06:00
Megan Kratz
c349c3665b fix for roi getting wrong data when imageAxisOrder='row-major' 2020-05-19 15:11:11 -06:00
Ogi Moore
c715c5ac28
Merge pull request #1201 from pyqtgraph/rtd_build
Get readthedocs working
2020-05-18 14:58:05 -07:00
Kenneth Lyons
5353acdb1c Static paths not used for docs. Fix malformed table in docstring 2020-05-16 10:12:33 -07:00
Chris Billington
9a9be68d90
mkQApp: Use sys.argv if non-empty and always set given name (#1199)
Always pass `sys.argv`, if non-empty, to `QApplication` constructor.
This allows code to continue to rely on the fact that the application
name is by default set from `sys.argv[0]`, which is important for
example on Linux where this determines the WM_CLASS X attribute used by
desktop environments to match applications to their launchers.

If `sys.argv` is empty, as it is in an interactive Python session, pass
`["pyqtgraph"]` in its place as a sensible default for the application
name, which causes issues if not set (issue #1165).

If a `name` is given, set it using `setApplicationName()` instead of via
the argument list. This ensures it will be set even if the singleton
`QApplication` already existed prior to calling `mkQApp()`.
2020-05-15 11:31:42 -07:00
Kyle Sunden
fb56d3eaa9
Merge pull request #801 from ales-erjavec/remove-address-cache
Remove use of GraphicsScene._addressCache in translateGraphicsItem
2020-05-11 10:38:39 -05:00
Maxim Millen
14075e6223
Added support for plot curve to handle both fill and connect args. (#1188) 2020-05-10 08:42:04 -07:00
Kenneth Lyons
5bebf697b0
Disable remove ROI menu action in handle context menu (#1197) 2020-05-10 08:39:17 -07:00
2xB
720fa5f3c2
DateAxisItem: AxisItem unlinking tests and doc fixed (#1179)
* Added test_AxisItem by @mliberty1

As found in https://github.com/pyqtgraph/pyqtgraph/pull/917

* test_AxisItem: Fit to current implementation

* DateAxisItem: Fix documentation to zoomLevels

zoomLevels is not intended to be set by the user (see discussion in converstation from
https://github.com/pyqtgraph/pyqtgraph/pull/1154/files#diff-aefdb23660d0963df0dff3a116baded8
). Also, `zoomLevelWidths` does currently not exist.
This commit adapts the documentation to reflect that.

* DateAxisItem: Do not publish ZoomLevel

* DateAxisItem testing: Removed unnecessary monkeypatch fixture

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-05-05 09:16:07 -07:00
2xB
96be1bd23f
Fix: AxisItem tickFont is defined in two places while only one is used (#1180)
To set the tick font of `AxisItem`s, there are two options:
`setStyle({"tickFont":...})` and `setTickFont(...)`.
The first option sets `AxisItem.style['tickFont']`, the second
sets `self.tickFont`. Only `self.tickFont` is actually used.
This PR replaces all occurrences of the second variable with the first
variable, so both options work again. Also, documentation from
`setStyle` is copied to `setTickFont`.

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-05-04 14:58:29 -07:00
Daniel Hrisca
f7364f52b3
improve SymbolAtlas.getSymbolCoords performance (#1184)
* remote legacy work-around for old numpy errors

* forgot to remove the numpy_fix import

* require numyp >= 1.8.0

* improve performance of updateData PlotCurveItem (saves about 2us per call)

* improve ScatterPlotItem performance
2020-05-04 13:42:03 -07:00
Ales Erjavec
02b7532706 Remove use of GraphicsScene._addressCache in translateGraphicsItem
Use QGraphicsItem.toQGrapicsObject on the item instead.

This probably is not even needed since PyQt 4.9
2020-05-01 13:05:51 +02:00
Lev Maximov
a76d9daec2
Date axis item (#1154)
* Add DateAxisItem

* Change style to camelCase

* Fix missing first tick for negative timestamps

* Add ms precision, auto skipping

Auto skipping allows a zoom level to skip ticks automatically if the
maximum number of ticks/pt is exceeded

* fixes suggested by @goetzc

* workaround for negative argument to utcfromtimestamp on windows

* attachToPlotItem method

* default date axis orientation

* Use new DateAxisItem in Plot Customization example

* attachToPlotItem bugfix

* examples of DateAxisItem

* modified description of customPlot example

* added descriptions to the new examples, reformatted their code, included the first one into utils.py

* typo

* Refactored code for setting axis items into new function

Replaces "DateAxisItem.attachToPlotItem"

* Fix string comparison with ==

* Doc: Slightly more text for DateAxisItem, small improvement for PlotItem

* Make PlotWidget.setAxisItems official

* Fix typo in docstring

* renamed an example

* merge bug fix

* Revert "merge bug fix"

This reverts commit 876b5a7cdb.

* Real bug fix

* support for dates upto -1e13..1e13

* Automatically limit DateAxisItem to a range from -1e12 to 1e12 years

Very large years (|y|>1e13) cause infinite loop, and since nobody
needs time 100 times larger than the age of the universe anyways,
this constrains it to 1e12.

Following suggestion by @axil:
https://github.com/pyqtgraph/pyqtgraph/pull/1154#issuecomment-612662168

* Also catch ValueErrors occuring on Linux before OverfloeErrors

While zooming out, before hitting OverflowErrors, utctimestamp
produces ValueErrors (at least on my Linux machine), so they
are also catched.

* Fix: Timestamp 0 corresponds to year 1970

For large years, x axis labels jump by 1970 years if it is not
accounted for timestamp 0 to be equal to year 1970.

* Fix: When zooming into extreme dates, OSError occurs

This commit catches the OSError like the other observed errors

* Disable stepping below years for dates outside *_REGULAR_TIMESTAMP

2 reasons: First: At least on my Linux machine, zooming into
those dates creates infinite loops. Second: Nobody needs
sub-year-precision for those extreme years anyways.

* Adapt zoom level sizes based on current font size and screen resolution

This is somewhat experimental. With this commit, no longer 60 px are
assumed as width for all zoom levels, but the current font and
display resolution are considered to calculate the width of ticks in
each zoom level. See the new function `updateZoomLevels` for
details.
Before calling this function, overridden functions `paint` and
`generateDrawSpecs` provide information over the current display
and font via `self.fontScaleFactor` and `self.fontMetrics`.

* Meaningful error meassage when adding axis to multiple PlotItems

As @axil noted in the DateAxisItem PR, currently users get a
segmentation fault when one tries to add an axis to multiple
PlotItems. This commit adds a meaningful RuntimeError message
for that case.

* setZoomLevelForDensity: Refactoring and calculating optimal spacing on the fly

* DateTimeAxis Fix: 1970 shows when zooming far out

* Refactoring: Make zoomLevels a customizable dict again

* updated the dateaxisitem example

* Fix: Get screen resolution in a way that also works for Qt 4

This is both a simplification in code and an improvement in backwards compatibility with Qt 4.

* DateAxisItem Fix: Also resolve time below 0.5 seconds

* unix line endings in examples

* DateTimeAxis Fix: For years < 1 and > 9999, stepping broke

Stepping was off by 1970 years for years < 1 and > 9999,
resulting in a gap in ticks visible when zooming out. Fixed by
subtracting the usual 1970 years.

* DateTimeAxis Fix: Zooming out too far causes infinite loop

Fixed by setting default limits to +/- 1e10 years. Should still
be enough.

* improved second dateaxisitem example

* 1..9999 years limit

* DateTimeAxis: Use OrderedDict to stay compatible with Python < 3-6

* DateAxisItem: Use font height to determine spacing for vertical axes

* window title

* added dateaxisitem.rst

* updated index.rst

Co-authored-by: Lukas Heiniger <lukas.heiniger@sed.ethz.ch>
Co-authored-by: Lev Maximov <lev.maximov@gmail.com>
Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-04-27 11:43:22 -07:00
Marcel Schumacher
a697b5584a Fixed a possible race condition with linked views 2020-04-14 17:24:54 +02:00
2xB
ec66c34fc9 GraphicsLayout: Always call layout.activate() after adding items
Items added to a `GraphicsLayout` only learn their size information
after the internal `QGraphicsGridLayout` recalculates the layout.
This is happening as a slot in the Qt event queue.
Not having updated geometry bounds directly after adding an item
leads to multiple issues when not executing the Qt event loop
in time (see below). This commit fixes that by always calling
`layout.activate()` after adding items, updating item sizes
directly.

This is a follow-up to PR #1167, where introducing a direct call to
`processEvents` was suspected to be able to cause side effects.

Notifying @j9ac9k and @campagnola, as they were involved in #1167.

Fixes #8
Fixes #1136
2020-04-14 02:00:49 +02:00
Kenneth Lyons
a703155a21 Replace default list arg with None 2020-04-11 20:15:00 -07:00
2xB
4f1bf8bb18 GroupParameterItem: Did not pass changed options to ParameterItem
`ParameterItem` handles visibility changes in `optsChanged`.
`GroupParameterItem` overrides this function, but never calls
the super function, leading in visibility changes not being
applied. This PR fixes this by calling said function.

Fixes #788
2020-04-12 02:47:23 +02:00
2xB
be1ed14bd0 pg.mkQApp: Pass default application name to Qt, added documentation 2020-04-12 00:43:16 +02:00
Ogi Moore
6f4048596b
Merge pull request #1156 from 2xB/2xb-fix-1155
SVGExporter: Correct image pixelation.
2020-04-09 07:52:46 -07:00
2xB
71636e3518 Fix: Update axes after data is set 2020-04-08 17:11:20 +02:00
2xB
1e81f3dad0 SVGExporter: Correct image pixelation. 2020-04-08 01:14:36 +02:00
Ogi Moore
88931bc4a5
Merge pull request #1152 from ixjlyons/fnanfix-test
Fnanfix test
2020-04-03 18:39:10 -07:00
Kenneth Lyons
988e5c1222 Test makeARGB with nans 2020-04-03 17:56:38 -07:00
Jan Kotanski
6f34da586d remove second nanMask = np.isnan(data) 2020-04-03 17:56:38 -07:00
Jan Kotanski
daeacad71f Make nanMask compatible with 3D data 2020-04-03 17:56:11 -07:00
Jan Kotanski
61967bd7f7 add nanfix 2020-04-03 17:49:34 -07:00
lcmcninch
a5dd549be1
Pass showAxRect keyword arguments to setRange to allow caller to set padding, etc. (#1145)
Co-authored-by: Luke McNinch <lucas.c.mcninch.civ@mail.mil>
2020-04-03 15:33:21 -07:00
Kenneth Lyons
db67a256a9
Miscellaneous doc fixups (#1142)
* Miscellaneous doc cleanup

* Moved dockarea up a level (like flowchart, parametertree). Removed extraneous parametertree doc
2020-04-03 10:06:25 -07:00
Ogi Moore
7cbc703449
Merge pull request #1151 from ixjlyons/imageexporter-tests
ImageExporter py2-pyside fix with test
2020-04-03 09:46:45 -07:00
Kenneth Lyons
3ba76475d4 Added ImageExporter test for py2-pyside fix 2020-04-03 09:30:23 -07:00
Ogi Moore
a8d1a84870
Merge pull request #1063 from ales-erjavec/view-box-enable-menu-fix
Fix: AttributeError in ViewBox.setEnableMenu
2020-03-06 16:16:14 -08:00
Ogi Moore
93f8ee9f0a
Merge pull request #1111 from JoeXinfa/add-label
Add name label to GradientEditorItem
2020-03-06 15:30:57 -08:00
Ogi Moore
f61d38ba8b
Merge pull request #1110 from jkotan/nextafter2
fix for makeARGB error after #955
2020-03-06 13:32:11 -08:00
Ogi Moore
5cd19ba7a0
Merge pull request #1139 from SamSchott/patch-1
Bug fix in LegendItem for `setPen`, `setBrush` etc
2020-03-06 11:26:48 -08:00
SamSchott
3509d79c0f
bug fix for setPen, setBrush, ...
Fixes a bug where `setPen`, `setBrush` and `setLabelTextColor` would fail because they call `LegendItem.paint` without a pen. They should instead call `LegendItem.update`.
2020-03-06 15:02:39 +00:00
Unknown
6985be2a6f replaced incompatible string construction 2020-03-01 17:46:01 +01:00
Ogi
3158c5b4db Use int() instead of .__int__() 2020-02-29 14:38:19 -08:00
Ognyan Moore
6ed8a405fe Address FutureWarning about implicit float to int conversions 2020-02-28 14:27:10 -08:00
Ognyan Moore
7199a4f4ce deepcopy(dict) does not necessarily preserve insertion order 2020-02-28 14:25:34 -08:00
Ognyan Moore
3195ed4c8f Skip some tests on pyside2 2020-02-26 10:06:02 -08:00
Ogi
19ae94765f Skip tests involving loadUi with pyside2 5.14 2020-02-24 23:00:42 -08:00
Ogi
428af4950d unskip py3 tests, weakref works fine in a list 2020-02-24 23:00:09 -08:00
Ognyan Moore
f0d1c4eda1 Skipping problematic test on py2/qt4/linux 2020-02-24 22:30:27 -08:00
Xinfa Joseph Zhu
660ac675f1 Fix typo bug 2020-01-09 15:23:49 -06:00
Jan Kotanski
65d2ac58e0 fix for nextafter 2020-01-08 21:19:09 +01:00
Kenneth Lyons
61104cd43c Fix small oversight in LegendItem 2019-12-24 10:04:31 -08:00
Paul Müller
57909aab45
dump ExportDialog.exporterParameters, b/c it prevents correct aspect ratio on image export (close #1087) 2019-12-03 11:52:09 +01:00
Ogi Moore
db483f8ec2
Merge pull request #1082 from pyqtgraph/revert-360-develop
Redo "Allow MetaArray.__array__ to accept an optional dtype arg"
2019-11-25 06:52:44 -08:00
Paul Müller
2a01c3848a
fix wrong offset when drawing symbol 2019-11-25 14:14:15 +01:00
Paul Müller
b02ada024b
fix error on SVG export of scatter plots: KeyError: 'resolutionScale' 2019-11-23 13:10:49 +01:00
Ognyan Moore
ef4ca9e9ea Incorporated correction luke suggested 2019-11-21 08:46:25 -08:00
Ogi Moore
770ce06dc1
Revert "Allow MetaArray.__array__ to accept an optional dtype arg" 2019-11-21 08:42:44 -08:00
Ogi Moore
78e218fe6c
Merge pull request #360 from nfirvine/develop
Allow MetaArray.__array__ to accept an optional dtype arg
2019-11-20 22:17:18 -08:00
Ogi Moore
71c4807559 fix dict eq() checks 2019-11-20 21:54:56 -08:00
Ogi Moore
477feb777b import h5py.highlevel is deprecated, use import h5py instead 2019-11-20 21:54:56 -08:00
Luke Campagnola
a8529e48f3 faster keys comparison 2019-11-20 21:54:56 -08:00
Luke Campagnola
7cb27594a5 fix dict keys comparison 2019-11-20 21:54:56 -08:00
Luke Campagnola
542f4b446b Add eq() support for comparing dict, list, tuple 2019-11-20 21:54:56 -08:00
Luke Campagnola
e58b7d4708 minor correction 2019-11-20 21:54:56 -08:00
Luke Campagnola
c484c86417 don't modify info from v1 files, move info correction to hdf reading 2019-11-20 21:54:56 -08:00
Paul B. Manis
ae61d3582e Py2/3 MetaArray adjustments, first pass 2019-11-20 21:54:56 -08:00
SamSchott
c0ae44bc2d Nicer legend (#958)
* More customizable and nicer legend.

- Give kwargs for legend frame and background colors instead of hard-coded values.
- Reduce spacing for more compact legend
- Give separate kwarg `labelTextColor`.
- New method to clear all legend items.
- New methods to get and change `offset` relative to the legend's parent.
- Horizontal instead of tilted lines for legend pictures.
2019-11-19 21:42:31 -08:00
SamSchott
c95ab570b1 set color of tick-labels separately (#841) 2019-11-19 20:43:27 -08:00
rwalroth
455fdc2a2a Allowed actions to diplay title instead of name (#1069)
ActionParameterItem changed so that if there is
a title it will be displayed, otherwise displays name.
2019-11-19 20:05:45 -08:00
boylea
b1b2f4662b Fixed image scatter plot export bug (#88) 2019-11-19 20:03:15 -08:00
Paul Müller
267a0af8e7 Reset currentRow and currentCol on clear (#1076) 2019-11-19 08:21:36 -08:00
Ogi Moore
60c760a2e0
Add RemoteGraphicsView to __init__.py (#1066) 2019-11-19 08:15:27 -08:00
Daniel Hrisca
15a1f5af94 improve performance of updateData PlotCurveItem (saves about 2us per call) (#1079)
* improve performance of updateData PlotCurveItem (saves about 2us per call)
2019-11-19 08:14:53 -08:00
Kenneth Lyons
ec445e7601 HDF5Exporter handling of ragged curves with tests (#1072)
* HDF5Exporter handles ragged curves by saving them into different datasets based on their names.

* Add HDF5Exporter tests

* Document HDF5Exporter

* Fix tmp file path
2019-11-12 09:01:49 -08:00
Kenneth Lyons
faef56c3e7 Qulogic py3 fixes (#1073)
* py3k: Remove reduce calls.

* py3k: Remove compatibility sortList function.

Sorting by key has existed since Python 2.4.

* Remove unnecessary sys.path manipulation.

This file doesn't have any __main__ code to run anyway.

* Use context manager
2019-11-12 08:45:42 -08:00
Kenneth Lyons
f5e25622a7 Validate min/max text inputs in ViewBoxMenu (#1074) 2019-11-12 08:36:16 -08:00
Ales Erjavec
a65b8c91f7 Add simple test for setEnableMenu 2019-11-06 10:59:51 +01:00
Ales Erjavec
50cf2f561f Move common code to _applyEnableMenu 2019-11-06 10:58:00 +01:00
Jan Kotanski
6848824557 add bookkeeping exporter parameters (#1023) 2019-11-02 22:00:06 -07:00
Eugene Prilepin
b1df230964 Remove 'global' for CONFIG_OPTIONS because it is redundant for dict (#1055) 2019-11-02 21:51:20 -07:00
wuyuanyi135
cb4d9b23b2 fix flowchart context menu redundant menu (#1060) 2019-11-02 21:36:58 -07:00
Ales Erjavec
a84953530f Fix: setEnableMenu in ViewBox 2019-10-28 14:30:22 +01:00
Agamemnon Krasoulis
f2740f7e69 Fix typo in documentation (#1062) 2019-10-22 09:45:45 -07:00
2xB
ed6586c7dd Removed unnecessary enlargement of bounding box (#1048) 2019-09-30 09:15:03 -07:00
Kenneth Lyons
61ec73a741 Close windows at the end of test functions (#1042)
* Close windows at the end of test functions

* Can't show window deletion warning during interpreter shutdown
starting
2019-09-27 13:37:40 -07:00
Mi!
071e429535 makeRGBA/ImageItem: Applying alpha mask on numpy.nan data values (#406)
* Applying alpha mask on numpy.nan data values

* Typesafe, checking for `data.dtype.kind`
2019-09-27 13:31:47 -07:00
2xB
96a4270a30 Fix HistogramLUTWidget with background parameter (#953)
* Fix HistogramLUTWidget with background parameter

HistogramLUTWidget cannot be initialized with the `background` parameter, because all parameters are also passed to the constructor of HistogramLUTItem which does not have a `background` parameter. This pull request fixes that issue by defining `background` explicitly as parameter in the function header.

Closes #175

* Added test for HistogramLUTWidget initialization with background

* Fixed Python2 compatibility

* Do not pg.exit() after test

* Moved test_histogramlutwidget to widget tests
2019-09-27 13:02:54 -07:00
Daniel Hrisca
aa3a5d3995 remote legacy work-around for old numpy errors (#1046)
* remote legacy work-around for old numpy errors

* forgot to remove the numpy_fix import

* require numyp >= 1.8.0
2019-09-26 10:08:43 -07:00
Kenneth Lyons
3ae58a065e
Merge pull request #1045 from ixjlyons/fix-525
Raise AttributeError in __getattr__
2019-09-25 17:57:12 -07:00
Kenneth Lyons
b57d45df6d The lazier way 2019-09-23 21:25:52 -07:00
Kenneth Lyons
ed264802a2 Raise AttributeError in __getattr__ 2019-09-23 21:19:01 -07:00
Kenneth Lyons
b7f1aa88cd Cast to int after division 2019-09-22 17:03:30 -07:00
lidstrom83
df28c41d4b Make DockArea compatible with Qt Designer (#158) 2019-09-13 23:08:28 -07:00
Aikhjarto
8c137a1caf fix: circular texture was slightly off-center (#1012) 2019-09-13 22:12:23 -07:00
Kenneth Lyons
c94b1cb99e Always update transform when setting angle of a TextItem (#970)
* Always update transform when setting angle of a TextItem

* Add test to check TextItem.setAngle

* Relax test a bit but still check that setAngle has an effect

* Add docstring to setAngle

* Remove unneeded numpy testing function imports
2019-09-13 22:04:48 -07:00
Kenneth Lyons
fc9768be3c
Merge pull request #356 from QuLogic/np-warnings
Fix some NumPy warnings
2019-09-12 22:36:55 -07:00
Elliott Sales de Andrade
2e90089890 Fix undefined reduce call. 2019-09-13 01:07:57 -04:00
Elliott Sales de Andrade
3edbef6c57 Ensure exported images use integer dimensions.
It seems that the parameter tree doesn't enforce the int type very
strongly.

Also, use some local variables more often.
2019-09-13 01:07:57 -04:00
2xB
061a30e827 Correctly include SI units for log AxisItems (#972) 2019-09-12 21:58:49 -07:00
2xB
bfd36dc203 Prevent element-wise string comparison (code by @flutefreak7) (#1024) 2019-09-12 21:30:39 -07:00
2xB
8309b53014 Fix: Reset ParentItem to None on removing from PlotItem/ViewBox (#1031) 2019-09-12 21:00:38 -07:00