py: cam: Convert to PyQt6

Qt5 is now end of life. The libcamera 'qcam' application has removed
support for Qt5, and updated to Qt6.

Update the python 'cam' application accordingly to Qt6.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Tomi Valkeinen 2024-08-12 17:20:30 +03:00
parent 7c6b960a8e
commit 15a51caae8
2 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@
# Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
from helpers import mfb_to_rgb from helpers import mfb_to_rgb
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import libcamera as libcam import libcamera as libcam
import libcamera.utils import libcamera.utils
import sys import sys
@ -63,10 +63,10 @@ class QtRenderer:
self.buf_mmap_map = buf_mmap_map self.buf_mmap_map = buf_mmap_map
def run(self): def run(self):
camnotif = QtCore.QSocketNotifier(self.cm.event_fd, QtCore.QSocketNotifier.Read) camnotif = QtCore.QSocketNotifier(self.cm.event_fd, QtCore.QSocketNotifier.Type.Read)
camnotif.activated.connect(lambda _: self.readcam()) camnotif.activated.connect(lambda _: self.readcam())
keynotif = QtCore.QSocketNotifier(sys.stdin.fileno(), QtCore.QSocketNotifier.Read) keynotif = QtCore.QSocketNotifier(sys.stdin.fileno(), QtCore.QSocketNotifier.Type.Read)
keynotif.activated.connect(lambda _: self.readkey()) keynotif.activated.connect(lambda _: self.readkey())
print('Capturing...') print('Capturing...')

View file

@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
from PyQt5 import QtCore, QtWidgets from PyQt6 import QtCore, QtWidgets
from PyQt5.QtCore import Qt from PyQt6.QtCore import Qt
import math import math
import os import os
@ -142,10 +142,10 @@ class QtRenderer:
self.window = window self.window = window
def run(self): def run(self):
camnotif = QtCore.QSocketNotifier(self.state.cm.event_fd, QtCore.QSocketNotifier.Read) camnotif = QtCore.QSocketNotifier(self.state.cm.event_fd, QtCore.QSocketNotifier.Type.Read)
camnotif.activated.connect(lambda _: self.readcam()) camnotif.activated.connect(lambda _: self.readcam())
keynotif = QtCore.QSocketNotifier(sys.stdin.fileno(), QtCore.QSocketNotifier.Read) keynotif = QtCore.QSocketNotifier(sys.stdin.fileno(), QtCore.QSocketNotifier.Type.Read)
keynotif.activated.connect(lambda _: self.readkey()) keynotif.activated.connect(lambda _: self.readkey())
print('Capturing...') print('Capturing...')
@ -175,8 +175,8 @@ class MainWindow(QtWidgets.QWidget):
def __init__(self, state): def __init__(self, state):
super().__init__() super().__init__()
self.setAttribute(Qt.WA_PaintOnScreen) self.setAttribute(Qt.WidgetAttribute.WA_PaintOnScreen)
self.setAttribute(Qt.WA_NativeWindow) self.setAttribute(Qt.WidgetAttribute.WA_NativeWindow)
self.state = state self.state = state