當前位置: 首頁>>代碼示例>>Python>>正文


Python QMovie.setFileName方法代碼示例

本文整理匯總了Python中PyQt5.QtGui.QMovie.setFileName方法的典型用法代碼示例。如果您正苦於以下問題:Python QMovie.setFileName方法的具體用法?Python QMovie.setFileName怎麽用?Python QMovie.setFileName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtGui.QMovie的用法示例。


在下文中一共展示了QMovie.setFileName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: SystemTrayIcon

# 需要導入模塊: from PyQt5.QtGui import QMovie [as 別名]
# 或者: from PyQt5.QtGui.QMovie import setFileName [as 別名]
class SystemTrayIcon(QSystemTrayIcon):
    def __init__(self, parent):
        super(SystemTrayIcon, self).__init__()
        self.parent = parent

        self.new_folder_window = NewFolderWindow(parent)
        self.preferences_window = PreferencesWindow()
        
        self.setIcon(QIcon(":gridsync.png"))

        self.right_menu = RightClickMenu(self)
        self.setContextMenu(self.right_menu)
        self.activated.connect(self.on_click)

        self.animation = QMovie()
        self.animation.setFileName(":sync.gif")
        self.animation.updated.connect(self.update_animation_frame)
        self.animation.setCacheMode(True)

    def update_animation_frame(self):
        self.setIcon(QIcon(self.animation.currentPixmap()))

    def set_icon(self, resource):
        self.setIcon(QIcon(resource))

    def on_click(self, value):
        #self.right_menu.populate()
        if value == QSystemTrayIcon.Trigger:
            open_gridsync_folder()

    def on_quit(self):
        reactor.stop()
開發者ID:david415,項目名稱:gridsync,代碼行數:34,代碼來源:systray.py

示例2: MoviePlayer

# 需要導入模塊: from PyQt5.QtGui import QMovie [as 別名]
# 或者: from PyQt5.QtGui.QMovie import setFileName [as 別名]
class MoviePlayer(QWidget):
    def __init__(self):
        super(MoviePlayer, self).__init__()

        self.setAttribute(Qt.WA_TranslucentBackground)        
        self.setWindowFlags(Qt.FramelessWindowHint)

        self.movie = QMovie(self)

        self.movieLabel = QLabel("No movie loaded")
        self.movieLabel.setAlignment(Qt.AlignAbsolute)
        self.movieLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)


        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(self.movieLabel)
        self.setLayout(self.mainLayout)
        
        #self.resize(400, 500)

        self.movieLabel.setMovie(self.movie)
        self.movie.setFileName('icon/gears.gif')

        pos = kp.pos()

        x = pos.x() - ((self.width()/2) - (kp.width()/2)) +220
        y = pos.y() - ((self.height()/2) - (kp.height()/2)) +160
        
        self.setGeometry(x,y, 400, 500)

        self.movie.start()   
開發者ID:dhoy,項目名稱:KornitPrint,代碼行數:33,代碼來源:kornit_print.py

示例3: setupWidget1

# 需要導入模塊: from PyQt5.QtGui import QMovie [as 別名]
# 或者: from PyQt5.QtGui.QMovie import setFileName [as 別名]
    def setupWidget1(self):
        #setup the tree
        movie = QMovie()
        movie.setFileName("res/tree.gif")
        self.ui.lb_tree.setMovie(movie)
        self.ui.lb_tree_big.setMovie(movie)
        movie.start()

        #setup the statistics
        self.ui.gridLayout.setHorizontalSpacing(60)
        self.ui.gridLayout.setVerticalSpacing(10)
        self.ui.gridLayout.setGeometry(QRect(0, 51, 291, 224))
        self.ui.gridLayout.setAlignment(QtCore.Qt.AlignCenter)
        self.statLabels = []
        for i in range(7):
            self.statLabels.append([])
            for j in range(4):
                self.statLabels[i].append(QLabel())
                self.statLabels[i][j].setScaledContents(True)
                self.statLabels[i][j].setAutoFillBackground(False)
                self.statLabels[i][j].setAlignment(QtCore.Qt.AlignCenter)
                self.ui.gridLayout.addWidget(self.statLabels[i][j], i, j, 1, 1)
