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


Python QtWidgets.QProgressDialog方法代码示例

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


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

示例1: loadNewGameDef

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def loadNewGameDef(def_):
    """
    Loads MiyamotoGameDefinition def_, and displays a progress dialog
    """
    dlg = QtWidgets.QProgressDialog()
    dlg.setAutoClose(True)
    btn = QtWidgets.QPushButton('Cancel')
    btn.setEnabled(False)
    dlg.setCancelButton(btn)
    dlg.show()
    dlg.setValue(0)

    import loading
    loading.LoadGameDef(def_, dlg)
    del loading

    dlg.setValue(100)
    del dlg 
开发者ID:aboood40091,项目名称:Miyamoto,代码行数:20,代码来源:gamedefs.py

示例2: to_raw

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def to_raw(self):
        text = self.path_edit.toPlainText()
        paths = text.splitlines()
        movie_groups = io.get_movie_groups(paths)
        n_movies = len(movie_groups)
        if n_movies == 1:
            text = "Converting 1 movie..."
        else:
            text = "Converting {} movies...".format(n_movies)
        self.progress_dialog = QtWidgets.QProgressDialog(
            text, "Cancel", 0, n_movies, self
        )
        progress_bar = QtWidgets.QProgressBar(self.progress_dialog)
        progress_bar.setTextVisible(False)
        self.progress_dialog.setBar(progress_bar)
        self.progress_dialog.setMaximum(n_movies)
        self.progress_dialog.setWindowTitle("Picasso: ToRaw")
        self.progress_dialog.setWindowModality(QtCore.Qt.WindowModal)
        self.progress_dialog.canceled.connect(self.cancel)
        self.progress_dialog.closeEvent = self.cancel
        self.worker = Worker(movie_groups)
        self.worker.progressMade.connect(self.update_progress)
        self.worker.finished.connect(self.on_finished)
        self.worker.start()
        self.progress_dialog.show() 
开发者ID:jungmannlab,项目名称:picasso,代码行数:27,代码来源:toraw.py

示例3: prompt_extractor

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def prompt_extractor(self, item):
        extractor = extractors[item.data(Qt.UserRole)]
        inputs = []
        if not assert_installed(self.view, **extractor.get('depends', {})):
            return
        
        if not extractor.get('pick_url', False):
            files, mime = QFileDialog.getOpenFileNames()
            for path in files:
                inputs.append((path, Path(path).stem))
        else:
            text, good = QInputDialog.getText(self.view, ' ', 'Input an URL:')
            if text:
                url = urlparse(text)
                inputs.append((url.geturl(), url.netloc))
        
        if inputs:
            wait = QProgressDialog('Extracting .proto structures...', None, 0, 0)
            wait.setWindowTitle(' ')
            self.set_view(wait)
            
            self.worker = Worker(inputs, extractor)
            self.worker.progress.connect(self.extraction_progress)
            self.worker.finished.connect(self.extraction_done)
            self.worker.start() 
开发者ID:marin-m,项目名称:pbtk,代码行数:27,代码来源:gui.py

示例4: progress_dialog

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def progress_dialog(message):
    prgr_dialog = QProgressDialog()
    prgr_dialog.setFixedSize(300, 50)
    prgr_dialog.setAutoFillBackground(True)
    prgr_dialog.setWindowModality(Qt.WindowModal)
    prgr_dialog.setWindowTitle('Please wait')
    prgr_dialog.setLabelText(message)
    prgr_dialog.setSizeGripEnabled(False)
    prgr_dialog.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
    prgr_dialog.setWindowFlag(Qt.WindowContextHelpButtonHint, False)
    prgr_dialog.setWindowFlag(Qt.WindowCloseButtonHint, False)
    prgr_dialog.setModal(True)
    prgr_dialog.setCancelButton(None)
    prgr_dialog.setRange(0, 0)
    prgr_dialog.setMinimumDuration(0)
    prgr_dialog.setAutoClose(False)
    return prgr_dialog 
开发者ID:iGio90,项目名称:Dwarf,代码行数:19,代码来源:utils.py

