本文整理汇总了Python中PyQt4.QtGui.QMovie类的典型用法代码示例。如果您正苦于以下问题:Python QMovie类的具体用法?Python QMovie怎么用?Python QMovie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMovie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wxfinished
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: ImagePlayer
class ImagePlayer(QWidget):
def __init__(self, filename, title, parent=None):
QWidget.__init__(self, parent)
# Load the file into a QMovie
self.movie = QMovie(filename, QByteArray(), self)
print(filename)
size = self.movie.scaledSize()
self.setGeometry(200, 200, size.width(), size.height())
self.setWindowTitle(title)
self.movie_screen = QLabel()
# Make label fit the gif
self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.movie_screen.setAlignment(Qt.AlignCenter)
self.btn_ex = QPushButton()
self.btn_ex.setFixedWidth(100)
self.btn_ex.setFixedHeight(100)
# self.btn_ex.setIcon(QIcon("image/ex_stu.gif"))
self.btn_ex.setStyleSheet("background-color: rgba(255,255,255,20);")
self.btn_ex.setIcon(QIcon("image/smile.png"))
self.btn_ex.setIconSize(QSize(80,80))
self.btn_ex.setFlat(True)
popMenu = QMenu(self)
entry1 = popMenu.addAction("正确")
# self.connect(entry1,SIGNAL('triggered()'), lambda item=item[0]: self.answerRight(item))
entry2 = popMenu.addAction("错误")
# self.connect(entry2,SIGNAL('triggered()'), lambda item=item[0]: self.answerWrong(item))
entry3 = popMenu.addAction("替换")
# self.connect(entry3,SIGNAL('triggered()'), lambda item=item[0]: self.resetStudent(item))
self.btn_ex.setMenu(popMenu)
# Create the layout
main_layout = QVBoxLayout()
main_layout.addWidget(self.movie_screen)
# main_layout.addWidget(self.btn_ex)
self.setLayout(main_layout)
# Add the QMovie object to the label
self.movie.setCacheMode(QMovie.CacheAll)
# self.movie.setSpeed(100)
self.movie_screen.setMovie(self.movie)
self.movie_screen.setLayout(QHBoxLayout())
self.movie_screen.layout().addWidget(self.btn_ex)
popMenu = QMenu(self)
entry1 = popMenu.addAction("正确")
# self.movie_screen.setMenu(popMenu)
self.movie.start()
示例3: Loading
class Loading(QDialog):
def __init__(self, parent, text=""):
super(Loading, self).__init__(parent)
self.setStyleSheet("background-color:white;")
Gl.Signals["changeLoadingText"].connect(self.change_text)
Gl.Signals["endLoading"].connect(self.on_end)
self.setWindowTitle("Please wait")
# Credit to zegerdon on DeviantArt for his loading gif.
self.load_gif = QMovie(os.path.join(Gl.Graphics, "loading_by_zegerdon-deviantart.gif"))
self.load_label = QLabel()
self.load_label.setMovie(self.load_gif)
self.text = QLabel(text)
self.text.setStyleSheet("QLabel { color : black; }")
self.vbox = QVBoxLayout()
self.vbox.addWidget(self.load_label)
self.vbox.setAlignment(self.load_label, Qt.AlignCenter)
self.vbox.addWidget(self.text)
self.vbox.setAlignment(self.text, Qt.AlignCenter)
self.vbox.setMargin(20)
self.vbox.setSpacing(30)
self.setLayout(self.vbox)
self.load_gif.start()
self.end_loading = False
def change_text(self, string):
self.text.setText(string)
def on_end(self):
"""
Close on signal.
:return:
"""
self.end_loading = True
self.close()
# noinspection PyArgumentList
def closeEvent(self, close_event):
"""
If closed by user, exit program.
:return:
"""
if self.end_loading:
super(Loading, self).close()
else:
Gl.Signals["KILL"].emit()
QApplication.processEvents()
示例4: __init__
def __init__(self, parent, text=""):
super(Loading, self).__init__(parent)
self.setStyleSheet("background-color:white;")
Gl.Signals["changeLoadingText"].connect(self.change_text)
Gl.Signals["endLoading"].connect(self.on_end)
self.setWindowTitle("Please wait")
# Credit to zegerdon on DeviantArt for his loading gif.
self.load_gif = QMovie(os.path.join(Gl.Graphics, "loading_by_zegerdon-deviantart.gif"))
self.load_label = QLabel()
self.load_label.setMovie(self.load_gif)
self.text = QLabel(text)
self.text.setStyleSheet("QLabel { color : black; }")
self.vbox = QVBoxLayout()
self.vbox.addWidget(self.load_label)
self.vbox.setAlignment(self.load_label, Qt.AlignCenter)
self.vbox.addWidget(self.text)
self.vbox.setAlignment(self.text, Qt.AlignCenter)
self.vbox.setMargin(20)
self.vbox.setSpacing(30)
self.setLayout(self.vbox)
self.load_gif.start()
self.end_loading = False
示例5: __init__
def __init__(self):
super(MainWindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.searchEdit.textChanged.connect(self.search_text_changed)
self.ui.show_button.clicked.connect(self.show_episodes)
self.ui.searchEdit.returnPressed.connect(self.show_episodes)
self.episodes = None
self.episode_list = None
self.number = 0
self.anime_list = None
self.ui.download_button.clicked.connect(self.download)
self.ui.res_list_widget.currentItemChanged.connect(self.episode_change)
self.com = Comunicate()
self.com.sig.connect(self.message)
self.com.img.connect(self.set_image)
self.ui.anime_list_widget.itemDoubleClicked.connect(self.show_episodes)
self.setWindowIcon(QIcon(get_file('animes.png')))
self.ui.anime_list_widget.itemPressed.connect(self.anime_entered)
Thread(target=self.load_url_items).start()
#self.load_url_items()
self.movie = QMovie(get_file('ajax-loader.gif'))
self.ui.loading_label.setMovie(self.movie)
self.link = None
self.main_download_page = None
self.tray = SystemTrayIcon(
QIcon(get_file('animes.png')), self.com, self)
self.com.op.connect(self.show_semard)
self.ui.action_About_Semard.activated.connect(self.about_semard)
self.ui.action_Contato.activated.connect(self.show_feedback)
self.setWindowTitle('Semard - Animes')
self.browser = None
self.player = None
示例6: __init__
def __init__(self, model, parent=None):
super(ServerToolsWindow, self).__init__(parent)
with Resources.directory:
self.setupUi(self)
self.spinner_movie = QMovie(Resources.get("icons/servertools-spinner.mng"))
self.spinner_label.setMovie(self.spinner_movie)
self.spinner_label.hide()
self.progress_bar.hide()
while self.tab_widget.count():
self.tab_widget.removeTab(0) # remove the tab(s) added in designer
self.tab_widget.tabBar().hide()
self.account_button.setMenu(QMenu(self.account_button))
self.setWindowTitle("Blink Server Tools")
self.setWindowIconText("Server Tools")
self.model = model
self.tab_widget.addTab(ServerToolsWebView(self), "")
font = self.account_label.font()
font.setPointSizeF(self.account_label.fontInfo().pointSizeF() + 2)
font.setFamily("Sans Serif")
self.account_label.setFont(font)
self.model.rowsInserted.connect(self._SH_ModelChanged)
self.model.rowsRemoved.connect(self._SH_ModelChanged)
self.account_button.menu().triggered.connect(self._SH_AccountButtonMenuTriggered)
web_view = self.tab_widget.currentWidget()
web_view.loadStarted.connect(self._SH_WebViewLoadStarted)
web_view.loadFinished.connect(self._SH_WebViewLoadFinished)
web_view.loadProgress.connect(self._SH_WebViewLoadProgress)
示例7: __init__
def __init__(self):
QWidget.__init__(self)
self.tray = Tray(self)
self.setMinimumSize(QSize(320, 200))
self.setWindowFlags(Qt.Popup|Qt.FramelessWindowHint)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setMargin(1)
self.text = QTextBrowser(self)
self.text.setReadOnly(True)
self.text.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.text.setOpenExternalLinks(True)
self.verticalLayout.addWidget(self.text)
self.text.textChanged.connect(self.on_text_changed)
self.notify = Notify(self)
self.movie = QMovie()
dev = QBuffer()
dev.setData(QByteArray.fromBase64(CHECK_IMAGE))
dev.open(QBuffer.ReadOnly)
dev.setParent(self.movie)
self.movie.setDevice(dev)
self.movie.frameChanged.connect(self.on_frame_changed)
self.realized = False
self.show()
示例8: __init__
def __init__(self, filename, title, parent=None):
QWidget.__init__(self, parent)
# Load the file into a QMovie
self.movie = QMovie(filename, QByteArray(), self)
size = self.movie.scaledSize()
self.setGeometry(200, 200, size.width(), size.height())
self.setWindowTitle(title)
self.movie_screen = QLabel()
# Make label fit the gif
self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.movie_screen.setAlignment(Qt.AlignCenter)
# Create the layout
main_layout = QVBoxLayout()
main_layout.addWidget(self.movie_screen)
self.setLayout(main_layout)
# 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()
示例9: __init__
def __init__(self, parent, radar, rect):
global xscale, yscale
self.rect = rect
self.baseurl = self.mapurl(radar, rect, False)
print "google map base url: "+self.baseurl
self.mkurl = self.mapurl(radar, rect, True)
self.wxurl = self.radarurl(radar, rect)
QtGui.QLabel.__init__(self, parent)
self.setObjectName("radar")
self.setGeometry(rect)
self.setStyleSheet("#radar { background-color: grey; }")
self.setAlignment(Qt.AlignCenter)
self.wwx = QtGui.QLabel(self)
self.wwx.setObjectName("wx")
self.wwx.setStyleSheet("#wx { background-color: transparent; }")
self.wwx.setGeometry(0, 0, rect.width(), rect.height())
self.wmk = QtGui.QLabel(self)
self.wmk.setObjectName("mk")
self.wmk.setStyleSheet("#mk { background-color: transparent; }")
self.wmk.setGeometry(0, 0, rect.width(), rect.height())
self.wxmovie = QMovie()
示例10: show_unmute
def show_unmute(self):
self.movie = QMovie(":/unmute.gif", QByteArray(), self)
self.movie.setScaledSize(CustomSize*0.7)
self.movie.setCacheMode(QMovie.CacheAll)
self.movie.setSpeed(100)
self.movie_screen.setMovie(self.movie)
self.muted = False
self.movie.start()
示例11: __init__
def __init__(self, parent, text="", isLightTheme=True, onCloseSlot=None, showIP=False):
QDialog.__init__(self, parent)
self.onCloseSignal.connect(onCloseSlot)
# Create connecting image
connMov = QMovie(utils.getAbsoluteResourcePath('images/' + ('light' if isLightTheme else 'dark') + '/waiting.gif'))
connMov.start()
self.connImg = QLabel(self)
self.connImg.setMovie(connMov)
# Create connecting and IP address labels
self.connLabel = QLabel(text, self)
if showIP:
self.ipLabel = QLabel(self.ipLabelPrefix + "Getting IP address...", self)
self.ipHelpLabel = QLabel("Your friend should enter the IP address above as the host to connect to.\n"
"Make sure that port " + str(constants.DEFAULT_PORT) + " is forwarded to "
"this computer. See the help\nfor more info.", self)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(self.connImg)
hbox.addSpacing(10)
hbox.addWidget(self.connLabel)
hbox.addStretch(1)
vbox = QVBoxLayout()
vbox.addStretch(1)
vbox.addLayout(hbox)
if showIP:
vbox.addSpacing(10)
vbox.addWidget(QLine())
vbox.addSpacing(10)
vbox.addWidget(self.ipLabel)
vbox.addSpacing(10)
vbox.addWidget(self.ipHelpLabel)
vbox.addStretch(1)
self.setLayout(vbox)
if showIP:
# Start the thread to get the IP address and update the IP label when finished
self.ipThread = qtThreads.GetIPAddressThread(self.__setIPAddress, self.__getIPAddressFailure)
self.ipThread.start()
示例12: LoadingItem
class LoadingItem(QLabel):
def __init__(self):
super(LoadingItem, self).__init__()
self.movie = QMovie(resources.IMAGES["loading"])
self.setMovie(self.movie)
self.movie.setScaledSize(QSize(16, 16))
self.movie.start()
def add_item_to_tree(self, folder, tree, item_type=None, parent=None):
if item_type is None:
item = QTreeWidgetItem()
item.setText(0, self.tr(' LOADING: "%1"').arg(folder))
else:
item = item_type(parent, self.tr(' LOADING: "%1"').arg(folder), folder)
tree.addTopLevelItem(item)
tree.setItemWidget(item, 0, self)
return item
示例13: add_loading_widgets
def add_loading_widgets(self, children):
# Generate list if only one item was given
if not type(children) is list:
item_list = []
item_list.append(children)
children = item_list
# Add loading widgets to tree items
for child in children:
if child.tree_item == None:
return
# Create loading widget
load_widget = QtGui.QLabel()
load_widget.resize(50,50)
#load_widget.setMaximumSize(50,50)
load_widget.setStyleSheet("QLabel { background-color: transparent; }")
# Create animation
load_anim = QMovie(self.datahandler.datapath("ui/images/loading_tree.gif"), "GIF", load_widget)
load_anim.setCacheMode(QMovie.CacheAll)
load_anim.setSpeed(150)
load_anim.setScaledSize(QtCore.QSize(50,50))
# Add to data model and tree
child.set_load_widget(load_widget, load_anim)
self.tree.setItemWidget(child.tree_item, 1, load_widget)
示例14: wxfinished
def wxfinished(self):
if self.wxreply.error() != QNetworkReply.NoError: return
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')
self.wwx.setMovie( self.wxmovie)
if self.parent().isVisible():
self.wxmovie.start()
示例15: __init__
def __init__(self, parent, text=""):
QDialog.__init__(self, parent)
# Create waiting image
waitingImage = QMovie(qtUtils.getAbsoluteImagePath('waiting.gif'))
waitingImage.start()
waitingImageLabel = QLabel(self)
waitingImageLabel.setMovie(waitingImage)
waitingLabel = QLabel(text, self)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(waitingImageLabel)
hbox.addSpacing(10)
hbox.addWidget(waitingLabel)
hbox.addStretch(1)
self.setLayout(hbox)