Started adding code to make eric6 usable with PyQt5 and PyQt4.

Sun, 07 Sep 2014 19:57:40 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 07 Sep 2014 19:57:40 +0200
changeset 3776
ccb6eacb50e5
parent 3774
285e5aa860a0
child 3777
0c47cbb5b199

Started adding code to make eric6 usable with PyQt5 and PyQt4.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
E5Gui/E5ErrorMessage.py file | annotate | diff | comparison | revisions
E5Gui/E5LineEdit.py file | annotate | diff | comparison | revisions
E5Network/E5SslInfoWidget.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockAccessHandler.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockSubscription.py file | annotate | diff | comparison | revisions
Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py file | annotate | diff | comparison | revisions
Helpviewer/HelpBrowserWV.py file | annotate | diff | comparison | revisions
Helpviewer/OpenSearch/OpenSearchEngine.py file | annotate | diff | comparison | revisions
Helpviewer/Passwords/PasswordManager.py file | annotate | diff | comparison | revisions
Toolbox/PyQt4ImportHook.py file | annotate | diff | comparison | revisions
UI/NumbersWidget.py file | annotate | diff | comparison | revisions
UI/Previewers/PreviewerQSS.py file | annotate | diff | comparison | revisions
UI/SymbolsWidget.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
eric6.e4p file | annotate | diff | comparison | revisions
eric6.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/E5Gui/E5ErrorMessage.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/E5Gui/E5ErrorMessage.py	Sun Sep 07 19:57:40 2014 +0200
@@ -87,14 +87,20 @@
             self.settings.setValue("MessageFilters", filters)
 
 
-def messageHandler(msgType, context, message):
+def messageHandler(msgType, *args):
     """
     Module function handling messages.
     
     @param msgType type of the message (integer, QtMsgType)
-    @param context context information (QMessageLogContext)
-    @param message message to be shown (bytes)
+    @param args message handler arguments, for PyQt4 message to be shown
+        (bytes), for PyQt5 context information (QMessageLogContext) and 
+        message to be shown (bytes)
     """
+    if len(args) == 2:
+        context = args[0]
+        message = args[1]
+    else:
+        message = args[0]
     if __msgHandlerDialog:
         try:
             if msgType == QtDebugMsg:
@@ -114,10 +120,14 @@
             message = message.replace("\r\n", "<br/>")\
                              .replace("\n", "<br/>")\
                              .replace("\r", "<br/>")
-            msg = "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" \
-                "<p>Line: {3}</p><p>Function: {4}</p>".format(
-                    messageType, Utilities.html_uencode(message),
-                    context.file, context.line, context.function)
+            if len(args) == 2:
+                msg = "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" \
+                    "<p>Line: {3}</p><p>Function: {4}</p>".format(
+                        messageType, Utilities.html_uencode(message),
+                        context.file, context.line, context.function)
+            else:
+                msg = "<p><b>{0}</b></p><p>{1}</p>".format(
+                    messageType, Utilities.html_uencode(message))
             if QThread.currentThread() == qApp.thread():
                 __msgHandlerDialog.showMessage(msg)
             else:
@@ -147,8 +157,12 @@
             "E5ErrorMessage", "Fatal Error")
     if isinstance(message, bytes):
         message = message.decode()
-    print("{0}: {1} in {2} at line {3} ({4})".format(
-        messageType, message, context.file, context.line, context.function))
+    if len(args) == 2:
+        print("{0}: {1} in {2} at line {3} ({4})".format(
+            messageType, message, context.file, context.line,
+            context.function))
+    else:
+        print("{0}: {1}".format(messageType, message))
 
 
 def qtHandler():
--- a/E5Gui/E5LineEdit.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/E5Gui/E5LineEdit.py	Sun Sep 07 19:57:40 2014 +0200
@@ -12,8 +12,11 @@
 from PyQt5.QtCore import pyqtSignal, Qt, QEvent, qVersion
 from PyQt5.QtGui import QPainter, QPalette
 from PyQt5.QtWidgets import QLineEdit, QStyle, QWidget, QHBoxLayout, \
-    QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy, \
-    QStyleOptionFrame
+    QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy
+if qVersion() >= "5.0.0":
+    from PyQt5.QtWidgets import QStyleOptionFrame
+else:
+    from PyQt5.QtWidgets import QStyleOptionFrameV2 as QStyleOptionFrame
 
 import UI.PixmapCache
 
--- a/E5Network/E5SslInfoWidget.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/E5Network/E5SslInfoWidget.py	Sun Sep 07 19:57:40 2014 +0200
@@ -139,8 +139,8 @@
                 sslVersion = "SSL 3.0"
                 imageLabel.setPixmap(
                     UI.PixmapCache.getPixmap("securityHigh32.png"))
-            elif proto == QSsl.TlsV1:
-                sslVersion = "TLS 1.0"
+            elif proto == QSsl.TlsV1SslV3:
+                sslVersion = "TLS 1.0/SSL 3.0"
                 imageLabel.setPixmap(
                     UI.PixmapCache.getPixmap("securityHigh32.png"))
             elif proto == QSsl.SslV2:
@@ -151,6 +151,24 @@
                 sslVersion = self.tr("unknown")
                 imageLabel.setPixmap(
                     UI.PixmapCache.getPixmap("securityLow32.png"))
+            if qVersion() >= "5.0.0":
+                if proto == QSsl.TlsV1_0:
+                    sslVersion = "TLS 1.0"
+                    imageLabel.setPixmap(
+                        UI.PixmapCache.getPixmap("securityHigh32.png"))
+                elif proto == QSsl.TlsV1_1:
+                    sslVersion = "TLS 1.1"
+                    imageLabel.setPixmap(
+                        UI.PixmapCache.getPixmap("securityHigh32.png"))
+                elif proto == QSsl.TlsV1_2:
+                    sslVersion = "TLS 1.2"
+                    imageLabel.setPixmap(
+                        UI.PixmapCache.getPixmap("securityHigh32.png"))
+            else:
+                if proto == QSsl.TlsV1:
+                    sslVersion = "TLS 1.0"
+                    imageLabel.setPixmap(
+                        UI.PixmapCache.getPixmap("securityHigh32.png"))
             rows += 1
             
             label = QLabel(self)
--- a/Helpviewer/AdBlock/AdBlockAccessHandler.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/Helpviewer/AdBlock/AdBlockAccessHandler.py	Sun Sep 07 19:57:40 2014 +0200
@@ -9,7 +9,7 @@
 
 from __future__ import unicode_literals
 
-from PyQt5.QtCore import QUrlQuery
+from PyQt5.QtCore import qVersion
 from PyQt5.QtNetwork import QNetworkAccessManager
 
 from E5Gui import E5MessageBox
@@ -40,7 +40,13 @@
         if url.path() != "subscribe":
             return None
         
