-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sphinx gallery to docs #2323
base: master
Are you sure you want to change the base?
Conversation
- Add title to each example docstring - Add examples README - Sphinx conf is a total hack right now, need to figure out something better, potentially rename examples
Still seeing some "C++ object deleted..." errors, but at least with PyQt6, these seem to not be fatal.
PyQt6 failed to install on readthedocs
@@ -4,7 +4,7 @@ | |||
not run twice. | |||
""" | |||
|
|||
from ExampleApp import ExampleLoader | |||
from _ExampleApp import ExampleLoader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should check - this doesn't break one of the various ways of running the example application does it? This and some of the other file renames weren't strictly necessary but it made coming up with an ignore_pattern
a little easier.
@@ -1,20 +1,25 @@ | |||
""" | |||
Display a plot and an image with minimal setup. | |||
CLI Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Tutorialized" this example https://pyqtgraph--2323.org.readthedocs.build/en/2323/examples/CLIexample.html#sphx-glr-examples-cliexample-py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was wondering if this example even worked anymore now that interactive mode doesn't necessarily work with some bindings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, looks like this usage currently only works with PyQt{5,6}. So maybe not the best example to iterate on, but I believe this would still work with PySide at least for the docs build. I use PySide2 for qtgallery and the iterative example works.
Playing with the CLI example, I found that with PyQt5, running that example interactively in a REPL, right clicking on the image, then exiting caused a pyqtgraph/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py Lines 239 to 240 in 4b802de
I'd need to understand a little better what's going on in I do still see a bunch of these types of errors with PySide:
But I'm somewhat hopeful a similar fix could work and might end up getting rid of some of these errors that occasionally pop up in regular usage (or does that still actually happen?) |
Re: comment above Yep, wrapping this in a try/except gets rid of the rest of the errors for PyQt and PySide
The difference here is that from the traceback I pasted above, this is happening during setup and not teardown, so this is probably not the right approach. Maybe there's something in qtgallery to fix in this case. |
Hi @ixjlyons I just made some documentation changes which caused some merge conflicts, sorry about that! Once addressed, would you mind re-running with error on warning enabled again? I'd like to try and replicate and solve those if possible! |
Updated with master and resolved conflicts. It's running now with The last thing I had done was play around with the environment to see if I could get all the OpenGL examples working reliably. I'm not really sure what's wrong but I do get some GL errors locally too. For the record, here's are the patches I mentioned above that give me an error-free build locally (aside from the OpenGL stuff): diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
index 3ca843ce..8454b26c 100644
--- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
+++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
@@ -1693,7 +1693,10 @@ class ViewBox(GraphicsWidget):
return (view.window() is self.window(), view.name)
## make a sorted list of all named views
- nv = sorted(ViewBox.NamedViews.values(), key=view_key)
+ try:
+ nv = sorted(ViewBox.NamedViews.values(), key=view_key)
+ except RuntimeError:
+ return
if self in nv:
nv.remove(self)
diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py b/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py
index cf468ed3..90bd6314 100644
--- a/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py
+++ b/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py
@@ -236,8 +236,11 @@ class ViewBoxMenu(QtWidgets.QMenu):
self.viewMap[name] = v
for i in [0,1]:
- c = self.ctrl[i].linkCombo
- current = c.currentText()
+ try:
+ c = self.ctrl[i].linkCombo
+ current = c.currentText()
+ except RuntimeError:
+ continue
c.blockSignals(True)
changed = True
try: |
Heh, macOS seemed to have an issue 😆 Also some more issues on macOS:
|
this Runtime error that is being encountered is screaming race condition to me; I think it would be beneficial if we tracked down the source (whether it's in qtgallery or in pyqtgraph). I'll poke around some. |
Also after a
Looking at our examples, looks like they are going in specific directories; we should probably rename those files here, since they're examples, I'm not too worried about going through a deprecation dance. |
Hmm, not sure what to make of this. I suspect it's because The original motivation for using
That's pretty much what is happening - it's a non-fatal warning. However, I just noticed that disabling the virtual display, the renderings are mostly not the plot window contents but are seemingly random grabs of my display contents (behind the window?). Looking more at the
Yep, haven't been able to track it down to this point. |
been poking around, in just about all cases, the ones that are raising errors are plots that have QTimers. I would guess what's happening is that the QTimer is still connected to the update methods, and that timer is still firing after |
I don't think this PR should attempt to address this issue. Was mostly bringing it up because it surprised me. |
|
||
try: | ||
from pyqtgraph.metaarray import * | ||
except: |
Check notice
Code scanning / CodeQL
Except block handles 'BaseException'
from pyqtgraph.Qt import QtWidgets | ||
|
||
try: | ||
from pyqtgraph.metaarray import * |
Check notice
Code scanning / CodeQL
'import *' may pollute namespace
@@ -0,0 +1,39 @@ | |||
#!/usr/bin/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: re-remove this example, here and in the example list in _utils
https://pyqtgraph--2323.org.readthedocs.build/en/2323/examples/index.html
I'm thinking once this is working relatively well, we can start tackling some other improvements like categorizing examples in a separate PR.
__file__
issue in some of the examples (https://sphinx-gallery.github.io/stable/faq.html#why-is-file-not-defined-what-can-i-use)Can we get intersphinx working with Qt/bindings somehow so things like(edit: haven't gotten it to work with https://doc.qt.io/qtforpython/ thought it might be feasible?)QMainWindow
used in an example links to the Qt API page for it? That would be neeeeat, but I suspect unlikely with our abstraction package