Skip to content

PlotSpeedTest: reflect initial use_opengl state#2487

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:fix-opengl-toggle
Oct 26, 2022
Merged

PlotSpeedTest: reflect initial use_opengl state#2487
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:fix-opengl-toggle

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Oct 12, 2022

Since #2318, when enabling OpenGL from the command line, the associated checkboxes were not reflecting the initial state.
Also, toggling OpenGL would have no effect as GraphicsView::useOpenGL() needs to be called.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Oct 12, 2022

Gonna ask @ntjess to make sure this is setup as it's supposed to.

@ntjess
Copy link
Copy Markdown
Contributor

ntjess commented Oct 12, 2022

Since #2318, when enabling OpenGL from the command line, the associated checkboxes were not reflecting the initial state.

Would it work to simply address useOpenGL from updateOptions? This would be the diff:

@@ -35,6 +35,7 @@ args = parser.parse_args()
 if args.use_opengl is not None:
     pg.setConfigOption('useOpenGL', args.use_opengl)
     pg.setConfigOption('enableExperimental', args.use_opengl)
+use_opengl = pg.getConfigOption('useOpenGL')
 
 # don't limit frame rate to vsync
 sfmt = QtGui.QSurfaceFormat()
@@ -151,11 +152,11 @@ def updateOptions(
     curvePen=pg.mkPen(),
     plotMethod='pyqtgraph',
     fillLevel=False,
-    enableExperimental=False,
-    useOpenGL=False,
+    enableExperimental=use_opengl,
+    useOpenGL=use_opengl,
 ):
     pg.setConfigOption('enableExperimental', enableExperimental)
-    pg.setConfigOption('useOpenGL', useOpenGL)
+    pw.useOpenGL(useOpenGL)
     curve.setPen(curvePen)
     curve.setFillLevel(0.0 if fillLevel else None)
     curve.setMethod(plotMethod)

@pijyoi pijyoi force-pushed the fix-opengl-toggle branch from 6a9ccc3 to a1182d9 Compare October 14, 2022 12:16
@pijyoi
Copy link
Copy Markdown
Contributor Author

pijyoi commented Oct 14, 2022

I tried out your version and it seems like it's not such a big penalty to reset the QGraphicsView viewport when changing other unrelated options.
https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/widgets/GraphicsView.py#L153

I have changed the PR to use your version instead.

@ntjess
Copy link
Copy Markdown
Contributor

ntjess commented Oct 14, 2022

👍 LGTM. I might make a separate PR to determine if the current viewport already matches useOpenGL, but that change would be out of scope for this PR

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Oct 26, 2022

Thanks for the PR @pijyoi and thanks for the review @ntjess LGTM, merging!

@j9ac9k j9ac9k merged commit a13f456 into pyqtgraph:master Oct 26, 2022
@pijyoi pijyoi deleted the fix-opengl-toggle branch October 26, 2022 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants