--- a/E5Gui/E5PathPicker.py Sat Jan 26 13:56:19 2019 +0100 +++ b/E5Gui/E5PathPicker.py Sat Jan 26 17:04:11 2019 +0100 @@ -16,7 +16,7 @@ except ImportError: from ThirdParty.enum import Enum -from PyQt5.QtCore import pyqtSignal, Qt, QFileInfo, QCoreApplication +from PyQt5.QtCore import pyqtSignal, Qt, QFileInfo, QCoreApplication, QDir from PyQt5.QtWidgets import QWidget, QHBoxLayout, QToolButton, QSizePolicy from . import E5FileDialog @@ -25,7 +25,6 @@ from .E5ComboBox import E5ClearableComboBox import UI.PixmapCache -import Utilities class E5PathPickerModes(Enum): @@ -129,7 +128,7 @@ @type str """ if self._completer and not self._completer.popup().isVisible(): - self._completer.setRootPath(Utilities.toNativeSeparators(path)) + self._completer.setRootPath(QDir.toNativeSeparators(path)) def setMode(self, mode): """ @@ -246,7 +245,7 @@ self._setEditorText(path) else: if toNative: - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) self._setEditorText(path) if self._completer: self._completer.setRootPath(path) @@ -264,14 +263,14 @@ if self.__mode == E5PathPickerModes.OpenFilesMode: if toNative: return ";".join( - [Utilities.toNativeSeparators(path) + [QDir.toNativeSeparators(path) for path in self._editorText().split(";")]) else: return self._editorText() else: if toNative: return os.path.expanduser( - Utilities.toNativeSeparators(self._editorText())) + QDir.toNativeSeparators(self._editorText())) else: return os.path.expanduser(self._editorText()) @@ -520,7 +519,7 @@ directory = os.path.expanduser(directory) if not os.path.isabs(directory) and self.__defaultDirectory: directory = os.path.join(self.__defaultDirectory, directory) - directory = Utilities.fromNativeSeparators(directory) + directory = QDir.fromNativeSeparators(directory) if self.__mode == E5PathPickerModes.OpenFileMode: path = E5FileDialog.getOpenFileName( @@ -528,14 +527,14 @@ windowTitle, directory, self.__filters) - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) elif self.__mode == E5PathPickerModes.OpenFilesMode: paths = E5FileDialog.getOpenFileNames( self, windowTitle, directory, self.__filters) - path = ";".join([Utilities.toNativeSeparators(path) + path = ";".join([QDir.toNativeSeparators(path) for path in paths]) elif self.__mode == E5PathPickerModes.SaveFileMode: path = E5FileDialog.getSaveFileName( @@ -544,7 +543,7 @@ directory, self.__filters, E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) elif self.__mode == E5PathPickerModes.SaveFileEnsureExtensionMode: path, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self, @@ -553,7 +552,7 @@ self.__filters, None, E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) if path: ext = QFileInfo(path).suffix() if not ext: @@ -566,14 +565,14 @@ windowTitle, directory, self.__filters) - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) elif self.__mode == E5PathPickerModes.DirectoryMode: path = E5FileDialog.getExistingDirectory( self, windowTitle, directory, E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) while path.endswith(os.sep): path = path[:-1] elif self.__mode == E5PathPickerModes.DirectoryShowFilesMode: @@ -582,7 +581,7 @@ windowTitle, directory, E5FileDialog.Options(E5FileDialog.DontUseNativeDialog)) - path = Utilities.toNativeSeparators(path) + path = QDir.toNativeSeparators(path) while path.endswith(os.sep): path = path[:-1]