示例5: start

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def start(self, text, maximum):
        """Start showing a progress dialog."""
        self._progress = QProgressDialog()
        self._progress.setMinimumDuration(500)
        self._progress.setLabelText(text)
        self._progress.setMaximum(maximum)
        self._progress.setCancelButton(None)
        self._progress.show()
        QApplication.processEvents() 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:11,代码来源:history.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def __init__(self, text):
            if QApplication.instance() is None:
                self.dialog = None
                print(text)
            else:
                self.dialog = QProgressDialog(text, 'Cancel', 0, 100)
                self.dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
                self.dialog.show() 
开发者ID:TUDelft-CNS-ATM,项目名称:bluesky,代码行数:10,代码来源:load_visuals_txt.py

示例7: _dialog_accepted

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def _dialog_accepted(self, dialog):
        project, database = dialog.get_result()

        # Create the download progress dialog
        text = "Downloading database from server, please wait..."
        progress = QProgressDialog(text, "Cancel", 0, 1)
        progress.setCancelButton(None)  # Remove cancel button
        progress.setModal(True)  # Set as a modal dialog
        window_flags = progress.windowFlags()  # Disable close button
        progress.setWindowFlags(window_flags & ~Qt.WindowCloseButtonHint)
        progress.setWindowTitle("Open from server")
        icon_path = self._plugin.plugin_resource("download.png")
        progress.setWindowIcon(QIcon(icon_path))

        # Send a packet to download the file
        packet = DownloadFile.Query(project.name, database.name)
        callback = partial(self._on_progress, progress)

        def set_download_callback(reply):
            reply.downback = callback

        d = self._plugin.network.send_packet(packet)
        d.add_initback(set_download_callback)
        d.add_callback(partial(self._file_downloaded, database, progress))
        d.add_errback(self._plugin.logger.exception)
        progress.show() 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:28,代码来源:actions.py

示例8: upload_file

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def upload_file(plugin, packet):
        # Save the current database
        plugin.core.save_netnode()
        input_path = ida_loader.get_path(ida_loader.PATH_TYPE_IDB)
        ida_loader.save_database(input_path, 0)

        with open(input_path, "rb") as input_file:
            packet.content = input_file.read()

        # Create the upload progress dialog
        text = "Uploading database to server, please wait..."
        progress = QProgressDialog(text, "Cancel", 0, 1)
        progress.setCancelButton(None)  # Remove cancel button
        progress.setModal(True)  # Set as a modal dialog
        window_flags = progress.windowFlags()  # Disable close button
        progress.setWindowFlags(window_flags & ~Qt.WindowCloseButtonHint)
        progress.setWindowTitle("Save to server")
        icon_path = plugin.plugin_resource("upload.png")
        progress.setWindowIcon(QIcon(icon_path))

        # Send the packet to upload the file
        packet.upback = partial(SaveActionHandler._on_progress, progress)
        d = plugin.network.send_packet(packet)
        if d:
            d.add_callback(
                partial(SaveActionHandler.file_uploaded, plugin, progress)
            )
            d.add_errback(plugin.logger.exception)
        progress.show() 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:31,代码来源:actions.py

示例9: run

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def run(self):
        ## geometry
        #tl_x = 0.0
        #tl_y = 0.0
        br_x = settings.get('scanner:width')
        br_y = settings.get('scanner:height')

        resolution = settings.get('scanner:resolution')
        mode = settings.get('scanner:mode')

        self.process = ScanimageProcess(self.device, mode, resolution,
                                        (br_x, br_y))
        # QObject.connect(self.process, SIGNAL("finished(int)"), self.scanned)
        self.process.finished.connect(self.scanned(int))
        self.process.readyReadStandardError.connect(self.progress)

        #TODO: manage Abort button
        progress = QProgressDialog(
            self.tr("Progress"),
            self.tr("Abort"), 0, 100)
        progress.setWindowTitle(self.tr("Scanning..."))
        progress.setWindowModality(Qt.WindowModal)
        progress.setMinimumDuration(0)
        progress.setValue(0)
        progress.setAutoClose(True)
        progress.setAutoReset(True)
        progress.forceShow()

        self.progressDialog = progress
        self.loaded = False 
开发者ID:zdenop,项目名称:lector,代码行数:32,代码来源:scannerthread.py

