From 0d5c68075c7350cfb0b96487b2af22a65827d4f2 Mon Sep 17 00:00:00 2001 From: Dpeta Date: Sat, 19 Nov 2022 09:53:22 +0100 Subject: [PATCH] Fix PyQt5 animated emotes (#105) --- convo.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/convo.py b/convo.py index c7c0f84..612267e 100644 --- a/convo.py +++ b/convo.py @@ -348,18 +348,24 @@ class PesterMovie(QtGui.QMovie): url = text.urls[movie].toString() html = str(text.toHtml()) if html.find(url) != -1: + try: + # PyQt6 + resource_type = QtGui.QTextDocument.ResourceType.ImageResource.value + except AttributeError: + # PyQt5 + resource_type = QtGui.QTextDocument.ResourceType.ImageResource if text.hasTabs: i = text.tabobject.tabIndices[text.parent().title()] if text.tabobject.tabs.currentIndex() == i: text.document().addResource( - QtGui.QTextDocument.ResourceType.ImageResource.value, + resource_type, text.urls[movie], movie.currentPixmap(), ) text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth()) else: text.document().addResource( - QtGui.QTextDocument.ResourceType.ImageResource.value, + resource_type, text.urls[movie], movie.currentPixmap(), )