Tue, 06 Oct 2020 17:56:16 +0200
Eliminated use of qApp in order to prepare for PyQt6 migration.
--- a/eric6/E5Gui/E5Action.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/E5Gui/E5Action.py Tue Oct 06 17:56:16 2020 +0200 @@ -12,7 +12,9 @@ from PyQt5.QtGui import QIcon, QKeySequence -from PyQt5.QtWidgets import QAction, QActionGroup, qApp +from PyQt5.QtWidgets import QAction, QActionGroup + +from E5Gui.E5Application import e5App class ArgumentsError(RuntimeError): @@ -181,7 +183,7 @@ """ shortcut = self.shortcut().toString(QKeySequence.NativeText) if shortcut: - if qApp.isLeftToRight(): + if e5App().isLeftToRight(): fmt = "{0} ({1})" else: fmt = "({1}) {0}"
--- a/eric6/E5Gui/E5ErrorMessage.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/E5Gui/E5ErrorMessage.py Tue Oct 06 17:56:16 2020 +0200 @@ -12,7 +12,9 @@ qInstallMessageHandler, QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QThread, QMetaObject, Qt, Q_ARG, QSettings ) -from PyQt5.QtWidgets import QErrorMessage, qApp, QDialog +from PyQt5.QtWidgets import QErrorMessage, QDialog + +from E5Gui.E5Application import e5App import Globals import Utilities @@ -144,7 +146,7 @@ else: msg = "<p><b>{0}</b></p><p>{1}</p>".format( messageType, Utilities.html_uencode(message)) - if QThread.currentThread() == qApp.thread(): + if QThread.currentThread() == e5App().thread(): _msgHandlerDialog.showMessage(msg) else: QMetaObject.invokeMethod(
--- a/eric6/SqlBrowser/SqlBrowser.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/SqlBrowser/SqlBrowser.py Tue Oct 06 17:56:16 2020 +0200 @@ -10,12 +10,12 @@ from PyQt5.QtCore import QTimer, QUrl from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import qApp from PyQt5.QtSql import QSqlError, QSqlDatabase from E5Gui.E5Action import E5Action from E5Gui import E5MessageBox from E5Gui.E5MainWindow import E5MainWindow +from E5Gui.E5Application import e5App import UI.PixmapCache import UI.Config @@ -126,7 +126,7 @@ """<b>Quit</b>""" """<p>Quit the SQL browser.</p>""" )) - self.exitAct.triggered.connect(qApp.closeAllWindows) + self.exitAct.triggered.connect(e5App().closeAllWindows) self.aboutAct = E5Action( self.tr('About'),
--- a/eric6/Tools/TRPreviewer.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/Tools/TRPreviewer.py Tue Oct 06 17:56:16 2020 +0200 @@ -17,13 +17,14 @@ from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import ( QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QMdiArea, - qApp, QApplication, QComboBox, QVBoxLayout, QAction, QLabel + QApplication, QComboBox, QVBoxLayout, QAction, QLabel ) from PyQt5 import uic from E5Gui import E5MessageBox, E5FileDialog from E5Gui.E5MainWindow import E5MainWindow +from E5Gui.E5Application import e5App import UI.PixmapCache import UI.Config @@ -203,7 +204,7 @@ """<b>Quit</b>""" """<p>Quit the application.</p>""" )) - self.exitAct.triggered.connect(qApp.closeAllWindows) + self.exitAct.triggered.connect(e5App().closeAllWindows) self.whatsThisAct = QAction( UI.PixmapCache.getIcon("whatsThis"),
--- a/eric6/Tools/TrayStarter.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/Tools/TrayStarter.py Tue Oct 06 17:56:16 2020 +0200 @@ -13,9 +13,10 @@ from PyQt5.QtCore import QProcess, QSettings, QFileInfo from PyQt5.QtGui import QCursor -from PyQt5.QtWidgets import QSystemTrayIcon, QMenu, qApp, QDialog, QApplication +from PyQt5.QtWidgets import QSystemTrayIcon, QMenu, QDialog, QApplication from E5Gui import E5MessageBox +from E5Gui.E5Application import e5App import Globals import UI.PixmapCache @@ -178,7 +179,7 @@ self.__menu.addAction( UI.PixmapCache.getIcon("exit"), - self.tr('Quit'), qApp.quit) + self.tr('Quit'), e5App().quit) def __loadRecentProjects(self): """
--- a/eric6/Tools/UIPreviewer.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/Tools/UIPreviewer.py Tue Oct 06 17:56:16 2020 +0200 @@ -12,7 +12,7 @@ from PyQt5.QtGui import QCursor, QKeySequence, QImageWriter, QPainter from PyQt5.QtWidgets import ( QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog, - QScrollArea, qApp, QApplication, QStyleFactory, QFrame, QMainWindow, + QScrollArea, QApplication, QStyleFactory, QFrame, QMainWindow, QComboBox, QVBoxLayout, QAction, QLabel ) from PyQt5.QtPrintSupport import QPrinter, QPrintDialog @@ -21,6 +21,7 @@ from E5Gui import E5MessageBox, E5FileDialog from E5Gui.E5MainWindow import E5MainWindow +from E5Gui.E5Application import e5App import Preferences import UI.PixmapCache @@ -184,7 +185,7 @@ """<b>Quit</b>""" """<p>Quit the application.</p>""" )) - self.exitAct.triggered.connect(qApp.closeAllWindows) + self.exitAct.triggered.connect(e5App().closeAllWindows) self.copyAct = QAction( UI.PixmapCache.getIcon("editCopy"), self.tr('&Copy'), self)
--- a/eric6/WebBrowser/Network/EricSchemeHandler.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/WebBrowser/Network/EricSchemeHandler.py Tue Oct 06 17:56:16 2020 +0200 @@ -10,9 +10,10 @@ from PyQt5.QtCore import ( pyqtSignal, QByteArray, QBuffer, QIODevice, QUrlQuery, QMutex, QMutexLocker ) -from PyQt5.QtWidgets import qApp from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler +from E5Gui.E5Application import e5App + from ..Tools.WebBrowserTools import ( getHtmlPage, getJavascript, pixmapFileToDataUrl ) @@ -191,7 +192,7 @@ page = page.replace("@ERIC_LINK@", self.tr("About eric6")) page = page.replace("@HEADER_TITLE@", self.tr("eric6 Web Browser")) page = page.replace("@SUBMIT@", self.tr("Search!")) - if qApp.isLeftToRight(): + if e5App().isLeftToRight(): ltr = "LTR" else: ltr = "RTL"
--- a/eric6/WebBrowser/Network/NetworkManager.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/WebBrowser/Network/NetworkManager.py Tue Oct 06 17:56:16 2020 +0200 @@ -11,12 +11,13 @@ import json from PyQt5.QtCore import pyqtSignal, QByteArray -from PyQt5.QtWidgets import qApp, QStyle, QDialog +from PyQt5.QtWidgets import QStyle, QDialog from PyQt5.QtNetwork import ( QNetworkAccessManager, QNetworkProxy, QNetworkProxyFactory, QNetworkRequest ) from E5Gui import E5MessageBox +from E5Gui.E5Application import e5App from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired try: @@ -327,10 +328,10 @@ """ html = getHtmlPage("authenticationErrorPage.html") html = html.replace("@IMAGE@", pixmapToDataUrl( - qApp.style().standardIcon(QStyle.SP_MessageBoxCritical).pixmap( + e5App().style().standardIcon(QStyle.SP_MessageBoxCritical).pixmap( 48, 48)).toString()) html = html.replace("@FAVICON@", pixmapToDataUrl( - qApp.style() .standardIcon(QStyle.SP_MessageBoxCritical).pixmap( + e5App().style() .standardIcon(QStyle.SP_MessageBoxCritical).pixmap( 16, 16)).toString()) html = html.replace("@TITLE@", self.tr("Authentication required")) html = html.replace("@H1@", self.tr("Authentication required"))
--- a/eric6/WebBrowser/WebBrowserView.py Tue Oct 06 17:55:10 2020 +0200 +++ b/eric6/WebBrowser/WebBrowserView.py Tue Oct 06 17:56:16 2020 +0200 @@ -18,12 +18,13 @@ from PyQt5.QtGui import ( QDesktopServices, QClipboard, QIcon, QContextMenuEvent, QPixmap, QCursor ) -from PyQt5.QtWidgets import qApp, QStyle, QMenu, QApplication, QDialog +from PyQt5.QtWidgets import QStyle, QMenu, QApplication, QDialog from PyQt5.QtWebEngineWidgets import ( QWebEngineView, QWebEnginePage, QWebEngineDownloadItem ) from E5Gui import E5MessageBox, E5FileDialog +from E5Gui.E5Application import e5App from WebBrowser.WebBrowserWindow import WebBrowserWindow from .WebBrowserPage import WebBrowserPage @@ -1773,10 +1774,10 @@ html = getHtmlPage("tabCrashPage.html") html = html.replace("@IMAGE@", pixmapToDataUrl( - qApp.style().standardIcon(QStyle.SP_MessageBoxWarning).pixmap( + e5App().style().standardIcon(QStyle.SP_MessageBoxWarning).pixmap( 48, 48)).toString()) html = html.replace("@FAVICON@", pixmapToDataUrl( - qApp.style() .standardIcon(QStyle.SP_MessageBoxWarning).pixmap( + e5App().style() .standardIcon(QStyle.SP_MessageBoxWarning).pixmap( 16, 16)).toString()) html = html.replace( "@TITLE@", self.tr("Render Process terminated abnormally"))