From 5897f1fe92a32f01a90aa198e8bd349e8a8af0ea Mon Sep 17 00:00:00 2001 From: Peter Zhang Date: Tue, 26 Dec 2017 10:44:36 +0800 Subject: [PATCH 1/2] Update coverage test to QCoreApplication --- conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conftest.py b/conftest.py index c1078d3..7ece003 100644 --- a/conftest.py +++ b/conftest.py @@ -38,5 +38,5 @@ @fixture(scope='session') def application(): - from quamash import QApplication - return QApplication([]) + from quamash import QCoreApplication + return QCoreApplication([]) From eb5ebdd5202bd702c939f333a07ef7b4a97bfcb5 Mon Sep 17 00:00:00 2001 From: Peter Zhang Date: Tue, 26 Dec 2017 10:45:45 +0800 Subject: [PATCH 2/2] Remove dependence on modules: QtWidgets, QtGui --- quamash/__init__.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/quamash/__init__.py b/quamash/__init__.py index e6b40d0..e777b8f 100644 --- a/quamash/__init__.py +++ b/quamash/__init__.py @@ -41,13 +41,7 @@ logger.info('Using Qt Implementation: {}'.format(QtModuleName)) QtCore = __import__(QtModuleName + '.QtCore', fromlist=(QtModuleName,)) -QtGui = __import__(QtModuleName + '.QtGui', fromlist=(QtModuleName,)) -if QtModuleName == 'PyQt5': - from PyQt5 import QtWidgets - QApplication = QtWidgets.QApplication -else: - QApplication = QtGui.QApplication - +QCoreApplication = QtCore.QCoreApplication from ._common import with_logger @@ -237,8 +231,8 @@ class _QEventLoop: """ def __init__(self, app=None): - self.__app = app or QApplication.instance() - assert self.__app is not None, 'No QApplication has been instantiated' + self.__app = app or QCoreApplication.instance() + assert self.__app is not None, 'No QCoreApplication has been instantiated' self.__is_running = False self.__debug_enabled = False self.__default_executor = None