From f764e2d3ffeb46d4c5a3d86b459a5040bad7b294 Mon Sep 17 00:00:00 2001 From: Martin Chase Date: Wed, 23 Jun 2021 19:34:55 -0700 Subject: [PATCH] progress dialog fix (#1861) --- pyqtgraph/widgets/ProgressDialog.py | 4 ++-- tests/widgets/test_progressdialog.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 tests/widgets/test_progressdialog.py diff --git a/pyqtgraph/widgets/ProgressDialog.py b/pyqtgraph/widgets/ProgressDialog.py index a4c9b58c..2af135d2 100644 --- a/pyqtgraph/widgets/ProgressDialog.py +++ b/pyqtgraph/widgets/ProgressDialog.py @@ -73,7 +73,7 @@ class ProgressDialog(QtGui.QProgressDialog): else: self.setMinimumDuration(wait) - self.setWindowModality(QtCore.Qt.WindowType.WindowModality.WindowModal) + self.setWindowModality(QtCore.Qt.WindowModality.WindowModal) self.setValue(self.minimum()) if noCancel: self.setCancelButton(None) @@ -206,7 +206,7 @@ class ProgressDialog(QtGui.QProgressDialog): # Qt docs say this should happen automatically, but that doesn't seem # to be the case. - if self.windowModality() == QtCore.Qt.WindowType.WindowModality.WindowModal: + if self.windowModality() == QtCore.Qt.WindowModality.WindowModal: now = ptime.time() if self._lastProcessEvents is None or (now - self._lastProcessEvents) > 0.2: QtGui.QApplication.processEvents() diff --git a/tests/widgets/test_progressdialog.py b/tests/widgets/test_progressdialog.py new file mode 100644 index 00000000..6e7dfb79 --- /dev/null +++ b/tests/widgets/test_progressdialog.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from pyqtgraph import mkQApp, ProgressDialog + +mkQApp() + + +def test_progress_dialog(): + with ProgressDialog("test", 0, 1) as dlg: + dlg += 1