Fix PyQt5 animated emotes (#105)
This commit is contained in:
parent
5981a27817
commit
0d5c68075c
1 changed files with 8 additions and 2 deletions
10
convo.py
10
convo.py
|
@ -348,18 +348,24 @@ class PesterMovie(QtGui.QMovie):
|
||||||
url = text.urls[movie].toString()
|
url = text.urls[movie].toString()
|
||||||
html = str(text.toHtml())
|
html = str(text.toHtml())
|
||||||
if html.find(url) != -1:
|
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:
|
if text.hasTabs:
|
||||||
i = text.tabobject.tabIndices[text.parent().title()]
|
i = text.tabobject.tabIndices[text.parent().title()]
|
||||||
if text.tabobject.tabs.currentIndex() == i:
|
if text.tabobject.tabs.currentIndex() == i:
|
||||||
text.document().addResource(
|
text.document().addResource(
|
||||||
QtGui.QTextDocument.ResourceType.ImageResource.value,
|
resource_type,
|
||||||
text.urls[movie],
|
text.urls[movie],
|
||||||
movie.currentPixmap(),
|
movie.currentPixmap(),
|
||||||
)
|
)
|
||||||
text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth())
|
text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth())
|
||||||
else:
|
else:
|
||||||
text.document().addResource(
|
text.document().addResource(
|
||||||
QtGui.QTextDocument.ResourceType.ImageResource.value,
|
resource_type,
|
||||||
text.urls[movie],
|
text.urls[movie],
|
||||||
movie.currentPixmap(),
|
movie.currentPixmap(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue