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()
|
||||
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(),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue