Preferences/__init__.py

changeset 4714
03c5936c79e5
parent 4695
9dc08852de25
child 4716
6c8fbcd4d66c
diff -r a910b5ae47c9 -r 03c5936c79e5 Preferences/__init__.py
--- a/Preferences/__init__.py	Wed Feb 03 19:44:28 2016 +0100
+++ b/Preferences/__init__.py	Thu Feb 04 18:40:04 2016 +0100
@@ -29,7 +29,7 @@
 import sys
 
 from PyQt5.QtCore import QDir, QPoint, QLocale, QSettings, QFileInfo, \
-    QCoreApplication, QByteArray, QSize, QUrl, Qt, QLibraryInfo
+    QCoreApplication, QByteArray, QSize, QUrl, Qt, QLibraryInfo, qVersion
 from PyQt5.QtGui import QColor, QFont, QPalette
 from PyQt5.QtWidgets import QInputDialog, QApplication
 from PyQt5.QtNetwork import QNetworkRequest
@@ -2571,9 +2571,10 @@
     prefClass.settings.setValue("System/" + key, value)
     
 
-def getQt4TranslationsDir(prefClass=Prefs):
+def getQtTranslationsDir(prefClass=Prefs):
     """
-    Module function to retrieve the Qt4TranslationsDir setting.
+    Module function to retrieve the Qt4TranslationsDir setting (Name kept for
+    backward compatibility).
     
     @param prefClass preferences class used as the storage area
     @return the requested Qt4TranslationsDir setting (string)
@@ -2581,7 +2582,12 @@
     s = prefClass.settings.value(
         "Qt/Qt4TranslationsDir", prefClass.qtDefaults["Qt4TranslationsDir"])
     if s == "":
-        s = os.getenv("QT4TRANSLATIONSDIR", "")
+        s = os.getenv("QTTRANSLATIONSDIR", "")
+    if s == "":
+        if qVersion() < "5.0.0":
+            s = os.getenv("QT4TRANSLATIONSDIR", "")
+        else:
+            s = os.getenv("QT5TRANSLATIONSDIR", "")
     if s == "":
         s = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
     if s == "" and isWindowsPlatform():
@@ -2600,7 +2606,7 @@
     @return the requested Qt setting
     """
     if key == "Qt4TranslationsDir":
-        return getQt4TranslationsDir(prefClass)
+        return getQtTranslationsDir(prefClass)
     elif key in ["PyuicIndent"]:
         return int(prefClass.settings.value(
             "Qt/" + key, prefClass.qtDefaults[key]))

eric ide

mercurial