Commit Graph

67 Commits

Author SHA1 Message Date
KIU Shueng Chuan
ab41c03358 generate _pyqt6.py files
VideoTemplate_pyside6.py : regenerate for cuda feature
2021-01-23 08:29:39 +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
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
Dennis Göries
2affe322ec
PlotItem: Fix enableMenu setting when passing a viewbox (#1496)
* PlotItem: enableMenu setting when passing a viewbox
2021-01-12 20:34:14 -08: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
Ogi Moore
a719a06b8b
Merge pull request #467 from meganbkratz/derivativePlots_cleanup
Add dy/dx and y vs. y` plot modes to context menus from plots.
2020-06-27 12:50:44 -07:00
Ogi Moore
264d63e90e Update PyQt5, PySide2, PySide1 Templates, apply else statement 2020-06-26 23:51:09 -07:00
Ogi Moore
14d5085636
Merge branch 'develop' into derivativePlots_cleanup 2020-06-23 23:03:56 -07:00
Karl Georg Bedrich
3a758cac96
NEW options for LegendItem (#395)
* NEW options for LegendItem

* * changed 'drawFrame' into 'frame'
* added **kwargs to plotItem.addLegend
* added (frame=False, colCount=2) in legend example
* more elegant solution for legend.getLabel

* repaired getLabel
ItemSample.item == plotitem

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-12 22:40:20 -07:00
Ogi
66d8943317 PlotItem doesn't add item if already there 2020-06-08 21:50:29 -07:00
Ogi Moore
5b5749aa0b Revert "changed structure to redefine axis via plotitem.setAxes (#391)"
This reverts commit bb21791c71.
2020-06-07 20:29:28 -07:00
Kenneth Lyons
120d251a25 Minor improvements to LegendItem.
- Adds doc strings for user-facing methods so they appear in the
  documentation.
- Allows PlotItem.addLegend to accept the same arguments as LegendItem
  constructor for convenience.
- Fixes a bug for adding a BarGraphItem (which doesn't have an antialias
  option) to LegendItem
2020-06-06 15:56:01 -07:00
Adam Strzelecki
983cc1695e
Patch/window handling (#468)
* Do not wrap PlotView/ImageView

There is no need to wrap PlotView/ImageView into QMainWindow, since
only purpose of the QMainWindow is some default menu toolbar & menu
handling, that is not used by PyQtGraph anyway.

Moreover, every parent-less Qt widget can become window, so this
change just use PlotView/ImageView as windows, removing extra
complexity, eg. method forwarding, self.win property.

Another benefit of this change, it that these windows get initial
dimensions and titles as they were designed in .ui file.

* Properly cleanup on ImageView.close()

We should not close explicitly child widgets or clear scene, otherwise
Qt will deallocate children views, and cause "wrapped C/C++ object of
type ImageItem has been deleted" error next time we call close()
and/or some other methods.

All children, including self.ui.roiPlot, self.ui.graphicsView will be
closed together with its parent, so there is no need to close them
explicitly.

So the purpose of close it to reclaim the memory, but not to make the existing ImageView object dysfunctional.

* Remove references to plot & image windows after close

PyQtGraph images and plots module list variables are currently holding
references to all plots and image windows returned directly from main
module. This does not seem to be documented however, and causes the Qt
windows to be not released from memory, even if user releases all own
references.

This change removes the references from images/plots list once window
is closed, so when there is no other reference, window and all related
memory is reclaimed.

* Change all UI forms title from Form to PyQtGraph

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-01 11:23:18 -07:00
Karl Georg Bedrich
bb21791c71
changed structure to redefine axis via plotitem.setAxes (#391)
* changed structure to redefine axis via
plotitem.setAxes

* cleanuup

* remove old axesitems before adding new ones

* DEBUGGED plotitem.setAxes
NEW AxisItem.setOrientation (needed by plotitem.setAxes)
show/hide right axes after .setAxes()

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-01 11:12:52 -07:00
Kenneth Lyons
5353acdb1c Static paths not used for docs. Fix malformed table in docstring 2020-05-16 10:12:33 -07: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
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
2xB
8309b53014 Fix: Reset ParentItem to None on removing from PlotItem/ViewBox (#1031) 2019-09-12 21:00:38 -07:00
2xB
b7b431de8d FIX: Curves are automatically set visible when one is deleted (#987)
* Do not automatically set all curves visible

* Improved array iteration in PlotItem.updateDecimation
2019-08-17 20:36:34 -07:00
2xB
04baa6eef7
addLine now accepts 'pos' and 'angle' parameters
The issue and this solution are discussed in issue https://github.com/pyqtgraph/pyqtgraph/issues/70.
2019-06-20 04:37:09 +02:00
Thomas A Caswell
691da09eb0
MNT: do not use 'is' with literals, use ==
py3.8 gives a syntax warning on this
2019-02-14 16:36:02 -05:00
Luke Campagnola
7be7c3f459 More PlotItem cleanup 2018-06-08 08:43:46 -07:00
Luke Campagnola
7358664414 Merge branch 'Refactor' of https://github.com/Billy4195/pyqtgraph into Billy4195-Refactor 2018-06-07 19:06:44 -07:00
Billy Su
90857e7f27 Extract _choose_filename_dialog() as helper func
To reduce the redundancy, extract the same code as a helper function
_choose_filename_dialog() in PlotItem class
2018-04-05 00:25:36 +08:00
Billy Su
42d96d0c21 Remove outdated comments 2018-04-02 19:26:01 +08:00
Luke Campagnola
46f10f24f8 Merge branch 'develop' of https://github.com/maxpeng/pyqtgraph into maxpeng-develop 2018-02-15 18:30:12 -08:00
Luke Campagnola
ee0ea56695 PlotItem.addLegend will not try to add more than once 2017-09-15 09:05:24 -07:00
Megan Kratz
4cd53ddb1b updated PyQt4 template file; still need to update template files for PyQt5 and PySide (but it's not working for me in this moment) 2017-03-31 10:41:39 -04:00
Megan Kratz
8307e96cfe changed dV/dt labels to dy/dx, to be more general 2017-03-31 10:40:24 -04:00
Paul manis
b93facb10a Added dv/Dt and V vs V' phasemap Plots to context tool in PlotDataItem
(cherry picked from commit 9d88041a0b3b165439d4e0e45923c83afaefb1ad)
2017-03-31 10:14:11 -04:00
Max Peng
8bdc19be75 update to support pyside2 2016-09-25 00:16:36 +08:00
Luke Campagnola
f22493651d Merge pull request #135 from termim/stepMode_and_Average
PlotItem.addAvgCurve: pass through 'stepMode'
2015-08-08 13:02:16 -04:00
Luke Campagnola
0976991efd Import from python2_3 for all uses of basestring, cmp, and xrange 2015-05-19 09:29:55 -04:00
Luke Campagnola
9df4df55c4 Bugfix: don't create extra AxisItem when user provides them
Committed old changelog updates
2015-04-04 11:20:11 -04:00
Mikhail Terekhov
e0c5ae1d0f PlotItem.addAvgCurve: pass through 'stepMode'
Selecting "Plot Options"->"Average" and checking checkbox freezes KDE if
the curve has stepMode=True. See examples/histogram.py as an example.
2015-03-17 00:52:30 -04:00
Luke Campagnola
1fe5976e19 Merge branch 'pyqt5' into develop
Conflicts:
	examples/parametertree.py
	pyqtgraph/Qt.py
	pyqtgraph/graphicsItems/FillBetweenItem.py
	pyqtgraph/graphicsItems/InfiniteLine.py
	pyqtgraph/imageview/ImageView.py
2015-02-28 11:46:41 -05:00
Luke Campagnola
058dd183d3 Cleaned up example loader 2015-02-28 10:32:34 -05:00
Luke Campagnola
f6ded808ef Fixed a few exit crashes, added unit tests to cover them 2014-11-26 21:25:17 -05:00
Luke Campagnola
753ac9b4c4 Squashed commit of the following:
commit ca3fbe2ff9
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Thu Aug 7 08:41:30 2014 -0400

    Merged numerous updates from acq4:
    * Added HDF5 exporter
    * CSV exporter gets (x,y,y,y) export mode
    * Updates to SVG, Matplotlib exporter
    * Console can filter exceptions by string
    * Added tick context menu to GradientEditorItem
    * Added export feature to imageview
    * Parameter trees:
        - Option to save only user-editable values
        - Option to set visible title of parameters separately from name
        - Added experimental ParameterSystem for handling large systems of
            interdependent parameters
        - Auto-select editable portion of spinbox when editing
    * Added Vector.__abs__
    * Added replacement garbage collector for avoiding crashes on multithreaded Qt
    * Fixed "illegal instruction" caused by closing file handle 7 on OSX
    * configfile now reloads QtCore objects, Point, ColorMap, numpy arrays
    * Avoid triggering recursion issues in exception handler
    * Various bugfies and performance enhancements
2014-08-07 09:03:26 -04:00
Luke Campagnola
c6f2e9c2a9 Added code for inverting X axis 2014-04-28 07:36:59 -04:00
Luke Campagnola
6b66edfd46 Added Travis CI support
Fixed bugs / style issues to please Lord Travis

Squashed commit of the following:

commit f25048a1e1
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Sun Mar 30 02:40:47 2014 -0400

    syntax

commit cc8b69695a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Sun Mar 30 02:36:49 2014 -0400

    add size check, diff style check

commit 5d5ea065a4
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Sun Mar 30 02:16:05 2014 -0400

    travis fix

commit b154c6d997
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Sun Mar 30 02:09:41 2014 -0400

    travis, flake colored output

commit 46921dcd87
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Wed Mar 26 12:37:54 2014 -0400

    fix pyside+py3 bugs to satisfy CI

commit 1d30f3c5c7
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Wed Mar 26 11:13:18 2014 -0400

    fix py3 tests

commit 426578fa4c
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Wed Mar 26 07:39:19 2014 -0400

    fix pytest install

commit 88a13c1a71
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Wed Mar 26 00:29:29 2014 -0400

    qt5 updates

commit 51995488cc
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Wed Mar 26 00:16:04 2014 -0400

    correct py.test command for py3

commit e2b02fbcbd
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 23:50:38 2014 -0400

    fix 2nd install test

commit 4b3e3ee04a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 23:31:31 2014 -0400

    syntax error

commit 250eabdb34
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 23:13:42 2014 -0400

    look for py.test3

commit 9f9bca47c1
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 22:54:19 2014 -0400

    fix syntax

commit 0a871c6f36
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 22:47:58 2014 -0400

    output pip build log

commit dbce58d8cd
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 22:38:55 2014 -0400

    no comments allowed between shall lines

commit b79c06121d
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 20:56:35 2014 -0400

    another pip try

commit 09f4f5d82a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 13:36:09 2014 -0400

    pip correction

commit 0eedb5c18e
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 13:29:00 2014 -0400

    correct py version output

commit d9fd039be2
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 11:55:43 2014 -0400

    apt checks

commit cf95ccef86
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Tue Mar 25 10:23:10 2014 -0400

    alternate pip install method

commit bee0bcddfe
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:51:45 2014 -0400

    correct deps install

commit 963a4211fc
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:47:30 2014 -0400

    fixes

commit 0c86cd1dc2
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:31:06 2014 -0400

    permission fix

commit 5d04ef53b8
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:30:19 2014 -0400

    Fix py.test version selection

commit b0e6c7cb94
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:25:34 2014 -0400

    try another pyqt5 install method

commit 422a792866
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:12:36 2014 -0400

    syntax error

commit 533133905a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 23:04:37 2014 -0400

    fixes

commit 8d65211ba4
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 22:40:18 2014 -0400

    Add Qt5 test
    minor fixes

commit 4484efaefe
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 22:31:56 2014 -0400

    use correct py.test for python version

commit 5d2441a29b
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 22:24:27 2014 -0400

    add setup tests

commit 9291db64f2
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 21:48:43 2014 -0400

    fix py3-pyqt install

commit a7aa675c5a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 21:31:33 2014 -0400

    travis tests

commit e71cd2b23a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 21:17:15 2014 -0400

    more corrections

commit 527df3bca8
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 20:56:01 2014 -0400

    travis corrections

commit 87d65cac4a
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 20:48:02 2014 -0400

    Add flake tests
    Correct style in a few files to please Lord Travis

commit 537028f88f
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 17:36:24 2014 -0400

    minimize pyside package install
    correct line endings to satisfy Lord Travis

commit 1e3cc95e37
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 17:23:03 2014 -0400

    enable pyside, line ending check
    fix test

commit d7df4517f9
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 17:12:06 2014 -0400

    syntax fix

commit 1ad77a2155
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 17:00:30 2014 -0400

    alt. pytest install

commit 5edcc02072
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Mon Mar 24 16:52:33 2014 -0400

    Added initial travis.yml
2014-03-30 02:51:32 -04:00
Luke Campagnola
0bb300b7f2 Generated qt5 template files 2014-03-29 06:57:13 -04:00
Luke Campagnola
8046f1e4ff Merge branch 'pyqt5' of https://github.com/mfitzp/pyqtgraph into mfitzp-pyqt5 2014-03-26 13:56:32 -04:00
Luke Campagnola
25e7d12f09 Cleanup / fixes:
- Corrected isQObjectAlive for PyQt and older PySide
  - Warning messages are opt-in using pg.setConfigOptions(crashWarning=True)
2014-03-24 15:47:32 -04:00
fabioz
6433795e78 Make sure we don't leave view boxes alive by doing a 'bridge' for the on the plot items. Also added warnings if proper cleanup wasn't done. 2014-03-13 17:38:50 -03:00
Luke Campagnola
c72638ab1b Merge branch 'tommy3001-doc-updates' into develop
Conflicts:
	pyqtgraph/graphicsItems/AxisItem.py
	pyqtgraph/graphicsItems/PlotDataItem.py
	pyqtgraph/graphicsItems/ROI.py
2014-02-28 21:07:43 -05:00
Martin Fitzpatrick
42dbd7956a Adding PyQt5 compatibility (broken)
Adding compatibility for PyQt5 via a shim in Qt.py. This restructures the PyQt5 libraries
to match the layout seen in PyQt4, allowing it to continue to be used as drop in replacement.

This works up to the point of importing, however other API changes are broken - for example
the deprectation of .scale() on GraphicsItems throws an error currently.
2014-02-14 10:29:33 +01:00
tommy3001
af106e3245 Minor Arguments list alignment in setDownSampling 2014-02-12 21:18:36 +01:00
tommy3001
9f5954641d ":" added 2014-02-12 21:06:54 +01:00