Globals/__init__.py

branch
Py2 comp.
changeset 2677
3d4277929fb3
parent 2573
71837b5366d5
parent 2615
bdc9b4659826
child 3057
10516539f238
--- a/Globals/__init__.py	Fri May 24 18:39:58 2013 +0200
+++ b/Globals/__init__.py	Tue May 28 20:52:12 2013 +0200
@@ -12,7 +12,7 @@
 import sys
 import os
 
-from PyQt4.QtCore import QDir
+from PyQt4.QtCore import QDir, QLibraryInfo
 
 # names of the various settings objects
 settingsNameOrganization = "Eric5"
@@ -147,6 +147,49 @@
     configDir = os.path.expanduser(d)
 
 
+def getPythonModulesDirectory():
+    """
+    Function to determine the path to Python's modules directory.
+    
+    @return path to the Python modules directory (string)
+    """
+    import distutils.sysconfig
+    return distutils.sysconfig.get_python_lib(True)
+
+
+def getPyQt4ModulesDirectory():
+    """
+    Function to determine the path to PyQt4's modules directory.
+    
+    @return path to the PyQt4 modules directory (string)
+    """
+    import distutils.sysconfig
+    return os.path.join(distutils.sysconfig.get_python_lib(True), "PyQt4")
+    
+
+def getQtBinariesPath():
+    """
+    Module function to get the path of the Qt binaries.
+    
+    @return path of the Qt binaries (string)
+    """
+    path = ""
+    if isWindowsPlatform():
+        # check for PyQt4 installer first (designer is test object)
+        modDir = getPyQt4ModulesDirectory()
+        if os.path.exists(os.path.join(modDir, "bin", "designer.exe")):
+            path = os.path.join(modDir, "bin")
+        elif os.path.exists(os.path.join(modDir, "designer.exe")):
+            path = modDir
+    
+    if not path:
+        path = QLibraryInfo.location(QLibraryInfo.BinariesPath)
+        if not os.path.exists(path):
+            path = ""
+    
+    return QDir.toNativeSeparators(path)
+
+
 ################################################################################
 ## functions for searching a Python2/3 interpreter
 ################################################################################

eric ide

mercurial