-        title = QUrlQuery(url).queryItemValue("title")
+        if qVersion() >= "5.0.0":
+            from PyQt5.QtCore import QUrlQuery
+            title = QUrlQuery(url).queryItemValue("title")
+        else:
+            from PyQt5.QtCore import QUrl
+            title = QUrl.fromPercentEncoding(
+                url.encodedQueryItemValue("title"))
         if not title:
             return None
         res = E5MessageBox.yesNo(
--- a/Helpviewer/AdBlock/AdBlockSubscription.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/Helpviewer/AdBlock/AdBlockSubscription.py	Sun Sep 07 19:57:40 2014 +0200
@@ -15,8 +15,8 @@
 import base64
 
 from PyQt5.QtCore import pyqtSignal, Qt, QObject, QByteArray, QDateTime, \
-    QUrl, QUrlQuery, QCryptographicHash, QFile, QIODevice, QTextStream, \
-    QDate, QTime
+    QUrl, QCryptographicHash, QFile, QIODevice, QTextStream, QDate, QTime, \
+    qVersion
 from PyQt5.QtNetwork import QNetworkReply
 
 from E5Gui import E5MessageBox
@@ -113,22 +113,49 @@
         if url.path() != "subscribe":
             return
         
-        urlQuery = QUrlQuery(url)
-        self.__title = urlQuery.queryItemValue("title")
-        self.__enabled = urlQuery.queryItemValue("enabled") != "false"
-        self.__location = QByteArray(urlQuery.queryItemValue("location"))
-        
-        # Check for required subscription
-        self.__requiresLocation = urlQuery.queryItemValue("requiresLocation")
-        self.__requiresTitle = urlQuery.queryItemValue("requiresTitle")
-        if self.__requiresLocation and self.__requiresTitle:
-            import Helpviewer.HelpWindow
-            Helpviewer.HelpWindow.HelpWindow.adBlockManager()\
-                .loadRequiredSubscription(self.__requiresLocation,
-                                          self.__requiresTitle)
-        
-        lastUpdateString = urlQuery.queryItemValue("lastUpdate")
-        self.__lastUpdate = QDateTime.fromString(lastUpdateString, Qt.ISODate)
+        if qVersion() >= "5.0.0":
+            from PyQt5.QtCore import QUrlQuery
+            urlQuery = QUrlQuery(url)
+            self.__title = urlQuery.queryItemValue("title")
+            self.__enabled = urlQuery.queryItemValue("enabled") != "false"
+            self.__location = QByteArray(urlQuery.queryItemValue("location"))
+            
+            # Check for required subscription
+            self.__requiresLocation = urlQuery.queryItemValue(
+                "requiresLocation")
+            self.__requiresTitle = urlQuery.queryItemValue("requiresTitle")
+            if self.__requiresLocation and self.__requiresTitle:
+                import Helpviewer.HelpWindow
+                Helpviewer.HelpWindow.HelpWindow.adBlockManager()\
+                    .loadRequiredSubscription(self.__requiresLocation,
+                                              self.__requiresTitle)
+            
+            lastUpdateString = urlQuery.queryItemValue("lastUpdate")
+            self.__lastUpdate = QDateTime.fromString(lastUpdateString,
+                                                     Qt.ISODate)
+        else:
+            self.__title = \
+                QUrl.fromPercentEncoding(url.encodedQueryItemValue("title"))
+            self.__enabled = QUrl.fromPercentEncoding(
+                url.encodedQueryItemValue("enabled")) != "false"
+            self.__location = QByteArray(QUrl.fromPercentEncoding(
+                url.encodedQueryItemValue("location")))
+            
+            # Check for required subscription
+            self.__requiresLocation = QUrl.fromPercentEncoding(
+                url.encodedQueryItemValue("requiresLocation"))
+            self.__requiresTitle = QUrl.fromPercentEncoding(
+                url.encodedQueryItemValue("requiresTitle"))
+            if self.__requiresLocation and self.__requiresTitle:
+                import Helpviewer.HelpWindow
+                Helpviewer.HelpWindow.HelpWindow.adBlockManager()\
+                    .loadRequiredSubscription(self.__requiresLocation,
+                                              self.__requiresTitle)
+            
+            lastUpdateByteArray = url.encodedQueryItemValue("lastUpdate")
+            lastUpdateString = QUrl.fromPercentEncoding(lastUpdateByteArray)
+            self.__lastUpdate = QDateTime.fromString(lastUpdateString,
+                                                     Qt.ISODate)
         
         self.__loadRules()
     
@@ -153,9 +180,13 @@
         if self.__lastUpdate.isValid():
             queryItems.append(("lastUpdate",
                                self.__lastUpdate.toString(Qt.ISODate)))
-        query = QUrlQuery()
-        query.setQueryItems(queryItems)
-        url.setQuery(query)
+        if qVersion() >= "5.0.0":
+            from PyQt5.QtCore import QUrlQuery
+            query = QUrlQuery()
+            query.setQueryItems(queryItems)
+            url.setQuery(query)
+        else:
+            url.setQueryItems(queryItems)
         return url
     
     def isEnabled(self):
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py	Sun Sep 07 19:57:40 2014 +0200
@@ -10,10 +10,13 @@
 
 from __future__ import unicode_literals
 
-from PyQt5.QtCore import Qt, QSize, QRect
+from PyQt5.QtCore import Qt, QSize, QRect, qVersion
 from PyQt5.QtGui import QFontMetrics, QPalette, QFont
-from PyQt5.QtWidgets import QStyle, QStyledItemDelegate, QApplication, \
-    QStyleOptionViewItem
+from PyQt5.QtWidgets import QStyle, QStyledItemDelegate, QApplication
+if qVersion() >= "5.0.0":
+    from PyQt5.QtWidgets import QStyleOptionViewItem
+else:
+    from PyQt5.QtWidgets import QStyleOptionViewItemV4 as QStyleOptionViewItem
 
 import UI.PixmapCache
 import Globals
--- a/Helpviewer/HelpBrowserWV.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/Helpviewer/HelpBrowserWV.py	Sun Sep 07 19:57:40 2014 +0200
@@ -15,7 +15,7 @@
     pass
 
 from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QT_TRANSLATE_NOOP, \
-    QUrl, QUrlQuery, QBuffer, QIODevice, QFileInfo, Qt, QTimer, QEvent, \
+    QUrl, QBuffer, QIODevice, QFileInfo, Qt, QTimer, QEvent, \
     QRect, QFile, QPoint, QByteArray, qVersion
 from PyQt5.QtGui import QDesktopServices, QClipboard, QMouseEvent, QColor, \
     QPalette
@@ -1531,7 +1531,9 @@
         if searchUrl.scheme() != "http":
             return
         
-        searchUrlQuery = QUrlQuery()
+        if qVersion() >= "5.0.0":
+            from PyQt5.QtCore import QUrlQuery
+            searchUrlQuery = QUrlQuery()
         searchEngines = {}
         inputFields = formElement.findAll("input")
         for inputField in inputFields.toList():
@@ -1544,12 +1546,21 @@
             elif type_ == "text":
                 if inputField == element:
                     value = "{searchTerms}"
-                searchUrlQuery.addQueryItem(name, value)
+                if qVersion() >= "5.0.0":
+                    searchUrlQuery.addQueryItem(name, value)
+                else:
+                    searchUrl.addQueryItem(name, value)
             elif type_ == "checkbox" or type_ == "radio":
                 if inputField.evaluateJavaScript("this.checked"):
-                    searchUrlQuery.addQueryItem(name, value)
+                    if qVersion() >= "5.0.0":
+                        searchUrlQuery.addQueryItem(name, value)
+                    else:
+                        searchUrl.addQueryItem(name, value)
             elif type_ == "hidden":
-                searchUrlQuery.addQueryItem(name, value)
+                if qVersion() >= "5.0.0":
+                    searchUrlQuery.addQueryItem(name, value)
+                else:
+                    searchUrl.addQueryItem(name, value)
         
         selectFields = formElement.findAll("select")
         for selectField in selectFields.toList():
@@ -1561,7 +1572,10 @@
             
             options = selectField.findAll("option")
             value = options.at(selectedIndex).toPlainText()
-            searchUrlQuery.addQueryItem(name, value)
+            if qVersion() >= "5.0.0":
+                searchUrlQuery.addQueryItem(name, value)
+            else:
+                searchUrl.addQueryItem(name, value)
         
         ok = True
         if len(searchEngines) > 1:
@@ -1575,9 +1589,12 @@
                 return
             
             if searchEngines[searchEngine] != "":
-                searchUrlQuery.addQueryItem(
-                    searchEngines[searchEngine], searchEngine)
-        
+                if qVersion() >= "5.0.0":
+                    searchUrlQuery.addQueryItem(
+                        searchEngines[searchEngine], searchEngine)
+                else:
+                    searchUrl.addQueryItem(        
+                        searchEngines[searchEngine], searchEngine)
         engineName = ""
         labels = formElement.findAll('label[for="{0}"]'.format(elementName))
         if labels.count() > 0:
@@ -1592,7 +1609,8 @@
         if not ok:
             return
         
-        searchUrl.setQuery(searchUrlQuery)
+        if qVersion() >= "5.0.0":
+            searchUrl.setQuery(searchUrlQuery)
         
         from .OpenSearch.OpenSearchEngine import OpenSearchEngine
         engine = OpenSearchEngine()
--- a/Helpviewer/OpenSearch/OpenSearchEngine.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/Helpviewer/OpenSearch/OpenSearchEngine.py	Sun Sep 07 19:57:40 2014 +0200
@@ -12,8 +12,8 @@
 import re
 import json
 
-from PyQt5.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QUrlQuery, \
-    QByteArray, QBuffer, QIODevice, QObject
+from PyQt5.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QByteArray, \
+    QBuffer, QIODevice, QObject, qVersion
 from PyQt5.QtGui import QImage
 from PyQt5.QtNetwork import QNetworkRequest, QNetworkAccessManager
 
@@ -153,11 +153,19 @@
             self.parseTemplate(searchTerm, self._searchUrlTemplate))
         
         if self.__searchMethod != "post":
