Commit Graph

462 Commits

Author SHA1 Message Date
KIU Shueng Chuan
e10dbfd9e1 change examples to use setCameraPosition 2021-07-17 18:25:21 +08:00
Ogi Moore
e83b91e9af
Merge pull request #1871 from pijyoi/opengl_init
Allow adding items to GLViewWidget before show
2021-07-03 08:10:35 -07:00
ntjess
820c1604dd
Set focus to the example filter + Ctrl+F listener for focus (#1873)
* Set focus to the example filter + Ctrl+F listener for focus

* Early return on detecting "F"
2021-07-03 07:58:51 -07:00
KIU Shueng Chuan
f9f5d46589 missing import of pg
CI passed because of the way the example gets invoked.
2021-07-01 08:56:47 +08:00
ntjess
4a921ddf71
Filter examples (#1868)
* Allows filtering of examples

* For some reason, the ui designer ignored the courier font family so I manually inserted it into the .ui file

* Allows filtering by file content, too

* Respects dark mode (maybe?), fixes policy setting on code layout

* Prevents "run edited code" from showing unless the actual content changes

* Looks like black font is always best against highlight background

* Left test code in commit...

* Fix broken highlighting on PyQt6

* Address #133

* Better highlighting for both dark and light mode

* Minor refactoring/cleanup, uses combo box instead of checkbox

* Combo box below text edit to avoid clipping

Co-authored-by: njessurun <ntjessu@gmail.com>
2021-06-26 17:51:34 -07: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
KIU Shueng Chuan
89f6c7da81 remove codepaths other than pixmap fragments codepath 2021-06-15 09:43:31 +08:00
KIU Shueng Chuan
ad3e3a6b8b ScatterPlotSpeedTest: add toggle for drawPixmapFragments 2021-06-13 08:00:45 +08: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
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
Ogi Moore
29bdf9949e Skip GLTextIem on some conditions on macOS 2021-06-08 21:11:24 -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
KIU Shueng Chuan
1715d5a6fa error on presence of "Exception:" and "Error:" 2021-06-08 15:13:17 +08:00
Nils Nemitz
61f067bf7c
Add axis convenience methods and matrix display example (#1726)
* add axis convenient methods and matrix display example

* wrestled wayward space back into docstring

* color map names are case sensitive on Linux

* docstring fix for PlotItem

* protect AxisItem.linkToView from being obscured by DateAxisItem override

* replaced setOrigin method by promoted setPos and setScale

* made tri-state axes switching explicit

* reverted setRect behavior, documentation pass for ImageItem

* minor text adjustment

* implmented some suggested revisions

* fix input parsing for setRect and add tests so that I don't break it again

* don't try to re-add transform after clearing it

* changed example and doc image generators to pg.exec()

* removed commented-out code

* cleaned up transform eqaulity assertion

* restored devoured comment

* restored devoured comment
2021-06-07 07:44:19 -07:00
shikishima-TasakiLab
f13002b251
Add "GLTextItem" (#1776)
* Add GLTextItem

* Fixed DocString.

* Delete unnecessary function.

* Add `from .items.GLTextItem import *`

* Add an example.

* [Combines two `isinstance()` into one.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046120)

* [Combines two `isinstance()` into one.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046120)

* [The long code has been broken up into separate lines.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046234)

* [Moved `pos`, `color`, `text`, and `font` to the `__init__` method.](https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633047216)

* Add `import initExample` and fix `mkQApp().exec_()` to `pg.exec()` (https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046878, https://github.com/pyqtgraph/pyqtgraph/pull/1776#discussion_r633046781)

* Fix `pg.exec()` to `pg.mkQApp().exec()`

* Revert "Fix `pg.exec()` to `pg.mkQApp().exec()`"

This reverts commit 67d397d803.

* Remove type-hints.

* Fix `glColor4d(float(self.color[0]), float(self.color[1]), float(self.color[2]), float(self.color[3]))` to `glColor4d(*self.color)`

* Add `value = fn.glColor(value)`

* Remove debug print.

* Add GLGridItem and GLAxisItem

* Remove if-check for "color" argument

* Draw text without using GLUT.

* Divide the text position by the device pixel ratio

* Fixed bare exceptions to ValueError and TypeError.

* Add 'GLTextItem.py' to utils.py.

* Fixed a bare exception to ArgumentErrror.

* Add `__all__ = ['GLTextItem']`
2021-06-05 08:19:54 -07:00
Ogi Moore
145ab2e9e3 Merge branch 'master' into test-polyline 2021-06-04 21:06:52 -07:00
Ogi Moore
c7675ca8bb Fix unraisable exception in test_examples
The way we called subprocess.Popen, it looks like we didn't close all
the pipes; this PR addresses the warning that pytest generates when
running the examples.

In addition, we toggle the pytest setting to error on any warning
2021-05-31 21:06:16 -07:00
Ogi Moore
ee951331be Close the example app after it launches 2021-05-31 21:06:16 -07:00
Ogi Moore
e7a30b9324 Clean up test files
Remove if __name__ == "__main__" bits, replace some == None to is None
checks

Cleanup variety of static code checker issue

Removed missing imports, restructured some logic to make a little
cleaner, fixed a function in test_dockarea, unfortunately broke the test
so now I tell pytest to expect the Exception.
2021-05-31 21:06:16 -07:00
Luke Campagnola
e29f86578f
Revert Point.angle behavior change (#1806)
* Revert behavior change of Point.angle

* Propagate Point.angle revert
2021-05-27 08:51:06 -07:00
Ogi Moore
aaae0b9e1c Have MultiPlotSpeedTest use skipFiniteCheck 2021-05-25 21:58:58 -07:00
Fernando Bordignon
a4de137535 update cx_freeze example and add a workaround for templates 2021-05-24 17:50:24 -03:00
Mark Schloeman
1c1212e5e9 Set minStep in dec stepping SpinBox example 2021-05-16 17:37:33 -04:00
Ogi Moore
9624b2a049 Do not attempt to avoid np.log(0), instead ignore the warning
Fixes #1775, also took the opportunity to clean the file a bit.
2021-05-16 10:18:23 -07:00
KIU Shueng Chuan
21296cd4f3 change all examples to use pg.exec() 2021-05-14 06:16:21 +08:00
KIU Shueng Chuan
09ce81655d VideoSpeedTest.py : Add numba checkbox 2021-05-07 15:35:27 +08:00
Nils Nemitz
bfc63bb730
Make plotting with gradients more fun (#1742)
* added convenience functions to better handle plotting with gradients

* docstring correction, example name correction

* retrying to get  documentation format right

* another attempt at cleaning up docs

* Don't hardcode timer type (and docs fixing attempt)

* more docstring re-formatting

* linebreaks in docstrings

* more documentation adjustments

* documentation pass

* some corrections to documentation

* more adjustments to documentation

* again?

* removed some whitespace and redundant blank lines, changed some checks '== None' to 'is None'

* fixed mis-spelling QColor as Qcolor
2021-05-06 23:20:21 -07:00
Kenneth Lyons
cafe079910
Support horizontal HistogramLUT{Item,Widget} (#1757)
* Improve HistogramLUTItem docs, a few cosmetic changes

* Initial implementation of horizontally-oriented HistogramLUTItem

- Also adds support in HistogramLUTWidget
- Fixes AxisItem orientation bug for vertical orientation
- Make use of GradientEditorItem orientation (fixes another bug for
  vertical orientation)
- Use horizontal orientation in an example for demonstration

* Remove unused HistogramLUTItem option

* A few more minor fixups

* Copy paste bug

* Use f-strings

* Update from review and a couple more minor updates

* Woops

* Add doc for orientation arg

* Add top/bottom orientation to doc. Expand on levelMode doc a bit
2021-05-04 21:25:42 -07:00
Ogi Moore
a534132c62
Various performance improvements to pg.Point (#1741)
This change makes use of QPointF methods which perform faster than the python
equivalent methods.  Furthermore, some tests are added.

* Set __slots__ to empty tuple for pg.Point
* Make Point.angle() behave as Vector.angle()
2021-04-28 21:29:47 -07:00
Ogi Moore
4d388ee633 Use open context-manager instead of file.open()
Static code checker identified multiple places where a file is opened
but is not necessarily closed.  This commit addressed that with the
exception of RemoteGraphicsView.py
2021-04-25 17:05:05 -07:00
Ogi Moore
6a708dc203
Merge pull request #1724 from j9ac9k/use-math-module-for-single-values
Use math module methods for scalars
2021-04-23 23:10:17 -07:00
Ogi Moore
03ea368454 Clean up Errors for CodeQL analyzer
CodeQL identified some errors and warnings, which this commit cleans up.
2021-04-23 22:44:29 -07:00
Ogi Moore
e1415cb3a8 Use np.pi or math.pi instead of just pi 2021-04-23 22:43:57 -07:00
Ogi Moore
c4a1cf11a1 Use clip_array or clip_scalar instead of np.clip
Significant performance issues have been identified with np.clip
and thus clip_array was created to speed up the operation.  In addition
clip_scalar was created to clip a scalar value between two other values
this commit replaces many uses of np.clip from operating on scalars to
using clip_scalar instead
2021-04-23 11:53:00 -07:00
Ogi Moore
b01e0e0895 Remove unused function and change line calc
Using @pijyoi's suggestion regarding line calculation broadcasting
2021-04-23 11:53:00 -07:00
Ogi Moore
f60fa3b534 Use clip_array instead of np.clip in GLVolumeItem 2021-04-23 11:53:00 -07:00
Ogi Moore
f8cefa6284 Use hypot method to avoid over/underflow errors
Use hypot instead of manual calculation
2021-04-23 11:53:00 -07:00
Ogi Moore
b0a3849960 Use math module methods for singular values
Using numpy methods that are intended for vectorized operations is
substantially slower than using the math module, so when feasible the
math module methods should be used.
2021-04-23 11:53:00 -07:00
Ogi Moore
ec4d613037
Merge pull request #1730 from pijyoi/fix_powershell 2021-04-21 07:02:28 -07:00
Martin Chase
d531a808e1
allow gradient position to be configured on a histogram (#1729)
* NEW features for HistgramLUTItem

* gradientPosition=('left', 'right')
* only paint if item is visible (is faster)
* link hisogram to other histograms

* fixes to be able to merge

 * drop linkHistogram (rgba needs to be better integrated)
 * make sure defaults to same as current behavior
 * draw connecting lines correctly on each side
 * add example use
2021-04-20 19:57:15 -07:00
KIU Shueng Chuan
0781f9392b use Popen instead of os.spawnle 2021-04-21 07:31:03 +08:00
Ogi Moore
e735d2d9b8 Block pyopenGL tests on more macOS platforms
When running on macOS Big Sur, pyopenGL is unable to find the bindings

Previously this was assumed that it would be fixed in later versions
of Python 3.8, but that has not happened.
2021-04-15 22:08:50 -07:00
Martin Chase
a465f93d9b
small TargetItem fixes (#1715)
* angle is just an int, not a method

* more TargetItem use in the example

* offset is needed before super sometimes

* use setLabel, too
2021-04-14 10:44:03 -07:00
Ogi Moore
fe6ad52262 Remove infiniteline from others in examples 2021-04-10 23:10:12 -07:00
Ogi Moore
5a08650853
Improve target item - incorporate bits from PR 313 (#1318)
Overhaul TargetItem based on @lesauxvi 's PR #313
2021-04-10 22:42:44 -07:00
Nils Nemitz
758c038411
Add ColorBarItem for simplified image level adjustment (#1596)
* Initial implementation of ColorBarItem

* initial commit

* fixed missing indent

* docstring extension and corrections

* Converted example to match others / run as part of tests

* load local color maps instead of importing from colorcet

* clean up window creation code

* horizontal color bar and clean-up

* switched to mkQApp initialization

* cleaned up some comments
2021-04-05 20:50:52 -07:00
KIU Shueng Chuan
de85a23ae0 switch to row-major order 2021-03-26 04:07:19 +08:00
KIU Shueng Chuan
fda8731dab reduce memory usage during data generation
random.normal() generates as float64 and gets converted to a smaller
dtype. generating all the needed data in a single call thus uses a lot
more memory than is necessary.

this changes it such that smaller chunks are generated.
data clipping is also changed to be in-place.

the gaussian filtering which gave the video a washed-out look is also
removed. this also contributed to data generation time.
2021-03-26 04:07:19 +08:00
KIU Shueng Chuan
cbafc773f5 fix: max value of uint16 is 65535 2021-03-26 04:07:19 +08:00
Ogi Moore
3b620836c4
Merge pull request #1651 from j9ac9k/Use_collections.abc
collections.abc not just collections
2021-03-23 11:56:02 -07:00