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


Python QMovie.start方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QMovie.start方法的典型用法代码示例。如果您正苦于以下问题:Python QMovie.start方法的具体用法?Python QMovie.start怎么用?Python QMovie.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QMovie的用法示例。


在下文中一共展示了QMovie.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ImagePlayer

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
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)

        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()
开发者ID:evil-is-good,项目名称:primat-projects,代码行数:29,代码来源:3.py

示例2: ImagePlayer

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
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()
开发者ID:iefan,项目名称:randstudent,代码行数:57,代码来源:ex11_gif.py

示例3: Loading

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
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()
开发者ID:aiudirog,项目名称:Checkers-Over-IP,代码行数:57,代码来源:loading.py

示例4: notifyTimeout

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
 def notifyTimeout(self):
     self.timeoutCount += 1
     if self.timeoutCount == self.notifyCount:
         msg = self.tr(u'No fix for %s since more than %d seconds!') % (self.name, self.timeoutTime * self.timeoutCount / 1000)
         w = self.iface.messageBar().createMessage(self.tr(u'PosiView Attention'), msg)
         l = QLabel(w)
         m = QMovie(':/plugins/PosiView/hand.gif')
         m.setSpeed(75)
         l.setMovie(m)
         m.setParent(l)
         m.start()
         w.layout().addWidget(l)
         self.iface.messageBar().pushWidget(w, QgsMessageBar.CRITICAL, duration=self.notifyDuration)
开发者ID:jrenken,项目名称:qgis-PosiView,代码行数:15,代码来源:mobile_item.py

示例5: LoadingItem

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
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
开发者ID:kennyfm91,项目名称:ninja-ide,代码行数:19,代码来源:ui_tools.py

示例6: __init__

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
    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()
开发者ID:oukiar,项目名称:Cryptully,代码行数:48,代码来源:qWaitingDialog.py

示例7: __init__

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
    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)
开发者ID:GageAmes,项目名称:Cryptully,代码行数:21,代码来源:qWaitingDialog.py

示例8: setStatus

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
    def setStatus(self,status,message='',tooltip=None):
        '''Sets indicator icon and statusbar message'''
        self.parent.statusbar.showMessage(message)
        self.parent.statusbar.setToolTip(tooltip if tooltip else '')

        #progress
        loc = os.path.abspath(os.path.join(IMG_LOC,self.imgset[status]))
        #loc = os.path.abspath(os.path.join(os.path.dirname(__file__),self.parent.IMG_LOC,self.imgset[status]))
        self.progressbar.setVisible(status in (self.STATUS.BUSY, self.STATUS.CLEAN))
        
        #icon
        anim = QMovie(loc, QByteArray(), self)
        anim.setScaledSize(QSize(self.IMG_WIDTH,self.IMG_HEIGHT))
        anim.setCacheMode(QMovie.CacheAll)
        anim.setSpeed(self.IMG_SPEED)
        self.view.clear()
        self.view.setMovie(anim)
        anim.start()

        self.view.repaint()
        QApplication.processEvents(QEventLoop.AllEvents)
开发者ID:josephramsay,项目名称:LDS,代码行数:23,代码来源:LDSGUI.py