-            urlQuery = QUrlQuery()
-            for parameter in self._searchParameters:
-                urlQuery.addQueryItem(
-                    parameter[0], self.parseTemplate(searchTerm, parameter[1]))
-            ret.setQuery(urlQuery)
+            if qVersion() >= "5.0.0":
+                from PyQt5.QtCore import QUrlQuery
+                urlQuery = QUrlQuery()
+                for parameter in self._searchParameters:
+                    urlQuery.addQueryItem(
+                        parameter[0],
+                        self.parseTemplate(searchTerm, parameter[1]))
+                ret.setQuery(urlQuery)
+            else:
+                for parameter in self._searchParameters:
+                    ret.addQueryItem(
+                        parameter[0],
+                        self.parseTemplate(searchTerm, parameter[1]))
         
         return ret
     
@@ -200,11 +208,19 @@
             searchTerm, self._suggestionsUrlTemplate)))
         
         if self.__searchMethod != "post":
-            urlQuery = QUrlQuery()
-            for parameter in self._suggestionsParameters:
-                urlQuery.addQueryItem(
-                    parameter[0], self.parseTemplate(searchTerm, parameter[1]))
-            ret.setQuery(urlQuery)
+            if qVersion() >= "5.0.0":
+                from PyQt5.QtCore import QUrlQuery
+                urlQuery = QUrlQuery()
+                for parameter in self._suggestionsParameters:
+                    urlQuery.addQueryItem(
+                        parameter[0],
+                        self.parseTemplate(searchTerm, parameter[1]))
+                ret.setQuery(urlQuery)
+            else:
+                for parameter in self._suggestionsParameters:
+                    ret.addQueryItem(
+                        parameter[0],
+                        self.parseTemplate(searchTerm, parameter[1]))
         
         return ret
     
--- a/Helpviewer/Passwords/PasswordManager.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/Helpviewer/Passwords/PasswordManager.py	Sun Sep 07 19:57:40 2014 +0200
@@ -11,8 +11,8 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, QUrlQuery, \
-    QCoreApplication, QXmlStreamReader
+from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, \
+    QCoreApplication, QXmlStreamReader, qVersion
 from PyQt5.QtWidgets import QApplication
 from PyQt5.QtNetwork import QNetworkRequest
 from PyQt5.QtWebKit import QWebSettings
@@ -437,7 +437,10 @@
         @return stripped URL (QUrl)
         """
         cleanUrl = QUrl(url)
-        cleanUrl.setQuery("")
+        if qVersion() >= "5.0.0":
+            cleanUrl.setQuery("")
+        else:
+            cleanUrl.setQueryItems([])
         cleanUrl.setUserInfo("")
         
         authority = cleanUrl.authority()
@@ -463,10 +466,16 @@
         if boundary is not None:
             args = self.__extractMultipartQueryItems(data, boundary)
         else:
-            argsUrl = QUrl.fromEncoded(
-                QByteArray("foo://bar.com/?" + QUrl.fromPercentEncoding(
-                    data.replace(b"+", b"%20"))))
-            encodedArgs = QUrlQuery(argsUrl).queryItems()
+            if qVersion() >= "5.0.0":
+                from PyQt5.QtCore import QUrlQuery
+                argsUrl = QUrl.fromEncoded(
+                    QByteArray("foo://bar.com/?" + QUrl.fromPercentEncoding(
+                        data.replace(b"+", b"%20"))))
+                encodedArgs = QUrlQuery(argsUrl).queryItems()
+            else:
+                argsUrl = QUrl.fromEncoded(
+                    QByteArray("foo://bar.com/?" + data.replace(b"+", b"%20")))
+                encodedArgs = argsUrl.queryItems()
             args = set()
             for arg in encodedArgs:
                 key = arg[0]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Toolbox/PyQt4ImportHook.py	Sun Sep 07 19:57:40 2014 +0200
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+try:
+    import PyQt5    # __IGNORE_WARNING__ 
+except ImportError:
+    import sys
+
+    # TODO: adapt this for Python2
+    class PyQt4Importer(object):
+        def __init__(self):
+            """
+            Constructor
+            """
+            self.__path = None
+        
+        def find_module(self, fullname, path=None):
+            """
+            Public method returning the module loader.
+            
+            @param fullname name of the module to be loaded (string)
+            @param path path to resolve the module name (string)
+            @return module loader object
+            """
+            if fullname.startswith("PyQt5"):
+                self.__path = path
+                return self
+            
+            return None
+        
+        def load_module(self, fullname):
+            """
+            Public method to load a module.
+            
+            @param fullname name of the module to be loaded (string)
+            @return reference to the loaded module (module)
+            """
+            if fullname in ["PyQt5.QtWidgets", "PyQt5.QtPrintSupport"]:
+                newname = "PyQt4.QtGui"
+            elif fullname in ["PyQt5.QtWebKitWidgets"]:
+                newname = "PyQt4.QtWebKit"
+            else:
+                newname = fullname.replace("PyQt5", "PyQt4")
+            
+            import importlib
+            loader = importlib.find_loader(newname, self.__path)
+            module = loader.load_module(newname)
+            sys.modules[fullname] = module
+            if fullname == "PyQt5.QtCore":
+                import PyQt4.QtGui
+                module.qInstallMessageHandler = module.qInstallMsgHandler
+                module.QItemSelectionModel = PyQt4.QtGui.QItemSelectionModel
+                module.QItemSelection = PyQt4.QtGui.QItemSelection
+                module.QSortFilterProxyModel = \
+                    PyQt4.QtGui.QSortFilterProxyModel
+                module.QAbstractProxyModel = PyQt4.QtGui.QAbstractProxyModel
+                module.QStringListModel = PyQt4.QtGui.QStringListModel
+            return module
+
+    sys.meta_path.insert(0, PyQt4Importer())
--- a/UI/NumbersWidget.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/UI/NumbersWidget.py	Sun Sep 07 19:57:40 2014 +0200
@@ -205,7 +205,7 @@
             self.binTable.horizontalHeader().setSectionResizeMode(
                 QHeaderView.ResizeToContents)
         else:
-            self.binTable.horizontalHeader().setSectionResizeMode(
+            self.binTable.horizontalHeader().setResizeMode(
                 QHeaderView.ResizeToContents)
         self.__model.setBitsAndValue(self.__bytes * 8, self.__input)
         self.__model.dataChanged.connect(self.__binModelDataChanged)
--- a/UI/Previewers/PreviewerQSS.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/UI/Previewers/PreviewerQSS.py	Sun Sep 07 19:57:40 2014 +0200
@@ -54,7 +54,7 @@
         else:
             self.tree.header().setResizeMode(
                 QHeaderView.ResizeToContents)
-            self.table.horizontalHeader().setSectionResizeMode(
+            self.table.horizontalHeader().setResizeMode(
                 QHeaderView.ResizeToContents)
         self.tree.topLevelItem(0).setExpanded(True)
         
--- a/UI/SymbolsWidget.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/UI/SymbolsWidget.py	Sun Sep 07 19:57:40 2014 +0200
@@ -495,7 +495,7 @@
             self.symbolsTable.horizontalHeader().setSectionResizeMode(
                 QHeaderView.Fixed)
         else:
-            self.symbolsTable.horizontalHeader().setSectionResizeMode(
+            self.symbolsTable.horizontalHeader().setResizeMode(
                 QHeaderView.Fixed)
         fm = self.fontMetrics()
         em = fm.width("M")
--- a/UI/UserInterface.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/UI/UserInterface.py	Sun Sep 07 19:57:40 2014 +0200
@@ -19,7 +19,7 @@
 
 from PyQt5.QtCore import pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, \
     PYQT_VERSION_STR, QDate, QIODevice, qVersion, QProcess, QSize, QUrl, \
-    QUrlQuery, QObject, Qt
+    QObject, Qt
 from PyQt5.QtGui import QKeySequence, QDesktopServices
 from PyQt5.QtWidgets import QSizePolicy, QWidget, QWhatsThis, QToolBar, \
     QDialog, QSplitter, QApplication, QMenu, QVBoxLayout, QDockWidget, \
@@ -3033,10 +3033,15 @@
                 Utilities.generateDistroInfo("\r\n"))
         
         url = QUrl("mailto:{0}".format(address))
-        urlQuery = QUrlQuery()
-        urlQuery.addQueryItem("subject", subject)
-        urlQuery.addQueryItem("body", body)
-        url.setQuery(urlQuery)
+        if qVersion() >= "5.0.0":
+            from PyQt5.QtCore import QUrlQuery
+            urlQuery = QUrlQuery()
+            urlQuery.addQueryItem("subject", subject)
+            urlQuery.addQueryItem("body", body)
+            url.setQuery(urlQuery)
+        else:
+            url.addQueryItem("subject", subject)
+            url.addQueryItem("body", body)
         QDesktopServices.openUrl(url)
         
     def checkForErrorLog(self):
--- a/eric6.e4p	Sat Sep 06 14:22:41 2014 +0200
+++ b/eric6.e4p	Sun Sep 07 19:57:40 2014 +0200
@@ -1149,6 +1149,7 @@
     <Source>eric6config.py</Source>
     <Source>DebugClients/Python/eric6dbgstub.py</Source>
     <Source>DebugClients/Python3/eric6dbgstub.py</Source>
+    <Source>Toolbox/PyQt4ImportHook.py</Source>
   </Sources>
   <Forms>
     <Form>PyUnit/UnittestDialog.ui</Form>
--- a/eric6.py	Sat Sep 06 14:22:41 2014 +0200
+++ b/eric6.py	Sun Sep 07 19:57:40 2014 +0200
@@ -13,6 +13,8 @@
 
 from __future__ import unicode_literals
 
+import Toolbox.PyQt4ImportHook  # __IGNORE_WARNING__ 
+
 try:  # Only for Py2
     import StringIO as io   # __IGNORE_EXCEPTION__
     import Utilities.compatibility_fixes     # __IGNORE_WARNING__

eric ide

mercurial