-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Short description
In 0.13.3 I was able to add additional items to the menu of the histogram gradient. The changes in 0.13.4 mean that this now gives a TypeError
File ".../pyqtgraph/graphicsItems/GradientEditorItem.py", line 499, in contextMenuClicked
name, source = action.data()
TypeError: cannot unpack non-iterable NoneType objec
Code to reproduce
import pyqtgraph as pg
import numpy as np
from pyqtgraph.Qt import QtWidgets
app = pg.mkQApp("ImageView Example")
win = QtWidgets.QMainWindow()
img = pg.ImageView()
img.setImage(np.zeros((100,100)))
win.setCentralWidget(img)
action = QtWidgets.QAction("Test")
action.triggered.connect(lambda :print("Action triggered"))
menu = img.getHistogramWidget().gradient.menu
menu.addAction(action)
win.show()
if __name__ == '__main__':
pg.exec()Expected behavior
Add a new menu entry that can be used. (works in 0.13..3)
Real behavior
Menu item works, but gives the above error message
Tested environment(s)
- PyQtGraph version: 0.13.4
- Qt Python binding: PyQt5 5.15.9 Qt 5.15.8'
- Python version: 3.10.13
- NumPy version: 1.21.6
- Operating system: Linux
- Installation method: conda
Additional context
I think this was introduced by
#2779
c2372a2
The menu items in the GradientEditorItem are now expected to have data, that is used to change the gradient:
name, source = action.data()
I can provide a patch
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels