当前位置: 首页>>代码示例>>Python>>正文


Python QMovie.frameCount方法代码示例

本文整理汇总了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()
开发者ID:esus111,项目名称:PiClock,代码行数:29,代码来源:PyQtPiClock.py

示例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()
开发者ID:ndileo4,项目名称:PiClock,代码行数:70,代码来源:PyQtPiClock.py


注:本文中的PyQt4.QtGui.QMovie.frameCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。