本文整理汇总了Python中PyQt4.QtGui.QMovie.frameCount方法的典型用法代码示例。如果您正苦于以下问题:Python QMovie.frameCount方法的具体用法?Python QMovie.frameCount怎么用?Python QMovie.frameCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMovie
的用法示例。
在下文中一共展示了QMovie.frameCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wxfinished
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import frameCount [as 别名]
def wxfinished(self):
if self.wxreply.error() != QNetworkReply.NoError:
print "get radar error "+self.myname+":"+str(self.wxreply.error())
self.lastwx = 0
return
print "radar map received:"+self.myname+":"+time.ctime()
self.wxmovie.stop()
self.wxdata = QtCore.QByteArray(self.wxreply.readAll())
self.wxbuff = QtCore.QBuffer(self.wxdata)
self.wxbuff.open(QtCore.QIODevice.ReadOnly)
mov = QMovie(self.wxbuff, 'GIF')
print "radar map frame count:"+self.myname+":"+str(mov.frameCount())
if mov.frameCount() > 2:
self.lastwx = time.time()
else:
# radar image retreval failed
self.lastwx = 0
# retry in 5 seconds
QtCore.QTimer.singleShot(5*1000, self.getwx)
return
self.wxmovie = mov
if Config.satellite:
self.setMovie( self.wxmovie)
else:
self.wwx.setMovie( self.wxmovie)
if self.parent().isVisible():
self.wxmovie.start()
示例2: Radar
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import frameCount [as 别名]
#.........这里部分代码省略.........
+ "&height="
+ str(rect.height())
+ "&newmaps=0&reproj.automerc=1&num=5&delay=25&timelabel=1&timelabel.y=10&rainsnow=1&smooth=1&radar_bitmap=1&xnoclutter=1&xnoclutter_mask=1&cors=1"
)
def basefinished(self):
if self.basereply.error() != QNetworkReply.NoError:
return
self.basepixmap = QPixmap()
self.basepixmap.loadFromData(self.basereply.readAll())
if self.basepixmap.size() != self.rect.size():
self.basepixmap = self.basepixmap.scaled(self.rect.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.setPixmap(self.basepixmap)
def mkfinished(self):
if self.mkreply.error() != QNetworkReply.NoError:
return
self.mkpixmap = QPixmap()
self.mkpixmap.loadFromData(self.mkreply.readAll())
if self.mkpixmap.size() != self.rect.size():
self.mkpixmap = self.mkpixmap.scaled(self.rect.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.wmk.setPixmap(self.mkpixmap)
def wxfinished(self):
if self.wxreply.error() != QNetworkReply.NoError:
print "get radar error " + self.myname + ":" + str(self.wxreply.error())
self.lastwx = 0
return
print "radar map received:" + self.myname + ":" + time.ctime()
self.wxdata = QtCore.QByteArray(self.wxreply.readAll())
self.wxbuff = QtCore.QBuffer(self.wxdata)
self.wxbuff.open(QtCore.QIODevice.ReadOnly)
self.wxmovie = QMovie(self.wxbuff, "GIF")
print "radar map frame count:" + self.myname + ":" + str(self.wxmovie.frameCount())
if self.wxmovie.frameCount() > 2:
self.lastwx = time.time()
else:
# radar image retreval failed
self.lastwx = 0
# retry in 5 seconds
QtCore.QTimer.singleShot(5 * 1000, self.getwx)
return
self.wwx.setMovie(self.wxmovie)
if self.parent().isVisible():
self.wxmovie.start()
def getwx(self):
global lastapiget
i = 0.1
# making sure there is at least 2 seconds between radar api calls
lastapiget += 2
if time.time() > lastapiget:
lastapiget = time.time()
else:
i = lastapiget - time.time()
print "get radar api call spacing oneshot get i=" + str(i)
QtCore.QTimer.singleShot(i * 1000, self.getwx2)
def getwx2(self):
global manager
try:
if self.wxreply.isRunning():
return
except Exception:
pass
print "getting radar map " + self.myname + ":" + time.ctime()