Changed the logic to access the Qt tools (executables) to use the information compiled into Qt (QLibraryInfo.location(...)).

Sat, 20 Apr 2013 17:23:36 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 20 Apr 2013 17:23:36 +0200
changeset 2596
32c4afbe0801
parent 2595
921067c38243
child 2597
951e631c9c1d

Changed the logic to access the Qt tools (executables) to use the information compiled into Qt (QLibraryInfo.location(...)).

DocumentationTools/QtHelpGenerator.py file | annotate | diff | comparison | revisions
Plugins/PluginEricdoc.py file | annotate | diff | comparison | revisions
Preferences/ProgramsDialog.py file | annotate | diff | comparison | revisions
Project/ProjectTranslationsBrowser.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
--- a/DocumentationTools/QtHelpGenerator.py	Sat Apr 20 16:27:22 2013 +0200
+++ b/DocumentationTools/QtHelpGenerator.py	Sat Apr 20 17:23:36 2013 +0200
@@ -12,6 +12,8 @@
 import shutil
 import subprocess
 
+from PyQt4.QtCore import QLibraryInfo
+
 from Utilities import joinext, relpath, html_encode
 
 HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?>
@@ -259,8 +261,9 @@
         # generate the compressed files
         shutil.copy(os.path.join(self.outputDir, HelpProjectFile), self.htmlDir)
         os.chdir(self.htmlDir)
-        subprocess.call(["qhelpgenerator", "source.qhp",
-                         "-o", os.path.join(self.outputDir, HelpHelpFile)])
+        subprocess.call([os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                            "qhelpgenerator"),
+                         "source.qhp", "-o", os.path.join(self.outputDir, HelpHelpFile)])
         os.remove(HelpProjectFile)
         
         if self.createCollection:
@@ -268,6 +271,9 @@
             sys.stdout.flush()
             sys.stderr.flush()
             os.chdir(self.outputDir)
-            subprocess.call(["qcollectiongenerator", "source.qhcp", "-o", "collection.qhc"])
+            subprocess.call([os.path.join(
+                                QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                                "qcollectiongenerator"),
+                             "source.qhcp", "-o", "collection.qhc"])
         
         os.chdir(cwd)
--- a/Plugins/PluginEricdoc.py	Sat Apr 20 16:27:22 2013 +0200
+++ b/Plugins/PluginEricdoc.py	Sat Apr 20 17:23:36 2013 +0200
@@ -9,7 +9,7 @@
 
 import os
 
-from PyQt4.QtCore import QObject
+from PyQt4.QtCore import QObject, QLibraryInfo
 from PyQt4.QtGui import QDialog, QApplication
 
 from E5Gui.E5Application import e5App
@@ -64,7 +64,8 @@
     })
     
     # 2. Qt Help Generator
-    exe = 'qhelpgenerator'
+    exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                       'qhelpgenerator')
     if Utilities.isWindowsPlatform():
         exe += '.exe'
     dataList.append({
@@ -80,7 +81,8 @@
     })
     
     # 3. Qt Collection Generator
-    exe = 'qcollectiongenerator'
+    exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                       'qcollectiongenerator')
     if Utilities.isWindowsPlatform():
         exe += '.exe'
     dataList.append({
--- a/Preferences/ProgramsDialog.py	Sat Apr 20 16:27:22 2013 +0200
+++ b/Preferences/ProgramsDialog.py	Sat Apr 20 17:23:36 2013 +0200
@@ -10,7 +10,7 @@
 import os
 import re
 
-from PyQt4.QtCore import pyqtSlot, Qt, QProcess
+from PyQt4.QtCore import pyqtSlot, Qt, QProcess, QLibraryInfo
 from PyQt4.QtGui import QApplication, QTreeWidgetItem, QHeaderView, QCursor, \
     QDialog, QDialogButtonBox
 
@@ -79,31 +79,38 @@
         exe = Utilities.isWindowsPlatform() and \
             "{0}.exe".format(Utilities.generateQtToolName("lrelease")) or \
             Utilities.generateQtToolName("lrelease")
+        exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath), exe)
         version = self.__createProgramEntry(self.trUtf8("Translation Converter (Qt)"),
                     exe, '-version', 'lrelease', -1)
         # 1b. Qt Designer
         if Utilities.isWindowsPlatform():
-            exe = "{0}.exe".format(Utilities.generateQtToolName("designer"))
+            exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                "{0}.exe".format(Utilities.generateQtToolName("designer")))
         elif Utilities.isMacPlatform():
             exe = Utilities.getQtMacBundle("designer")
         else:
-            exe = Utilities.generateQtToolName("designer")
+            exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                Utilities.generateQtToolName("designer"))
         self.__createProgramEntry(self.trUtf8("Qt Designer"), exe, version=version)
         # 1c. Qt Linguist
         if Utilities.isWindowsPlatform():
-            exe = "{0}.exe".format(Utilities.generateQtToolName("linguist"))
+            exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                "{0}.exe".format(Utilities.generateQtToolName("linguist")))
         elif Utilities.isMacPlatform():
             exe = Utilities.getQtMacBundle("linguist")
         else:
-            exe = Utilities.generateQtToolName("linguist")
+            exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                Utilities.generateQtToolName("linguist"))
         self.__createProgramEntry(self.trUtf8("Qt Linguist"), exe, version=version)
         # 1d. Qt Assistant
         if Utilities.isWindowsPlatform():
-            exe = "{0}.exe".format(Utilities.generateQtToolName("assistant"))
+            exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                "{0}.exe".format(Utilities.generateQtToolName("assistant")))
         elif Utilities.isMacPlatform():
             exe = Utilities.getQtMacBundle("assistant")
         else:
-            exe = Utilities.generateQtToolName("assistant")
+            exe = os.path.join(QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                Utilities.generateQtToolName("assistant"))
         self.__createProgramEntry(self.trUtf8("Qt Assistant"), exe, version=version)
         
         # 2. do the PyQt programs
--- a/Project/ProjectTranslationsBrowser.py	Sat Apr 20 16:27:22 2013 +0200
+++ b/Project/ProjectTranslationsBrowser.py	Sat Apr 20 17:23:36 2013 +0200
@@ -11,7 +11,7 @@
 import shutil
 import fnmatch
 
-from PyQt4.QtCore import pyqtSignal, QProcess
+from PyQt4.QtCore import pyqtSignal, QProcess, QLibraryInfo
 from PyQt4.QtGui import QDialog, QMenu
 
 from E5Gui import E5MessageBox
@@ -1053,7 +1053,9 @@
         
         if self.project.getProjectType() in \
                 ["Qt4", "Qt4C", "E4Plugin", "PySide", "PySideC"]:
-            lrelease = Utilities.generateQtToolName("lrelease")
+            lrelease = os.path.join(
+                    QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                    Utilities.generateQtToolName("lrelease"))
         else:
             return
         if Utilities.isWindowsPlatform():
--- a/UI/UserInterface.py	Sat Apr 20 16:27:22 2013 +0200
+++ b/UI/UserInterface.py	Sat Apr 20 17:23:36 2013 +0200
@@ -12,7 +12,7 @@
 import logging
 
 from PyQt4.QtCore import QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, \
-    QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt
+    QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QLibraryInfo
 from PyQt4.QtGui import QSizePolicy, QWidget, QKeySequence, QDesktopServices, \
     QWhatsThis, QToolBar, QDialog, QSplitter, QApplication, QMenu, QProgressDialog, \
     QVBoxLayout, QDockWidget, QAction, QLabel
@@ -1602,7 +1602,9 @@
             designerExe = Utilities.getQtMacBundle("designer")
         else:
             designerExe = Utilities.generateQtToolName("designer")
-        if Utilities.isinpath(designerExe):
+        if Utilities.isinpath(designerExe) or \
+           os.path.exists(os.path.join(
+                QLibraryInfo.location(QLibraryInfo.BinariesPath), designerExe)):
             self.designer4Act = E5Action(self.trUtf8('Qt-Designer'),
                     UI.PixmapCache.getIcon("designer4.png"),
                     self.trUtf8('Qt-&Designer...'), 0, 0, self, 'qt_designer4')
@@ -1622,7 +1624,9 @@
             linguistExe = Utilities.getQtMacBundle("linguist")
         else:
             linguistExe = Utilities.generateQtToolName("linguist")
-        if Utilities.isinpath(linguistExe):
+        if Utilities.isinpath(linguistExe) or \
+           os.path.exists(os.path.join(
+                QLibraryInfo.location(QLibraryInfo.BinariesPath), linguistExe)):
             self.linguist4Act = E5Action(self.trUtf8('Qt-Linguist'),
                     UI.PixmapCache.getIcon("linguist4.png"),
                     self.trUtf8('Qt-&Linguist...'), 0, 0, self, 'qt_linguist4')
@@ -3751,9 +3755,11 @@
             designer, args = Utilities.prepareQtMacBundle("designer", version, args)
         else:
             if version == 4:
-                designer = Utilities.generateQtToolName("designer")
+                designer = os.path.join(
+                    QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                    Utilities.generateQtToolName("designer"))
             if Utilities.isWindowsPlatform():
-                designer = designer + '.exe'
+                designer += '.exe'
         
         proc = QProcess()
         if not proc.startDetached(designer, args):
@@ -3808,9 +3814,11 @@
             linguist, args = Utilities.prepareQtMacBundle("linguist", version, args)
         else:
             if version == 4:
-                linguist = Utilities.generateQtToolName("linguist")
+                linguist = os.path.join(
+                    QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                    Utilities.generateQtToolName("linguist"))
             if Utilities.isWindowsPlatform():
-                linguist = linguist + '.exe'
+                linguist += '.exe'
         
         proc = QProcess()
         if not proc.startDetached(linguist, args):
@@ -3852,9 +3860,11 @@
             assistant, args = Utilities.prepareQtMacBundle("assistant", version, args)
         else:
             if version == 4:
-                assistant = Utilities.generateQtToolName("assistant")
+                assistant = os.path.join(
+                    QLibraryInfo.location(QLibraryInfo.BinariesPath),
+                    Utilities.generateQtToolName("assistant"))
             if Utilities.isWindowsPlatform():
-                assistant = assistant + '.exe'
+                assistant += '.exe'
         
         proc = QProcess()
         if not proc.startDetached(assistant, args):

eric ide

mercurial