開發者ID:blackskygg,項目名稱:jielu,代碼行數:24,代碼來源:blueApp.py

示例4: MoviePlayer

# 需要導入模塊: from PyQt5.QtGui import QMovie [as 別名]
# 或者: from PyQt5.QtGui.QMovie import setFileName [as 別名]
class MoviePlayer(QWidget):
    def __init__(self, parent=None):
        super(MoviePlayer, self).__init__(parent)

        self.movie = QMovie(self)
        self.movie.setCacheMode(QMovie.CacheAll)

        self.movieLabel = QLabel("No movie loaded")
        self.movieLabel.setAlignment(Qt.AlignCenter)
        self.movieLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.movieLabel.setBackgroundRole(QPalette.Dark)
        self.movieLabel.setAutoFillBackground(True)

        self.currentMovieDirectory = ''

        self.createControls()
        self.createButtons()

        self.movie.frameChanged.connect(self.updateFrameSlider)
        self.movie.stateChanged.connect(self.updateButtons)
        self.fitCheckBox.clicked.connect(self.fitToWindow)
        self.frameSlider.valueChanged.connect(self.goToFrame)
        self.speedSpinBox.valueChanged.connect(self.movie.setSpeed)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.movieLabel)
        mainLayout.addLayout(self.controlsLayout)
        mainLayout.addLayout(self.buttonsLayout)
        self.setLayout(mainLayout)

        self.updateFrameSlider()
        self.updateButtons()

        self.setWindowTitle("Movie Player")
        self.resize(400, 400)

    def open(self):
        fileName, _ = QFileDialog.getOpenFileName(self, "Open a Movie",
                self.currentMovieDirectory)

        if fileName:
            self.openFile(fileName)

    def openFile(self, fileName):
        self.currentMovieDirectory = QFileInfo(fileName).path()

        self.movie.stop()
        self.movieLabel.setMovie(self.movie)
        self.movie.setFileName(fileName)
        self.movie.start()

        self.updateFrameSlider();
        self.updateButtons();

    def goToFrame(self, frame):
        self.movie.jumpToFrame(frame)

    def fitToWindow(self):
        self.movieLabel.setScaledContents(self.fitCheckBox.isChecked())

    def updateFrameSlider(self):
        hasFrames = (self.movie.currentFrameNumber() >= 0)

        if hasFrames:
            if self.movie.frameCount() > 0:
                self.frameSlider.setMaximum(self.movie.frameCount() - 1)
            elif self.movie.currentFrameNumber() > self.frameSlider.maximum():
                self.frameSlider.setMaximum(self.movie.currentFrameNumber())

            self.frameSlider.setValue(self.movie.currentFrameNumber())
        else:
            self.frameSlider.setMaximum(0)

        self.frameLabel.setEnabled(hasFrames)
        self.frameSlider.setEnabled(hasFrames)

    def updateButtons(self):
        state = self.movie.state()

        self.playButton.setEnabled(self.movie.isValid() and
                self.movie.frameCount() != 1 and state == QMovie.NotRunning)
        self.pauseButton.setEnabled(state != QMovie.NotRunning)
        self.pauseButton.setChecked(state == QMovie.Paused)
        self.stopButton.setEnabled(state != QMovie.NotRunning)

    def createControls(self):
        self.fitCheckBox = QCheckBox("Fit to Window")

        self.frameLabel = QLabel("Current frame:")

        self.frameSlider = QSlider(Qt.Horizontal)
        self.frameSlider.setTickPosition(QSlider.TicksBelow)
        self.frameSlider.setTickInterval(10)

        speedLabel = QLabel("Speed:")

        self.speedSpinBox = QSpinBox()
        self.speedSpinBox.setRange(1, 9999)
        self.speedSpinBox.setValue(100)
        self.speedSpinBox.setSuffix("%")
#.........這裏部分代碼省略.........
開發者ID:death-finger,項目名稱:Scripts,代碼行數:103,代碼來源:movie.py


注:本文中的PyQt5.QtGui.QMovie.setFileName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。