Skip to content

Commit

Permalink
fixing...
Browse files Browse the repository at this point in the history
  • Loading branch information
tomba committed Dec 10, 2023
1 parent 0ff3e40 commit c88c782
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-allow-list=
extension-pkg-allow-list=PyQt5

# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
Expand Down
10 changes: 5 additions & 5 deletions utils/cam-rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

struct_fmt = struct.Struct('<IIII16pI4I')


# Loading MJPEG to a QPixmap produces corrupt JPEG data warnings. Ignore these.
def qt_message_handler(msg_type, msg_log_context, msg_string):
if msg_string.startswith("Corrupt JPEG data"):
Expand Down Expand Up @@ -103,6 +102,8 @@ def __init__(self, socket: PyQt5.QtNetwork.QTcpSocket):
print("done")

def on_ready_read(self):
qApp = QtWidgets.QApplication.instance()

while self.socket.bytesAvailable():
if self.state == 0:
data = self.socket.read(struct_fmt.size - len(self.header_buffer))
Expand Down Expand Up @@ -145,10 +146,11 @@ def on_buffers(self):
label = self.labels[idx]

if fmt in [ "META_8", "META_CSI2_10", "META_CSI2_12" ]:
pix = meta_to_pix(fmt, w, h, bytesperline, self.data_buffer)
meta_to_pix(fmt, w, h, bytesperline, self.data_buffer)
else:
pix = data_to_pix(fmt, w, h, bytesperline, self.data_buffer)

# pylint: disable=no-member
pix = pix.scaled(label.width(), label.height(), Qt.AspectRatioMode.KeepAspectRatio,
Qt.TransformationMode.FastTransformation)

Expand All @@ -174,14 +176,12 @@ def new_connection(tcpServer):


def readkey():
global qApp
qApp = QtWidgets.QApplication.instance()
sys.stdin.readline()
qApp.quit()


if __name__ == '__main__':
global qApp

qApp = QtWidgets.QApplication(sys.argv)
qApp.setQuitOnLastWindowClosed(False)

Expand Down
2 changes: 1 addition & 1 deletion utils/cam_rx_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def data_to_rgb(fmt, w, h, bytesperline, data):
def rgb_to_pix(rgb):
w = rgb.shape[1]
h = rgb.shape[0]
qim = QtGui.QImage(rgb, w, h, QtGui.QImage.Format.Format_RGB888)
qim = QtGui.QImage(rgb, w, h, QtGui.QImage.Format.Format_RGB888) # pylint: disable=no-member
pix = QtGui.QPixmap.fromImage(qim)
return pix

Expand Down
4 changes: 2 additions & 2 deletions v4l2/mbusformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ class BusFormat(IntEnum):
S5C_UYVY_JPEG_1X8 = v4l2.uapi.V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8
AHSV8888_1X32 = v4l2.uapi.V4L2_MBUS_FMT_AHSV8888_1X32

META_8 = NotImplementedError()
META_12 = NotImplementedError()
META_8 = 0 # XXX
META_12 = 0 # XXX
12 changes: 6 additions & 6 deletions v4l2/pixelformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ class PixelFormat(IntEnum):
HM12 = v4l2.uapi.V4L2_PIX_FMT_HM12
SUNXI_TILED_NV12 = v4l2.uapi.V4L2_PIX_FMT_SUNXI_TILED_NV12

META_8 = NotImplementedError()
META_CSI2_10 = NotImplementedError()
META_CSI2_12 = NotImplementedError()
SENSOR_DATA = NotImplementedError()
META_FMT_GENERIC_8 = NotImplementedError()
META_FMT_GENERIC_CSI2_12 = NotImplementedError()
META_8 = 0 # XXX
META_CSI2_10 = 0 # XXX
META_CSI2_12 = 0 # XXX
SENSOR_DATA = 0 # XXX
META_FMT_GENERIC_8 = 0 # XXX
META_FMT_GENERIC_CSI2_12 = 0 # XXX

0 comments on commit c88c782

Please sign in to comment.