示例9: MuteButtonLabel

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
class MuteButtonLabel(QWidget):

    def __init__(self, parent=None): 
        QWidget.__init__(self, parent) 
        #self.setFixedSize(CustomSize)
        self.movie_screen = QLabel()
        self.movie_screen.setFixedSize(CustomSize)
        self.movie_screen.setAlignment(Qt.AlignLeft)
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.movie_screen)
        self.setLayout(main_layout)
        self.muted = False

        #self.unmute() # this is for testpurpose only

        
    def unmute(self):
        """start animation"""
        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
        #print("Emitted 'sig_unmute'")
        self.emit(SIGNAL("sig_unmute"))
        self.movie.start()

    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()

    def mute(self):
        """stop the animation"""
        self.movie = QMovie(":/mute.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 = True
        #print("Emitted 'sig_mute'")
        self.emit(SIGNAL("sig_mute"))
        self.movie.start()

    def toggleMute(self):
        if self.muted:
            self.unmute()
        else:
            self.mute()

    def mousePressEvent(self, QMouseEvent):

        self.toggleMute()

        QMouseEvent.accept()
开发者ID:Acer54,项目名称:Webradio_v2,代码行数:62,代码来源:button_labels.py

示例10: animationLabel

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
 def animationLabel(self, index, animationFile):
     """
     Public slot to set an animated icon.
     
     @param index tab index (integer)
     @param animationFile name of the file containing the animation (string)
     @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(50)
             animation.setMovie(movie)
             movie.start()
         self.__tabBar.setTabButton(index, side, None)
         self.__tabBar.setTabButton(index, side, animation)
         return animation
     else:
         return None
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:26,代码来源:E4TabWidget.py

示例11: __init__

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]

#.........这里部分代码省略.........
        self.main_widget.show()
        self.main_widget.showMaximized()

    def show_settings_widget(self):
        if self.settings_widget != None:
            if not self.settings_widget.isVisible():
                self.settings_widget.show()
                self.settings_widget.check_settings()

    def show_transfer_widget(self):
        if self.settings_widget.isVisible():
            self.settings_widget.hide()
        self.transfer_widget.show()
        
    def show_about(self):
        if not self.about_dialog.isVisible():
            self.about_dialog.show()
        
    def show_note(self, message):
        QMaemo5InformationBox.information(None, QString(message), 0)
        
    def show_banner(self, message, timeout = 5000):
        QMaemo5InformationBox.information(None, QString(message), timeout)
        
    def show_loading_ui(self, message = "", loading = True):
        self.loading_ui.info_label.setText(message)
        self.loading_ui.info_label_icon.hide()
        self.thumb_was_visible = self.manager_ui.thumb_container.isVisible()
        self.manager_ui.thumb_container.hide()
        self.loading_widget.show()

        self.loading_ui.load_animation_label.setVisible(loading)
        if loading:
            self.loading_animation.start()
        else:
            self.loading_animation.stop()

    def show_information_ui(self, message, succesfull, timeout = 4000):
        self.loading_ui.load_animation_label.hide()
        self.thumb_was_visible = self.manager_ui.thumb_container.isVisible()
        if self.thumb_was_visible:
            self.manager_ui.thumb_container.hide()
        self.loading_ui.info_label.setText(message)
        if succesfull == None:
            icon = self.information_icon_queue
        elif succesfull:
            icon = self.information_icon_ok
        else:
            icon = self.information_icon_error
        self.loading_ui.info_label_icon.setPixmap(icon)
        self.loading_ui.info_label_icon.show()
        self.loading_widget.show()
        self.information_message_timer.start(timeout)

    def hide_loading_ui(self):
        if not self.information_message_timer.isActive():
            self.loading_widget.hide()
        if self.loading_animation.state() == QMovie.Running:
            self.loading_animation.stop()

    def hide_information_message(self):
        self.loading_ui.info_label_icon.hide()
        self.hide_loading_ui()
        self.manager_ui.thumb_container.setVisible(self.thumb_was_visible)
            
    def try_trusted_login(self):
开发者ID:Sohil876,项目名称:DropN900,代码行数:70,代码来源:uicontroller.py

示例12: LearningWizard

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
class LearningWizard(QWizard, Ui_Wizard):
    def __init__(self, settings):
        QWizard.__init__(self)
        self.setupUi(self)
        self.settings = settings
        self.wizardPage3.pageCreated.connect(self.showSummary)
        self.wizardPage3.fullfilled = True

        self.wizardPage2.fullfilled = True
        self.errors = 0
        self.steps = 0
        self.delete_images_button.clicked.connect(self.deleteUserImages)
        self.add_files_button.clicked.connect(self.AddFiles)
        self.remove_file_button.clicked.connect(self.removeFile)
        self.save_button.clicked.connect(self.saveImgData)
        self.train_button.clicked.connect(self.trainOCR)
        self.ocr_button.clicked.connect(self.runOCR)
        self.next_button.clicked.connect(self.nextWord)
        self.prev_button.clicked.connect(self.previousWord)
        #self.add_screenshots.clicked.connect(self.AddFiles)
        #self.wizardPage2.pageCreated.connect(self.AnalyzeImg)
        #self.contrast = 0.0
        #self.img_fields = [self.g1,self.g2,self.g3,self.g4,self.g5,self.g6,self.g7,self.g8,self.g9,self.g10,self.g11,self.g12,self.g13,self.g14,self.g15,self.g16,self.g17,self.g18,self.g19,self.g20]
        #self.input_fields = [self.e1,self.e2,self.e3,self.e4,self.e5,self.e6,self.e7,self.e8,self.e9,self.e10,self.e11,self.e12,self.e13,self.e14,self.e15,self.e16,self.e17,self.e18,self.e19,self.e20]
        self.gviews = []
        self.ledits = []
        self.boxlist = []
        self.imglist = []
        self.charlist = []
        self.words = []
        self.boundaries = []
        self.wordcount = 0
        self.current = 0
        self.scene = None
        self.ratio_h = 1.0
        self.ratio_w = 1.0
        self.base = self.loadBase()
        self.user = self.loadUser()
        if not self.base is None:
            self.base_data_label.setText(self.getBaseData())
        if not self.user is None:
            self.delete_images_button.setEnabled(True)
            self.user_data_label.setText(self.getUserData())
        #self.resizeElements()
        
        #for index,item in zip(range(20), self.input_fields):
        #    item.textEdited.connect(partial(self.changeText, index))
        self.train_button.setEnabled(True)
        #self.grid = QGridLayout()
        #self.field_holder.addLayout(self.grid)
        
        
    def deleteUserImages(self):
        self.user = None
        path = self.settings.storage_path+os.sep+"user_training_data.pck"
        remove(path)
        self.user_data_label.setText("-")
        self.delete_images_button.setEnabled(False)
    
    def showSummary(self):
        summary = ""
        userdata = {}
        characters = ["'", ',', '-', '&', '[', ']', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '*', '+', '#']
        for word in self.words:
            for letter in word:
                if letter[1] in characters:
                    if letter[1] in userdata:
                        userdata[letter[1]] += 1
                    else:
                        userdata[letter[1]] = 1
        for key in characters:
            if key in userdata:
                summary += '"'+key+'"' +": " +str(userdata[key])+", "
                
        self.summary_label.setText(summary)
    
    def trainOCR(self):
        self.train_button.setEnabled(False)
        alldata = self.connectData()
        testnumbers = self.getRandomData(alldata,[',', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
        testletters = self.getRandomData(alldata,["'", ',', '-', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
        teststation = self.getRandomData(alldata,["'", ',', '-', '&', '[', ']', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
        testlevel   = self.getRandomData(alldata,['*', '+', '#'])
        self.movie = QMovie(":/ico/loader.gif")
        self.loader.setMovie(self.movie)
        self.movie.start()
        self.numberstrainerthread = Trainer(self, "numbers", self.base, self.user, testnumbers, testletters, teststation, testlevel)
        self.letterstrainerthread = Trainer(self, "letters", self.base, self.user, testnumbers, testletters, teststation, testlevel)
        self.stationtrainerthread = Trainer(self, "station", self.base, self.user, testnumbers, testletters, teststation, testlevel)
        self.leveltrainerthread   = Trainer(self, "level"  , self.base, self.user, testnumbers, testletters, teststation, testlevel)
        QObject.connect(self.numberstrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished)
        QObject.connect(self.letterstrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished)
        QObject.connect(self.stationtrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished)
        QObject.connect(self.leveltrainerthread  , SIGNAL('finished(QString, int)'), self.stepFinished)
        #QObject.connect(self.trainerthread, SIGNAL('finishedall(int)'), self.trainingFinished)
        self.numberstrainerthread.execute()
        self.letterstrainerthread.execute()
        self.stationtrainerthread.execute()
        self.leveltrainerthread.execute()
        self.training_summary.setText("Training in progress")
#.........这里部分代码省略.........
开发者ID:deflektor,项目名称:EliteOCR,代码行数:103,代码来源:learningwizard.py

示例13: VisionneurImagePourEKD

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
class VisionneurImagePourEKD(QScrollArea):
	''' Classe pour l'affichage des images (avec des barres de
	défilement)'''
	def __init__(self, img=None):
		QScrollArea.__init__(self)

		# Déclaration du drapeau: a-t-on chargé un *.gif
		if img and os.path.splitext(img)[1]!=".gif":
			self.gif = 1
		else:
			self.gif = 0
		
		# Facteur de redimensionnement de l'image à afficher par rapport à la taille réelle de l'image
		self.factor = 1
		
		# Variables de paramètres
		self.modeTransformation=Qt.SmoothTransformation
		#self.modeTransformation=Qt.FastTransformation
		
		# widget qui contiendra l'image
		self.imageLabel = QLabel()
		self.imageLabel.setAlignment(Qt.AlignCenter)
		
		self.setBackgroundRole(QPalette.Dark)
		self.setWidget(self.imageLabel)
		# Indispensable pour ne pas avoir d'images tronquées, lors du chargement de nvll img
		self.setWidgetResizable(True)
		
		# Position du curseur dans le QScrollArea au moment du clic de la souris
		self.positionPresseeSourisIni = QPoint()
		# Position du point haut-gauche du QScrollArea par rapport au QPixMap entier au
		# moment du clic de la souris (par la suite appelée "position de la barre de défilement")
        	self.positionBarrePresseeSourisIni = QPoint()
		
		# Création du menu contextuel
		self.menuZoom=QMenu("Zoom")
		
		# Entrée zoom taille réelle
		self.menuTailleReelle=self.menuZoom.addAction(_(u'&Taille Réelle'))
		self.menuTailleReelle.setIcon(QIcon("Icones" + os.sep + "taillereelle.png"))
		self.connect(self.menuTailleReelle, SIGNAL("triggered()"), self.setTailleReelle)
		
		# Entrée zoom taille fenetre
		self.menuTailleFenetre=self.menuZoom.addAction(_(u'&Adapter à la fenêtre'))
		self.menuTailleFenetre.setIcon(QIcon("Icones" + os.sep + "fenetre.png"))
		self.connect(self.menuTailleFenetre, SIGNAL("triggered()"), self.setTailleFenetre)
	
		# Entrée zoom +
		self.menuZoomPlus=self.menuZoom.addAction(_(u'&Zoom Avant'))
		self.menuZoomPlus.setIcon(QIcon("Icones" + os.sep + "zoomplus.png"))
		self.connect(self.menuZoomPlus, SIGNAL("triggered()"), self.zoomAvant)
		
		# Entrée zoom - 
		self.menuZoomMoins=self.menuZoom.addAction(_(u'&Zoom Arrière'))
		self.menuZoomMoins.setIcon(QIcon("Icones" + os.sep + "zoommoins.png"))
		self.connect(self.menuZoomMoins, SIGNAL("triggered()"), self.zoomArriere)
		
		# Entrée mettre en pause/démarrer l'animation du gif
		self.menuStartPauseGif=self.menuZoom.addAction(_(u"Mettre en pause/démarrer l'animation"))
		self.menuStartPauseGif.setIcon(QIcon("Icones" + os.sep + "player_end.png"))
		self.connect(self.menuStartPauseGif, SIGNAL("triggered()"), self.startPauseGif)
			
		# Entrée mettre en pause/démarrer l'animation du gif
		self.menuStopGif=self.menuZoom.addAction(_(u"Arrêter l'animation"))
		self.menuStopGif.setIcon(QIcon("Icones" + os.sep + "player_stop.png"))
		self.connect(self.menuStopGif, SIGNAL("triggered()"), self.stopGif)
		
		# On cache les 2 menus de *.gif si on ne traite pas ce format
		if not self.gif:
			self.menuStartPauseGif.setVisible(False)
			self.menuStopGif.setVisible(False)
		
		# Si une image est en paramètre de classe, on l'affiche directement
		# sinon on pourra toujours l'afficher plus tard en appelant la
		# méthode setImage(), le moment venu
		if img:
			self.setImage(img)
			self.setToolTip(img)
		else:
			# image par défaut
			self.setImage("Icones" + os.sep + "avant-image.png")
			self.setToolTip(_(u"image d'accueil"))
			self.setTailleReelle()
	
	def mousePressEvent(self, event):
		"Menu contextuel et enregistrement de données préparant le déplacement de l'image par pincement"
		
		# Menu contextuel
		if event.button() == Qt.RightButton: 
			self.menuZoom.popup(event.globalPos())
		
		# On enregistre la position du curseur et de la barre de défilement au moment du clic
		elif event.button() == Qt.LeftButton:
			self.positionPresseeSourisIni = QPoint(event.pos())
			self.positionBarrePresseeSourisIni.setX(self.horizontalScrollBar().value())
			self.positionBarrePresseeSourisIni.setY(self.verticalScrollBar().value())
			if PYQT_VERSION_STR >= "4.1.0": 
				# curseur main fermée
				self.setCursor(Qt.ClosedHandCursor)
			else: self.setCursor(Qt.SizeAllCursor)
#.........这里部分代码省略.........
开发者ID:Ptaah,项目名称:Ekd,代码行数:103,代码来源:afficheurImage.py

示例14: ServerToolsWindow

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
class ServerToolsWindow(base_class, ui_class):
    __metaclass__ = QSingleton

    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)

    def _SH_AccountButtonMenuTriggered(self, action):
        view = self.tab_widget.currentWidget()
        account = action.data().toPyObject()
        self.account_label.setText(account.id)
        self.tab_widget.setTabText(self.tab_widget.currentIndex(), account.id)
        view.load_account_page(account, tab=view.tab, task=view.task)

    def _SH_WebViewLoadStarted(self):
        self.spinner_label.setMovie(self.spinner_movie)
        self.spinner_label.show()
        self.spinner_movie.start()
        self.progress_bar.setValue(0)
        # self.progress_bar.show()

    def _SH_WebViewLoadFinished(self, load_ok):
        self.spinner_movie.stop()
        self.spinner_label.hide()
        self.progress_bar.hide()
        if not load_ok:
            web_view = self.tab_widget.currentWidget()
            icon_path = Resources.get("icons/invalid.png")
            error_message = web_view.last_error or "Unknown error"
            html = """
            <html>
             <head>
              <style>
                .icon    { width: 64px; height: 64px; float: left; }
                .message { margin-left: 74px; line-height: 64px; vertical-align: middle; }
              </style>
             </head>
             <body>
              <img class="icon" src="file:%s" />
              <div class="message">Failed to load web page: <b>%s</b></div>
             </body>
            </html>
            """ % (
                icon_path,
                error_message,
            )
            web_view.loadStarted.disconnect(self._SH_WebViewLoadStarted)
            web_view.loadFinished.disconnect(self._SH_WebViewLoadFinished)
            web_view.setHtml(html)
            web_view.loadStarted.connect(self._SH_WebViewLoadStarted)
            web_view.loadFinished.connect(self._SH_WebViewLoadFinished)

    def _SH_WebViewLoadProgress(self, percent):
        self.progress_bar.setValue(percent)

    def _SH_ModelChanged(self, parent_index, start, end):
        menu = self.account_button.menu()
        menu.clear()
        for row in xrange(self.model.rowCount()):
            account_info = self.model.data(self.model.index(row, 0), Qt.UserRole).toPyObject()
            action = QAction(account_info.name, self)
            action.setData(QVariant(account_info.account))
            menu.addAction(action)

    def open_settings_page(self, account):
        view = self.tab_widget.currentWidget()
        account = account or view.account
        if account is None or account.server.settings_url is None:
            account = self.account_button.menu().actions()[0].data().toPyObject()
        self.account_label.setText(account.id)
        self.tab_widget.setTabText(self.tab_widget.currentIndex(), account.id)
        view.load_account_page(account, tab="settings")
        self.show()

    def open_search_for_people_page(self, account):
        view = self.tab_widget.currentWidget()
#.........这里部分代码省略.........
开发者ID:grengojbo,项目名称:sipclients,代码行数:103,代码来源:accounts.py

示例15: set_loading

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import start [as 别名]
 def set_loading(self):
     movie = QMovie(":/images/loading.gif")
     self.labelLoading.setMovie(movie)
     self.labelLoading.setVisible(False)
     movie.start()
开发者ID:gen2brain,项目名称:crtaci,代码行数:7,代码来源:main.py


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