Runviewer: Time axis drawing generates errors when Marker Spacing is enabled

80 views
Skip to first unread message

carte...@gmail.com

unread,
Sep 19, 2023, 2:12:51 PM9/19/23
to the labscript suite
Hello,

After enabling marker spacing in runviewer (with at least one trace active), I encounter many error messages stating
"""
Traceback (most recent call last):
File "[redacted]/lib/python3.11/site-packages/pyqtgraph/graphicsItems/AxisItem.py", line 654, in paint
specs = self.generateDrawSpecs(painter)

File "[redacted]/lib/python3.11/site-packages/pyqtgraph/graphicsItems/AxisItem.py", line 1118, in generateDrawSpecs
br = p.boundingRect(QtCore.QRectF(0, 0, 100, 100), QtCore.Qt.AlignmentFlag.AlignCenter, s)

TypeError: arguments did not match any overloaded call:
boundingRect(self, rect: QRectF, flags: int, text: str): argument 3 has unexpected type 'int'
boundingRect(self, rect: QRect, flags: int, text: str): argument 1 has unexpected type 'QRectF'
boundingRect(self, rectangle: QRectF, text: str, option: QTextOption = QTextOption()): argument 2 has unexpected type 'AlignmentFlag'
boundingRect(self, x: int, y: int, w: int, h: int, flags: int, text: str): argument 1 has unexpected type 'QRectF'
"""
(with new messages seeming to appear on every redrawing, until the `Too many errors` dialog appears).
I have seen this error for both Python 3.10 and 3.11 (with PyQt 5.15.2 and PyQtGraph 0.13.3 for the 3.11 installation, other versions for the 3.10 installation) with labscript-suite installed via pip.

I have been able to prevent this error by explicitly casting the axis labels to strings (see https://github.com/carterturn/runviewer/tree/carterturn-setTicks-str for an implementation), but I thought it might be good to check if anyone else had seen this (perhaps I have some compatibility issue?) before pursuing the code fix further.

Thank you,
Carter

dihm....@gmail.com

unread,
Sep 19, 2023, 5:32:53 PM9/19/23
to the labscript suite
Carter,

I'm not surprised there has been some sort of bitrot here and your solution is likely the correct one. Would you happen to have a shot you could send that reproduces the behavior you could send me (privately if you would prefer)? Mostly just want to play around and make sure there aren't other weak points that also need shoring up at the same time.

-David

carte...@gmail.com

unread,
Sep 21, 2023, 11:06:46 PM9/21/23
to the labscript suite
Hello David,

Here is a fairly minimal shot that is able to generate the messages on my setup.
I looked into the issue further, as I was still a bit surprised that no one else had run into this (as you can see, it appears for fairly trivial cases). It seems like it starts happening between versions 0.12.2 and 0.12.3 of pyqtgraph, as a result of the removal of the "asUnicode" (which is a function pyqtgraph defines that effectively calls "str" on its argument in Python 3) from the boundingRect function call that appears in the error message I quoted previously. This is probably appearing for me because of the more recent pyqtgraph version.

Thank you,
Carter
2023-09-21_0002_test_sequence_0.h5

dihm....@gmail.com

unread,
Sep 26, 2023, 2:56:53 PM9/26/23
to the labscript suite
Thanks for the test file Carter! I've used your branch to make a PR to fix this specific issue and made a second PR to fix some other deprecations with regards to pyqtgraph. For better or worse, Qt is generally moving away for implicit type casting of function arguments so these types of issues crop up somewhat frequently. Thanks for catching it and helping to fix it.

-David

carte...@gmail.com

unread,
Sep 27, 2023, 6:56:26 PM9/27/23
to the labscript suite
Hello David,

Thank you for getting that merged!

Thank you,
Carter
Reply all
Reply to author
Forward
0 new messages