Sun, 29 Nov 2015 19:29:34 +0100
Modified more dialogs to use the path picker widgets.
--- a/E5Gui/E5PathPicker.py Sun Nov 29 17:25:42 2015 +0100 +++ b/E5Gui/E5PathPicker.py Sun Nov 29 19:29:34 2015 +0100 @@ -16,7 +16,7 @@ except ImportError: from ThirdParty.enum import Enum -from PyQt5.QtCore import pyqtSignal, Qt +from PyQt5.QtCore import pyqtSignal, Qt, QFileInfo from PyQt5.QtWidgets import QWidget, QHBoxLayout, QToolButton from . import E5FileDialog @@ -35,7 +35,8 @@ OpenFileMode = 0 OpenFilesMode = 1 SaveFileMode = 2 - DirectoryMode = 3 + SaveFileEnsureExtensionMode = 3 + DirectoryMode = 4 # TODO: Refactor the classes using a base class with common functions @@ -312,6 +313,15 @@ """ return self.__filters + def setNameFilters(self, filters): + """ + Public method to set the name filters for the completer. + + @param filter list of file name filters + @type list of str + """ + self.__editor.completer().model().setNameFilters(filters) + def setButtonToolTip(self, tooltip): """ Public method to set the tool button tool tip. @@ -360,7 +370,9 @@ windowTitle = self.tr("Choose a file to open") elif self.__mode == E5PathPickerModes.OpenFilesMode: windowTitle = self.tr("Choose files to open") - elif self.__mode == E5PathPickerModes.SaveFileMode: + elif self.__mode in [ + E5PathPickerModes.SaveFileMode, + E5PathPickerModes.SaveFileEnsureExtensionMode]: windowTitle = self.tr("Choose a file to save") elif self.__mode == E5PathPickerModes.DirectoryMode: windowTitle = self.tr("Choose a directory") @@ -399,6 +411,21 @@ self.__filters, E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) path = Utilities.toNativeSeparators(path) + elif self.__mode == E5PathPickerModes.SaveFileEnsureExtensionMode: + path, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( + self, + windowTitle, + directory, + self.__filters, + None, + E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) + path = Utilities.toNativeSeparators(path) + if path: + ext = QFileInfo(path).suffix() + if not ext: + ex = selectedFilter.split("(*")[1].split(")")[0] + if ex: + path += ex elif self.__mode == E5PathPickerModes.DirectoryMode: path = E5FileDialog.getExistingDirectory( self, @@ -835,6 +862,21 @@ self.__filters, E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) path = Utilities.toNativeSeparators(path) + elif self.__mode == E5PathPickerModes.SaveFileEnsureExtensionMode: + path, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( + self, + windowTitle, + directory, + self.__filters, + None, + E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) + path = Utilities.toNativeSeparators(path) + if path: + ext = QFileInfo(path).suffix() + if not ext: + ex = selectedFilter.split("(*")[1].split(")")[0] + if ex: + path += ex elif self.__mode == E5PathPickerModes.DirectoryMode: path = E5FileDialog.getExistingDirectory( self,
--- a/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -16,12 +16,10 @@ from PyQt5.QtCore import pyqtSlot, Qt from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_EricapiConfigDialog import Ui_EricapiConfigDialog import Utilities -import UI.PixmapCache import DocumentationTools from eric6config import getConfig @@ -42,8 +40,13 @@ super(EricapiConfigDialog, self).__init__(parent) self.setupUi(self) - self.outputFileButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.ignoreDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) + self.outputFilePicker.setMode(E5PathPickerModes.SaveFileMode) + self.outputFilePicker.setDefaultDirectory(project.getProjectPath()) + self.outputFilePicker.setFilters(self.tr( + "API files (*.api);;All files (*)")) + + self.ignoreDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.ignoreDirPicker.setDefaultDirectory(project.getProjectPath()) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) for language in sorted( @@ -65,13 +68,10 @@ self.parameters['outputFile'] = \ Utilities.toNativeSeparators(self.parameters['outputFile']) - self.outputFileCompleter = E5FileCompleter(self.outputFileEdit) - self.ignoreDirCompleter = E5DirCompleter(self.ignoreDirEdit) - self.recursionCheckBox.setChecked(self.parameters['useRecursion']) self.includePrivateCheckBox.setChecked( self.parameters['includePrivate']) - self.outputFileEdit.setText(self.parameters['outputFile']) + self.outputFilePicker.setText(self.parameters['outputFile']) self.baseEdit.setText(self.parameters['basePackage']) self.ignoreDirsList.clear() for d in self.parameters['ignoreDirectories']: @@ -181,63 +181,48 @@ return (args, parms) @pyqtSlot() - def on_outputFileButton_clicked(self): + def on_outputFilePicker_aboutToShowPathPickerDialog(self): """ - Private slot to select the output file. - - It displays a file selection dialog to - select the file the api is written to. + Private slot called before the file selection dialog is shown. """ - startFile = Utilities.fromNativeSeparators(self.outputFileEdit.text()) + startFile = self.outputFilePicker.text() if not startFile: - startPath = Utilities.fromNativeSeparators( - self.project.getProjectPath()) - startFile = (startPath + "/" + - self.project.getProjectName() + ".api") - filename = E5FileDialog.getSaveFileName( - self, - self.tr("Select output file"), - startFile, - self.tr("API files (*.api);;All files (*)")) - - if filename: - # make it relative, if it is in a subdirectory of the project path - fn = Utilities.toNativeSeparators(filename) - fn = self.project.getRelativePath(fn) - self.outputFileEdit.setText(fn) + self.outputFilePicker.setText( + self.project.getProjectName() + ".api") + + @pyqtSlot(str) + def on_outputFilePicker_pathSelected(self, path): + """ + Private slot handling the selection of an output file. + + @param path path of the output file + @type str + """ + # make it relative, if it is in a subdirectory of the project path + fn = self.project.getRelativePath(path) + self.outputFilePicker.setText(fn) - def on_outputFileEdit_textChanged(self, filename): + def on_outputFilePicker_textChanged(self, filename): """ Private slot to enable/disable the "OK" button. @param filename name of the file (string) """ self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(filename != "") - - @pyqtSlot() - def on_ignoreDirButton_clicked(self): - """ - Private slot to select a directory to be ignored. - - It displays a directory selection dialog to - select a directory to be ignored. + + @pyqtSlot(str) + def on_ignoreDirPicker_pathSelected(self, path): """ - startDir = Utilities.fromNativeSeparators(self.ignoreDirEdit.text()) - if not startDir: - startDir = self.ppath - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select directory to exclude"), - startDir, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - # make it relative, if it is a subdirectory of the project path - dn = Utilities.toNativeSeparators(directory) - dn = self.project.getRelativePath(dn) - while dn.endswith(os.sep): - dn = dn[:-1] - self.ignoreDirEdit.setText(dn) + Private slot handling the selection of a directory to be ignored. + + @param path path of the directory to be ignored + @type str + """ + # make it relative, if it is in a subdirectory of the project path + dn = self.project.getRelativePath(path) + while dn.endswith(os.sep): + dn = dn[:-1] + self.ignoreDirPicker.setText(dn) @pyqtSlot() def on_addButton_clicked(self): @@ -247,10 +232,10 @@ The directory in the ignore directories line edit is moved to the listbox above and the edit is cleared. """ - basename = os.path.basename(self.ignoreDirEdit.text()) + basename = os.path.basename(self.ignoreDirPicker.text()) if basename: self.ignoreDirsList.addItem(basename) - self.ignoreDirEdit.clear() + self.ignoreDirPicker.clear() @pyqtSlot() def on_deleteButton_clicked(self): @@ -269,7 +254,7 @@ self.parameters['useRecursion'] = self.recursionCheckBox.isChecked() self.parameters['includePrivate'] = \ self.includePrivateCheckBox.isChecked() - outfile = self.outputFileEdit.text() + outfile = self.outputFilePicker.text() if outfile != '': outfile = os.path.normpath(outfile) self.parameters['outputFile'] = outfile
--- a/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -18,31 +18,30 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <layout class="QGridLayout"> - <item row="0" column="1"> - <widget class="QLineEdit" name="outputFileEdit"> - <property name="toolTip"> - <string>Enter an output filename</string> - </property> - <property name="whatsThis"> - <string><b>Output Filename</b><p>Enter the filename of the output file. A '%L' placeholder is replaced by the language of the API file.</p></string> - </property> - </widget> - </item> - <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> <widget class="QLabel" name="TextLabel6"> <property name="text"> <string>Output File:</string> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QToolButton" name="outputFileButton"> + <item> + <widget class="E5PathPicker" name="outputFilePicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> + <enum>Qt::StrongFocus</enum> </property> <property name="toolTip"> - <string>Press to open a file selection dialog</string> + <string>Enter an output filename</string> + </property> + <property name="whatsThis"> + <string><b>Output Filename</b><p>Enter the filename of the output file. A '%L' placeholder is replaced by the language of the API file.</p></string> </property> </widget> </item> @@ -178,11 +177,21 @@ <property name="title"> <string>Exclude Directories</string> </property> - <layout class="QGridLayout"> - <item row="1" column="2"> - <widget class="QLineEdit" name="ignoreDirEdit"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="3"> + <widget class="QListWidget" name="ignoreDirsList"> <property name="toolTip"> - <string>Enter a directory basename to be ignored</string> + <string>List of directory basenames to be ignored</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="deleteButton"> + <property name="toolTip"> + <string>Press to delete the selected directory from the list</string> + </property> + <property name="text"> + <string>Delete</string> </property> </widget> </item> @@ -196,30 +205,19 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QPushButton" name="deleteButton"> - <property name="toolTip"> - <string>Press to delete the selected directory from the list</string> - </property> - <property name="text"> - <string>Delete</string> + <item row="1" column="2"> + <widget class="E5PathPicker" name="ignoreDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="0" column="0" colspan="4"> - <widget class="QListWidget" name="ignoreDirsList"> - <property name="toolTip"> - <string>List of directory basenames to be ignored</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QToolButton" name="ignoreDirButton"> <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> + <enum>Qt::StrongFocus</enum> </property> <property name="toolTip"> - <string>Press to open a directory selection dialog</string> + <string>Enter a directory basename to be ignored</string> </property> </widget> </item> @@ -240,19 +238,26 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>outputFileEdit</tabstop> + <tabstop>outputFilePicker</tabstop> <tabstop>languagesList</tabstop> <tabstop>sourceExtEdit</tabstop> <tabstop>recursionCheckBox</tabstop> <tabstop>includePrivateCheckBox</tabstop> <tabstop>baseEdit</tabstop> <tabstop>excludeFilesEdit</tabstop> - <tabstop>ignoreDirEdit</tabstop> + <tabstop>ignoreDirPicker</tabstop> <tabstop>addButton</tabstop> <tabstop>ignoreDirsList</tabstop> <tabstop>deleteButton</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -17,14 +17,12 @@ from PyQt5.QtGui import QColor from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QColorDialog -from E5Gui.E5Completers import E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_EricdocConfigDialog import Ui_EricdocConfigDialog from DocumentationTools.Config import eric6docDefaultColors, \ eric6docColorParameterNames import Utilities -import UI.PixmapCache from eric6config import getConfig @@ -44,10 +42,19 @@ super(EricdocConfigDialog, self).__init__(parent) self.setupUi(self) - self.outputDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.ignoreDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.cssButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.qtHelpDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) + self.outputDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.outputDirPicker.setDefaultDirectory(project.getProjectPath()) + + self.ignoreDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.ignoreDirPicker.setDefaultDirectory(project.getProjectPath()) + + self.cssPicker.setMode(E5PathPickerModes.OpenFileMode) + self.cssPicker.setDefaultDirectory(getConfig('ericCSSDir')) + self.cssPicker.setFilters(self.tr( + "Style sheet (*.css);;All files (*)")) + + self.qtHelpDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.qtHelpDirPicker.setDefaultDirectory(project.getProjectPath()) self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) @@ -100,18 +107,14 @@ self.ppath = project.getProjectPath() self.project = project - self.outputDirCompleter = E5DirCompleter(self.outputDirEdit) - self.ignoreDirCompleter = E5DirCompleter(self.ignoreDirEdit) - self.qtHelpDirCompleter = E5DirCompleter(self.qtHelpDirEdit) - self.recursionCheckBox.setChecked(self.parameters['useRecursion']) self.noindexCheckBox.setChecked(self.parameters['noindex']) self.noemptyCheckBox.setChecked(self.parameters['noempty']) - self.outputDirEdit.setText(self.parameters['outputDirectory']) + self.outputDirPicker.setText(self.parameters['outputDirectory']) self.ignoreDirsList.clear() for d in self.parameters['ignoreDirectories']: self.ignoreDirsList.addItem(d) - self.cssEdit.setText(self.parameters['cssFile']) + self.cssPicker.setText(self.parameters['cssFile']) self.sourceExtEdit.setText( ", ".join(self.parameters['sourceExtensions'])) self.excludeFilesEdit.setText( @@ -119,7 +122,7 @@ self.sample.setHtml(self.sampleText.format(**self.colors)) self.qtHelpGroup.setChecked(self.parameters['qtHelpEnabled']) - self.qtHelpDirEdit.setText(self.parameters['qtHelpOutputDirectory']) + self.qtHelpDirPicker.setText(self.parameters['qtHelpOutputDirectory']) self.qtHelpNamespaceEdit.setText(self.parameters['qtHelpNamespace']) self.qtHelpFolderEdit.setText(self.parameters['qtHelpVirtualFolder']) self.qtHelpFilterNameEdit.setText(self.parameters['qtHelpFilterName']) @@ -290,56 +293,34 @@ args.append('--create-qhc') return (args, parms) - - @pyqtSlot() - def on_outputDirButton_clicked(self): + + @pyqtSlot(str) + def on_outputDirPicker_pathSelected(self, path): """ - Private slot to select the output directory. + Private slot handling the selection of an output directory. - It displays a directory selection dialog to - select the directory the documentations is written to. + @param path path of the output directory + @type str """ - startDir = Utilities.fromNativeSeparators(self.outputDirEdit.text()) - if not startDir: - startDir = Utilities.fromNativeSeparators(self.ppath) - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select output directory"), - startDir, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - # make it relative, if it is a subdirectory of the project path - dn = Utilities.toNativeSeparators(directory) - dn = self.project.getRelativePath(dn) - while dn.endswith(os.sep): - dn = dn[:-1] - self.outputDirEdit.setText(dn) - - @pyqtSlot() - def on_ignoreDirButton_clicked(self): + # make it relative, if it is in a subdirectory of the project path + dn = self.project.getRelativePath(path) + while dn.endswith(os.sep): + dn = dn[:-1] + self.outputDirPicker.setText(dn) + + @pyqtSlot(str) + def on_ignoreDirPicker_pathSelected(self, path): """ - Private slot to select a directory to be ignored. + Private slot handling the selection of a directory to be ignored. - It displays a directory selection dialog to - select a directory to be ignored. + @param path path of the directory to be ignored + @type str """ - startDir = Utilities.fromNativeSeparators(self.ignoreDirEdit.text()) - if not startDir: - startDir = self.ppath - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select directory to exclude"), - startDir, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - # make it relative, if it is a subdirectory of the project path - dn = Utilities.toNativeSeparators(directory) - dn = self.project.getRelativePath(dn) - while dn.endswith(os.sep): - dn = dn[:-1] - self.ignoreDirEdit.setText(dn) + # make it relative, if it is in a subdirectory of the project path + dn = self.project.getRelativePath(path) + while dn.endswith(os.sep): + dn = dn[:-1] + self.ignoreDirPicker.setText(dn) @pyqtSlot() def on_addButton_clicked(self): @@ -349,10 +330,10 @@ The directory in the ignore directories line edit is moved to the listbox above and the edit is cleared. """ - basename = os.path.basename(self.ignoreDirEdit.text()) + basename = os.path.basename(self.ignoreDirPicker.text()) if basename: self.ignoreDirsList.addItem(basename) - self.ignoreDirEdit.clear() + self.ignoreDirPicker.clear() @pyqtSlot() def on_deleteButton_clicked(self): @@ -361,23 +342,18 @@ """ itm = self.ignoreDirsList.takeItem(self.ignoreDirsList.currentRow()) del itm - - @pyqtSlot() - def on_cssButton_clicked(self): - """ - Private slot to select a css style sheet. + + @pyqtSlot(str) + def on_cssPicker_pathSelected(self, path): """ - cssFile = E5FileDialog.getOpenFileName( - self, - self.tr("Select CSS style sheet"), - getConfig('ericCSSDir'), - self.tr("Style sheet (*.css);;All files (*)")) - - if cssFile: - # make it relative, if it is in a subdirectory of the project path - cf = Utilities.toNativeSeparators(cssFile) - cf = self.project.getRelativePath(cf) - self.cssEdit.setText(cf) + Private slot handling the selection of a css style sheet. + + @param path path of the css style sheet + @type str + """ + # make it relative, if it is in a subdirectory of the project path + cf = self.project.getRelativePath(path) + self.cssPicker.setText(cf) def __selectColor(self, colorKey): """ @@ -508,27 +484,20 @@ """ self.__checkQtHelpOptions() - @pyqtSlot() - def on_qtHelpDirButton_clicked(self): - """ - Private slot to select the output directory for the QtHelp files. - - It displays a directory selection dialog to - select the directory the QtHelp files are written to. + @pyqtSlot(str) + def on_qtHelpDirPicker_pathSelected(self, path): """ - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select output directory for QtHelp files"), - self.qtHelpDirEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - # make it relative, if it is a subdirectory of the project path - dn = Utilities.toNativeSeparators(directory) - dn = self.project.getRelativePath(dn) - while dn.endswith(os.sep): - dn = dn[:-1] - self.qtHelpDirEdit.setText(dn) + Private slot handling the selection of the output directory for the + QtHelp files. + + @param path path of the the output directory for the QtHelp files + @type str + """ + # make it relative, if it is in a subdirectory of the project path + dn = self.project.getRelativePath(path) + while dn.endswith(os.sep): + dn = dn[:-1] + self.qtHelpDirPicker.setText(dn) def accept(self): """ @@ -539,7 +508,7 @@ self.parameters['useRecursion'] = self.recursionCheckBox.isChecked() self.parameters['noindex'] = self.noindexCheckBox.isChecked() self.parameters['noempty'] = self.noemptyCheckBox.isChecked() - outdir = self.outputDirEdit.text() + outdir = self.outputDirPicker.text() if outdir != '': outdir = os.path.normpath(outdir) if outdir.endswith(os.sep): @@ -550,7 +519,7 @@ itm = self.ignoreDirsList.item(row) self.parameters['ignoreDirectories'].append( os.path.normpath(itm.text())) - cssFile = self.cssEdit.text() + cssFile = self.cssPicker.text() if cssFile != '': cssFile = os.path.normpath(cssFile) self.parameters['cssFile'] = cssFile @@ -562,7 +531,7 @@ [pattern.strip() for pattern in patterns] self.parameters['qtHelpEnabled'] = self.qtHelpGroup.isChecked() - self.parameters['qtHelpOutputDirectory'] = self.qtHelpDirEdit.text() + self.parameters['qtHelpOutputDirectory'] = self.qtHelpDirPicker.text() self.parameters['qtHelpNamespace'] = self.qtHelpNamespaceEdit.text() self.parameters['qtHelpVirtualFolder'] = self.qtHelpFolderEdit.text() self.parameters['qtHelpFilterName'] = self.qtHelpFilterNameEdit.text()
--- a/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -26,9 +26,9 @@ <attribute name="title"> <string>General</string> </attribute> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <layout class="QHBoxLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QLabel" name="TextLabel6"> <property name="text"> @@ -37,22 +37,21 @@ </widget> </item> <item> - <widget class="QLineEdit" name="outputDirEdit"> + <widget class="E5PathPicker" name="outputDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> <property name="toolTip"> <string>Enter an output directory</string> </property> </widget> </item> - <item> - <widget class="QToolButton" name="outputDirButton"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="toolTip"> - <string>Press to open a directory selection dialog</string> - </property> - </widget> - </item> </layout> </item> <item> @@ -163,17 +162,16 @@ </item> <item> <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>2</verstretch> + </sizepolicy> + </property> <property name="title"> <string>Exclude Directories</string> </property> - <layout class="QGridLayout"> - <item row="1" column="2"> - <widget class="QLineEdit" name="ignoreDirEdit"> - <property name="toolTip"> - <string>Enter a directory basename to be ignored</string> - </property> - </widget> - </item> + <layout class="QGridLayout" name="gridLayout_2"> <item row="1" column="1"> <widget class="QPushButton" name="addButton"> <property name="toolTip"> @@ -194,20 +192,32 @@ </property> </widget> </item> - <item row="0" column="0" colspan="4"> + <item row="0" column="0" colspan="3"> <widget class="QListWidget" name="ignoreDirsList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>3</verstretch> + </sizepolicy> + </property> <property name="toolTip"> <string>List of directory basenames to be ignored</string> </property> </widget> </item> - <item row="1" column="3"> - <widget class="QToolButton" name="ignoreDirButton"> + <item row="1" column="2"> + <widget class="E5PathPicker" name="ignoreDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> + <enum>Qt::StrongFocus</enum> </property> <property name="toolTip"> - <string>Press to open a directory selection dialog</string> + <string>Enter a directory basename to be ignored</string> </property> </widget> </item> @@ -226,24 +236,23 @@ <property name="title"> <string>Style Sheet</string> </property> - <layout class="QHBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout_3"> <item> - <widget class="QLineEdit" name="cssEdit"> + <widget class="E5PathPicker" name="cssPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> <property name="toolTip"> <string>Enter the filename of a CSS style sheet. Leave empty to use the colours defined below.</string> </property> </widget> </item> - <item> - <widget class="QToolButton" name="cssButton"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="toolTip"> - <string>Press to open a file selection dialog</string> - </property> - </widget> - </item> </layout> </widget> </item> @@ -383,25 +392,20 @@ </widget> </item> <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLineEdit" name="qtHelpDirEdit"> - <property name="toolTip"> - <string>Enter an output directory</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="qtHelpDirButton"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="toolTip"> - <string>Press to open a directory selection dialog</string> - </property> - </widget> - </item> - </layout> + <widget class="E5PathPicker" name="qtHelpDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter an output directory</string> + </property> + </widget> </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> @@ -483,7 +487,7 @@ </property> </widget> </item> - <item row="7" column="1"> + <item row="7" column="0" colspan="2"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -517,19 +521,27 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>tabWidget</tabstop> - <tabstop>outputDirEdit</tabstop> + <tabstop>outputDirPicker</tabstop> <tabstop>sourceExtEdit</tabstop> <tabstop>recursionCheckBox</tabstop> <tabstop>noindexCheckBox</tabstop> <tabstop>noemptyCheckBox</tabstop> <tabstop>excludeFilesEdit</tabstop> <tabstop>ignoreDirsList</tabstop> - <tabstop>ignoreDirEdit</tabstop> + <tabstop>ignoreDirPicker</tabstop> <tabstop>addButton</tabstop> <tabstop>deleteButton</tabstop> - <tabstop>cssEdit</tabstop> + <tabstop>cssPicker</tabstop> <tabstop>bodyFgButton</tabstop> <tabstop>bodyBgButton</tabstop> <tabstop>l1FgButton</tabstop> @@ -541,14 +553,13 @@ <tabstop>linkFgButton</tabstop> <tabstop>sample</tabstop> <tabstop>qtHelpGroup</tabstop> - <tabstop>qtHelpDirEdit</tabstop> + <tabstop>qtHelpDirPicker</tabstop> <tabstop>qtHelpNamespaceEdit</tabstop> <tabstop>qtHelpFolderEdit</tabstop> <tabstop>qtHelpFilterNameEdit</tabstop> <tabstop>qtHelpFilterAttributesEdit</tabstop> <tabstop>qtHelpTitleEdit</tabstop> <tabstop>qtHelpGenerateCollectionCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -14,10 +14,10 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui import E5FileDialog, E5MessageBox +from E5Gui import E5MessageBox +from E5Gui.E5PathPicker import E5PathPickerModes import Utilities -import UI.PixmapCache from .Ui_HgAddSubrepositoryDialog import Ui_HgAddSubrepositoryDialog @@ -36,12 +36,13 @@ super(HgAddSubrepositoryDialog, self).__init__(parent) self.setupUi(self) - self.pathButton.setIcon(UI.PixmapCache.getIcon("open.png")) + self.pathPicker.setMode(E5PathPickerModes.DirectoryMode) + self.pathPicker.setDefaultDirectory(projectPath) self.__ok = self.buttonBox.button(QDialogButtonBox.Ok) self.__ok.setEnabled(False) - self.__projectPath = projectPath + self.__projectPath = Utilities.toNativeSeparators(projectPath) self.typeCombo.addItem("Mercurial", "hg") self.typeCombo.addItem("GIT", "git") @@ -54,7 +55,7 @@ """ Private slot to update the state of the OK button. """ - path = self.pathEdit.text() + path = self.pathPicker.text() url = self.urlEdit.text() self.__ok.setEnabled( @@ -64,7 +65,7 @@ ) @pyqtSlot(str) - def on_pathEdit_textChanged(self, p0): + def on_pathPicker_textChanged(self, p0): """ Private slot to handle the update of the path. @@ -81,30 +82,24 @@ """ self.__updateOk() - @pyqtSlot() - def on_pathButton_clicked(self): - """ - Private slot to handle the path selection via a directory selection - dialog. + @pyqtSlot(str) + def on_pathPicker_pathSelected(self, path): """ - path = E5FileDialog.getExistingDirectory( - self, - self.tr("Add Sub-repository"), - os.path.join(self.__projectPath, self.pathEdit.text()), - E5FileDialog.Options(E5FileDialog.Option(0))) + Private slot handling the selection of a subrepository path. - if path: - path = Utilities.toNativeSeparators(path) - if path.startswith(self.__projectPath): - path = path.replace(self.__projectPath, "")[1:] - self.pathEdit.setText(path) - else: - E5MessageBox.critical( - self, - self.tr("Add Sub-repository"), - self.tr("""The sub-repository path must be inside""" - """ the project.""")) - return + @param path path of the subrepository + @type str + """ + if path.startswith(self.__projectPath + os.sep): + path = path.replace(self.__projectPath + os.sep, "") + self.pathPicker.setText(path) + else: + E5MessageBox.critical( + self, + self.tr("Add Sub-repository"), + self.tr("""The sub-repository path must be inside""" + """ the project.""")) + self.pathPicker.setText("") def getData(self): """ @@ -115,7 +110,7 @@ string) """ return ( - self.pathEdit.text(), + self.pathPicker.text(), self.typeCombo.itemData(self.typeCombo.currentIndex()), self.urlEdit.text() )
--- a/Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>550</width> - <height>142</height> + <height>124</height> </rect> </property> <property name="windowTitle"> @@ -23,27 +23,25 @@ <string>&Path within Project:</string> </property> <property name="buddy"> - <cstring>pathEdit</cstring> + <cstring>pathPicker</cstring> </property> </widget> </item> <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLineEdit" name="pathEdit"> - <property name="toolTip"> - <string>Enter the path of the sub-repository relative to the project</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="pathButton"> - <property name="toolTip"> - <string>Select the path of the sub-repository with a directory selection dialog</string> - </property> - </widget> - </item> - </layout> + <widget class="E5PathPicker" name="pathPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the path of the sub-repository relative to the project</string> + </property> + </widget> </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> @@ -108,12 +106,18 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>pathEdit</tabstop> - <tabstop>pathButton</tabstop> + <tabstop>pathPicker</tabstop> <tabstop>typeCombo</tabstop> <tabstop>urlEdit</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -9,16 +9,14 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot, QFileInfo +from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_HgArchiveDialog import Ui_HgArchiveDialog import Utilities -import UI.PixmapCache class HgArchiveDialog(QDialog, Ui_HgArchiveDialog): @@ -35,13 +33,8 @@ super(HgArchiveDialog, self).__init__(parent) self.setupUi(self) - self.archiveButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.__archiveFileCompleter = E5FileCompleter() - self.__archiveDirCompleter = E5DirCompleter() - self.__activeCompleter = self.__archiveFileCompleter - self.archiveEdit.setCompleter(self.__activeCompleter) - self.__activeCompleter.model().setNameFilters([]) + self.archivePicker.setMode( + E5PathPickerModes.SaveFileEnsureExtensionMode) self.typeComboBox.addItem( self.tr("Detect Automatically"), "") @@ -68,12 +61,14 @@ self.tr("Uncompressed ZIP-Archive (*.uzip)") ] if Utilities.isWindowsPlatform(): - self.__fileFilters = ";;".join( + fileFilters = ";;".join( self.__windowsFileFilters + self.__unixFileFilters) else: - self.__fileFilters = ";;".join( + fileFilters = ";;".join( self.__unixFileFilters + self.__windowsFileFilters) - self.__fileFilters += ";;" + self.tr("All Files (*)") + fileFilters += ";;" + self.tr("All Files (*)") + + self.archivePicker.setFilters(fileFilters) self.__typeFilters = { "tar": ["*.tar"], @@ -94,7 +89,7 @@ self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot(str) - def on_archiveEdit_textChanged(self, archive): + def on_archivePicker_textChanged(self, archive): """ Private slot to handle changes of the archive name. @@ -102,41 +97,6 @@ """ self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(archive != "") - @pyqtSlot() - def on_archiveButton_clicked(self): - """ - Private slot to select the archive name via a file selection dialog. - """ - type_ = self.typeComboBox.itemData(self.typeComboBox.currentIndex()) - - archive = Utilities.fromNativeSeparators(self.archiveEdit.text()) - if not archive: - archive = self.__projectPath - - if type_ == "files": - archive = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Archive Directory"), - archive, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - else: - archive, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( - self, - self.tr("Select Archive File"), - archive, - self.__fileFilters, - None, - E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - if archive: - ext = QFileInfo(archive).suffix() - if not ext: - ex = selectedFilter.split("(*")[1].split(")")[0] - if ex: - archive += ex - - if archive: - self.archiveEdit.setText(Utilities.toNativeSeparators(archive)) - @pyqtSlot(int) def on_typeComboBox_activated(self, index): """ @@ -146,18 +106,15 @@ """ type_ = self.typeComboBox.itemData(index) if type_ == "files": - if self.__activeCompleter != self.__archiveDirCompleter: - self.__activeCompleter = self.__archiveDirCompleter - self.archiveEdit.setCompleter(self.__activeCompleter) + self.archivePicker.setMode(E5PathPickerModes.DirectoryMode) else: - if self.__activeCompleter != self.__archiveFileCompleter: - self.__activeCompleter = self.__archiveFileCompleter - self.archiveEdit.setCompleter(self.__activeCompleter) + self.archivePicker.setMode( + E5PathPickerModes.SaveFileEnsureExtensionMode) if type_ in self.__typeFilters: - self.__activeCompleter.model().setNameFilters( + self.archivePicker.setNameFilters( self.__typeFilters[type_]) else: - self.__activeCompleter.model().setNameFilters([]) + self.archivePicker.setNameFilters([]) def getData(self): """ @@ -168,7 +125,7 @@ to recurse into subrepositories (boolean) """ return ( - self.archiveEdit.text(), + self.archivePicker.text(), self.typeComboBox.itemData(self.typeComboBox.currentIndex()), self.prefixEdit.text(), self.subReposCheckBox.isChecked(),
--- a/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>167</height> + <height>149</height> </rect> </property> <property name="windowTitle"> @@ -25,7 +25,16 @@ </widget> </item> <item row="0" column="1"> - <widget class="QLineEdit" name="archiveEdit"> + <widget class="E5PathPicker" name="archivePicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> <property name="toolTip"> <string>Enter the file name of the archive</string> </property> @@ -38,7 +47,7 @@ </property> </widget> </item> - <item row="1" column="1" colspan="2"> + <item row="1" column="1"> <widget class="QComboBox" name="typeComboBox"> <property name="toolTip"> <string>Select the archive type</string> @@ -52,14 +61,14 @@ </property> </widget> </item> - <item row="2" column="1" colspan="2"> + <item row="2" column="1"> <widget class="QLineEdit" name="prefixEdit"> <property name="toolTip"> <string>Enter the directory prefix for the files in the archive</string> </property> </widget> </item> - <item row="3" column="0" colspan="3"> + <item row="3" column="0" colspan="2"> <widget class="QCheckBox" name="subReposCheckBox"> <property name="toolTip"> <string>Select to recurse into subrepositories</string> @@ -69,7 +78,7 @@ </property> </widget> </item> - <item row="4" column="0" colspan="3"> + <item row="4" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -79,22 +88,21 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QToolButton" name="archiveButton"> - <property name="toolTip"> - <string>Press to select the archive file name via a file selection dialog</string> - </property> - </widget> - </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>archiveEdit</tabstop> - <tabstop>archiveButton</tabstop> + <tabstop>archivePicker</tabstop> <tabstop>typeComboBox</tabstop> <tabstop>prefixEdit</tabstop> <tabstop>subReposCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -14,14 +14,10 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_HgCopyDialog import Ui_HgCopyDialog -import Utilities -import UI.PixmapCache - class HgCopyDialog(QDialog, Ui_HgCopyDialog): """ @@ -39,13 +35,11 @@ super(HgCopyDialog, self).__init__(parent) self.setupUi(self) - self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.source = source if os.path.isdir(self.source): - self.targetCompleter = E5DirCompleter(self.targetEdit) + self.targetPicker.setMode(E5PathPickerModes.DirectoryMode) else: - self.targetCompleter = E5FileCompleter(self.targetEdit) + self.targetPicker.setMode(E5PathPickerModes.SaveFileMode) if move: self.setWindowTitle(self.tr('Mercurial Move')) @@ -66,38 +60,14 @@ @return the target name (string) and a flag indicating the operation should be enforced (boolean) """ - target = self.targetEdit.text() + target = self.targetPicker.text() if not os.path.isabs(target): sourceDir = os.path.dirname(self.sourceEdit.text()) target = os.path.join(sourceDir, target) - return Utilities.toNativeSeparators(target), \ - self.forceCheckBox.isChecked() - - @pyqtSlot() - def on_dirButton_clicked(self): - """ - Private slot to handle the button press for selecting the target via a - selection dialog. - """ - if os.path.isdir(self.source): - target = E5FileDialog.getExistingDirectory( - self, - self.tr("Select target"), - self.targetEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - else: - target = E5FileDialog.getSaveFileName( - self, - self.tr("Select target"), - self.targetEdit.text(), - "", - E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - - if target: - self.targetEdit.setText(Utilities.toNativeSeparators(target)) + return target, self.forceCheckBox.isChecked() @pyqtSlot(str) - def on_targetEdit_textChanged(self, txt): + def on_targetPicker_textChanged(self, txt): """ Private slot to handle changes of the target.
--- a/Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>409</width> - <height>138</height> + <height>120</height> </rect> </property> <property name="windowTitle"> @@ -16,62 +16,56 @@ <property name="sizeGripEnabled"> <bool>true</bool> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="text"> - <string>Source:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="sourceEdit"> - <property name="toolTip"> - <string>Shows the name of the source</string> - </property> - <property name="whatsThis"> - <string><b>Source name</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="text"> + <string>Source:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="sourceEdit"> + <property name="toolTip"> + <string>Shows the name of the source</string> + </property> + <property name="whatsThis"> + <string><b>Source name</b> <p>This field shows the name of the source.</p></string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="targetEdit"> - <property name="toolTip"> - <string>Enter the target name</string> - </property> - <property name="whatsThis"> - <string><b>Target name</b> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2"> + <property name="text"> + <string>Target:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="targetPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the target name</string> + </property> + <property name="whatsThis"> + <string><b>Target name</b> <p>Enter the new name in this field. The target must be the new name or an absolute path.</p></string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2"> - <property name="text"> - <string>Target:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="dirButton"> - <property name="toolTip"> - <string>Press to open a selection dialog</string> - </property> - <property name="whatsThis"> - <string><b>Target directory</b> -<p>Select the target name for the operation via a selection dialog.</p></string> - </property> - </widget> - </item> - </layout> + </property> + </widget> </item> - <item> + <item row="2" column="0" colspan="2"> <widget class="QCheckBox" name="forceCheckBox"> <property name="toolTip"> <string>Select to force the operation</string> @@ -81,7 +75,7 @@ </property> </widget> </item> - <item> + <item row="3" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -95,12 +89,18 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>targetEdit</tabstop> - <tabstop>dirButton</tabstop> + <tabstop>sourceEdit</tabstop> + <tabstop>targetPicker</tabstop> <tabstop>forceCheckBox</tabstop> - <tabstop>buttonBox</tabstop> - <tabstop>sourceEdit</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -14,13 +14,10 @@ from PyQt5.QtCore import pyqtSlot, QDir from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui import E5FileDialog -from E5Gui.E5Completers import E5DirCompleter +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_HgExportDialog import Ui_HgExportDialog -import Utilities -import UI.PixmapCache class HgExportDialog(QDialog, Ui_HgExportDialog): @@ -36,15 +33,13 @@ super(HgExportDialog, self).__init__(parent) self.setupUi(self) - self.directoryButton.setIcon(UI.PixmapCache.getIcon("open.png")) + self.directoryPicker.setMode(E5PathPickerModes.DirectoryMode) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) - self.__directoryCompleter = E5DirCompleter(self.directoryEdit) - # set default values for directory and pattern self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff") - self.directoryEdit.setText(QDir.tempPath()) + self.directoryPicker.setText(QDir.tempPath()) def __updateOK(self): """ @@ -52,7 +47,7 @@ """ enabled = True - if self.directoryEdit.text() == "": + if self.directoryPicker.text() == "": enabled = False elif self.patternEdit.text() == "": enabled = False @@ -62,7 +57,7 @@ self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) @pyqtSlot(str) - def on_directoryEdit_textChanged(self, txt): + def on_directoryPicker_textChanged(self, txt): """ Private slot to react on changes of the export directory edit. @@ -70,20 +65,6 @@ """ self.__updateOK() - @pyqtSlot() - def on_directoryButton_clicked(self): - """ - Private slot called by pressing the export directory selection button. - """ - dn = E5FileDialog.getExistingDirectory( - self, - self.tr("Export Patches"), - self.directoryEdit.text(), - E5FileDialog.Options(E5FileDialog.Option(0))) - - if dn: - self.directoryEdit.setText(Utilities.toNativeSeparators(dn)) - @pyqtSlot(str) def on_patternEdit_textChanged(self, txt): """ @@ -112,7 +93,7 @@ """ return ( os.path.join( - Utilities.toNativeSeparators(self.directoryEdit.text()), + self.directoryPicker.text(), self.patternEdit.text()), self.changesetsEdit.toPlainText().splitlines(), self.switchParentCheckBox.isChecked(),
--- a/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>456</width> - <height>301</height> + <width>450</width> + <height>350</height> </rect> </property> <property name="windowTitle"> @@ -27,7 +27,24 @@ </widget> </item> <item row="0" column="1"> - <widget class="QLineEdit" name="directoryEdit"/> + <widget class="E5PathPicker" name="directoryPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the target name</string> + </property> + <property name="whatsThis"> + <string><b>Target name</b> +<p>Enter the new name in this field. The target must be the new name or an absolute path.</p></string> + </property> + </widget> </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> @@ -36,7 +53,7 @@ </property> </widget> </item> - <item row="1" column="1" colspan="2"> + <item row="1" column="1"> <widget class="QLineEdit" name="patternEdit"> <property name="toolTip"> <string>Enter the file name pattern for the export files</string> @@ -64,9 +81,12 @@ <property name="text"> <string>Changesets:</string> </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> </widget> </item> - <item row="2" column="1" colspan="2"> + <item row="2" column="1"> <widget class="QPlainTextEdit" name="changesetsEdit"> <property name="toolTip"> <string>Enter changesets by number, id, range or revset expression one per line</string> @@ -79,13 +99,6 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QToolButton" name="directoryButton"> - <property name="toolTip"> - <string>Press to select the export directory via a directory selection dialog</string> - </property> - </widget> - </item> </layout> </item> <item> @@ -134,16 +147,22 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> - <tabstop>directoryEdit</tabstop> - <tabstop>directoryButton</tabstop> + <tabstop>directoryPicker</tabstop> <tabstop>patternEdit</tabstop> <tabstop>changesetsEdit</tabstop> <tabstop>switchParentCheckBox</tabstop> <tabstop>textCheckBox</tabstop> <tabstop>datesCheckBox</tabstop> <tabstop>gitCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -12,14 +12,10 @@ from PyQt5.QtCore import pyqtSlot, QDateTime from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui import E5FileDialog -from E5Gui.E5Completers import E5FileCompleter +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_HgImportDialog import Ui_HgImportDialog -import Utilities -import UI.PixmapCache - class HgImportDialog(QDialog, Ui_HgImportDialog): """ @@ -34,12 +30,12 @@ super(HgImportDialog, self).__init__(parent) self.setupUi(self) - self.patchFileButton.setIcon(UI.PixmapCache.getIcon("open.png")) + self.patchFilePicker.setMode(E5PathPickerModes.OpenFileMode) + self.patchFilePicker.setFilters(self.tr( + "Patch Files (*.diff *.patch);;All Files (*)")) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) - self.__patchFileCompleter = E5FileCompleter(self.patchFileEdit) - self.__initDateTime = QDateTime.currentDateTime() self.dateEdit.setDateTime(self.__initDateTime) @@ -48,13 +44,13 @@ Private slot to update the OK button. """ enabled = True - if self.patchFileEdit.text() == "": + if self.patchFilePicker.text() == "": enabled = False self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) @pyqtSlot(str) - def on_patchFileEdit_textChanged(self, txt): + def on_patchFilePicker_textChanged(self, txt): """ Private slot to react on changes of the patch file edit. @@ -62,20 +58,6 @@ """ self.__updateOK() - @pyqtSlot() - def on_patchFileButton_clicked(self): - """ - Private slot called by pressing the file selection button. - """ - fn = E5FileDialog.getOpenFileName( - self, - self.tr("Select patch file"), - self.patchFileEdit.text(), - self.tr("Patch Files (*.diff *.patch);;All Files (*)")) - - if fn: - self.patchFileEdit.setText(Utilities.toNativeSeparators(fn)) - def getParameters(self): """ Public method to retrieve the import data. @@ -90,6 +72,6 @@ else: date = "" - return (self.patchFileEdit.text(), self.noCommitCheckBox.isChecked(), + return (self.patchFilePicker.text(), self.noCommitCheckBox.isChecked(), self.messageEdit.toPlainText(), date, self.userEdit.text(), self.stripSpinBox.value(), self.forceCheckBox.isChecked())
--- a/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>500</width> - <height>380</height> + <height>400</height> </rect> </property> <property name="windowTitle"> @@ -164,22 +164,20 @@ </widget> </item> <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLineEdit" name="patchFileEdit"> - <property name="toolTip"> - <string>Enter the name of the patch file</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="patchFileButton"> - <property name="toolTip"> - <string>Press to select the patch file via a file selection dialog</string> - </property> - </widget> - </item> - </layout> + <widget class="E5PathPicker" name="patchFilePicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the name of the patch file</string> + </property> + </widget> </item> <item row="3" column="0" colspan="2"> <widget class="QCheckBox" name="forceCheckBox"> @@ -203,16 +201,22 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>noCommitCheckBox</tabstop> <tabstop>messageEdit</tabstop> <tabstop>dateEdit</tabstop> <tabstop>userEdit</tabstop> <tabstop>stripSpinBox</tabstop> - <tabstop>patchFileEdit</tabstop> - <tabstop>patchFileButton</tabstop> + <tabstop>patchFilePicker</tabstop> <tabstop>forceCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -15,15 +15,13 @@ from PyQt5.QtCore import pyqtSlot, QDir from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_HgNewProjectOptionsDialog import Ui_HgNewProjectOptionsDialog from .Config import ConfigHgProtocols import Utilities import Preferences -import UI.PixmapCache class HgNewProjectOptionsDialog(QDialog, Ui_HgNewProjectOptionsDialog): @@ -41,17 +39,14 @@ super(HgNewProjectOptionsDialog, self).__init__(parent) self.setupUi(self) - self.projectDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - self.vcsUrlButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.vcsDirectoryCompleter = E5DirCompleter(self.vcsUrlEdit) - self.vcsProjectDirCompleter = E5DirCompleter(self.vcsProjectDirEdit) + self.vcsProjectDirPicker.setMode(E5PathPickerModes.DirectoryMode) + self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode) self.protocolCombo.addItems(ConfigHgProtocols) hd = Utilities.toNativeSeparators(QDir.homePath()) hd = os.path.join(hd, 'hgroot') - self.vcsUrlEdit.setText(hd) + self.vcsUrlPicker.setText(hd) self.vcs = vcs @@ -65,8 +60,7 @@ Utilities.fromNativeSeparators(ipath), Utilities.fromNativeSeparators(ipath) + "/", ] - self.vcsProjectDirEdit.setText( - Utilities.toNativeSeparators(self.__initPaths[0])) + self.vcsProjectDirPicker.setText(self.__initPaths[0]) self.lfNoteLabel.setVisible(self.vcs.isExtensionActive("largefiles")) self.largeCheckBox.setVisible(self.vcs.isExtensionActive("largefiles")) @@ -79,7 +73,7 @@ self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot(str) - def on_vcsProjectDirEdit_textChanged(self, txt): + def on_vcsProjectDirPicker_textChanged(self, txt): """ Private slot to handle a change of the project directory. @@ -89,37 +83,6 @@ bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) - @pyqtSlot() - def on_vcsUrlButton_clicked(self): - """ - Private slot to display a selection dialog. - """ - if self.protocolCombo.currentText() == "file://": - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Repository-Directory"), - self.vcsUrlEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - self.vcsUrlEdit.setText( - Utilities.toNativeSeparators(directory)) - - @pyqtSlot() - def on_projectDirButton_clicked(self): - """ - Private slot to display a directory selection dialog. - """ - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("Select Project Directory"), - self.vcsProjectDirEdit.text(), - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if directory: - self.vcsProjectDirEdit.setText( - Utilities.toNativeSeparators(directory)) - @pyqtSlot(str) def on_protocolCombo_activated(self, protocol): """ @@ -127,19 +90,19 @@ @param protocol name of the selected protocol (string) """ - self.vcsUrlButton.setEnabled(protocol == "file://") + self.vcsUrlPicker.setPickerEnabled(protocol == "file://") if protocol == "file://": - self.networkPath = self.vcsUrlEdit.text() - self.vcsUrlEdit.setText(self.localPath) + self.networkPath = self.vcsUrlPicker.text() + self.vcsUrlPicker.setText(self.localPath) self.localProtocol = True else: if self.localProtocol: - self.localPath = self.vcsUrlEdit.text() - self.vcsUrlEdit.setText(self.networkPath) + self.localPath = self.vcsUrlPicker.text() + self.vcsUrlPicker.setText(self.networkPath) self.localProtocol = False @pyqtSlot(str) - def on_vcsUrlEdit_textChanged(self, txt): + def on_vcsUrlPicker_textChanged(self, txt): """ Private slot to handle changes of the URL. @@ -156,7 +119,7 @@ containing the data entered. """ scheme = self.protocolCombo.currentText() - url = self.vcsUrlEdit.text() + url = self.vcsUrlPicker.text() if scheme == "file://" and url[0] not in ["\\", "/"]: url = "/{0}".format(url) vcsdatadict = { @@ -164,4 +127,4 @@ "revision": self.vcsRevisionEdit.text(), "largefiles": self.largeCheckBox.isChecked(), } - return (self.vcsProjectDirEdit.text(), vcsdatadict) + return (self.vcsProjectDirPicker.text(), vcsdatadict)
--- a/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>562</width> - <height>221</height> + <height>191</height> </rect> </property> <property name="windowTitle"> @@ -32,7 +32,7 @@ </property> </widget> </item> - <item row="0" column="1" colspan="2"> + <item row="0" column="1"> <widget class="QComboBox" name="protocolCombo"> <property name="toolTip"> <string>Select the protocol to access the repository</string> @@ -45,24 +45,26 @@ <string>&URL:</string> </property> <property name="buddy"> - <cstring>vcsUrlEdit</cstring> + <cstring>vcsUrlPicker</cstring> </property> </widget> </item> <item row="1" column="1"> - <widget class="QLineEdit" name="vcsUrlEdit"> + <widget class="E5PathPicker" name="vcsUrlPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> <property name="toolTip"> <string>Enter the url path of the repository (without protocol part)</string> </property> </widget> </item> - <item row="1" column="2"> - <widget class="QToolButton" name="vcsUrlButton"> - <property name="toolTip"> - <string>Select the repository url via a directory selection dialog</string> - </property> - </widget> - </item> <item row="2" column="0"> <widget class="QLabel" name="vcsRevisionLabel"> <property name="text"> @@ -73,7 +75,7 @@ </property> </widget> </item> - <item row="2" column="1" colspan="2"> + <item row="2" column="1"> <widget class="QLineEdit" name="vcsRevisionEdit"> <property name="toolTip"> <string>Enter the revision the new project should be generated from</string> @@ -89,12 +91,21 @@ <string>Project &Directory:</string> </property> <property name="buddy"> - <cstring>vcsProjectDirEdit</cstring> + <cstring>vcsProjectDirPicker</cstring> </property> </widget> </item> <item row="3" column="1"> - <widget class="QLineEdit" name="vcsProjectDirEdit"> + <widget class="E5PathPicker" name="vcsProjectDirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> <property name="toolTip"> <string>Enter the directory of the new project.</string> </property> @@ -105,17 +116,14 @@ </property> </widget> </item> - <item row="3" column="2"> - <widget class="QToolButton" name="projectDirButton"/> - </item> - <item row="4" column="0" colspan="3"> + <item row="4" column="0" colspan="2"> <widget class="QCheckBox" name="largeCheckBox"> <property name="text"> <string>Download all versions of all large files</string> </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0" colspan="2"> <widget class="QLabel" name="lfNoteLabel"> <property name="text"> <string><b>Note:</b> This option increases the download time and volume.</string> @@ -125,7 +133,7 @@ </property> </widget> </item> - <item row="6" column="0" colspan="3"> + <item row="6" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -139,15 +147,20 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>protocolCombo</tabstop> - <tabstop>vcsUrlEdit</tabstop> - <tabstop>vcsUrlButton</tabstop> + <tabstop>vcsUrlPicker</tabstop> <tabstop>vcsRevisionEdit</tabstop> - <tabstop>vcsProjectDirEdit</tabstop> - <tabstop>projectDirButton</tabstop> + <tabstop>vcsProjectDirPicker</tabstop> <tabstop>largeCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfConvertDataDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfConvertDataDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -14,15 +14,13 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui import E5FileDialog -from E5Gui.E5Completers import E5DirCompleter +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_LfConvertDataDialog import Ui_LfConvertDataDialog from . import getDefaults import Utilities -import UI.PixmapCache class LfConvertDataDialog(QDialog, Ui_LfConvertDataDialog): @@ -40,15 +38,13 @@ super(LfConvertDataDialog, self).__init__(parent) self.setupUi(self) - self.newProjectButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.__newProjectCompleter = E5DirCompleter(self.newProjectEdit) + self.newProjectPicker.setMode(E5PathPickerModes.DirectoryMode) self.__defaults = getDefaults() self.__currentPath = Utilities.toNativeSeparators(currentPath) self.currentProjectLabel.setPath(currentPath) - self.newProjectEdit.setText(os.path.dirname(currentPath)) + self.newProjectPicker.setText(os.path.dirname(currentPath)) self.lfFileSizeSpinBox.setValue(self.__defaults["minsize"]) self.lfFilePatternsEdit.setText(" ".join(self.__defaults["pattern"])) @@ -61,7 +57,7 @@ self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot(str) - def on_newProjectEdit_textChanged(self, txt): + def on_newProjectPicker_textChanged(self, txt): """ Private slot to handle editing of the new project directory. @@ -71,22 +67,6 @@ txt and Utilities.toNativeSeparators(txt) != os.path.dirname( self.__currentPath)) - @pyqtSlot() - def on_newProjectButton_clicked(self): - """ - Private slot to select the new project directory name via a directory - selection dialog. - """ - directory = Utilities.fromNativeSeparators(self.newProjectEdit.text()) - directory = E5FileDialog.getExistingDirectory( - self, - self.tr("New Project Directory"), - directory, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - if directory: - self.newProjectEdit.setText( - Utilities.toNativeSeparators(directory)) - def getData(self): """ Public method to retrieve the entered data. @@ -99,7 +79,7 @@ patterns = [] return ( - Utilities.toNativeSeparators(self.newProjectEdit.text()), + self.newProjectPicker.text(), self.lfFileSizeSpinBox.value(), patterns, )
--- a/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfConvertDataDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfConvertDataDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>500</width> - <height>143</height> + <height>144</height> </rect> </property> <property name="windowTitle"> @@ -17,7 +17,7 @@ <bool>true</bool> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0" colspan="4"> + <item row="0" column="0" colspan="3"> <widget class="E5SqueezeLabelPath" name="currentProjectLabel"/> </item> <item row="1" column="0"> @@ -28,19 +28,21 @@ </widget> </item> <item row="1" column="1" colspan="2"> - <widget class="QLineEdit" name="newProjectEdit"> + <widget class="E5PathPicker" name="newProjectPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> <property name="toolTip"> <string>Enter the directory name of the new project directory</string> </property> </widget> </item> - <item row="1" column="3"> - <widget class="QToolButton" name="newProjectButton"> - <property name="toolTip"> - <string>Press to select the new project directory name via a directory selection dialog</string> - </property> - </widget> - </item> <item row="2" column="0"> <widget class="QLabel" name="label_4"> <property name="text"> @@ -67,7 +69,7 @@ </property> </widget> </item> - <item row="2" column="2" colspan="2"> + <item row="2" column="2"> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -87,14 +89,14 @@ </property> </widget> </item> - <item row="3" column="1" colspan="3"> + <item row="3" column="1" colspan="2"> <widget class="QLineEdit" name="lfFilePatternsEdit"> <property name="toolTip"> <string>Enter file patterns (space separated) for files to be treated as Large Files</string> </property> </widget> </item> - <item row="4" column="0" colspan="4"> + <item row="4" column="0" colspan="3"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -108,17 +110,21 @@ </widget> <customwidgets> <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + <customwidget> <class>E5SqueezeLabelPath</class> <extends>QLabel</extends> <header>E5Gui/E5SqueezeLabels.h</header> </customwidget> </customwidgets> <tabstops> - <tabstop>newProjectEdit</tabstop> - <tabstop>newProjectButton</tabstop> + <tabstop>newProjectPicker</tabstop> <tabstop>lfFileSizeSpinBox</tabstop> <tabstop>lfFilePatternsEdit</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections>
--- a/Plugins/VcsPlugins/vcsPySvn/SvnCommandDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnCommandDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -9,16 +9,13 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_SvnCommandDialog import Ui_SvnCommandDialog import Utilities -import UI.PixmapCache class SvnCommandDialog(QDialog, Ui_SvnCommandDialog): @@ -41,9 +38,7 @@ super(SvnCommandDialog, self).__init__(parent) self.setupUi(self) - self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.workdirCompleter = E5DirCompleter(self.workdirCombo) + self.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) self.okButton.setEnabled(False) @@ -52,10 +47,10 @@ self.commandCombo.addItems(argvList) if len(argvList) > 0: self.commandCombo.setCurrentIndex(0) - self.workdirCombo.clear() - self.workdirCombo.addItems(wdList) + self.workdirPicker.clear() + self.workdirPicker.addItems(wdList) if len(wdList) > 0: - self.workdirCombo.setCurrentIndex(0) + self.workdirPicker.setCurrentIndex(0) self.projectDirLabel.setText(ppath) # modify some what's this help texts @@ -67,23 +62,6 @@ msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - @pyqtSlot() - def on_dirButton_clicked(self): - """ - Private method used to open a directory selection dialog. - """ - cwd = self.workdirCombo.currentText() - if not cwd: - cwd = self.projectDirLabel.text() - d = E5FileDialog.getExistingDirectory( - self, - self.tr("Working directory"), - cwd, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if d: - self.workdirCombo.setEditText(Utilities.toNativeSeparators(d)) - def on_commandCombo_editTextChanged(self, text): """ Private method used to enable/disable the OK-button. @@ -99,4 +77,4 @@ @return a tuple of argv, workdir """ return (self.commandCombo.currentText(), - self.workdirCombo.currentText()) + self.workdirPicker.currentText())
--- a/Plugins/VcsPlugins/vcsPySvn/SvnCommandDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnCommandDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,132 +7,111 @@ <x>0</x> <y>0</y> <width>628</width> - <height>141</height> + <height>129</height> </rect> </property> <property name="windowTitle"> <string>Subversion Command</string> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="toolTip"> - <string/> - </property> - <property name="text"> - <string>Subversion Command:</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QComboBox" name="commandCombo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Enter the Subversion command to be executed with all necessary parameters</string> - </property> - <property name="whatsThis"> - <string><b>Subversion Command</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="toolTip"> + <string/> + </property> + <property name="text"> + <string>Subversion Command:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="commandCombo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Enter the Subversion command to be executed with all necessary parameters</string> + </property> + <property name="whatsThis"> + <string><b>Subversion Command</b> <p>Enter the Subversion command to be executed including all necessary parameters. If a parameter of the commandline includes a space you have to surround this parameter by single or double quotes. Do not include the name of the subversion client executable (i.e. svn).</p></string> - </property> - <property name="editable"> - <bool>true</bool> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAtTop</enum> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="workdirCombo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Enter the working directory for the Subversion command</string> - </property> - <property name="whatsThis"> - <string><b>Working directory</b> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtTop</enum> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2"> + <property name="text"> + <string>Working Directory:<br>(optional)</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5ComboPathPicker" name="workdirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the working directory for the Subversion command</string> + </property> + <property name="whatsThis"> + <string><b>Working directory</b> <p>Enter the working directory for the Subversion command. This is an optional entry. The button to the right will open a directory selection dialog.</p></string> - </property> - <property name="editable"> - <bool>true</bool> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAtTop</enum> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2"> - <property name="text"> - <string>Working Directory:<br>(optional)</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="textLabel3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Project Directory:</string> - </property> - </widget> - </item> - <item row="2" column="1" colspan="2"> - <widget class="QLabel" name="projectDirLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>This shows the root directory of the current project.</string> - </property> - <property name="text"> - <string>project directory</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="dirButton"> - <property name="toolTip"> - <string>Select the working directory via a directory selection dialog</string> - </property> - <property name="whatsThis"> - <string><b>Working directory</b> -<p>Select the working directory for the Subversion command via a directory selection dialog.</p></string> - </property> - </widget> - </item> - </layout> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="textLabel3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Project Directory:</string> + </property> + </widget> </item> - <item> + <item row="2" column="1"> + <widget class="QLabel" name="projectDirLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>This shows the root directory of the current project.</string> + </property> + <property name="text"> + <string>project directory</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -146,10 +125,16 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5ComboPathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>commandCombo</tabstop> - <tabstop>workdirCombo</tabstop> - <tabstop>dirButton</tabstop> <tabstop>buttonBox</tabstop> </tabstops> <resources/>
--- a/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py Sun Nov 29 19:29:34 2015 +0100 @@ -9,16 +9,13 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from E5Gui.E5Completers import E5DirCompleter -from E5Gui import E5FileDialog +from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_SvnCommandDialog import Ui_SvnCommandDialog import Utilities -import UI.PixmapCache class SvnCommandDialog(QDialog, Ui_SvnCommandDialog): @@ -41,9 +38,7 @@ super(SvnCommandDialog, self).__init__(parent) self.setupUi(self) - self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) - - self.workdirCompleter = E5DirCompleter(self.workdirCombo) + self.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) self.okButton.setEnabled(False) @@ -52,10 +47,10 @@ self.commandCombo.addItems(argvList) if len(argvList) > 0: self.commandCombo.setCurrentIndex(0) - self.workdirCombo.clear() - self.workdirCombo.addItems(wdList) + self.workdirPicker.clear() + self.workdirPicker.addItems(wdList) if len(wdList) > 0: - self.workdirCombo.setCurrentIndex(0) + self.workdirPicker.setCurrentIndex(0) self.projectDirLabel.setText(ppath) # modify some what's this help texts @@ -67,23 +62,6 @@ msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - @pyqtSlot() - def on_dirButton_clicked(self): - """ - Private method used to open a directory selection dialog. - """ - cwd = self.workdirCombo.currentText() - if not cwd: - cwd = self.projectDirLabel.text() - d = E5FileDialog.getExistingDirectory( - self, - self.tr("Working directory"), - cwd, - E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) - - if d: - self.workdirCombo.setEditText(Utilities.toNativeSeparators(d)) - def on_commandCombo_editTextChanged(self, text): """ Private method used to enable/disable the OK-button. @@ -99,4 +77,4 @@ @return a tuple of argv, workdir """ return (self.commandCombo.currentText(), - self.workdirCombo.currentText()) + self.workdirPicker.currentText())
--- a/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.ui Sun Nov 29 17:25:42 2015 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.ui Sun Nov 29 19:29:34 2015 +0100 @@ -7,132 +7,111 @@ <x>0</x> <y>0</y> <width>628</width> - <height>141</height> + <height>129</height> </rect> </property> <property name="windowTitle"> <string>Subversion Command</string> </property> - <layout class="QVBoxLayout"> - <item> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1"> - <property name="toolTip"> - <string/> - </property> - <property name="text"> - <string>Subversion Command:</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QComboBox" name="commandCombo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Enter the Subversion command to be executed with all necessary parameters</string> - </property> - <property name="whatsThis"> - <string><b>Subversion Command</b> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="toolTip"> + <string/> + </property> + <property name="text"> + <string>Subversion Command:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="commandCombo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Enter the Subversion command to be executed with all necessary parameters</string> + </property> + <property name="whatsThis"> + <string><b>Subversion Command</b> <p>Enter the Subversion command to be executed including all necessary parameters. If a parameter of the commandline includes a space you have to surround this parameter by single or double quotes. Do not include the name of the subversion client executable (i.e. svn).</p></string> - </property> - <property name="editable"> - <bool>true</bool> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAtTop</enum> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="workdirCombo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Enter the working directory for the Subversion command</string> - </property> - <property name="whatsThis"> - <string><b>Working directory</b> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtTop</enum> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2"> + <property name="text"> + <string>Working Directory:<br>(optional)</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5ComboPathPicker" name="workdirPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the working directory for the Subversion command</string> + </property> + <property name="whatsThis"> + <string><b>Working directory</b> <p>Enter the working directory for the Subversion command. This is an optional entry. The button to the right will open a directory selection dialog.</p></string> - </property> - <property name="editable"> - <bool>true</bool> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAtTop</enum> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2"> - <property name="text"> - <string>Working Directory:<br>(optional)</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="textLabel3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Project Directory:</string> - </property> - </widget> - </item> - <item row="2" column="1" colspan="2"> - <widget class="QLabel" name="projectDirLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>This shows the root directory of the current project.</string> - </property> - <property name="text"> - <string>project directory</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="dirButton"> - <property name="toolTip"> - <string>Select the working directory via a directory selection dialog</string> - </property> - <property name="whatsThis"> - <string><b>Working directory</b> -<p>Select the working directory for the Subversion command via a directory selection dialog.</p></string> - </property> - </widget> - </item> - </layout> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="textLabel3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Project Directory:</string> + </property> + </widget> </item> - <item> + <item row="2" column="1"> + <widget class="QLabel" name="projectDirLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>This shows the root directory of the current project.</string> + </property> + <property name="text"> + <string>project directory</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -146,11 +125,17 @@ </widget> <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <customwidgets> + <customwidget> + <class>E5ComboPathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>commandCombo</tabstop> - <tabstop>workdirCombo</tabstop> - <tabstop>dirButton</tabstop> - <tabstop>buttonBox</tabstop> + <tabstop>workdirPicker</tabstop> </tabstops> <resources/> <connections>