示例10: _export_encrypted_recovery

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def _export_encrypted_recovery(self, gateway, password):
        settings = gateway.get_settings(include_rootcap=True)
        if gateway.use_tor:
            settings["hide-ip"] = True
        data = json.dumps(settings)
        self.progress = QProgressDialog("Encrypting...", None, 0, 100)
        self.progress.show()
        self.animation = QPropertyAnimation(self.progress, b"value")
        self.animation.setDuration(6000)  # XXX
        self.animation.setStartValue(0)
        self.animation.setEndValue(99)
        self.animation.start()
        self.crypter = Crypter(data.encode(), password.encode())
        self.crypter_thread = QThread()
        self.crypter.moveToThread(self.crypter_thread)
        self.crypter.succeeded.connect(self.animation.stop)
        self.crypter.succeeded.connect(self.progress.close)
        self.crypter.succeeded.connect(self._on_encryption_succeeded)
        self.crypter.failed.connect(self.animation.stop)
        self.crypter.failed.connect(self.progress.close)
        self.crypter.failed.connect(self._on_encryption_failed)
        self.crypter_thread.started.connect(self.crypter.encrypt)
        self.crypter_thread.start()
        dest, _ = QFileDialog.getSaveFileName(
            self.parent,
            "Select a destination",
            os.path.join(
                os.path.expanduser("~"),
                gateway.name + " Recovery Key.json.encrypted",
            ),
        )
        if not dest:
            return
        if self.ciphertext:
            with atomic_write(dest, mode="wb", overwrite=True) as f:
                f.write(self.ciphertext)
            self.done.emit(dest)
            self.ciphertext = None
        else:
            self.filepath = dest 
开发者ID:gridsync,项目名称:gridsync,代码行数:42,代码来源:recovery.py

示例11: _decrypt_content

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def _decrypt_content(self, data, password):
        logging.debug("Trying to decrypt %s...", self.filepath)
        self.progress = QProgressDialog(
            "Trying to decrypt {}...".format(os.path.basename(self.filepath)),
            None,
            0,
            100,
        )
        self.progress.show()
        self.animation = QPropertyAnimation(self.progress, b"value")
        self.animation.setDuration(6000)  # XXX
        self.animation.setStartValue(0)
        self.animation.setEndValue(99)
        self.animation.start()
        self.crypter = Crypter(data, password.encode())
        self.crypter_thread = QThread()
        self.crypter.moveToThread(self.crypter_thread)
        self.crypter.succeeded.connect(self.animation.stop)
        self.crypter.succeeded.connect(self.progress.close)
        self.crypter.succeeded.connect(self._on_decryption_succeeded)
        self.crypter.failed.connect(self.animation.stop)
        self.crypter.failed.connect(self.progress.close)
        self.crypter.failed.connect(self._on_decryption_failed)
        self.crypter_thread.started.connect(self.crypter.decrypt)
        self.crypter_thread.start() 
开发者ID:gridsync,项目名称:gridsync,代码行数:27,代码来源:recovery.py

