Bug fix: YAAFFA (Yet Another Attempted Fix For Animations)
This commit is contained in:
parent
7ab14cdc2d
commit
0780f47614
2 changed files with 19 additions and 7 deletions
24
convo.py
24
convo.py
|
@ -230,17 +230,29 @@ class PesterText(QtGui.QTextEdit):
|
||||||
movie = QtGui.QMovie(self)
|
movie = QtGui.QMovie(self)
|
||||||
movie.setFileName(fileName)
|
movie.setFileName(fileName)
|
||||||
self.urls[movie] = url
|
self.urls[movie] = url
|
||||||
|
|
||||||
|
for f in range(movie.frameCount()):
|
||||||
|
yes = movie.jumpToFrame(f)
|
||||||
|
if yes:
|
||||||
|
url = "%s_%s" % (self.urls[movie].toString(), f)
|
||||||
|
self.document().addResource(QtGui.QTextDocument.ImageResource,
|
||||||
|
QtCore.QUrl(url), movie.currentPixmap())
|
||||||
|
|
||||||
self.connect(movie, QtCore.SIGNAL('frameChanged(int)'),
|
self.connect(movie, QtCore.SIGNAL('frameChanged(int)'),
|
||||||
self, QtCore.SLOT('animate()'))
|
self, QtCore.SLOT('animate(int)'))
|
||||||
movie.start()
|
movie.start()
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot(int)
|
||||||
def animate(self):
|
def animate(self, frame):
|
||||||
if self.mainwindow.config.animations():
|
if self.mainwindow.config.animations():
|
||||||
|
scrollPos = self.verticalScrollBar().sliderPosition()
|
||||||
movie = self.sender()
|
movie = self.sender()
|
||||||
self.document().resource(QtGui.QTextDocument.ImageResource, self.urls[movie]).clear()
|
url = self.urls[movie].toString()
|
||||||
self.document().addResource(QtGui.QTextDocument.ImageResource,
|
def stuff(mo):
|
||||||
self.urls[movie], movie.currentPixmap())
|
return '<img src="%s_%s" />' % (url, frame)
|
||||||
|
html = re.sub(r'<img src="%s\S{0,3}" />' % (url), stuff, str(self.toHtml()))
|
||||||
|
self.setHtml(html)
|
||||||
self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth())
|
self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth())
|
||||||
|
self.verticalScrollBar().setSliderPosition(scrollPos)
|
||||||
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot(bool)
|
@QtCore.pyqtSlot(bool)
|
||||||
|
|
|
@ -424,7 +424,7 @@ smiledict = {
|
||||||
":manipulative:": "manipulative.png",
|
":manipulative:": "manipulative.png",
|
||||||
":vigorous:": "vigorous.png",
|
":vigorous:": "vigorous.png",
|
||||||
":perky:": "perky.png",
|
":perky:": "perky.png",
|
||||||
":acceptant:": "acceptant.png",
|
":acceptant:": "acceptant.gif",
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse_smiley = dict((v,k) for k, v in smiledict.iteritems())
|
reverse_smiley = dict((v,k) for k, v in smiledict.iteritems())
|
||||||
|
|
Loading…
Reference in a new issue