Bug fix: Hopefully fix animated smilies slowing down over time
This commit is contained in:
parent
06835f4cfb
commit
beea65b5d1
1 changed files with 8 additions and 6 deletions
14
convo.py
14
convo.py
|
@ -221,20 +221,21 @@ class PesterText(QtGui.QTextEdit):
|
||||||
self, QtCore.SLOT('textReady(bool)'))
|
self, QtCore.SLOT('textReady(bool)'))
|
||||||
self.urls = {}
|
self.urls = {}
|
||||||
for k in smiledict:
|
for k in smiledict:
|
||||||
self.addAnimation(QtCore.QUrl("smilies/%s" % (smiledict[k])), "smilies/%s" % (smiledict[k]));
|
self.addAnimation(QtCore.QUrl("smilies/%s" % (smiledict[k])), "smilies/%s" % (smiledict[k]))
|
||||||
def addAnimation(self, url, fileName):
|
def addAnimation(self, url, fileName):
|
||||||
movie = QtGui.QMovie(self)
|
movie = QtGui.QMovie(self)
|
||||||
movie.setFileName(fileName)
|
movie.setFileName(fileName)
|
||||||
self.urls[movie] = url
|
self.urls[movie] = url
|
||||||
self.connect(movie, QtCore.SIGNAL('frameChanged(int)'),
|
self.connect(movie, QtCore.SIGNAL('frameChanged(int)'),
|
||||||
self, QtCore.SLOT('animate()'));
|
self, QtCore.SLOT('animate()'))
|
||||||
movie.start();
|
movie.start()
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def animate(self):
|
def animate(self):
|
||||||
movie = self.sender()
|
movie = self.sender()
|
||||||
|
self.document().resource(QtGui.QTextDocument.ImageResource, self.urls[movie]).clear()
|
||||||
self.document().addResource(QtGui.QTextDocument.ImageResource,
|
self.document().addResource(QtGui.QTextDocument.ImageResource,
|
||||||
self.urls[movie], movie.currentPixmap());
|
self.urls[movie], movie.currentPixmap())
|
||||||
self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth());
|
self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth())
|
||||||
|
|
||||||
@QtCore.pyqtSlot(bool)
|
@QtCore.pyqtSlot(bool)
|
||||||
def textReady(self, ready):
|
def textReady(self, ready):
|
||||||
|
@ -331,7 +332,8 @@ class PesterText(QtGui.QTextEdit):
|
||||||
QtGui.QTextEdit.focusInEvent(self, event)
|
QtGui.QTextEdit.focusInEvent(self, event)
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
self.parent().textInput.keyPressEvent(event)
|
if hasattr(self.parent(), 'textInput'):
|
||||||
|
self.parent().textInput.keyPressEvent(event)
|
||||||
QtGui.QTextEdit.keyPressEvent(self, event)
|
QtGui.QTextEdit.keyPressEvent(self, event)
|
||||||
|
|
||||||
def mousePressEvent(self, event):
|
def mousePressEvent(self, event):
|
||||||
|
|
Loading…
Reference in a new issue