--- a/Utilities/__init__.py Sun Apr 09 16:52:55 2017 +0200 +++ b/Utilities/__init__.py Sat May 06 13:43:21 2017 +0200 @@ -45,7 +45,7 @@ @param file file to write the warning message to (ignored) @param line line causing the warning (ignored) @raise SyntaxError - """ + """ # __IGNORE_WARNING_D252__ __IGNORE_WARNING_D253__ if category is SyntaxWarning: err = SyntaxError(str(message)) err.filename = filename @@ -65,7 +65,7 @@ from Globals import ( # __IGNORE_WARNING__ isWindowsPlatform, isLinuxPlatform, isMacPlatform, getConfigDir, setConfigDir, getPythonModulesDirectory, getPyQt5ModulesDirectory, - getQtBinariesPath) + getQtBinariesPath, getPyQtToolsPath) from E5Gui.E5Application import e5App @@ -1037,6 +1037,24 @@ @return flag indicating executable status (boolean) """ return os.access(exe, os.X_OK) + + +def isDrive(path): + """ + Function to check, if a path is a Windows drive. + + @param path path name to be checked + @type str + @return flag indicating a Windows drive + @rtype bool + """ + isDrive = False + drive, directory = os.path.splitdrive(path) + if drive and len(drive) == 2 and drive.endswith(":") and \ + directory in ["", "\\", "/"]: + isDrive = True + + return isDrive def samepath(f1, f2): @@ -1671,7 +1689,34 @@ return ("open", newArgs) ############################################################################### -# Qt utility functions below +# PyQt utility functions below +############################################################################### + + +def generatePyQtToolPath(toolname): + """ + Module function to generate the executable path for a PyQt tool. + + @param toolname base name of the tool + @type str + @return executable path name of the tool + @rtype str + """ + pyqtVariant = int(toolname[-1]) + pyqtToolsPath = getPyQtToolsPath(pyqtVariant) + if pyqtToolsPath: + exe = os.path.join(pyqtToolsPath, toolname) + if isWindowsPlatform(): + exe += ".exe" + else: + if isWindowsPlatform(): + exe = getWindowsExecutablePath(toolname) + else: + exe = toolname + return exe + +############################################################################### +# PySide utility functions below ############################################################################### @@ -1679,7 +1724,7 @@ """ Module function to generate the executable path for a PySide tool. - @param toolname base name of the tool (string or QString) + @param toolname base name of the tool (string) @return the PySide tool path with extension (string) """ if isWindowsPlatform():