Mon, 02 Sep 2019 18:50:38 +0200
Modified sources to be in line with the minimum Qt/PyQt requirement (v 5.9.0).
--- a/eric6.e4p Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6.e4p Mon Sep 02 18:50:38 2019 +0200 @@ -1431,7 +1431,6 @@ <Source>eric6/WebBrowser/TabManager/TabManagerWidget.py</Source> <Source>eric6/WebBrowser/TabManager/__init__.py</Source> <Source>eric6/WebBrowser/Tools/DelayedFileWatcher.py</Source> - <Source>eric6/WebBrowser/Tools/FilePrinter.py</Source> <Source>eric6/WebBrowser/Tools/PrintToPdfDialog.py</Source> <Source>eric6/WebBrowser/Tools/Scripts.py</Source> <Source>eric6/WebBrowser/Tools/WebBrowserTools.py</Source> @@ -2035,9 +2034,6 @@ <Other>eric6/APIs/MicroPython/circuitpython.api</Other> <Other>eric6/APIs/MicroPython/microbit.api</Other> <Other>eric6/APIs/MicroPython/micropython.api</Other> - <Other>eric6/APIs/Python/zope-2.10.7.api</Other> - <Other>eric6/APIs/Python/zope-2.11.2.api</Other> - <Other>eric6/APIs/Python/zope-3.3.1.api</Other> <Other>eric6/APIs/Python3/PyQt4.bas</Other> <Other>eric6/APIs/Python3/PyQt5.bas</Other> <Other>eric6/APIs/Python3/PyQtChart.bas</Other> @@ -2045,6 +2041,9 @@ <Other>eric6/APIs/Python3/QScintilla2.bas</Other> <Other>eric6/APIs/Python3/eric6.api</Other> <Other>eric6/APIs/Python3/eric6.bas</Other> + <Other>eric6/APIs/Python/zope-2.10.7.api</Other> + <Other>eric6/APIs/Python/zope-2.11.2.api</Other> + <Other>eric6/APIs/Python/zope-3.3.1.api</Other> <Other>eric6/APIs/QSS/qss.api</Other> <Other>eric6/APIs/Ruby/Ruby-1.8.7.api</Other> <Other>eric6/APIs/Ruby/Ruby-1.8.7.bas</Other>
--- a/eric6/Documentation/Source/eric6.WebBrowser.Tools.FilePrinter.html Sun Sep 01 19:58:00 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,587 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric6.WebBrowser.Tools.FilePrinter</title> -<meta charset="UTF-8"> -<style> -body { - background: #EDECE6; - margin: 0em 1em 10em 1em; - color: black; -} - -h1 { color: white; background: #85774A; } -h2 { color: white; background: #85774A; } -h3 { color: white; background: #9D936E; } -h4 { color: white; background: #9D936E; } - -a { color: #BA6D36; } - -</style> -</head> -<body><a NAME="top" ID="top"></a> -<h1>eric6.WebBrowser.Tools.FilePrinter</h1> -<p> -Module implementing an object for printing of files. -</p> -<h3>Global Attributes</h3> -<table> -<tr><td>_FilePrintJobs</td></tr> -</table> -<h3>Classes</h3> -<table> -<tr> -<td><a href="#FilePrinter">FilePrinter</a></td> -<td>Class implementing methods for printing on *nix systems.</td> -</tr> -</table> -<h3>Functions</h3> -<table> -<tr> -<td><a href="#isCupsAvailable">isCupsAvailable</a></td> -<td>Static method to test the availability of CUPS.</td> -</tr><tr> -<td><a href="#printFile">printFile</a></td> -<td>Static method to print a file.</td> -</tr> -</table> -<hr /><hr /> -<a NAME="FilePrinter" ID="FilePrinter"></a> -<h2>FilePrinter</h2> -<p> - Class implementing methods for printing on *nix systems. -</p> -<h3>Derived from</h3> -object -<h3>Class Attributes</h3> -<table> -<tr><td>ApplicationDeletesFiles</td></tr><tr><td>ApplicationSelectsPages</td></tr><tr><td>SystemDeletesFiles</td></tr><tr><td>SystemSelectsPages</td></tr> -</table> -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Methods</h3> -<table> -<tr> -<td><a href="#FilePrinter.__init__">FilePrinter</a></td> -<td>Constructor</td> -</tr><tr> -<td><a href="#FilePrinter.__doCleanup">__doCleanup</a></td> -<td>Private method to perform some internal cleanup actions.</td> -</tr><tr> -<td><a href="#FilePrinter.__processError">__processError</a></td> -<td>Private slot handling process errors.</td> -</tr><tr> -<td><a href="#FilePrinter.__processFinished">__processFinished</a></td> -<td>Private slot handling the end of the process.</td> -</tr><tr> -<td><a href="#FilePrinter._copies">_copies</a></td> -<td>Protected method to assemble the number of copies arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._cupsOptions">_cupsOptions</a></td> -<td>Protected method to assemble the CUPS specific arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._deleteFile">_deleteFile</a></td> -<td>Protected method to assemble the jobname arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._destination">_destination</a></td> -<td>Protected method to assemble the printer destination arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._doPrintFile">_doPrintFile</a></td> -<td>Protected method to print a file.</td> -</tr><tr> -<td><a href="#FilePrinter._jobname">_jobname</a></td> -<td>Protected method to assemble the jobname arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._mediaPageSize">_mediaPageSize</a></td> -<td>Protected method to get the page size argument.</td> -</tr><tr> -<td><a href="#FilePrinter._mediaPaperSource">_mediaPaperSource</a></td> -<td>Protected method to get the paper source argument.</td> -</tr><tr> -<td><a href="#FilePrinter._optionCollateCopies">_optionCollateCopies</a></td> -<td>Protected method to assemble the collate copies arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._optionCupsProperties">_optionCupsProperties</a></td> -<td>Protected method to assemble the CUPS properties arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._optionDoubleSidedPrinting">_optionDoubleSidedPrinting</a></td> -<td>Protected method to assemble the double sided printing arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._optionMedia">_optionMedia</a></td> -<td>Protected method to assemble the print media arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._optionPageOrder">_optionPageOrder</a></td> -<td>Protected method to assemble the page order arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._pages">_pages</a></td> -<td>Protected method to assemble the page range(s) arguments.</td> -</tr><tr> -<td><a href="#FilePrinter._printArguments">_printArguments</a></td> -<td>Protected method to assemble the command line arguments for the print command.</td> -</tr> -</table> -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<a NAME="FilePrinter.__init__" ID="FilePrinter.__init__"></a> -<h4>FilePrinter (Constructor)</h4> -<b>FilePrinter</b>(<i></i>) -<p> - Constructor -</p><a NAME="FilePrinter.__doCleanup" ID="FilePrinter.__doCleanup"></a> -<h4>FilePrinter.__doCleanup</h4> -<b>__doCleanup</b>(<i>deleteFile</i>) -<p> - Private method to perform some internal cleanup actions. -</p><dl> -<dt><i>deleteFile</i> (bool)</dt> -<dd> -flag indicating to delete the print file -</dd> -</dl><a NAME="FilePrinter.__processError" ID="FilePrinter.__processError"></a> -<h4>FilePrinter.__processError</h4> -<b>__processError</b>(<i>error</i>) -<p> - Private slot handling process errors. -</p><dl> -<dt><i>error</i> (QProcess.ProcessError)</dt> -<dd> -error value -</dd> -</dl><a NAME="FilePrinter.__processFinished" ID="FilePrinter.__processFinished"></a> -<h4>FilePrinter.__processFinished</h4> -<b>__processFinished</b>(<i>exitCode, exitStatus</i>) -<p> - Private slot handling the end of the process. -</p><dl> -<dt><i>exitCode</i> (int)</dt> -<dd> -exit code of the process -</dd><dt><i>exitStatus</i> (QProcess.ExitStatus)</dt> -<dd> -exit status of the process -</dd> -</dl><a NAME="FilePrinter._copies" ID="FilePrinter._copies"></a> -<h4>FilePrinter._copies</h4> -<b>_copies</b>(<i>printer, variant</i>) -<p> - Protected method to assemble the number of copies arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>variant</i> (str)</dt> -<dd> -string identifying the print command variant -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled number of copies arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._cupsOptions" ID="FilePrinter._cupsOptions"></a> -<h4>FilePrinter._cupsOptions</h4> -<b>_cupsOptions</b>(<i>printer</i>) -<p> - Protected method to assemble the CUPS specific arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled CUPS arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._deleteFile" ID="FilePrinter._deleteFile"></a> -<h4>FilePrinter._deleteFile</h4> -<b>_deleteFile</b>(<i>printer, fileDeletePolicy, variant</i>) -<p> - Protected method to assemble the jobname arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who deletes the file to be - printed (application or system) -</dd><dt><i>variant</i> (str)</dt> -<dd> -string identifying the print command variant -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled jobname arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._destination" ID="FilePrinter._destination"></a> -<h4>FilePrinter._destination</h4> -<b>_destination</b>(<i>printer, variant</i>) -<p> - Protected method to assemble the printer destination arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>variant</i> (str)</dt> -<dd> -string identifying the print command variant -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled printer destination arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._doPrintFile" ID="FilePrinter._doPrintFile"></a> -<h4>FilePrinter._doPrintFile</h4> -<b>_doPrintFile</b>(<i>printer, fileName, fileDeletePolicy, pageSelectPolicy, pageRange</i>) -<p> - Protected method to print a file. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>fileName</i> (str)</dt> -<dd> -name (path) of the file to be printed -</dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who deletes the file to be - printed (application or system) -</dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who selects the pages to be - printed (application or system) -</dd><dt><i>pageRange</i> (str)</dt> -<dd> -string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating successful print job submission -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl><a NAME="FilePrinter._jobname" ID="FilePrinter._jobname"></a> -<h4>FilePrinter._jobname</h4> -<b>_jobname</b>(<i>printer, variant</i>) -<p> - Protected method to assemble the jobname arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>variant</i> (str)</dt> -<dd> -string identifying the print command variant -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled jobname arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._mediaPageSize" ID="FilePrinter._mediaPageSize"></a> -<h4>FilePrinter._mediaPageSize</h4> -<b>_mediaPageSize</b>(<i>printer</i>) -<p> - Protected method to get the page size argument. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -page size argument -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl><a NAME="FilePrinter._mediaPaperSource" ID="FilePrinter._mediaPaperSource"></a> -<h4>FilePrinter._mediaPaperSource</h4> -<b>_mediaPaperSource</b>(<i>printer</i>) -<p> - Protected method to get the paper source argument. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -paper source argument -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl><a NAME="FilePrinter._optionCollateCopies" ID="FilePrinter._optionCollateCopies"></a> -<h4>FilePrinter._optionCollateCopies</h4> -<b>_optionCollateCopies</b>(<i>printer</i>) -<p> - Protected method to assemble the collate copies arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled collate copies arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._optionCupsProperties" ID="FilePrinter._optionCupsProperties"></a> -<h4>FilePrinter._optionCupsProperties</h4> -<b>_optionCupsProperties</b>(<i>printer</i>) -<p> - Protected method to assemble the CUPS properties arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled CUPS properties arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._optionDoubleSidedPrinting" ID="FilePrinter._optionDoubleSidedPrinting"></a> -<h4>FilePrinter._optionDoubleSidedPrinting</h4> -<b>_optionDoubleSidedPrinting</b>(<i>printer</i>) -<p> - Protected method to assemble the double sided printing arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled double sided printing arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._optionMedia" ID="FilePrinter._optionMedia"></a> -<h4>FilePrinter._optionMedia</h4> -<b>_optionMedia</b>(<i>printer</i>) -<p> - Protected method to assemble the print media arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled print media arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._optionPageOrder" ID="FilePrinter._optionPageOrder"></a> -<h4>FilePrinter._optionPageOrder</h4> -<b>_optionPageOrder</b>(<i>printer</i>) -<p> - Protected method to assemble the page order arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled page order arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._pages" ID="FilePrinter._pages"></a> -<h4>FilePrinter._pages</h4> -<b>_pages</b>(<i>printer, pageSelectPolicy, pageRange, useCupsOptions, variant</i>) -<p> - Protected method to assemble the page range(s) arguments. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who selects the pages to be - printed (application or system) -</dd><dt><i>pageRange</i> (str)</dt> -<dd> -string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog -</dd><dt><i>useCupsOptions</i> (bool)</dt> -<dd> -flag indicating to assemble the arguments for - CUPS -</dd><dt><i>variant</i> (str)</dt> -<dd> -string identifying the print command variant -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled page range(s) arguments -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl><a NAME="FilePrinter._printArguments" ID="FilePrinter._printArguments"></a> -<h4>FilePrinter._printArguments</h4> -<b>_printArguments</b>(<i>printer, fileDeletePolicy, pageSelectPolicy, useCupsOptions, pageRange, variant</i>) -<p> - Protected method to assemble the command line arguments for the print - command. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who deletes the file to be - printed (application or system) -</dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who selects the pages to be - printed (application or system) -</dd><dt><i>useCupsOptions</i> (bool)</dt> -<dd> -flag indicating to assemble the arguments for - CUPS -</dd><dt><i>pageRange</i> (str)</dt> -<dd> -string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog -</dd><dt><i>variant</i> (str)</dt> -<dd> -string identifying the print command variant -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -assembled command line arguments for the print command -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="isCupsAvailable" ID="isCupsAvailable"></a> -<h2>isCupsAvailable</h2> -<b>isCupsAvailable</b>(<i></i>) -<p> - Static method to test the availability of CUPS. -</p><dl> -<dt>Returns:</dt> -<dd> -flag indicating the availability of CUPS -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="printFile" ID="printFile"></a> -<h2>printFile</h2> -<b>printFile</b>(<i>printer, fileName, fileDeletePolicy=FilePrinter.ApplicationDeletesFiles, pageSelectPolicy=FilePrinter.ApplicationSelectsPages, pageRange=""</i>) -<p> - Static method to print a file. -</p><p> - Note: Only CUPS and LPR on *nix systems is supported. -</p><dl> -<dt><i>printer</i> (QPrinter)</dt> -<dd> -reference to the printer to print to -</dd><dt><i>fileName</i> (str)</dt> -<dd> -name (path) of the file to be printed -</dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who deletes the file to be - printed (application or system) -</dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt> -<dd> -policy determining who selects the pages to be - printed (application or system) -</dd><dt><i>pageRange</i> (str)</dt> -<dd> -string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html> \ No newline at end of file
--- a/eric6/E5Gui/E5FileDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/E5Gui/E5FileDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -10,7 +10,6 @@ from __future__ import unicode_literals -from PyQt5.QtCore import PYQT_VERSION_STR from PyQt5.QtWidgets import QFileDialog import Globals @@ -62,12 +61,8 @@ options = QFileDialog.Options() if Globals.isLinuxPlatform(): options |= QFileDialog.DontUseNativeDialog - if PYQT_VERSION_STR >= "5.0.0": - return QFileDialog.getOpenFileName( - parent, caption, directory, filterStr, "", options)[0] - else: - return QFileDialog.getOpenFileName( - parent, caption, directory, filterStr, options) + return QFileDialog.getOpenFileName( + parent, caption, directory, filterStr, "", options)[0] def getOpenFileNameAndFilter(parent=None, caption="", directory="", @@ -90,12 +85,8 @@ if Globals.isLinuxPlatform(): options |= QFileDialog.DontUseNativeDialog newfilter = __reorderFilter(filterStr, initialFilter) - if PYQT_VERSION_STR >= "5.0.0": - return QFileDialog.getOpenFileName( - parent, caption, directory, newfilter, initialFilter, options) - else: - return QFileDialog.getOpenFileNameAndFilter( - parent, caption, directory, newfilter, initialFilter, options) + return QFileDialog.getOpenFileName( + parent, caption, directory, newfilter, initialFilter, options) def getOpenFileNames(parent=None, caption="", directory="", @@ -114,12 +105,8 @@ options = QFileDialog.Options() if Globals.isLinuxPlatform(): options |= QFileDialog.DontUseNativeDialog - if PYQT_VERSION_STR >= "5.0.0": - return QFileDialog.getOpenFileNames( - parent, caption, directory, filterStr, "", options)[0] - else: - return QFileDialog.getOpenFileNames( - parent, caption, directory, filterStr, options) + return QFileDialog.getOpenFileNames( + parent, caption, directory, filterStr, "", options)[0] def getOpenFileNamesAndFilter(parent=None, caption="", directory="", @@ -143,12 +130,8 @@ if Globals.isLinuxPlatform(): options |= QFileDialog.DontUseNativeDialog newfilter = __reorderFilter(filterStr, initialFilter) - if PYQT_VERSION_STR >= "5.0.0": - return QFileDialog.getOpenFileNames( - parent, caption, directory, newfilter, initialFilter, options) - else: - return QFileDialog.getOpenFileNamesAndFilter( - parent, caption, directory, newfilter, initialFilter, options) + return QFileDialog.getOpenFileNames( + parent, caption, directory, newfilter, initialFilter, options) def getSaveFileName(parent=None, caption="", directory="", @@ -167,12 +150,8 @@ options = QFileDialog.Options() if Globals.isLinuxPlatform(): options |= QFileDialog.DontUseNativeDialog - if PYQT_VERSION_STR >= "5.0.0": - return QFileDialog.getSaveFileName( - parent, caption, directory, filterStr, "", options)[0] - else: - return QFileDialog.getSaveFileName( - parent, caption, directory, filterStr, options) + return QFileDialog.getSaveFileName( + parent, caption, directory, filterStr, "", options)[0] def getSaveFileNameAndFilter(parent=None, caption="", directory="", @@ -195,12 +174,8 @@ if Globals.isLinuxPlatform(): options |= QFileDialog.DontUseNativeDialog newfilter = __reorderFilter(filterStr, initialFilter) - if PYQT_VERSION_STR >= "5.0.0": - return QFileDialog.getSaveFileName( - parent, caption, directory, newfilter, initialFilter, options) - else: - return QFileDialog.getSaveFileNameAndFilter( - parent, caption, directory, newfilter, initialFilter, options) + return QFileDialog.getSaveFileName( + parent, caption, directory, newfilter, initialFilter, options) def getExistingDirectory(parent=None, caption="",
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/IbmWatsonEngine.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/IbmWatsonEngine.py Mon Sep 02 18:50:38 2019 +0200 @@ -19,8 +19,6 @@ from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired -from Globals import qVersionTuple - from .TranslationEngine import TranslationEngine @@ -209,9 +207,7 @@ ] request = QNetworkRequest(url) - if qVersionTuple() >= (5, 6, 0): - request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, - True) + request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) if extraHeaders: for name, value in extraHeaders: request.setRawHeader(name, value)
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorRequest.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorRequest.py Mon Sep 02 18:50:38 2019 +0200 @@ -16,8 +16,6 @@ from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired -from Globals import qVersionTuple - class TranslatorRequest(QObject): """ @@ -54,9 +52,7 @@ @return server response (QByteArray) or error message (string) """ request = QNetworkRequest(requestUrl) - if qVersionTuple() >= (5, 6, 0): - request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, - True) + request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) if extraHeaders: for name, value in extraHeaders: request.setRawHeader(name, value) @@ -88,9 +84,7 @@ self.__contentTypes[dataType]) request.setRawHeader(b"Content-Length", QByteArray.number(requestData.size())) - if qVersionTuple() >= (5, 6, 0): - request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, - True) + request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) if extraHeaders: for name, value in extraHeaders: request.setRawHeader(name, value)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -17,12 +17,12 @@ from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QIcon, \ QTextCursor from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ - QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip + QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog -from Globals import qVersionTuple, strToQByteArray +from Globals import strToQByteArray from .Ui_GitLogBrowserDialog import Ui_GitLogBrowserDialog @@ -301,10 +301,7 @@ """ self.__actionsMenu = QMenu() self.__actionsMenu.setTearOffEnabled(True) - if qVersionTuple() >= (5, 1, 0): - self.__actionsMenu.setToolTipsVisible(True) - else: - self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) + self.__actionsMenu.setToolTipsVisible(True) self.__cherryAct = self.__actionsMenu.addAction( self.tr("Copy Commits"), self.__cherryActTriggered) @@ -347,17 +344,6 @@ UI.PixmapCache.getIcon("actionsToolButton.png")) self.actionsButton.setMenu(self.__actionsMenu) - def __actionsMenuHovered(self, action): - """ - Private slot to show the tooltip for an action menu entry. - - @param action action to show tooltip for - @type QAction - """ - QToolTip.showText( - QCursor.pos(), action.toolTip(), - self.__actionsMenu, self.__actionsMenu.actionGeometry(action)) - def __initData(self): """ Private method to (re-)initialize some data.
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -14,14 +14,14 @@ import tempfile from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize -from PyQt5.QtGui import QTextCursor, QCursor +from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \ - QTreeWidgetItem, QLineEdit, QInputDialog, QToolTip + QTreeWidgetItem, QLineEdit, QInputDialog from E5Gui.E5Application import e5App from E5Gui import E5MessageBox -from Globals import qVersionTuple, strToQByteArray +from Globals import strToQByteArray from .Ui_GitStatusDialog import Ui_GitStatusDialog @@ -182,10 +182,7 @@ """ self.__actionsMenu = QMenu() self.__actionsMenu.setTearOffEnabled(True) - if qVersionTuple() >= (5, 1, 0): - self.__actionsMenu.setToolTipsVisible(True) - else: - self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) + self.__actionsMenu.setToolTipsVisible(True) self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu) self.__commitAct = self.__actionsMenu.addAction( @@ -262,17 +259,6 @@ UI.PixmapCache.getIcon("actionsToolButton.png")) self.actionsButton.setMenu(self.__actionsMenu) - def __actionsMenuHovered(self, action): - """ - Private slot to show the tooltip for an action menu entry. - - @param action action to show tooltip for - @type QAction - """ - QToolTip.showText( - QCursor.pos(), action.toolTip(), - self.__actionsMenu, self.__actionsMenu.actionGeometry(action)) - def closeEvent(self, e): """ Protected slot implementing a close event handler.
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -18,7 +18,7 @@ from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \ QIcon, QTextCursor from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ - QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip + QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -31,7 +31,7 @@ import UI.PixmapCache import Preferences import Utilities -from Globals import qVersionTuple, strToQByteArray +from Globals import strToQByteArray COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", "cyan", "olive", "magenta", "darkred", "darkmagenta", @@ -258,10 +258,7 @@ """ self.__actionsMenu = QMenu() self.__actionsMenu.setTearOffEnabled(True) - if qVersionTuple() >= (5, 1, 0): - self.__actionsMenu.setToolTipsVisible(True) - else: - self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) + self.__actionsMenu.setToolTipsVisible(True) self.__graftAct = self.__actionsMenu.addAction( UI.PixmapCache.getIcon("vcsGraft.png"), @@ -398,17 +395,6 @@ UI.PixmapCache.getIcon("actionsToolButton.png")) self.actionsButton.setMenu(self.__actionsMenu) - def __actionsMenuHovered(self, action): - """ - Private slot to show the tooltip for an action menu entry. - - @param action action to show tooltip for - @type QAction - """ - QToolTip.showText( - QCursor.pos(), action.toolTip(), - self.__actionsMenu, self.__actionsMenu.actionGeometry(action)) - def __initData(self): """ Private method to (re-)initialize some data.
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -13,9 +13,9 @@ import os from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize -from PyQt5.QtGui import QTextCursor, QCursor +from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \ - QTreeWidgetItem, QLineEdit, QToolTip + QTreeWidgetItem, QLineEdit from E5Gui.E5Application import e5App from E5Gui import E5MessageBox @@ -27,7 +27,7 @@ import Preferences import UI.PixmapCache -from Globals import qVersionTuple, strToQByteArray +from Globals import strToQByteArray class HgStatusDialog(QWidget, Ui_HgStatusDialog): @@ -126,10 +126,7 @@ """ self.__actionsMenu = QMenu() self.__actionsMenu.setTearOffEnabled(True) - if qVersionTuple() >= (5, 1, 0): - self.__actionsMenu.setToolTipsVisible(True) - else: - self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) + self.__actionsMenu.setToolTipsVisible(True) self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu) self.__commitAct = self.__actionsMenu.addAction( @@ -208,17 +205,6 @@ self.actionsButton.setIcon( UI.PixmapCache.getIcon("actionsToolButton.png")) self.actionsButton.setMenu(self.__actionsMenu) - - def __actionsMenuHovered(self, action): - """ - Private slot to show the tooltip for an action menu entry. - - @param action action to show tooltip for - @type QAction - """ - QToolTip.showText( - QCursor.pos(), action.toolTip(), - self.__actionsMenu, self.__actionsMenu.actionGeometry(action)) def closeEvent(self, e): """
--- a/eric6/Preferences/ConfigurationDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Preferences/ConfigurationDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -12,8 +12,7 @@ import os import types -from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QMetaObject, \ - QRect +from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QMetaObject, QRect from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QTreeWidget, \ QStackedWidget, QDialog, QSplitter, QScrollArea, QApplication, \ @@ -24,7 +23,7 @@ from E5Gui import E5MessageBox from E5Gui.E5MainWindow import E5MainWindow -from Globals import isMacPlatform, qVersionTuple, getWebBrowserSupport +from Globals import isMacPlatform, getWebBrowserSupport import Preferences @@ -366,15 +365,12 @@ "webBrowserVirusTotalPage": [self.tr("VirusTotal Interface"), "virustotal.png", "WebBrowserVirusTotalPage", "0webBrowserPage", None], + "webBrowserSpellCheckingPage": + [self.tr("Spell checking"), + "preferences-spellchecking.png", + "WebBrowserSpellCheckingPage", "0webBrowserPage", + None], }) - if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: - self.configItems.update({ - "webBrowserSpellCheckingPage": - [self.tr("Spell checking"), - "preferences-spellchecking.png", - "WebBrowserSpellCheckingPage", "0webBrowserPage", - None], - }) self.configItems.update( e5App().getObject("PluginManager").getPluginConfigData()) @@ -419,15 +415,12 @@ "webBrowserVirusTotalPage": [self.tr("VirusTotal Interface"), "virustotal.png", "WebBrowserVirusTotalPage", None, None], + + "webBrowserSpellCheckingPage": + [self.tr("Spell checking"), + "preferences-spellchecking.png", + "WebBrowserSpellCheckingPage", None, None], } - - if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: - self.configItems.update({ - "webBrowserSpellCheckingPage": - [self.tr("Spell checking"), - "preferences-spellchecking.png", - "WebBrowserSpellCheckingPage", None, None], - }) elif displayMode == ConfigurationWidget.TrayStarterMode: self.configItems = {
--- a/eric6/Project/ProjectFormsBrowser.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Project/ProjectFormsBrowser.py Mon Sep 02 18:50:38 2019 +0200 @@ -13,7 +13,7 @@ import sys import shutil -from PyQt5.QtCore import PYQT_VERSION, QThread, QFileInfo, pyqtSignal, QProcess +from PyQt5.QtCore import QThread, QFileInfo, pyqtSignal, QProcess from PyQt5.QtWidgets import QDialog, QInputDialog, QApplication, QMenu from E5Gui.E5Application import e5App @@ -675,12 +675,8 @@ self.__uicompiler = Utilities.generatePyQtToolPath( 'pyuic5', ["py3uic5"]) elif self.project.getProjectType() in ["E6Plugin"]: - if PYQT_VERSION < 0x050000: - self.__uicompiler = Utilities.generatePyQtToolPath( - 'pyuic4', ["py3uic4"]) - else: - self.__uicompiler = Utilities.generatePyQtToolPath( - 'pyuic5', ["py3uic5"]) + self.__uicompiler = Utilities.generatePyQtToolPath( + 'pyuic5', ["py3uic5"]) elif self.project.getProjectType() == "PySide": self.__uicompiler = \ Utilities.generatePySideToolPath('pyside-uic', "1") @@ -837,9 +833,7 @@ else: # PyQt4 and PyQt5 if 'uic5' in uicompiler and \ - PYQT_VERSION >= 0x050600 and \ self.project.pdata["UICPARAMS"]["Package"]: - # only supported for PyQt5 >= 5.6 (April 2016) args.append("--import-from={0}".format( self.project.pdata["UICPARAMS"]["Package"])) elif Preferences.getQt("PyuicFromImports"):
--- a/eric6/Project/ProjectResourcesBrowser.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Project/ProjectResourcesBrowser.py Mon Sep 02 18:50:38 2019 +0200 @@ -11,7 +11,7 @@ import os -from PyQt5.QtCore import QThread, QFileInfo, pyqtSignal, PYQT_VERSION, QProcess +from PyQt5.QtCore import QThread, QFileInfo, pyqtSignal, QProcess from PyQt5.QtWidgets import QDialog, QApplication, QMenu from E5Gui.E5Application import e5App @@ -647,24 +647,15 @@ ["Python", "Python2", "Python3"]: if self.project.getProjectType() in ["Qt4", "Qt4C"]: self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc4') - if PYQT_VERSION >= 0x040500: - if self.project.getProjectLanguage() in \ - ["Python", "Python2"]: - args.append("-py2") - else: - args.append("-py3") + if self.project.getProjectLanguage() in \ + ["Python", "Python2"]: + args.append("-py2") + else: + args.append("-py3") elif self.project.getProjectType() in ["PyQt5", "PyQt5C"]: self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') elif self.project.getProjectType() in ["E6Plugin"]: - if PYQT_VERSION < 0x050000: - self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc4') - if self.project.getProjectLanguage() in \ - ["Python", "Python2"]: - args.append("-py2") - else: - args.append("-py3") - else: - self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') + self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') elif self.project.getProjectType() in ["PySide", "PySideC"]: self.rccCompiler = Utilities.generatePySideToolPath( 'pyside-rcc', "1")
--- a/eric6/Project/ProjectTranslationsBrowser.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Project/ProjectTranslationsBrowser.py Mon Sep 02 18:50:38 2019 +0200 @@ -14,7 +14,7 @@ import shutil import fnmatch -from PyQt5.QtCore import PYQT_VERSION, pyqtSignal, QProcess +from PyQt5.QtCore import pyqtSignal, QProcess from PyQt5.QtWidgets import QDialog, QMenu from E5Gui import E5MessageBox @@ -1018,10 +1018,7 @@ elif self.project.getProjectType() in ["PyQt5", "PyQt5C"]: self.pylupdate = Utilities.generatePyQtToolPath('pylupdate5') elif self.project.getProjectType() in ["E6Plugin"]: - if PYQT_VERSION < 0x050000: - self.pylupdate = Utilities.generatePyQtToolPath('pylupdate4') - else: - self.pylupdate = Utilities.generatePyQtToolPath('pylupdate5') + self.pylupdate = Utilities.generatePyQtToolPath('pylupdate5') elif self.project.getProjectType() in ["PySide", "PySideC"]: self.pylupdate = Utilities.generatePySideToolPath( 'pyside-lupdate', "1")
--- a/eric6/Project/UicCompilerOptionsDialog.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Project/UicCompilerOptionsDialog.py Mon Sep 02 18:50:38 2019 +0200 @@ -9,7 +9,6 @@ from __future__ import unicode_literals -from PyQt5.QtCore import PYQT_VERSION from PyQt5.QtWidgets import QDialog from .Ui_UicCompilerOptionsDialog import Ui_UicCompilerOptionsDialog @@ -37,8 +36,7 @@ self.packageRootEdit.setText(compilerOptions["PackagesRoot"]) self.suffixEdit.setText(compilerOptions["RcSuffix"]) - if 'uic5' not in compiler or PYQT_VERSION < 0x050600: - # only supported for PyQt5 >= 5.6 (April 2016) + if 'uic5' not in compiler: self.packageGroup.setEnabled(False) msh = self.minimumSizeHint()
--- a/eric6/QScintilla/KeySequenceTranslator.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/QScintilla/KeySequenceTranslator.py Mon Sep 02 18:50:38 2019 +0200 @@ -13,8 +13,6 @@ from PyQt5.QtGui import QKeySequence from PyQt5.Qsci import QsciScintilla -from Globals import qVersionTuple - __all__ = ["s2qTranslate"] Scintilla2QKeySequence = { @@ -108,13 +106,9 @@ QsciScintilla.SCI_MOVESELECTEDLINESDOWN: QKeySequence.UnknownKey, QsciScintilla.SCI_LOWERCASE: QKeySequence.UnknownKey, QsciScintilla.SCI_UPPERCASE: QKeySequence.UnknownKey, + QsciScintilla.SCI_LINEDELETE: QKeySequence.DeleteCompleteLine, + QsciScintilla.SCI_DELETEBACK: QKeySequence.Backspace, } -if qVersionTuple() >= (5, 2, 0): - Scintilla2QKeySequence[QsciScintilla.SCI_LINEDELETE] = \ - QKeySequence.DeleteCompleteLine, -if qVersionTuple() >= (5, 5, 0): - Scintilla2QKeySequence[QsciScintilla.SCI_DELETEBACK] = \ - QKeySequence.Backspace def s2qTranslate(scintillaCommand):
--- a/eric6/Snapshot/SnapWidget.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Snapshot/SnapWidget.py Mon Sep 02 18:50:38 2019 +0200 @@ -16,7 +16,7 @@ import os from PyQt5.QtCore import pyqtSlot, QFile, QFileInfo, QTimer, QPoint, \ - QMimeData, Qt, QRegExp, QLocale, PYQT_VERSION_STR + QMimeData, Qt, QRegExp, QLocale, QStandardPaths from PyQt5.QtGui import QImageWriter, QPixmap, QDrag, QKeySequence from PyQt5.QtWidgets import QWidget, QApplication, QShortcut @@ -94,14 +94,8 @@ delay = int(Preferences.Prefs.settings.value("Snapshot/Delay", 0)) self.delaySpin.setValue(delay) - if PYQT_VERSION_STR >= "5.0.0": - from PyQt5.QtCore import QStandardPaths - picturesLocation = QStandardPaths.writableLocation( - QStandardPaths.PicturesLocation) - else: - from PyQt5.QtGui import QDesktopServices - picturesLocation = QDesktopServices.storageLocation( - QDesktopServices.PicturesLocation) + picturesLocation = QStandardPaths.writableLocation( + QStandardPaths.PicturesLocation) self.__filename = Preferences.Prefs.settings.value( "Snapshot/Filename", os.path.join(picturesLocation,
--- a/eric6/UI/LogView.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/UI/LogView.py Mon Sep 02 18:50:38 2019 +0200 @@ -16,8 +16,6 @@ from E5Gui.E5Application import e5App -from Globals import qVersionTuple - import UI.PixmapCache import Preferences import Utilities @@ -42,8 +40,9 @@ self.__logViewer = LogViewerEdit(self) from .SearchWidget import SearchWidget + # TODO: get rid of 'hideRegExp' self.__searchWidget = SearchWidget( - self.__logViewer, self, hideRegExp=qVersionTuple() < (5, 3, 0)) + self.__logViewer, self, hideRegExp=False) self.__searchWidget.setSizePolicy( QSizePolicy.Fixed, QSizePolicy.Preferred) self.__searchWidget.hide()
--- a/eric6/Utilities/__init__.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/Utilities/__init__.py Mon Sep 02 18:50:38 2019 +0200 @@ -1913,14 +1913,13 @@ qVersion(), linesep, PYQT_VERSION_STR, linesep) info += " sip {0}{1} QScintilla {2}{3}".format( sip_version_str, linesep, QSCINTILLA_VERSION_STR, linesep) - if qVersionTuple() >= (5, 6, 0): - try: - from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ - from WebBrowser.Tools import WebBrowserTools - chromeVersion = WebBrowserTools.getWebEngineVersions()[0] - info += " WebEngine {0}{1}".format(chromeVersion, linesep) - except ImportError: - pass + try: + from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ + from WebBrowser.Tools import WebBrowserTools + chromeVersion = WebBrowserTools.getWebEngineVersions()[0] + info += " WebEngine {0}{1}".format(chromeVersion, linesep) + except ImportError: + pass info += " {0} {1}{2}".format( Program, Version, linesep * 2) info += "Platform: {0}{1}{2}{3}".format(
--- a/eric6/WebBrowser/AdBlock/AdBlockRule.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockRule.py Mon Sep 02 18:50:38 2019 +0200 @@ -13,11 +13,9 @@ from enum import IntEnum -from PyQt5.QtCore import PYQT_VERSION, Qt, QRegExp +from PyQt5.QtCore import Qt, QRegExp from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo -from Globals import qVersionTuple - def toSecondLevelDomain(url): """ @@ -655,11 +653,12 @@ """ match = ( req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypeSubResource) - if qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700: - match = match or ( - req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypePluginResource) + QWebEngineUrlRequestInfo.ResourceTypeSubResource + ) + match = match or ( + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceTypePluginResource + ) if self.__objectSubrequestException: return not match
--- a/eric6/WebBrowser/Download/DownloadItem.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/Download/DownloadItem.py Mon Sep 02 18:50:38 2019 +0200 @@ -11,7 +11,7 @@ import os -from PyQt5.QtCore import pyqtSlot, pyqtSignal, PYQT_VERSION, Qt, QTime, QUrl, \ +from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QTime, QUrl, \ QStandardPaths, QFileInfo, QDateTime from PyQt5.QtGui import QPalette, QDesktopServices from PyQt5.QtWidgets import QWidget, QStyle, QDialog @@ -26,8 +26,6 @@ import UI.PixmapCache import Utilities.MimeTypes -import Globals -from Globals import qVersionTuple class DownloadItem(QWidget, Ui_DownloadItem): @@ -143,15 +141,8 @@ if self.__gettingFileName: return - if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: - savePage = self.__downloadItem.type() == \ - QWebEngineDownloadItem.SavePage - elif qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700: - savePage = self.__downloadItem.savePageFormat() != \ - QWebEngineDownloadItem.UnknownSaveFormat - else: - savePage = self.__downloadItem.path().lower().endswith( - (".mhtml", ".mht")) + savePage = self.__downloadItem.type() == \ + QWebEngineDownloadItem.SavePage documentLocation = QStandardPaths.writableLocation( QStandardPaths.DocumentsLocation) @@ -218,50 +209,6 @@ defaultFileName, "") self.__gettingFileName = False - else: - # save page file name and format selection for Qt < 5.8.0 - self.__autoOpen = False - - filterList = [ - self.tr("Web Archive (*.mhtml *.mht)"), - self.tr("HTML File (*.html *.htm)"), - self.tr("HTML File with all resources (*.html *.htm)"), - ] - extensionsList = [ - # tuple of extensions for *nix and Windows - # keep in sync with filters list - (".mhtml", ".mht"), - (".html", ".htm"), - (".html", ".htm"), - ] - self.__gettingFileName = True - fileName, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( - None, - self.tr("Save Web Page"), - defaultFileName, - ";;".join(filterList), - None) - self.__gettingFileName = False - if fileName: - index = filterList.index(selectedFilter) - if index == 0: - self.__downloadItem.setSavePageFormat( - QWebEngineDownloadItem.MimeHtmlSaveFormat) - elif index == 1: - self.__downloadItem.setSavePageFormat( - QWebEngineDownloadItem.SingleHtmlSaveFormat) - else: - self.__downloadItem.setSavePageFormat( - QWebEngineDownloadItem.CompleteHtmlSaveFormat) - extension = os.path.splitext(fileName)[1] - if not extension: - # add the platform specific default extension - if Globals.isWindowsPlatform(): - extensionsIndex = 1 - else: - extensionsIndex = 0 - extensions = extensionsList[index] - fileName += extensions[extensionsIndex] if not fileName: self.progressBar.setVisible(False)
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Mon Sep 02 18:50:38 2019 +0200 @@ -22,8 +22,6 @@ from ..WebBrowserPage import WebBrowserPage from ..WebBrowserWindow import WebBrowserWindow -from Globals import qVersionTuple - class GreaseMonkeyScript(QObject): """ @@ -362,38 +360,10 @@ QByteArray(self.fullName().encode("utf-8")), QCryptographicHash.Md4).toHex()).decode("ascii") valuesScript = values_js.format(nspace) - if qVersionTuple() < (5, 8, 0): - runCheck = """ - for (var value of {0}) {{ - var re = new RegExp(value); - if (re.test(window.location.href)) {{ - return; - }} - }} - __eric_includes = false; - for (var value of {1}) {{ - var re = new RegExp(value); - if (re.test(window.location.href)) {{ - __eric_includes = true; - break; - }} - }} - if (!__eric_includes) {{ - return; - }} - delete __eric_includes;""".format( - self.__toJavaScriptList(self.__exclude[:]), - self.__toJavaScriptList(self.__include[:]) - ) - self.__script = "(function(){{{0}\n{1}\n{2}\n{3}\n}})();".format( - runCheck, valuesScript, - self.__manager.requireScripts(self.__require), fileData - ) - else: - self.__script = "(function(){{{0}\n{1}\n{2}\n}})();".format( - valuesScript, self.__manager.requireScripts(self.__require), - fileData - ) + self.__script = "(function(){{{0}\n{1}\n{2}\n}})();".format( + valuesScript, self.__manager.requireScripts(self.__require), + fileData + ) self.__valid = True self.__downloadIcon() @@ -407,27 +377,16 @@ @rtype QWebEngineScript @exception ValueError raised to indicate an unsupported start point """ - if qVersionTuple() < (5, 8, 0): - if self.startAt() == GreaseMonkeyScript.DocumentStart: - injectionPoint = QWebEngineScript.DocumentCreation - elif self.startAt() == GreaseMonkeyScript.DocumentEnd: - injectionPoint = QWebEngineScript.DocumentReady - elif self.startAt() == GreaseMonkeyScript.DocumentIdle: - injectionPoint = QWebEngineScript.Deferred - else: - raise ValueError("Wrong script start point.") - script = QWebEngineScript() script.setSourceCode("{0}\n{1}".format( bootstrap_js, self.__script )) script.setName(self.fullName()) - if qVersionTuple() < (5, 8, 0): - script.setInjectionPoint(injectionPoint) script.setWorldId(WebBrowserPage.SafeJsWorld) script.setRunsOnSubFrames(not self.__noFrames) return script + # TODO: get rid of it def __toJavaScriptList(self, patterns): """ Private method to convert a list of str to a string containing a valid @@ -438,21 +397,7 @@ @return JavaScript script containing the list @rtype str """ - if qVersionTuple() >= (5, 8, 0): - script = "" - else: - patternList = [] - for pattern in patterns: - if pattern.startswith("/") and pattern.endswith("/") and \ - len(pattern) > 1: - pattern = pattern[1:-1] - else: - pattern = pattern.replace(".", "\\.").replace("*", ".*") - pattern = "'{0}'".format(pattern) - patternList.append(pattern) - - script = "[{0}]".format(",".join(patternList)) - return script + return "" def updateScript(self): """
--- a/eric6/WebBrowser/Tools/FilePrinter.py Sun Sep 01 19:58:00 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,577 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2016 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing an object for printing of files. -""" - -# -# This code is inspired by and ported from Qupzilla. -# Original Copyright (C) 2016 by Kevin Kofler <kevin.kofler@chello.at> -# - -from __future__ import unicode_literals - -from PyQt5.QtCore import QFile, QStandardPaths, QProcess -from PyQt5.QtPrintSupport import QPrinter, QPrintEngine - -import Globals -from Globals import qVersionTuple - - -_FilePrintJobs = [] - - -class FilePrinter(object): - """ - Class implementing methods for printing on *nix systems. - """ - # - # Whether file(s) get deleted by the application or by the print system. - # - ApplicationDeletesFiles = 0 - SystemDeletesFiles = 1 - - # - # Whether pages to be printed are selected by the application or the print - # system. - # - # If application side, then the generated file will only contain those - # pages selected by the user, so FilePrinter will print all the pages in - # the file. - # - # If system side, then the file will contain all the pages in the - # document, and the print system will print the users selected print range - # from out of the file. - # - # Note: system side only works in CUPS, not LPR. - # - ApplicationSelectsPages = 0 - SystemSelectsPages = 1 - - def __init__(self): - """ - Constructor - """ - self.__paperSizesMap = { - QPrinter.A0: "A0", - QPrinter.A1: "A1", - QPrinter.A2: "A2", - QPrinter.A3: "A3", - QPrinter.A4: "A4", - QPrinter.A5: "A5", - QPrinter.A6: "A6", - QPrinter.A7: "A7", - QPrinter.A8: "A8", - QPrinter.A9: "A9", - QPrinter.B0: "B0", - QPrinter.B1: "B1", - QPrinter.B2: "B2", - QPrinter.B3: "B3", - QPrinter.B4: "B4", - QPrinter.B5: "B5", - QPrinter.B6: "B6", - QPrinter.B7: "B7", - QPrinter.B8: "B8", - QPrinter.B9: "B9", - QPrinter.B10: "B10", - QPrinter.C5E: "C5", - QPrinter.Comm10E: "Comm10", - QPrinter.DLE: "DL", - QPrinter.Executive: "Executive", - QPrinter.Folio: "Folio", - QPrinter.Ledger: "Ledger", - QPrinter.Legal: "Legal", - QPrinter.Letter: "Letter", - QPrinter.Tabloid: "Tabloid", - } - - self.__paperSourcesMap = { - QPrinter.Auto: "", - QPrinter.Cassette: "Cassette", - QPrinter.Envelope: "Envelope", - QPrinter.EnvelopeManual: "EnvelopeManual", - QPrinter.FormSource: "FormSource", - QPrinter.LargeCapacity: "LargeCapacity", - QPrinter.LargeFormat: "LargeFormat", - QPrinter.Lower: "Lower", - QPrinter.MaxPageSource: "MaxPageSource", - QPrinter.Middle: "Middle", - QPrinter.Manual: "Manual", - QPrinter.OnlyOne: "OnlyOne", - QPrinter.Tractor: "Tractor", - QPrinter.SmallFormat: "SmallFormat", - } - - self.__process = None - self.__doDeleteFile = FilePrinter.ApplicationDeletesFiles - self.__fileName = "" - - def _doPrintFile(self, printer, fileName, fileDeletePolicy, - pageSelectPolicy, pageRange): - """ - Protected method to print a file. - - @param printer reference to the printer to print to - @type QPrinter - @param fileName name (path) of the file to be printed - @type str - @param fileDeletePolicy policy determining who deletes the file to be - printed (application or system) - @type int (0 or 1) - @param pageSelectPolicy policy determining who selects the pages to be - printed (application or system) - @type int (0 or 1) - @param pageRange string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog - @type str - @return flag indicating successful print job submission - @rtype bool - """ - if not QFile.exists(fileName): - return False - - self.__fileName = fileName - self.__doDeleteFile = ( - fileDeletePolicy == FilePrinter.SystemDeletesFiles) - - if printer.printerState() in [QPrinter.Aborted, QPrinter.Error]: - if self.__doDeleteFile: - QFile.remove(fileName) - return False - - # - # Print via lpr/lp command - # - - # - # Decide what executable to use to print with, need the CUPS version - # of lpr if available. Some distros name the CUPS version of lpr as - # lpr-cups or lpr.cups so try those first before default to lpr, or - # failing that to lp. - if QStandardPaths.findExecutable("lpr-cups"): - exe = "lpr-cups" - elif QStandardPaths.findExecutable("lpr.cups"): - exe = "lpr.cups" - elif QStandardPaths.findExecutable("lpr"): - exe = "lpr" - elif QStandardPaths.findExecutable("lp"): - exe = "lp" - else: - if self.__doDeleteFile: - QFile.remove(fileName) - return False - - useCupsOptions = isCupsAvailable() - argsList = self._printArguments( - printer, fileDeletePolicy, pageSelectPolicy, useCupsOptions, - pageRange, exe) - argsList.append(fileName) - - self.__process = QProcess() - if qVersionTuple() < (5, 6, 0): - self.__process.error.connect(self.__processError) - else: - self.__process.errorOccurred.connect(self.__processError) - self.__process.finished.connect(self.__processFinished) - self.__process.start(exe, argsList) - if not self.__process.waitForStarted(10000): - # it failed to start - self.__doCleanup(self.__doDeleteFile) - return False - - return True - - def __doCleanup(self, deleteFile): - """ - Private method to perform some internal cleanup actions. - - @param deleteFile flag indicating to delete the print file - @type bool - """ - if deleteFile: - QFile.remove(self.__fileName) - - self.__process.deleteLater() - self.__process = None - - if self in _FilePrintJobs: - _FilePrintJobs.remove(self) - - def __processError(self, error): - """ - Private slot handling process errors. - - @param error error value - @type QProcess.ProcessError - """ - self.__doCleanup(self.__doDeleteFile) - - def __processFinished(self, exitCode, exitStatus): - """ - Private slot handling the end of the process. - - @param exitCode exit code of the process - @type int - @param exitStatus exit status of the process - @type QProcess.ExitStatus - """ - self.__doCleanup(self.__doDeleteFile and ( - exitStatus != QProcess.NormalExit or exitCode != 0)) - - def _printArguments(self, printer, fileDeletePolicy, pageSelectPolicy, - useCupsOptions, pageRange, variant): - """ - Protected method to assemble the command line arguments for the print - command. - - @param printer reference to the printer to print to - @type QPrinter - @param fileDeletePolicy policy determining who deletes the file to be - printed (application or system) - @type int (0 or 1) - @param pageSelectPolicy policy determining who selects the pages to be - printed (application or system) - @type int (0 or 1) - @param useCupsOptions flag indicating to assemble the arguments for - CUPS - @type bool - @param pageRange string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog - @type str - @param variant string identifying the print command variant - @type str - @return assembled command line arguments for the print command - @rtype list of str - """ - if variant.startswith("lpr"): - variant = "lpr" - - args = [] - args.extend(self._destination(printer, variant)) - args.extend(self._copies(printer, variant)) - args.extend(self._jobname(printer, variant)) - args.extend(self._pages(printer, pageSelectPolicy, pageRange, - useCupsOptions, variant)) - if useCupsOptions: - args.extend(self._cupsOptions(printer)) - args.extend(self._deleteFile(printer, fileDeletePolicy, variant)) - if variant == "lp": - args.append("--") - - return args - - def _destination(self, printer, variant): - """ - Protected method to assemble the printer destination arguments. - - @param printer reference to the printer to print to - @type QPrinter - @param variant string identifying the print command variant - @type str - @return assembled printer destination arguments - @rtype list of str - """ - if variant == "lp": - return ["-d", printer.printerName()] - elif variant == "lpr": - return ["-P", printer.printerName()] - else: - return [] - - def _copies(self, printer, variant): - """ - Protected method to assemble the number of copies arguments. - - @param printer reference to the printer to print to - @type QPrinter - @param variant string identifying the print command variant - @type str - @return assembled number of copies arguments - @rtype list of str - """ - copies = printer.copyCount() - if variant == "lp": - return ["-n", str(copies)] - elif variant == "lpr": - return ["-#{0}".format(copies)] - else: - return [] - - def _jobname(self, printer, variant): - """ - Protected method to assemble the jobname arguments. - - @param printer reference to the printer to print to - @type QPrinter - @param variant string identifying the print command variant - @type str - @return assembled jobname arguments - @rtype list of str - """ - if printer.docName(): - if variant == "lp": - return ["-t", printer.docName()] - elif variant == "lpr": - shortenedDocName = printer.docName()[:255] - return ["-J", shortenedDocName] - - return [] - - def _deleteFile(self, printer, fileDeletePolicy, variant): - """ - Protected method to assemble the jobname arguments. - - @param printer reference to the printer to print to - @type QPrinter - @param fileDeletePolicy policy determining who deletes the file to be - printed (application or system) - @type int (0 or 1) - @param variant string identifying the print command variant - @type str - @return assembled jobname arguments - @rtype list of str - """ - if fileDeletePolicy == FilePrinter.SystemDeletesFiles and \ - variant == "lpr": - return ["-r"] - else: - return [] - - def _pages(self, printer, pageSelectPolicy, pageRange, useCupsOptions, - variant): - """ - Protected method to assemble the page range(s) arguments. - - @param printer reference to the printer to print to - @type QPrinter - @param pageSelectPolicy policy determining who selects the pages to be - printed (application or system) - @type int (0 or 1) - @param pageRange string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog - @type str - @param useCupsOptions flag indicating to assemble the arguments for - CUPS - @type bool - @param variant string identifying the print command variant - @type str - @return assembled page range(s) arguments - @rtype list of str - """ - if pageSelectPolicy == FilePrinter.SystemSelectsPages: - if printer.printRange() == QPrinter.Selection and bool(pageRange): - if variant == "lp": - return ["-P", pageRange] - elif variant == "lpr": - return ["-o", "page-ranges={0}".format(pageRange)] - - if printer.printRange() == QPrinter.PageRange: - if variant == "lp": - return ["-P", "{0}-{1}".format( - printer.fromPage(), printer.toPage())] - elif variant == "lpr": - return ["-o", "page-ranges={0}-{1}".format( - printer.fromPage(), printer.toPage())] - - return [] # all pages - - def _cupsOptions(self, printer): - """ - Protected method to assemble the CUPS specific arguments. - - @param printer reference to the printer to print to - @type QPrinter - @return assembled CUPS arguments - @rtype list of str - """ - options = [] - options.extend(self._optionMedia(printer)) - options.extend(self._optionDoubleSidedPrinting(printer)) - options.extend(self._optionPageOrder(printer)) - options.extend(self._optionCollateCopies(printer)) - options.extend(self._optionCupsProperties(printer)) - - return options - - def _optionMedia(self, printer): - """ - Protected method to assemble the print media arguments. - - @param printer reference to the printer to print to - @type QPrinter - @return assembled print media arguments - @rtype list of str - """ - pageSize = self._mediaPageSize(printer) - paperSource = self._mediaPaperSource(printer) - - if pageSize and paperSource: - return ["-o", "media={0},{1}".format(pageSize, paperSource)] - - elif pageSize: - return ["-o", "media={0}".format(pageSize)] - - elif paperSource: - return ["-o", "media={0}".format(paperSource)] - - return [] - - def _mediaPageSize(self, printer): - """ - Protected method to get the page size argument. - - @param printer reference to the printer to print to - @type QPrinter - @return page size argument - @rtype str - """ - pageSize = printer.pageSize() - if pageSize in self.__paperSizesMap: - return self.__paperSizesMap[pageSize] - else: - return "" - - def _mediaPaperSource(self, printer): - """ - Protected method to get the paper source argument. - - @param printer reference to the printer to print to - @type QPrinter - @return paper source argument - @rtype str - """ - paperSource = printer.paperSource() - if paperSource in self.__paperSourcesMap: - return self.__paperSourcesMap[paperSource] - else: - return "" - - def _optionDoubleSidedPrinting(self, printer): - """ - Protected method to assemble the double sided printing arguments. - - @param printer reference to the printer to print to - @type QPrinter - @return assembled double sided printing arguments - @rtype list of str - """ - duplex = printer.duplex() - - if duplex == QPrinter.DuplexNone: - return ["-o", "sides=one-sided"] - elif duplex == QPrinter.DuplexAuto: - if printer.orientation() == QPrinter.Landscape: - return ["-o", "sides=two-sided-short-edge"] - else: - return ["-o", "sides=two-sided-long-edge"] - elif duplex == QPrinter.DuplexLongSide: - return ["-o", "sides=two-sided-long-edge"] - elif duplex == QPrinter.DuplexShortSide: - return ["-o", "sides=two-sided-short-edge"] - else: - return [] # use printer default - - def _optionPageOrder(self, printer): - """ - Protected method to assemble the page order arguments. - - @param printer reference to the printer to print to - @type QPrinter - @return assembled page order arguments - @rtype list of str - """ - if printer.pageOrder() == QPrinter.LastPageFirst: - return ["-o", "outputorder=reverse"] - else: - return ["-o", "outputorder=normal"] - - def _optionCollateCopies(self, printer): - """ - Protected method to assemble the collate copies arguments. - - @param printer reference to the printer to print to - @type QPrinter - @return assembled collate copies arguments - @rtype list of str - """ - if printer.collateCopies(): - return ["-o", "Collate=True"] - else: - return ["-o", "Collate=False"] - - def _optionCupsProperties(self, printer): - """ - Protected method to assemble the CUPS properties arguments. - - @param printer reference to the printer to print to - @type QPrinter - @return assembled CUPS properties arguments - @rtype list of str - """ - options = Globals.toList(printer.printEngine().property( - QPrintEngine.PrintEnginePropertyKey(0xfe00))) - - cupsOptions = [] - index = 0 - while index < len(options): - if options[index + 1]: - cupsOptions.extend(["-o", "{0}={1}".format( - options[index], options[index + 1])]) - else: - cupsOptions.extend(["-o", options[index]]) - index += 2 - - return cupsOptions - - -def isCupsAvailable(): - """ - Static method to test the availability of CUPS. - - @return flag indicating the availability of CUPS - @rtype bool - """ - if Globals.isMacPlatform(): - # OS X/MacOS always have CUPS - return True - elif Globals.isLinuxPlatform(): - testPrinter = QPrinter() - return testPrinter.supportsMultipleCopies() - else: - return False - - -def printFile(printer, fileName, - fileDeletePolicy=FilePrinter.ApplicationDeletesFiles, - pageSelectPolicy=FilePrinter.ApplicationSelectsPages, - pageRange=""): - """ - Static method to print a file. - - Note: Only CUPS and LPR on *nix systems is supported. - - @param printer reference to the printer to print to - @type QPrinter - @param fileName name (path) of the file to be printed - @type str - @param fileDeletePolicy policy determining who deletes the file to be - printed (application or system) - @type int (0 or 1) - @param pageSelectPolicy policy determining who selects the pages to be - printed (application or system) - @type int (0 or 1) - @param pageRange string determining the page range(s) to be printed, if - SystemSelectsPages was given for pageSelectPolicy and user chose - Selection in print dialog - @type str - """ - fp = FilePrinter() - if fp._doPrintFile(printer, fileName, fileDeletePolicy, pageSelectPolicy, - pageRange): - _FilePrintJobs.append(fp)
--- a/eric6/WebBrowser/Tools/WebHitTestResult.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/Tools/WebHitTestResult.py Mon Sep 02 18:50:38 2019 +0200 @@ -116,8 +116,6 @@ Public method to update the hit test data with data from the context menu event. - Note: This works for Qt >= 5.7.0. - @param data context menu data @type QWebEngineContextMenuData """
--- a/eric6/WebBrowser/WebBrowserPage.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/WebBrowserPage.py Mon Sep 02 18:50:38 2019 +0200 @@ -27,7 +27,6 @@ from .Tools import Scripts import Preferences -from Globals import qVersionTuple class WebBrowserPage(QWebEnginePage): @@ -43,11 +42,8 @@ @signal navigationRequestAccepted(url, navigation type, main frame) emitted to signal an accepted navigation request """ - if qVersionTuple() >= (5, 7, 0): - SafeJsWorld = QWebEngineScript.ApplicationWorld - # SafeJsWorld = QWebEngineScript.MainWorld - else: - SafeJsWorld = QWebEngineScript.MainWorld + SafeJsWorld = QWebEngineScript.ApplicationWorld + # SafeJsWorld = QWebEngineScript.MainWorld UnsafeJsWorld = QWebEngineScript.MainWorld safeBrowsingAbort = pyqtSignal() @@ -79,12 +75,7 @@ WebBrowserWindow.networkManager().proxyAuthentication) self.fullScreenRequested.connect(self.__fullScreenRequested) self.urlChanged.connect(self.__urlChanged) - - try: - self.contentsSizeChanged.connect(self.__contentsSizeChanged) - except AttributeError: - # defined for Qt >= 5.7 - pass + self.contentsSizeChanged.connect(self.__contentsSizeChanged) try: self.registerProtocolHandlerRequested.connect( @@ -308,7 +299,7 @@ ended @type function """ - if qVersionTuple() >= (5, 7, 0) and worldId > -1: + if worldId > -1: if callback is None: QWebEnginePage.runJavaScript(self, script, worldId) else:
--- a/eric6/WebBrowser/WebBrowserTabWidget.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/WebBrowserTabWidget.py Mon Sep 02 18:50:38 2019 +0200 @@ -11,8 +11,7 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QDir, QFile, \ - QFileDevice, QTemporaryFile +from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QFile, QFileDevice from PyQt5.QtGui import QIcon, QPixmap, QPainter from PyQt5.QtWidgets import QWidget, QHBoxLayout, QMenu, QToolButton, \ QDialog, QApplication @@ -25,7 +24,6 @@ from .WebBrowserView import WebBrowserView from .WebBrowserPage import WebBrowserPage from .Tools import WebBrowserTools -from .Tools import FilePrinter from . import WebInspector import UI.PixmapCache @@ -33,11 +31,27 @@ import Utilities import Preferences import Globals -from Globals import qVersionTuple from eric6config import getConfig +def isCupsAvailable(): + """ + Static method to test the availability of CUPS. + + @return flag indicating the availability of CUPS + @rtype bool + """ + if Globals.isMacPlatform(): + # OS X/MacOS always have CUPS + return True + elif Globals.isLinuxPlatform(): + testPrinter = QPrinter() + return testPrinter.supportsMultipleCopies() + else: + return False + + class WebBrowserTabWidget(E5TabWidget): """ Class implementing the central widget showing the web pages. @@ -142,8 +156,6 @@ self.__initTabContextMenu() self.__historyCompleter = None - - self.__pdfPrinter = None def __initTabContextMenu(self): """ @@ -173,20 +185,15 @@ self.__tabContextMenu.addAction( self.tr('Close All'), self.closeAllBrowsers) self.__tabContextMenu.addSeparator() - if qVersionTuple() >= (5, 8, 0) or ( - not Globals.isWindowsPlatform() and qVersionTuple() < (5, 7, 0)): - self.__tabContextMenu.addAction( - UI.PixmapCache.getIcon("printPreview.png"), - self.tr('Print Preview'), self.__tabContextMenuPrintPreview) - if qVersionTuple() >= (5, 8, 0) or ( - not Globals.isWindowsPlatform() or qVersionTuple() >= (5, 7, 0)): - self.__tabContextMenu.addAction( - UI.PixmapCache.getIcon("print.png"), - self.tr('Print'), self.__tabContextMenuPrint) - if Globals.isLinuxPlatform() or qVersionTuple() >= (5, 7, 0): - self.__tabContextMenu.addAction( - UI.PixmapCache.getIcon("printPdf.png"), - self.tr('Print as PDF'), self.__tabContextMenuPrintPdf) + self.__tabContextMenu.addAction( + UI.PixmapCache.getIcon("printPreview.png"), + self.tr('Print Preview'), self.__tabContextMenuPrintPreview) + self.__tabContextMenu.addAction( + UI.PixmapCache.getIcon("print.png"), + self.tr('Print'), self.__tabContextMenuPrint) + self.__tabContextMenu.addAction( + UI.PixmapCache.getIcon("printPdf.png"), + self.tr('Print as PDF'), self.__tabContextMenuPrintPdf) self.__tabContextMenu.addSeparator() if hasattr(WebBrowserPage, "isAudioMuted"): self.__audioAct = self.__tabContextMenu.addAction( @@ -660,29 +667,11 @@ printDialog.setOptions(QAbstractPrintDialog.PrintToFile | QAbstractPrintDialog.PrintShowPageSize) if not Globals.isWindowsPlatform(): - if FilePrinter.isCupsAvailable(): + if isCupsAvailable(): printDialog.setOption(QAbstractPrintDialog.PrintCollateCopies) printDialog.setOption(QAbstractPrintDialog.PrintPageRange) if printDialog.exec_() == QDialog.Accepted: - if hasattr(browser.page(), "print"): - # Qt >= 5.8.0 - browser.page().execPrintPage(printer, 10 * 1000) - elif hasattr(browser.page(), "printToPdf"): - # Qt >= 5.7.0 - if printer.outputFormat() == QPrinter.PdfFormat: - # print to PDF file selected - browser.page().printToPdf( - lambda pdf: self.__pdfGeneratedForSave( - printer.outputFileName(), pdf), - printer.pageLayout()) - else: - # print to printer - self.__pdfPrinter = printer - browser.page().printToPdf( - self.__pdfGeneratedForPrinting, - printer.pageLayout()) - else: - browser.render(printer) + browser.page().execPrintPage(printer, 10 * 1000) @pyqtSlot() def printBrowserPdf(self, browser=None): @@ -766,38 +755,6 @@ E5MessageBox.StandardButtons( E5MessageBox.Ok)) - def __pdfGeneratedForPrinting(self, pdfData): - """ - Private slot to print the generated PDF data. - - @param pdfData generated PDF document - @type QByteArray - """ - if self.__pdfPrinter is None or pdfData.isEmpty(): - return - - tempFile = QTemporaryFile(QDir.tempPath() + "/ericBrowserXXXXXX.pdf") - tempFile.setAutoRemove(False) - if tempFile.open(): - bytesWritten = tempFile.write(pdfData) - tempFile.close() - if bytesWritten == pdfData.size(): - if Globals.isWindowsPlatform(): - printerName = self.__pdfPrinter.printerName() - import ctypes - ctypes.windll.shell32.ShellExecuteW( - None, "printto", tempFile.fileName(), - '"{0}"'.format(printerName), None, 0) - else: - FilePrinter.printFile( - self.__pdfPrinter, tempFile.fileName(), - FilePrinter.FilePrinter.SystemDeletesFiles, - FilePrinter.FilePrinter.SystemSelectsPages) - else: - tempFile.remove() - - self.__pdfPrinter = None - @pyqtSlot() def printPreviewBrowser(self, browser=None): """ @@ -833,11 +790,8 @@ preview = QPrintPreviewDialog(printer, self) preview.resize(800, 750) - if qVersionTuple() >= (5, 8, 0): - preview.paintRequested.connect( - lambda p: self.__printPreviewRequested(p, browser)) - else: - preview.paintRequested.connect(lambda p: browser.render(p)) + preview.paintRequested.connect( + lambda p: self.__printPreviewRequested(p, browser)) preview.exec_() def __printPreviewRequested(self, printer, browser):
--- a/eric6/WebBrowser/WebBrowserView.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/WebBrowserView.py Mon Sep 02 18:50:38 2019 +0200 @@ -12,9 +12,9 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QUrl, \ - QFileInfo, QTimer, QEvent, QPoint, QPointF, QDateTime, QStandardPaths, \ - QByteArray, QIODevice, QDataStream +from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QFileInfo, QTimer, \ + QEvent, QPoint, QPointF, QDateTime, QStandardPaths, QByteArray, \ + QIODevice, QDataStream from PyQt5.QtGui import QDesktopServices, QClipboard, QIcon, \ QContextMenuEvent, QPixmap, QCursor from PyQt5.QtWidgets import qApp, QStyle, QMenu, QApplication, QDialog @@ -129,11 +129,10 @@ self.__restoreData = None - if qVersionTuple() >= (5, 8, 0): - if self.parentWidget() is not None: - self.parentWidget().installEventFilter(self) + if self.parentWidget() is not None: + self.parentWidget().installEventFilter(self) - if qVersionTuple() >= (5, 8, 0) and qVersionTuple() < (5, 11, 0): + if qVersionTuple() < (5, 11, 0): lay = self.layout() lay.currentChanged.connect( lambda: QTimer.singleShot(0, self.__setRwhvqt)) @@ -574,26 +573,24 @@ @type WebHitTestResult """ spellCheckActionCount = 0 - if qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700: - contextMenuData = self.page().contextMenuData() - hitTest.updateWithContextMenuData(contextMenuData) + contextMenuData = self.page().contextMenuData() + hitTest.updateWithContextMenuData(contextMenuData) + + if bool(contextMenuData.misspelledWord()): + boldFont = menu.font() + boldFont.setBold(True) - if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800 and \ - bool(contextMenuData.misspelledWord()): - boldFont = menu.font() - boldFont.setBold(True) - - for suggestion in contextMenuData.spellCheckerSuggestions(): - act = menu.addAction(suggestion) - act.setFont(boldFont) - act.triggered.connect( - lambda: self.__replaceMisspelledWord)(act) - - if not bool(menu.actions()): - menu.addAction(self.tr("No suggestions")).setEnabled(False) - - menu.addSeparator() - spellCheckActionCount = len(menu.actions()) + for suggestion in contextMenuData.spellCheckerSuggestions(): + act = menu.addAction(suggestion) + act.setFont(boldFont) + act.triggered.connect( + lambda: self.__replaceMisspelledWord)(act) + + if not bool(menu.actions()): + menu.addAction(self.tr("No suggestions")).setEnabled(False) + + menu.addSeparator() + spellCheckActionCount = len(menu.actions()) if not hitTest.linkUrl().isEmpty() and \ hitTest.linkUrl().scheme() != "javascript": @@ -1523,16 +1520,7 @@ # find the render widget receiving events for the web page if obj is self and evt.type() == QEvent.ChildAdded: - if qVersionTuple() < (5, 8, 0): - child = evt.child() - if child and child.inherits( - "QtWebEngineCore::" - "RenderWidgetHostViewQtDelegateWidget"): - self.__rwhvqt = child - self.grabGesture(Qt.PinchGesture) - self.__rwhvqt.grabGesture(Qt.PinchGesture) - self.__rwhvqt.installEventFilter(self) - elif qVersionTuple() >= (5, 11, 0): + if qVersionTuple() >= (5, 11, 0): QTimer.singleShot(0, self.__setRwhvqt) # forward events to WebBrowserView @@ -1857,13 +1845,9 @@ if url.isEmpty(): return - if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: - # since Qt 5.8.0 - fileName, savePageFormat = self.__getSavePageFileNameAndFormat() - if fileName: - self.page().save(fileName, savePageFormat) - else: - self.triggerPageAction(QWebEnginePage.SavePage) + fileName, savePageFormat = self.__getSavePageFileNameAndFormat() + if fileName: + self.page().save(fileName, savePageFormat) def __getSavePageFileNameAndFormat(self): """
--- a/eric6/WebBrowser/WebBrowserWindow.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/WebBrowser/WebBrowserWindow.py Mon Sep 02 18:50:38 2019 +0200 @@ -830,60 +830,49 @@ bookmarksManager.exportBookmarks) self.__actions.append(self.exportBookmarksAct) - if qVersionTuple() >= (5, 8, 0) or ( - not Globals.isWindowsPlatform() or qVersionTuple() >= (5, 7, 0)): - self.printAct = E5Action( - self.tr('Print'), - UI.PixmapCache.getIcon("print.png"), - self.tr('&Print'), - QKeySequence(self.tr("Ctrl+P", "File|Print")), - 0, self, 'webbrowser_file_print') - self.printAct.setStatusTip(self.tr('Print the displayed help')) - self.printAct.setWhatsThis(self.tr( - """<b>Print</b>""" - """<p>Print the displayed help text.</p>""" - )) - self.printAct.triggered.connect(self.__tabWidget.printBrowser) - self.__actions.append(self.printAct) - else: - self.printAct = None - - if Globals.isLinuxPlatform() or qVersionTuple() >= (5, 7, 0): - self.printPdfAct = E5Action( - self.tr('Print as PDF'), - UI.PixmapCache.getIcon("printPdf.png"), - self.tr('Print as PDF'), - 0, 0, self, 'webbrowser_file_print_pdf') - self.printPdfAct.setStatusTip(self.tr( - 'Print the displayed help as PDF')) - self.printPdfAct.setWhatsThis(self.tr( - """<b>Print as PDF</b>""" - """<p>Print the displayed help text as a PDF file.</p>""" - )) - self.printPdfAct.triggered.connect( - self.__tabWidget.printBrowserPdf) - self.__actions.append(self.printPdfAct) - else: - self.printPdfAct = None - - if qVersionTuple() >= (5, 8, 0) or ( - not Globals.isWindowsPlatform() and qVersionTuple() < (5, 7, 0)): - self.printPreviewAct = E5Action( - self.tr('Print Preview'), - UI.PixmapCache.getIcon("printPreview.png"), - self.tr('Print Preview'), - 0, 0, self, 'webbrowser_file_print_preview') - self.printPreviewAct.setStatusTip(self.tr( - 'Print preview of the displayed help')) - self.printPreviewAct.setWhatsThis(self.tr( - """<b>Print Preview</b>""" - """<p>Print preview of the displayed help text.</p>""" - )) - self.printPreviewAct.triggered.connect( - self.__tabWidget.printPreviewBrowser) - self.__actions.append(self.printPreviewAct) - else: - self.printPreviewAct = None + self.printAct = E5Action( + self.tr('Print'), + UI.PixmapCache.getIcon("print.png"), + self.tr('&Print'), + QKeySequence(self.tr("Ctrl+P", "File|Print")), + 0, self, 'webbrowser_file_print') + self.printAct.setStatusTip(self.tr('Print the displayed help')) + self.printAct.setWhatsThis(self.tr( + """<b>Print</b>""" + """<p>Print the displayed help text.</p>""" + )) + self.printAct.triggered.connect(self.__tabWidget.printBrowser) + self.__actions.append(self.printAct) + + self.printPdfAct = E5Action( + self.tr('Print as PDF'), + UI.PixmapCache.getIcon("printPdf.png"), + self.tr('Print as PDF'), + 0, 0, self, 'webbrowser_file_print_pdf') + self.printPdfAct.setStatusTip(self.tr( + 'Print the displayed help as PDF')) + self.printPdfAct.setWhatsThis(self.tr( + """<b>Print as PDF</b>""" + """<p>Print the displayed help text as a PDF file.</p>""" + )) + self.printPdfAct.triggered.connect( + self.__tabWidget.printBrowserPdf) + self.__actions.append(self.printPdfAct) + + self.printPreviewAct = E5Action( + self.tr('Print Preview'), + UI.PixmapCache.getIcon("printPreview.png"), + self.tr('Print Preview'), + 0, 0, self, 'webbrowser_file_print_preview') + self.printPreviewAct.setStatusTip(self.tr( + 'Print preview of the displayed help')) + self.printPreviewAct.setWhatsThis(self.tr( + """<b>Print Preview</b>""" + """<p>Print preview of the displayed help text.</p>""" + )) + self.printPreviewAct.triggered.connect( + self.__tabWidget.printPreviewBrowser) + self.__actions.append(self.printPreviewAct) self.sendPageLinkAct = E5Action( self.tr('Send Page Link'),
--- a/eric6/eric6_browser.py Sun Sep 01 19:58:00 2019 +0200 +++ b/eric6/eric6_browser.py Mon Sep 02 18:50:38 2019 +0200 @@ -28,25 +28,7 @@ except AttributeError: pass -from Globals import qVersionTuple - app = None - - -if qVersionTuple() < (5, 6, 0): - if "--quiet" not in sys.argv: - from PyQt5.QtCore import QTimer - from PyQt5.QtWidgets import QApplication - from E5Gui import E5MessageBox - app = QApplication([]) - QTimer.singleShot(0, lambda: E5MessageBox.critical( - None, - "eric6 Web Browser", - "You need at least Qt Version 5.6.0 to execute the web browser.") - ) - app.exec_() - sys.exit(100) - SettingsDir = None for arg in sys.argv[:]: