This commit is contained in:
Florian Bruhin 2018-09-06 20:09:57 +02:00
parent 4ca8fc0cb7
commit 5ca911bcdb

View File

@ -23,13 +23,12 @@ import os
import time import time
import contextlib import contextlib
from PyQt5.QtCore import pyqtSlot, QUrl, QTimer, pyqtSignal from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal
from PyQt5.QtWidgets import QProgressDialog, QApplication from PyQt5.QtWidgets import QProgressDialog, QApplication
from qutebrowser.config import config from qutebrowser.config import config
from qutebrowser.commands import cmdutils, cmdexc from qutebrowser.commands import cmdutils, cmdexc
from qutebrowser.utils import (utils, objreg, log, usertypes, message, from qutebrowser.utils import utils, objreg, log, usertypes, message, qtutils
debug, standarddir, qtutils)
from qutebrowser.misc import objects, sql from qutebrowser.misc import objects, sql
@ -51,6 +50,7 @@ class HistoryProgress:
self._value = 0 self._value = 0
def start(self, text, maximum): def start(self, text, maximum):
"""Start showing a progress dialog."""
self._progress = QProgressDialog() self._progress = QProgressDialog()
self._progress.setMinimumDuration(500) self._progress.setMinimumDuration(500)
self._progress.setLabelText(text) self._progress.setLabelText(text)
@ -60,12 +60,14 @@ class HistoryProgress:
QApplication.processEvents() QApplication.processEvents()
def tick(self): def tick(self):
"""Increase the displayed progress value."""
self._value += 1 self._value += 1
if self._progress is not None: if self._progress is not None:
self._progress.setValue(self._value) self._progress.setValue(self._value)
QApplication.processEvents() QApplication.processEvents()
def finish(self): def finish(self):
"""Finish showing the progress dialog."""
if self._progress is not None: if self._progress is not None:
self._progress.hide() self._progress.hide()