artiq/artiq/applets/image.py
David Nadlinger 9fbd6de30c Qt{5 -> 6}
Some changes are due to deprecations in Qt6 which were outright
removed in PyQt, for instance QRegExp or the x()/y() QMouseEvent
properties. Most of the diff is due to enumeration values now no
longer being available directly in the parent namespace.

This commit is purposefully restricted to the mechanical changes,
no reformatting/… is done to keep the diff easy to validate.
2024-07-27 21:37:19 +08:00

29 lines
623 B
Python
Executable File

#!/usr/bin/env python3
import PyQt6 # make sure pyqtgraph imports Qt6
import pyqtgraph
from artiq.applets.simple import SimpleApplet
class Image(pyqtgraph.ImageView):
def __init__(self, args, req):
pyqtgraph.ImageView.__init__(self)
self.args = args
def data_changed(self, value, metadata, persist, mods):
try:
img = value[self.args.img]
except KeyError:
return
self.setImage(img)
def main():
applet = SimpleApplet(Image)
applet.add_dataset("img", "image data (2D numpy array)")
applet.run()
if __name__ == "__main__":
main()