本文整理汇总了Python中PyQt5.QtGui.QMovie.setSpeed方法的典型用法代码示例。如果您正苦于以下问题:Python QMovie.setSpeed方法的具体用法?Python QMovie.setSpeed怎么用?Python QMovie.setSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QMovie
的用法示例。
在下文中一共展示了QMovie.setSpeed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: animationLabel
# 需要导入模块: from PyQt5.QtGui import QMovie [as 别名]
# 或者: from PyQt5.QtGui.QMovie import setSpeed [as 别名]
def animationLabel(self, index, animationFile, speed=100):
"""
Public slot to set an animated icon.
@param index tab index (integer)
@param animationFile name of the file containing the animation (string)
@param speed animation speed of the icon in percent of the original
icon's speed (integer)
@return reference to the created label (QLabel)
"""
if index == -1:
return None
if hasattr(self.__tabBar, 'setTabButton'):
side = self.__freeSide()
animation = QLabel(self)
if animationFile and not animation.movie():
movie = QMovie(animationFile, QByteArray(), animation)
movie.setSpeed(speed)
animation.setMovie(movie)
movie.start()
self.__tabBar.setTabButton(index, side, None)
self.__tabBar.setTabButton(index, side, animation)
return animation
else:
return None
示例2: open
# 需要导入模块: from PyQt5.QtGui import QMovie [as 别名]
# 或者: from PyQt5.QtGui.QMovie import setSpeed [as 别名]
def open(self):
self.file = QFileDialog.getOpenFileName(self, "Open File", self.pwd)[0]
if self.file == "":
return
self.information = info.Information(self, self.file)
movie = QMovie(self.file, QByteArray(), self)
movie.setCacheMode(QMovie.CacheAll)
movie.setSpeed(100)
self.label.setMovie(movie)
movie.start()
示例3: __makeAnimatedLabel
# 需要导入模块: from PyQt5.QtGui import QMovie [as 别名]
# 或者: from PyQt5.QtGui.QMovie import setSpeed [as 别名]
def __makeAnimatedLabel(self, fileName, label):
"""
Private slot to create an animated label.
@param fileName name of the file containing the animation (string)
@param label reference to the label to be animated (QLabel)
"""
movie = QMovie(fileName, QByteArray(), label)
movie.setSpeed(100)
label.setMovie(movie)
movie.start()
示例4: IconManagement
# 需要导入模块: from PyQt5.QtGui import QMovie [as 别名]
# 或者: from PyQt5.QtGui.QMovie import setSpeed [as 别名]
class IconManagement(object):
def __init__(self, tray, interval = 100):
self.tray = tray
self.movie = QMovie(":/images/tray_animations/tray.gif")
self.movie.setSpeed(interval)
self.movie.frameChanged.connect(self.next_icon)
self.icons = Enum(
ok = QIcon(":/images/demerio.png"),
problem = QIcon(":/images/demerio-problem.png"),
conductor_problem = QIcon(":/images/demerio-conductor-problem.png")
)
self.icon = self.icons.ok
self.update_icon()
def internet_is_ok(self, internet_is_ok):
self.icon = self.icons.ok if internet_is_ok else self.icons.problem
self.update_icon()
@pyqtSlot(int)
def next_icon(self, i):
self.tray.setIcon(QIcon(self.movie.currentPixmap()))
def start(self):
self.movie.start()
def stop(self):
self.update_icon()
self.movie.stop()
def update_icon(self):
self.tray.setIcon(self.icon)
def conductor_problem(self):
if self.movie.state() == QMovie.Running:
self.movie.stop()
self.icon = self.icons.conductor_problem
self.update_icon()
示例5: __evt_loadstarted
# 需要导入模块: from PyQt5.QtGui import QMovie [as 别名]
# 或者: from PyQt5.QtGui.QMovie import setSpeed [as 别名]
def __evt_loadstarted(self):
if not self.__loadlabel.movie():
movie = QMovie(getPath('iconDir','loading.gif'), QByteArray(), self.__loadlabel)
movie.setSpeed(50)
self.__loadlabel.setMovie(movie)
movie.start()
示例6: alarmChecker
# 需要导入模块: from PyQt5.QtGui import QMovie [as 别名]
# 或者: from PyQt5.QtGui.QMovie import setSpeed [as 别名]
class alarmChecker(QWidget):
def __init__(self, parent):
super(alarmChecker, self).__init__()
self.parent = parent
self.networkError = False
self.loadAlarm()
self.getAlarm()
self.getTimeout()
self.getTimer()
self.setLayout(self.alarm_layout)
def loadAlarm(self):
self.list_alarm = []
config = ConfigParser.ConfigParser()
config.readfp(open(self.parent.config_path + 'alarm.cfg'))
for a in config.sections():
dict = {"tableName": a}
for b in config.options(a):
dict[b] = config.get(a, b)
self.list_alarm.append(dict)
def getAlarm(self):
self.alarm_layout = QGridLayout()
self.movie = QMovie(self.parent.os_path + "/img/giphy2.gif", QByteArray(), self)
self.movie_screen = QLabel()
# Make label fit the gif
self.movie_screen.setFixedSize(80, 50)
# Add the QMovie object to the label
self.movie.setCacheMode(QMovie.CacheAll)
self.movie.setSpeed(100)
self.movie_screen.setMovie(self.movie)
self.movie.start()
self.timeout_ack = []
self.dialog = self.dialogTimeout()
self.dialog.hide()
self.label_acq = QPushButton("ACQUISITION")
self.label_acq.clicked.connect(self.dialog.show)
self.label_acq.setFixedHeight(50)
self.setColor("QPushButton", self.label_acq, "green")
self.alarm_layout.addWidget(self.movie_screen, 0, 0, 1, 1)
self.alarm_layout.addWidget(self.label_acq, 0, 1, 1, 2)
for i, device in enumerate(self.list_alarm):
name = device["tableName"] + device["key"]
button = QPushButton(device["label"].upper())
button.setFixedHeight(50)
self.setColor("QPushButton", button, "green")
button.clicked.connect(partial(self.showWarning, "msg_%s" % name))
self.alarm_layout.addWidget(button, 0, i + 3, 1, 1)
setattr(self, "alarm_%s" % name, button)
self.watcher_alarm = QTimer(self)
self.watcher_alarm.setInterval(5000)
self.watcher_alarm.timeout.connect(self.checkCriticalValue)
self.watcher_alarm.start()
def getTimeout(self):
self.device_dict = copy.deepcopy(self.parent.device_dict)
self.timeout_limit = 90
self.list_timeout = [key for key, value in self.parent.device_dict.iteritems()]
self.last_date = {}
self.last_time = {}
for key, value in self.device_dict.iteritems():
self.last_date[key] = 0
self.last_time[key] = datetime.datetime.now()
def getTimer(self):
watcher_timeout = QTimer(self)
watcher_timeout.singleShot(2000, partial(self.showTimeout, 0))
self.checker_timeout = QTimer(self)
self.checker_timeout.setInterval(15000)
self.checker_timeout.timeout.connect(self.checkTimeout)
self.checker_timeout.start()
def showTimeout(self, i):
for timeout in self.timeout_ack:
try:
self.list_timeout.remove(timeout)
except ValueError:
pass
if not self.networkError:
if self.list_timeout:
if i < len(self.list_timeout):
self.label_acq.setText("TIME OUT ON %s" % self.list_timeout[i])
self.setColor("QPushButton", self.label_acq, "red")
i += 1
else:
i = 0
else:
self.label_acq.setText("ACQUISITION")
self.setColor("QPushButton", self.label_acq, "green")
else:
self.label_acq.setText("SERVER LOST")
#.........这里部分代码省略.........