Preferences/__init__.py

changeset 1368
4489ee4feb59
parent 1353
e1c0af081a8e
child 1373
b3b3c99dba01
--- a/Preferences/__init__.py	Sun Oct 16 13:35:19 2011 +0200
+++ b/Preferences/__init__.py	Mon Oct 17 19:36:51 2011 +0200
@@ -21,7 +21,7 @@
 import shutil
 
 from PyQt4.QtCore import QDir, QPoint, QLocale, QSettings, QFileInfo, QCoreApplication, \
-    QByteArray, QSize, QUrl, Qt
+    QByteArray, QSize, QUrl, Qt, QLibraryInfo
 from PyQt4.QtGui import QColor, QFont, QInputDialog
 from PyQt4.QtNetwork import QNetworkRequest
 from PyQt4.QtWebKit import QWebSettings
@@ -1934,10 +1934,11 @@
     s = prefClass.settings.value("Help/Qt4DocDir",
         prefClass.helpDefaults["Qt4DocDir"])
     if s == "":
-        return os.getenv("QT4DOCDIR", "")
-    else:
-        return s
-    
+        s = os.getenv("QT4DOCDIR", "")
+    if s == "":
+        s = QLibraryInfo.location(QLibraryInfo.DocumentationPath)
+    return s
+
 
 def getHelp(key, prefClass=Prefs):
     """
@@ -2090,6 +2091,8 @@
         prefClass.qtDefaults["Qt4TranslationsDir"])
     if s == "":
         s = os.getenv("QT4TRANSLATIONSDIR", "")
+    if s == "":
+        s = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
     if s == "" and isWindowsPlatform():
         from PyQt4 import pyqtconfig
         transPath = os.path.join(pyqtconfig._pkg_config["pyqt_mod_dir"], "translations")
@@ -2108,6 +2111,11 @@
     """
     if key == "Qt4TranslationsDir":
         return getQt4TranslationsDir(prefClass)
+    elif key == "Qt4Dir":
+        p = prefClass.settings.value("Qt/" + key, prefClass.qtDefaults[key])
+        if p == "":
+            p = QLibraryInfo.location(QLibraryInfo.BinariesPath)
+        return p
     else:
         return prefClass.settings.value("Qt/" + key, prefClass.qtDefaults[key])
     

eric ide

mercurial