示例12: setup_progress

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def setup_progress(parent, title, message, icon_name):
    progress = QtWidgets.QProgressDialog(message, "", 0, 100, parent)

    progress.setWindowModality(QtCore.Qt.ApplicationModal)
    progress.setCancelButton(None)
    progress.setAutoClose(True)
    progress.setWindowTitle(title)
    icon = QtGui.QIcon()
    icon.addPixmap(
        QtGui.QPixmap(f":/{icon_name}.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off
    )
    progress.setWindowIcon(icon)
    progress.show()

    return progress 
开发者ID:danielhrisca,项目名称:asammdf,代码行数:17,代码来源:utils.py

示例13: __call__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def __call__(self, data, parent=None):
        """Detect slow waves on the data.

        Parameters
        ----------
        data : instance of Data
            data used for detection
        parent : QWidget
            for use with GUI, as parent widget for the progress bar
        
        Returns
        -------
        instance of graphoelement.Arousals
            description of the detected arousals
        """
        if parent is not None:
            progress = QProgressDialog('Finding arousals', 'Abort', 
                                       0, data.number_of('chan')[0], parent)
            progress.setWindowModality(Qt.ApplicationModal)
            
        arousal = Arousals()
        arousal.chan_name = data.axis['chan'][0]

        all_arousals = []
        for i, chan in enumerate(data.axis['chan'][0]):
            
            lg.info('Detecting arousals on chan %s', chan)
            time = hstack(data.axis['time'])
            dat_orig = hstack(data(chan=chan))

            if 'HouseDetector' in self.method:
                arou_in_chan = detect_HouseDetector(dat_orig, data.s_freq, time,
                                                  self)

            else:
                raise ValueError('Unknown method')

            for ar in arou_in_chan:
                ar.update({'chan': chan})
            all_arousals.extend(arou_in_chan)
            
            if parent is not None:
                progress.setValue(i)
                if progress.wasCanceled():
                    return
            # end of loop over chan

        arousal.events = sorted(all_arousals, key=lambda x: x['start'])

        if parent is not None:
            progress.setValue(i + 1)

        return arousal 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:55,代码来源:arousal.py

示例14: __call__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def __call__(self, data, parent=None):
        """Detect slow waves on the data.

        Parameters
        ----------
        data : instance of Data
            data used for detection
        parent : QWidget
            for use with GUI, as parent widget for the progress bar
        
        Returns
        -------
        instance of graphoelement.SlowWaves
            description of the detected SWs
        """
        if parent is not None:
            progress = QProgressDialog('Finding slow waves', 'Abort', 
                                       0, data.number_of('chan')[0], parent)
            progress.setWindowModality(Qt.ApplicationModal)
            
        slowwave = SlowWaves()
        slowwave.chan_name = data.axis['chan'][0]

        all_slowwaves = []
        for i, chan in enumerate(data.axis['chan'][0]):
            
            lg.info('Detecting slow waves on chan %s', chan)
            time = hstack(data.axis['time'])
            dat_orig = hstack(data(chan=chan))

            if 'Massimini2004' in self.method:
                sw_in_chan = detect_Massimini2004(dat_orig, data.s_freq, time,
                                                  self)

            else:
                raise ValueError('Unknown method')

            for sw in sw_in_chan:
                sw.update({'chan': chan})
            all_slowwaves.extend(sw_in_chan)
            
            if parent is not None:
                progress.setValue(i)
                if progress.wasCanceled():
                    return
            # end of loop over chan

        slowwave.events = sorted(all_slowwaves, key=lambda x: x['start'])

        if parent is not None:
            progress.setValue(i + 1)

        return slowwave 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:55,代码来源:slowwave.py

示例15: add_events

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressDialog [as 别名]
def add_events(self, event_list, name=None, chan=None, parent=None):
        """Add series of events. Faster than calling add_event in a loop.
        Parameters
        ----------
        event_list : list of dict
            each dict is an event with 'start' and 'end' times
        name : str, optional
            save events to this event type.
        chan : str or list of str, optional
            save events to this or these channel(s). If None, channel will be
            read from the event list dict under 'chan'
        """
        if name is not None:
            evt_name = name
            if name not in self.event_types:
                self.add_event_type(name)

        events = self.rater.find('events')
        
        if parent is not None:
            progress = QProgressDialog('Saving events', 'Abort',
                               0, len(events) - 1, parent)
            progress.setWindowModality(Qt.ApplicationModal)

        for i, evt in enumerate(event_list):
            if name is None:
                evt_name = evt['name']
                if evt_name not in self.event_types:
                    self.add_event_type(evt_name)
            pattern = "event_type[@type='" + evt_name + "']"
            event_type = events.find(pattern)
            new_event = SubElement(event_type, 'event')
            event_start = SubElement(new_event, 'event_start')
            event_start.text = str(evt['start'])
            event_end = SubElement(new_event, 'event_end')
            event_end.text = str(evt['end'])

            one_chan = chan
            if chan is None:
                one_chan = evt['chan']
            if isinstance(one_chan, (tuple, list)):
                one_chan = ', '.join(one_chan)
            event_chan = SubElement(new_event, 'event_chan')
            event_chan.text = one_chan

            event_qual = SubElement(new_event, 'event_qual')
            event_qual.text = 'Good'

            if parent is not None:
                progress.setValue(i)
                if progress.wasCanceled():
                    return

        self.save()

        if parent is not None:
            progress.close() 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:59,代码来源:annotations.py


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