Python PyQt5.QtWidgets.QProgressDialog() Examples
The following are 15
code examples of PyQt5.QtWidgets.QProgressDialog().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: toraw.py From picasso with MIT License | 8 votes |
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()
Example #2
Source File: gamedefs.py From Miyamoto with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: gui.py From pbtk with GNU General Public License v3.0 | 6 votes |
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()
Example #4
Source File: utils.py From Dwarf with GNU General Public License v3.0 | 6 votes |
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
Example #5
Source File: history.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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()
Example #6
Source File: load_visuals_txt.py From bluesky with GNU General Public License v3.0 | 5 votes |
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()
Example #7
Source File: actions.py From IDArling with GNU General Public License v3.0 | 5 votes |
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()
Example #8
Source File: actions.py From IDArling with GNU General Public License v3.0 | 5 votes |
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()
Example #9
Source File: scannerthread.py From lector with GNU General Public License v2.0 | 5 votes |
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
Example #10
Source File: recovery.py From gridsync with GNU General Public License v3.0 | 5 votes |
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()
Example #11
Source File: utils.py From asammdf with GNU Lesser General Public License v3.0 | 5 votes |
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
Example #12
Source File: arousal.py From wonambi with GNU General Public License v3.0 | 4 votes |
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
Example #13
Source File: slowwave.py From wonambi with GNU General Public License v3.0 | 4 votes |
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
Example #14
Source File: annotations.py From wonambi with GNU General Public License v3.0 | 4 votes |
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()
Example #15
Source File: recovery.py From gridsync with GNU General Public License v3.0 | 4 votes |
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